mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 20:23:25 +00:00
code cleanup: simplify if / else chains
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
9e6a3bee0d
commit
858740e8a1
1 changed files with 6 additions and 10 deletions
|
@ -1427,14 +1427,11 @@ QString MainWindow::filter_import()
|
||||||
|
|
||||||
bool MainWindow::askSaveChanges()
|
bool MainWindow::askSaveChanges()
|
||||||
{
|
{
|
||||||
QString message;
|
|
||||||
QMessageBox response(this);
|
QMessageBox response(this);
|
||||||
|
|
||||||
if (existing_filename)
|
QString message = existing_filename ?
|
||||||
message = tr("Do you want to save the changes that you made in the file %1?")
|
tr("Do you want to save the changes that you made in the file %1?").arg(displayedFilename(existing_filename)) :
|
||||||
.arg(displayedFilename(existing_filename));
|
tr("Do you want to save the changes that you made in the data file?");
|
||||||
else
|
|
||||||
message = tr("Do you want to save the changes that you made in the data file?");
|
|
||||||
|
|
||||||
response.setStandardButtons(QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
|
response.setStandardButtons(QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
|
||||||
response.setDefaultButton(QMessageBox::Save);
|
response.setDefaultButton(QMessageBox::Save);
|
||||||
|
@ -1729,10 +1726,9 @@ QString MainWindow::displayedFilename(QString fullFilename)
|
||||||
|
|
||||||
if (fullFilename.contains(prefs.cloud_git_url)) {
|
if (fullFilename.contains(prefs.cloud_git_url)) {
|
||||||
QString email = fileName.left(fileName.indexOf('['));
|
QString email = fileName.left(fileName.indexOf('['));
|
||||||
if (git_local_only)
|
return git_local_only ?
|
||||||
return tr("[local cache for] %1").arg(email);
|
tr("[local cache for] %1").arg(email) :
|
||||||
else
|
tr("[cloud storage for] %1").arg(email);
|
||||||
return tr("[cloud storage for] %1").arg(email);
|
|
||||||
} else {
|
} else {
|
||||||
return fileName;
|
return fileName;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue