mirror of
https://github.com/nextcloud/desktop.git
synced 2024-10-27 23:17:13 +03:00
Accountsettings: Show a notification when there are new unconfirmed folders
This commit is contained in:
parent
53f2468430
commit
81c10da8dc
5 changed files with 69 additions and 35 deletions
|
@ -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();
|
||||
|
|
|
@ -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,23 +136,40 @@
|
|||
<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">
|
||||
<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="Minimum" vsizetype="Maximum">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Cancel</string>
|
||||
<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">
|
||||
<property name="sizePolicy">
|
||||
|
@ -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>
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue