From 89d302264966de8c74614787800bedbe7e6c16ed Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Mon, 13 Feb 2023 19:37:12 +0100 Subject: [PATCH] Do not search for folder twice Signed-off-by: Claudio Cambra --- src/gui/accountsettings.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/gui/accountsettings.cpp b/src/gui/accountsettings.cpp index 9400cbb88..77aba9dd0 100644 --- a/src/gui/accountsettings.cpp +++ b/src/gui/accountsettings.cpp @@ -433,13 +433,12 @@ void AccountSettings::slotOpenMakeFolderDialog() return; } - const auto fileName = [this, &selected, &classification] { + const auto folder = _model->infoForIndex(selected)->_folder; + Q_ASSERT(folder); + const auto fileName = [selected, classification, folder, this] { QString result; if (classification == FolderStatusModel::RootFolder) { - const auto alias = _model->data(selected, FolderStatusDelegate::FolderAliasRole).toString(); - if (const auto folder = FolderMan::instance()->folder(alias)) { - result = folder->path(); - } + result = folder->path(); } else { result = _model->data(selected, FolderStatusDelegate::FolderPathRole).toString(); } @@ -456,7 +455,6 @@ void AccountSettings::slotOpenMakeFolderDialog() folderCreationDialog->setAttribute(Qt::WA_DeleteOnClose); folderCreationDialog->open(); - const auto folder = _model->infoForIndex(selected)->_folder; #ifdef Q_OS_MAC // The macOS FolderWatcher cannot detect file and folder changes made by the watching process -- us. // So we need to manually invoke the slot that is called by watched folder changes.