[trojita] src/Gui: GUI: Archive: Do not allow moving from Archive to Archive
Jan Kundrát
null at kde.org
Mon Mar 6 09:45:52 UTC 2017
Git commit be7cf061ee7564e03c1f7e2323a68a7314804d35 by Jan Kundrát.
Committed on 04/03/2017 at 15:34.
Pushed by gerrit into branch 'master'.
GUI: Archive: Do not allow moving from Archive to Archive
Because we do not support unarchiving (we don't know what the original
mailbox name was), let's prevent people from "archiving" within an
archive.
Change-Id: Icdcef7eeeeecd57248452c486702c791d7fb67d6
M +11 -1 src/Gui/Window.cpp
https://commits.kde.org/trojita/be7cf061ee7564e03c1f7e2323a68a7314804d35
diff --git a/src/Gui/Window.cpp b/src/Gui/Window.cpp
index f67533a3..9cd595fa 100644
--- a/src/Gui/Window.cpp
+++ b/src/Gui/Window.cpp
@@ -1668,7 +1668,17 @@ void MainWindow::updateMessageFlagsOf(const QModelIndex &index)
markAsFlagged->setEnabled(okToModify);
markAsJunk->setEnabled(okToModify);
markAsNotJunk->setEnabled(okToModify);
- moveToArchive->setEnabled(okToModify);
+
+ // There's no point in moving from Archive to, well, Archive
+ auto archiveFolderName = m_settings->value(Common::SettingsNames::imapArchiveFolderName).toString();
+ if (archiveFolderName.isEmpty()) {
+ archiveFolderName = Common::SettingsNames::imapDefaultArchiveFolderName;
+ }
+ moveToArchive->setEnabled(okToModify &&
+ std::any_of(indexes.cbegin(), indexes.cend(),
+ [archiveFolderName](const QModelIndex &i) {
+ return i.data(Imap::Mailbox::RoleMailboxName) != archiveFolderName;
+ }));
bool isRead = isValid,
isDeleted = isValid,
More information about the kde-doc-english
mailing list