diff options
author | Tomaz Canabrava <tcanabrava@kde.org> | 2018-09-13 18:08:26 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2018-09-15 15:51:26 -0700 |
commit | 858740e8a1ad9b0febb1f805cccf1f943062375b (patch) | |
tree | 602fa7a49f5dc32f6bd4251840a54ff5dc116e39 /desktop-widgets | |
parent | 9e6a3bee0d029205169896dc9d2b39f421a3039a (diff) | |
download | subsurface-858740e8a1ad9b0febb1f805cccf1f943062375b.tar.gz |
code cleanup: simplify if / else chains
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'desktop-widgets')
-rw-r--r-- | desktop-widgets/mainwindow.cpp | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp index 4e2365356..afdf02668 100644 --- a/desktop-widgets/mainwindow.cpp +++ b/desktop-widgets/mainwindow.cpp @@ -1427,14 +1427,11 @@ QString MainWindow::filter_import() bool MainWindow::askSaveChanges() { - QString message; QMessageBox response(this); - if (existing_filename) - message = tr("Do you want to save the changes that you made in the file %1?") - .arg(displayedFilename(existing_filename)); - else - message = tr("Do you want to save the changes that you made in the data file?"); + QString message = existing_filename ? + tr("Do you want to save the changes that you made in the file %1?").arg(displayedFilename(existing_filename)) : + tr("Do you want to save the changes that you made in the data file?"); response.setStandardButtons(QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel); response.setDefaultButton(QMessageBox::Save); @@ -1729,10 +1726,9 @@ QString MainWindow::displayedFilename(QString fullFilename) if (fullFilename.contains(prefs.cloud_git_url)) { QString email = fileName.left(fileName.indexOf('[')); - if (git_local_only) - return tr("[local cache for] %1").arg(email); - else - return tr("[cloud storage for] %1").arg(email); + return git_local_only ? + tr("[local cache for] %1").arg(email) : + tr("[cloud storage for] %1").arg(email); } else { return fileName; } |