diff options
author | Hannah von Reth <hannah.vonreth@owncloud.com> | 2021-09-29 17:12:00 +0300 |
---|---|---|
committer | Hannah von Reth <vonreth@kde.org> | 2021-10-01 16:26:47 +0300 |
commit | fd4f388af50da64931e2292d5d6b8ae5b916688a (patch) | |
tree | e2dbc915455e3348327131c55ae49681986c29ac | |
parent | 30dd7f627a57a6252d111af1062e25ac2ab45ce8 (diff) |
Allow to remove broken sync folder connections
-rw-r--r-- | changelog/unreleased/9099 | 6 | ||||
-rw-r--r-- | src/gui/accountsettings.cpp | 18 |
2 files changed, 19 insertions, 5 deletions
diff --git a/changelog/unreleased/9099 b/changelog/unreleased/9099 new file mode 100644 index 000000000..afb0c7a11 --- /dev/null +++ b/changelog/unreleased/9099 @@ -0,0 +1,6 @@ +Enhancement: Allow to remove broken sync folders + +In case a folder is no longer available it was not possible to remove the folder. +We now made the remove action available in that case. + +https://github.com/owncloud/client/pull/9099 diff --git a/src/gui/accountsettings.cpp b/src/gui/accountsettings.cpp index dc2b6fa77..016b786f0 100644 --- a/src/gui/accountsettings.cpp +++ b/src/gui/accountsettings.cpp @@ -240,9 +240,18 @@ void AccountSettings::doExpand() void AccountSettings::slotCustomContextMenuRequested(const QPoint &pos) { + const auto removeFolderAction = [this](QMenu *menu) { + return menu->addAction(tr("Remove folder sync connection"), this, &AccountSettings::slotRemoveCurrentFolder); + }; QTreeView *tv = ui->_folderList; QModelIndex index = tv->indexAt(pos); - if (!index.isValid() || !(index.flags() & Qt::ItemIsEnabled)) { + if (!index.isValid()) { + return; + } else if (!(index.flags() & Qt::ItemIsEnabled)) { + QMenu *menu = new QMenu(tv); + menu->setAttribute(Qt::WA_DeleteOnClose); + removeFolderAction(menu); + menu->popup(QCursor::pos()); return; } @@ -270,7 +279,7 @@ void AccountSettings::slotCustomContextMenuRequested(const QPoint &pos) }); - menu->popup(tv->mapToGlobal(pos)); + menu->popup(QCursor::pos()); return; } @@ -312,8 +321,7 @@ void AccountSettings::slotCustomContextMenuRequested(const QPoint &pos) ac = menu->addAction(folderPaused ? tr("Resume sync") : tr("Pause sync")); connect(ac, &QAction::triggered, this, &AccountSettings::slotEnableCurrentFolder); - ac = menu->addAction(tr("Remove folder sync connection")); - connect(ac, &QAction::triggered, this, &AccountSettings::slotRemoveCurrentFolder); + removeFolderAction(menu); if (folder->virtualFilesEnabled()) { auto availabilityMenu = menu->addMenu(tr("Availability")); @@ -348,7 +356,7 @@ void AccountSettings::slotCustomContextMenuRequested(const QPoint &pos) } - menu->popup(tv->mapToGlobal(pos)); + menu->popup(QCursor::pos()); } void AccountSettings::slotFolderListClicked(const QModelIndex &indx) |