diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2017-12-04 08:49:28 +0100 |
---|---|---|
committer | Lubomir I. Ivanov <neolit123@gmail.com> | 2017-12-04 18:35:44 +0100 |
commit | 0a2e53caf27b30186f8492fcfb6efa61ca7808b1 (patch) | |
tree | d9b8db120031bc6c8ecc139ad143a1096642341b /desktop-widgets | |
parent | ed92b60bfe249e2ec030c8e103e545dec854aba9 (diff) | |
download | subsurface-0a2e53caf27b30186f8492fcfb6efa61ca7808b1.tar.gz |
Use QDir::exists() instead of QDir::setCurrent() to check for existence
Don't change into a directory just to see if it exists.
Remove unnecessary braces of one of the changed if statements.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets')
-rw-r--r-- | desktop-widgets/divelistview.cpp | 2 | ||||
-rw-r--r-- | desktop-widgets/divelogexportdialog.cpp | 3 | ||||
-rw-r--r-- | desktop-widgets/mainwindow.cpp | 2 |
3 files changed, 3 insertions, 4 deletions
diff --git a/desktop-widgets/divelistview.cpp b/desktop-widgets/divelistview.cpp index 48b10fbc4..104b65a63 100644 --- a/desktop-widgets/divelistview.cpp +++ b/desktop-widgets/divelistview.cpp @@ -1017,7 +1017,7 @@ QString DiveListView::lastUsedImageDir() settings.beginGroup("FileDialog"); if (settings.contains("LastImageDir")) - if (QDir::setCurrent(settings.value("LastImageDir").toString())) + if (QDir(settings.value("LastImageDir").toString()).exists()) lastImageDir = settings.value("LastImageDir").toString(); return lastImageDir; } diff --git a/desktop-widgets/divelogexportdialog.cpp b/desktop-widgets/divelogexportdialog.cpp index ed908e937..96417c1bc 100644 --- a/desktop-widgets/divelogexportdialog.cpp +++ b/desktop-widgets/divelogexportdialog.cpp @@ -127,9 +127,8 @@ void DiveLogExportDialog::on_buttonBox_accepted() settings.beginGroup("FileDialog"); if (settings.contains("LastDir")) { - if (QDir::setCurrent(settings.value("LastDir").toString())) { + if (QDir(settings.value("LastDir").toString()).exists()) lastDir = settings.value("LastDir").toString(); - } } settings.endGroup(); diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp index 680a24fde..a9dd960d0 100644 --- a/desktop-widgets/mainwindow.cpp +++ b/desktop-widgets/mainwindow.cpp @@ -743,7 +743,7 @@ QString MainWindow::lastUsedDir() settings.beginGroup("FileDialog"); if (settings.contains("LastDir")) - if (QDir::setCurrent(settings.value("LastDir").toString())) + if (QDir(settings.value("LastDir").toString()).exists()) lastDir = settings.value("LastDir").toString(); return lastDir; } |