diff --git a/src/gui/accountsettings.cpp b/src/gui/accountsettings.cpp index 1af4d762231..3456f433dac 100644 --- a/src/gui/accountsettings.cpp +++ b/src/gui/accountsettings.cpp @@ -28,6 +28,7 @@ #include "quotainfo.h" #include "accountmanager.h" #include "creds/abstractcredentials.h" +#include #include @@ -472,6 +473,10 @@ void AccountSettings::refreshSelectiveSyncStatus() tr("There are new shared folders that were not synchronized because they are too big: %1") .arg(undecidedFolder.join(tr(", ")))); shouldBeVisible = true; + + if (!_newBigFolderNotificationTimer) { + newBigFolderNotificationTimeout(); + } } ui->selectiveSyncApply->setEnabled(_model->isDirty() || !undecidedFolder.isEmpty()); @@ -492,6 +497,49 @@ void AccountSettings::refreshSelectiveSyncStatus() } } +/** + * From the acceptence criteria of issue #3148: + * + * - The notification includes a message “A Folder larger than [setting] has been shared with you. + * Do you want to sync this folder to this device?". + * - This notification appears every 15 minutes as long as there is a decision in the activity list + * for the user to make. When the activity menu is viewed the notification can go away. + * (this is so users will be forced to decide what to do) + */ +void AccountSettings::newBigFolderNotificationTimeout() +{ + bool hasUndecidedFolder = false; + foreach (Folder *folder, FolderMan::instance()->map().values()) { + if (folder->accountState() != _accountState) { continue; } + auto undecidedList = folder->journalDb()->getSelectiveSyncList(SyncJournalDb::SelectiveSyncUndecidedList); + if (!undecidedList.isEmpty()) { + hasUndecidedFolder = true; + break; + } + } + + if (!hasUndecidedFolder) { + delete _newBigFolderNotificationTimer; + return; + } + + if (!_newBigFolderNotificationTimer) { + // Repeat every 15 minutes + _newBigFolderNotificationTimer = new QTimer(this); + connect(_newBigFolderNotificationTimer,SIGNAL(timeout()),this, SLOT(newBigFolderNotificationTimeout())); + _newBigFolderNotificationTimer->start(15 * 60 * 1000); + } + + QString message = tr("A Folder larger than %1 MB has been shared with you. " + "Do you want to sync this folder to this device?") + .arg(ConfigFile().newSharedFolderSizeLimit().second); + + auto logger = Logger::instance(); + logger->postOptionalGuiLog(Theme::instance()->appNameGUI(), message); + +} + + void AccountSettings::slotDeleteAccount() { int ret = QMessageBox::question( this, tr("Confirm Account Delete"), diff --git a/src/gui/accountsettings.h b/src/gui/accountsettings.h index 8a5a438800c..dcf4898aca0 100644 --- a/src/gui/accountsettings.h +++ b/src/gui/accountsettings.h @@ -80,6 +80,7 @@ protected slots: void slotDeleteAccount(); void refreshSelectiveSyncStatus(); void slotCustomContextMenuRequested(const QPoint&); + void newBigFolderNotificationTimeout(); private: void showConnectionLabel(const QString& message, @@ -94,6 +95,7 @@ protected slots: AccountState *_accountState; QLabel *_quotaLabel; QuotaInfo _quotaInfo; + QPointer _newBigFolderNotificationTimer; }; } // namespace OCC diff --git a/src/gui/folder.cpp b/src/gui/folder.cpp index 6caae6b337e..46ad5474b3a 100644 --- a/src/gui/folder.cpp +++ b/src/gui/folder.cpp @@ -1061,11 +1061,10 @@ void Folder::slotNewSharedBigFolderDiscovered(const QString &newF) if (!undecidedList.contains(newFolder)) { undecidedList.append(newFolder); journal->setSelectiveSyncList(SyncJournalDb::SelectiveSyncUndecidedList, undecidedList); - emit newSharedBigFolderDiscovered(newFolder); } -} - + emit newSharedBigFolderDiscovered(newFolder); +} void Folder::slotAboutToRemoveAllFiles(SyncFileItem::Direction, bool *cancel) {