From 78e4afb387a11e518dd614d50906eee1774f7b6f Mon Sep 17 00:00:00 2001 From: Martchus Date: Fri, 14 Feb 2020 17:18:01 +0100 Subject: [PATCH] Improve consistency of error messages --- CMakeLists.txt | 2 +- gui/mainwindow.cpp | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f89029b..2f9ff79 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,7 +15,7 @@ set(META_USE_QQC2 ON) set(META_ANDROID_PACKAGE_NAME "org.martchus.passwordmanager") set(META_VERSION_MAJOR 4) set(META_VERSION_MINOR 1) -set(META_VERSION_PATCH 2) +set(META_VERSION_PATCH 3) set(PNG_ICON_NO_CROP ON) # add project files diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 27947de..9a7733a 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -432,8 +432,7 @@ bool MainWindow::openFile(const QString &path, PasswordFileOpenFlags openFlags) } // show error message - const QString errmsg - = tr("An IO error occured when opening the specified file \"%1\".\n\n(%2)").arg(path, QString::fromLocal8Bit(failure.what())); + const QString errmsg = tr("An IO error occured when opening the specified file \"%1\": %2").arg(path, QString::fromLocal8Bit(failure.what())); m_ui->statusBar->showMessage(errmsg, 5000); QMessageBox::critical(this, QApplication::applicationName(), errmsg); return false; @@ -828,8 +827,7 @@ bool MainWindow::saveFile() try { m_file.doBackup(); } catch (const std::ios_base::failure &failure) { - const QString message( - tr("The backup file couldn't be created because in IO error occured: %1").arg(QString::fromLocal8Bit(failure.what()))); + const QString message(tr("An IO error occured when making the backup file: %1").arg(QString::fromLocal8Bit(failure.what()))); QMessageBox::critical(this, QApplication::applicationName(), message); m_ui->statusBar->showMessage(message, 7000); return false; @@ -898,7 +896,7 @@ void MainWindow::exportFile() try { m_file.exportToTextfile(targetPath.toStdString()); } catch (const std::ios_base::failure &failure) { - errmsg = tr("The password list couldn't be exported. %1").arg(QString::fromLocal8Bit(failure.what())); + errmsg = tr("An IO error occurred when exporting the password list: %1").arg(QString::fromLocal8Bit(failure.what())); } if (errmsg.isEmpty()) { m_ui->statusBar->showMessage(tr("The password list has been exported."), 5000);