[Pkg-owncloud-commits] [owncloud-client] 146/498: Accountsettings: Show a notification when there are new unconfirmed folders
Sandro Knauß
hefee-guest at moszumanska.debian.org
Tue Aug 11 14:48:44 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 81c10da8dc4054d04e60c45376516bd949f2499d
Author: Olivier Goffart <ogoffart at woboq.com>
Date: Fri Jun 12 11:28:56 2015 +0200
Accountsettings: Show a notification when there are new unconfirmed folders
---
src/gui/accountsettings.cpp | 24 ++++++++++++++--
src/gui/accountsettings.ui | 66 ++++++++++++++++++++++++++-----------------
src/gui/folder.cpp | 2 +-
src/gui/folder.h | 2 +-
src/gui/folderstatusmodel.cpp | 10 ++++---
5 files changed, 69 insertions(+), 35 deletions(-)
diff --git a/src/gui/accountsettings.cpp b/src/gui/accountsettings.cpp
index c99c984..659a97f 100644
--- a/src/gui/accountsettings.cpp
+++ b/src/gui/accountsettings.cpp
@@ -85,7 +85,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(dirtyChanged()), this, SLOT(refreshSelectiveSyncStatus()));
- ui->selectiveSyncStatus->hide();
+ refreshSelectiveSyncStatus();
QAction *resetFolderAction = new QAction(this);
resetFolderAction->setShortcut(QKeySequence(Qt::Key_F5));
@@ -443,13 +443,31 @@ AccountSettings::~AccountSettings()
void AccountSettings::refreshSelectiveSyncStatus()
{
- ui->selectiveSyncApply->setEnabled(_model->isDirty());
- ui->selectiveSyncCancel->setEnabled(_model->isDirty());
bool shouldBeVisible = _model->isDirty();
+ QStringList undecidedFolder;
for (int i = 0; !shouldBeVisible && i < _model->rowCount(); ++i) {
if (ui->_folderList->isExpanded(_model->index(i)))
shouldBeVisible = true;
}
+
+ foreach (Folder *folder, FolderMan::instance()->map().values()) {
+ if (folder->accountState() != _accountState) { continue; }
+ auto undecidedList = folder->journalDb()->getSelectiveSyncList(SyncJournalDb::SelectiveSyncUndecidedList);
+ foreach(const auto &it, undecidedList) {
+ undecidedFolder += ( folder->alias() + QLatin1String("/") + it);
+ }
+ }
+ if (undecidedFolder.isEmpty()) {
+ ui->selectiveSyncNotification->setText(QString());
+ } else {
+ ui->selectiveSyncNotification->setText(
+ tr("There are new shared folders that were not synchronized because they are too big: %1")
+ .arg(undecidedFolder.join(tr(", "))));
+ shouldBeVisible = true;
+ }
+
+ ui->selectiveSyncApply->setEnabled(_model->isDirty() || !undecidedFolder.isEmpty());
+ ui->selectiveSyncCancel->setEnabled(_model->isDirty());
bool wasVisible = ui->selectiveSyncApply->isVisible();
if (wasVisible != shouldBeVisible) {
QSize hint = ui->selectiveSyncStatus->sizeHint();
diff --git a/src/gui/accountsettings.ui b/src/gui/accountsettings.ui
index f390eb2..13727fb 100644
--- a/src/gui/accountsettings.ui
+++ b/src/gui/accountsettings.ui
@@ -37,13 +37,13 @@
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
- </property>
- <property name="openExternalLinks">
- <bool>true</bool>
</property>
<property name="text">
<string>Connected with <server> as <user></string>
</property>
+ <property name="openExternalLinks">
+ <bool>true</bool>
+ </property>
</widget>
</item>
<item>
@@ -136,22 +136,39 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
- <layout class="QGridLayout" name="gridLayout_2">
- <property name="sizeConstraint">
- <enum>QLayout::SetNoConstraint</enum>
- </property>
- <item row="1" column="1">
- <widget class="QPushButton" name="selectiveSyncCancel">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="Maximum">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Cancel</string>
- </property>
- </widget>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0" rowspan="2">
+ <layout class="QVBoxLayout" name="verticalLayout_3">
+ <item>
+ <widget class="QLabel" name="selectiveSyncLabel">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="MinimumExpanding" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Unchecked folders will be <b>removed</b> from your local file system and will not be synchronized to this computer anymore</string>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="selectiveSyncNotification">
+ <property name="styleSheet">
+ <string notr="true">color: red</string>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="selectiveSyncApply">
@@ -166,19 +183,16 @@
</property>
</widget>
</item>
- <item row="0" column="0" rowspan="2">
- <widget class="QLabel" name="label">
+ <item row="1" column="1">
+ <widget class="QPushButton" name="selectiveSyncCancel">
<property name="sizePolicy">
- <sizepolicy hsizetype="MinimumExpanding" vsizetype="Maximum">
+ <sizepolicy hsizetype="Minimum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
- <string>Unchecked folders will be <b>removed</b> from your local file system and will not be synchronized to this computer anymore</string>
- </property>
- <property name="wordWrap">
- <bool>true</bool>
+ <string>Cancel</string>
</property>
</widget>
</item>
diff --git a/src/gui/folder.cpp b/src/gui/folder.cpp
index b10e489..f51bfbb 100644
--- a/src/gui/folder.cpp
+++ b/src/gui/folder.cpp
@@ -1022,7 +1022,7 @@ void Folder::slotNewSharedBigFolderDiscovered(const QString &newF)
if (!undecidedList.contains(newFolder)) {
undecidedList.append(newFolder);
journal->setSelectiveSyncList(SyncJournalDb::SelectiveSyncUndecidedList, undecidedList);
- emit newSharedBigFolderDiscovered();
+ emit newSharedBigFolderDiscovered(newFolder);
}
}
diff --git a/src/gui/folder.h b/src/gui/folder.h
index bac74d6..7bbc6cd 100644
--- a/src/gui/folder.h
+++ b/src/gui/folder.h
@@ -174,7 +174,7 @@ signals:
void syncFinished(const SyncResult &result);
void scheduleToSync(Folder*);
void progressInfo(const ProgressInfo& progress);
- void newSharedBigFolderDiscovered(); // A new folder bigger than the threshold was discovered
+ void newSharedBigFolderDiscovered(const QString &); // A new folder bigger than the threshold was discovered
public slots:
diff --git a/src/gui/folderstatusmodel.cpp b/src/gui/folderstatusmodel.cpp
index fb6bae7..00482a3 100644
--- a/src/gui/folderstatusmodel.cpp
+++ b/src/gui/folderstatusmodel.cpp
@@ -59,9 +59,11 @@ void FolderStatusModel::setAccount(const AccountPtr& account)
connect(f, SIGNAL(progressInfo(ProgressInfo)), this, SLOT(slotSetProgress(ProgressInfo)), Qt::UniqueConnection);
connect(f, SIGNAL(syncStateChange()), this, SLOT(slotFolderSyncStateChange()), Qt::UniqueConnection);
+ connect(f, SIGNAL(newSharedBigFolderDiscovered(QString)), this, SIGNAL(dirtyChanged()), Qt::UniqueConnection);
}
endResetModel();
+ emit dirtyChanged();
}
@@ -514,11 +516,11 @@ void FolderStatusModel::slotUpdateFolderState(Folder *folder)
void FolderStatusModel::slotApplySelectiveSync()
{
- if (!_dirty)
- return;
-
for (int i = 0; i < _folders.count(); ++i) {
- if (!_folders[i]._fetched) continue;
+ if (!_folders[i]._fetched) {
+ _folders[i]._folder->journalDb()->setSelectiveSyncList(SyncJournalDb::SelectiveSyncUndecidedList, QStringList());
+ continue;
+ }
auto folder = _folders.at(i)._folder;
auto oldBlackList = folder->journalDb()->getSelectiveSyncList(SyncJournalDb::SelectiveSyncBlackList);
--
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