diff --git a/src/gui/accountsettings.cpp b/src/gui/accountsettings.cpp index c99c984d3..659a97fe2 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 f390eb213..13727fbf0 100644 --- a/src/gui/accountsettings.ui +++ b/src/gui/accountsettings.ui @@ -37,13 +37,13 @@ 0 0 - - - true Connected with <server> as <user> + + true + @@ -136,22 +136,39 @@ 0 - - - QLayout::SetNoConstraint - - - - - - 0 - 0 - - - - Cancel - - + + + + + + + + 0 + 0 + + + + Unchecked folders will be <b>removed</b> from your local file system and will not be synchronized to this computer anymore + + + true + + + + + + + color: red + + + + + + true + + + + @@ -166,19 +183,16 @@ - - + + - + 0 0 - Unchecked folders will be <b>removed</b> from your local file system and will not be synchronized to this computer anymore - - - true + Cancel diff --git a/src/gui/folder.cpp b/src/gui/folder.cpp index b10e4897e..f51bfbbc1 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 bac74d62e..7bbc6cda5 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 fb6bae740..00482a316 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);