Do not search for folder twice

Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
Claudio Cambra 2023-02-13 19:37:12 +01:00
parent 6c548145a2
commit 89d3022649

View file

@ -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();
}
} 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.