[Pkg-owncloud-commits] [owncloud-client] 450/498: AccountSettings: automatically refresh and expands the undecided folders #3541
Sandro Knauß
hefee-guest at moszumanska.debian.org
Tue Aug 11 14:49:17 UTC 2015
This is an automated email from the git hooks/post-receive script.
hefee-guest pushed a commit to branch master
in repository owncloud-client.
commit 38da1b7de189b453513d8a93d42b7e06feca9b8a
Author: Olivier Goffart <ogoffart at woboq.com>
Date: Wed Aug 5 12:51:49 2015 +0200
AccountSettings: automatically refresh and expands the undecided folders #3541
---
src/gui/accountsettings.cpp | 1 +
src/gui/folderstatusmodel.cpp | 41 ++++++++++++++++++++++++++++++++++++++++-
src/gui/folderstatusmodel.h | 4 +++-
3 files changed, 44 insertions(+), 2 deletions(-)
diff --git a/src/gui/accountsettings.cpp b/src/gui/accountsettings.cpp
index ae8522d..f11b87c 100644
--- a/src/gui/accountsettings.cpp
+++ b/src/gui/accountsettings.cpp
@@ -86,6 +86,7 @@ AccountSettings::AccountSettings(AccountState *accountState, QWidget *parent) :
connect(ui->_folderList, SIGNAL(expanded(QModelIndex)) , this, SLOT(refreshSelectiveSyncStatus()));
connect(ui->_folderList, SIGNAL(collapsed(QModelIndex)) , this, SLOT(refreshSelectiveSyncStatus()));
+ connect(_model, SIGNAL(suggestExpand(QModelIndex)), ui->_folderList, SLOT(expand(QModelIndex)));
connect(_model, SIGNAL(dirtyChanged()), this, SLOT(refreshSelectiveSyncStatus()));
refreshSelectiveSyncStatus();
diff --git a/src/gui/folderstatusmodel.cpp b/src/gui/folderstatusmodel.cpp
index cf76aee..a4a8f4b 100644
--- a/src/gui/folderstatusmodel.cpp
+++ b/src/gui/folderstatusmodel.cpp
@@ -58,7 +58,7 @@ void FolderStatusModel::setAccountState(const AccountState* accountState)
connect(f, SIGNAL(progressInfo(ProgressInfo)), this, SLOT(slotSetProgress(ProgressInfo)), Qt::UniqueConnection);
connect(f, SIGNAL(syncStateChange()), this, SLOT(slotFolderSyncStateChange()), Qt::UniqueConnection);
- connect(f, SIGNAL(newBigFolderDiscovered(QString)), this, SIGNAL(dirtyChanged()), Qt::UniqueConnection);
+ connect(f, SIGNAL(newBigFolderDiscovered(QString)), this, SLOT(slotNewBigFolder()), Qt::UniqueConnection);
}
endResetModel();
@@ -437,6 +437,8 @@ void FolderStatusModel::slotUpdateDirectories(const QStringList &list_)
}
auto selectiveSyncUndecidedList = parentInfo->_folder->journalDb()->getSelectiveSyncList(SyncJournalDb::SelectiveSyncUndecidedList);
+ QVarLengthArray<int> undecidedIndexes;
+
int i = 0;
foreach (QString path, list) {
SubFolderInfo newInfo;
@@ -468,9 +470,19 @@ void FolderStatusModel::slotUpdateDirectories(const QStringList &list_)
}
newInfo._isUndecided = selectiveSyncUndecidedList.contains(path);
parentInfo->_subs.append(newInfo);
+
+ foreach(const QString &str , selectiveSyncUndecidedList) {
+ if (str.startsWith(path)) {
+ undecidedIndexes.append(newInfo._pathIdx.last());
+ }
+ }
}
endInsertRows();
+
+ for (auto it = undecidedIndexes.begin(); it != undecidedIndexes.end(); ++it) {
+ suggestExpand(idx.child(*it, 0));
+ }
}
void FolderStatusModel::slotLscolFinishedWithError(QNetworkReply* r)
@@ -748,4 +760,31 @@ void FolderStatusModel::resetFolders()
setAccountState(_accountState);
}
+void FolderStatusModel::slotNewBigFolder()
+{
+ auto f = qobject_cast<Folder *>(sender());
+ Q_ASSERT(f);
+
+ int folderIndex = -1;
+ for (int i = 0; i < _folders.count(); ++i) {
+ if (_folders.at(i)._folder == f) {
+ folderIndex = i;
+ break;
+ }
+ }
+ if (folderIndex < 0) { return; }
+
+ _folders[folderIndex]._fetched = false;
+ _folders[folderIndex]._fetching = false;
+ if (!_folders.at(folderIndex)._subs.isEmpty()) {
+ beginRemoveRows(index(folderIndex), 0, _folders.at(folderIndex)._subs.count() - 1);
+ _folders[folderIndex]._subs.clear();
+ endRemoveRows();
+ }
+
+ emit suggestExpand(index(folderIndex));
+ emit dirtyChanged();
+}
+
+
} // namespace OCC
diff --git a/src/gui/folderstatusmodel.h b/src/gui/folderstatusmodel.h
index 4b3e394..8279be3 100644
--- a/src/gui/folderstatusmodel.h
+++ b/src/gui/folderstatusmodel.h
@@ -94,8 +94,9 @@ public slots:
private slots:
void slotUpdateDirectories(const QStringList &);
- void slotFolderSyncStateChange();
void slotLscolFinishedWithError(QNetworkReply *r);
+ void slotFolderSyncStateChange();
+ void slotNewBigFolder();
private:
QStringList createBlackList(OCC::FolderStatusModel::SubFolderInfo* root,
@@ -111,6 +112,7 @@ private:
signals:
void dirtyChanged();
+ void suggestExpand(const QModelIndex &); // Tell the view that this item should be expanded because it has a undecided item
};
} // namespace OCC
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git
More information about the Pkg-owncloud-commits
mailing list