diff options
author | saturneric <[email protected]> | 2024-01-30 03:26:41 +0000 |
---|---|---|
committer | saturneric <[email protected]> | 2024-01-30 03:26:41 +0000 |
commit | 635cfadda55fe79917c0ba96b589e2235571bab3 (patch) | |
tree | df1c3af2aec88e6f9b2addb6ffc104e7a23dfefb /src/ui/UserInterfaceUtils.cpp | |
parent | fix: solve reported issues (diff) | |
download | GpgFrontend-635cfadda55fe79917c0ba96b589e2235571bab3.tar.gz GpgFrontend-635cfadda55fe79917c0ba96b589e2235571bab3.zip |
fix: add function to import key rev cert
Diffstat (limited to 'src/ui/UserInterfaceUtils.cpp')
-rw-r--r-- | src/ui/UserInterfaceUtils.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/ui/UserInterfaceUtils.cpp b/src/ui/UserInterfaceUtils.cpp index c66b9845..ab8aeac9 100644 --- a/src/ui/UserInterfaceUtils.cpp +++ b/src/ui/UserInterfaceUtils.cpp @@ -281,6 +281,15 @@ void CommonUtils::SlotImportKeyFromFile(QWidget *parent) { if (file_name.isEmpty()) return; QFileInfo file_info(file_name); + + if (!file_info.isFile() || !file_info.isReadable()) { + QMessageBox::critical( + parent, tr("Error"), + tr("Cannot open this file. Please make sure that this " + "is a regular file and it's readable.")); + return; + } + if (file_info.size() > static_cast<qint64>(1024 * 1024)) { QMessageBox::critical(parent, tr("Error"), tr("The target file is too large for a keyring.")); @@ -342,7 +351,7 @@ void CommonUtils::SlotExecuteGpgCommand( const QStringList &arguments, const std::function<void(QProcess *)> &interact_func) { QEventLoop looper; - auto dialog = new WaitingDialog(tr("Processing"), nullptr); + auto *dialog = new WaitingDialog(tr("Processing"), nullptr); dialog->show(); auto *gpg_process = new QProcess(&looper); gpg_process->setProcessChannelMode(QProcess::MergedChannels); @@ -506,7 +515,7 @@ void CommonUtils::SlotRestartApplication(int code) { } } -bool CommonUtils::isApplicationNeedRestart() { +auto CommonUtils::isApplicationNeedRestart() -> bool { return application_need_to_restart_at_once_; } |