diff options
author | Saturneric <[email protected]> | 2021-12-12 09:36:08 +0000 |
---|---|---|
committer | Saturneric <[email protected]> | 2021-12-12 09:36:08 +0000 |
commit | e3792543f6d8b8dd8b0af78194967cc70448873f (patch) | |
tree | 7b078a5b437576e8021c2bb90a570c3f1969fbfe /src/ui/main_window/MainWindowFileSlotFunction.cpp | |
parent | Add Support For UI Header include Path (diff) | |
download | GpgFrontend-e3792543f6d8b8dd8b0af78194967cc70448873f.tar.gz GpgFrontend-e3792543f6d8b8dd8b0af78194967cc70448873f.zip |
Fixed & Modified & Added.
1. Fixed UTF-16 & UTF-8 filesystem path's bugs.
2. Added mkdir & create empty file.
3. Improve file browser.
4. Added Infoboard.ui.
5. Fixed Verify Bugs.
Diffstat (limited to '')
-rw-r--r-- | src/ui/main_window/MainWindowFileSlotFunction.cpp | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/src/ui/main_window/MainWindowFileSlotFunction.cpp b/src/ui/main_window/MainWindowFileSlotFunction.cpp index 19be9769..133a7820 100644 --- a/src/ui/main_window/MainWindowFileSlotFunction.cpp +++ b/src/ui/main_window/MainWindowFileSlotFunction.cpp @@ -245,14 +245,16 @@ void MainWindow::slotFileVerify() { signFilePath = path + ".sig"; } - bool ok; - QString text = - QInputDialog::getText(this, _("Origin file to verify"), _("Filepath"), - QLineEdit::Normal, dataFilePath, &ok); - if (ok && !text.isEmpty()) { - dataFilePath = text; - } else { - return; + if (fileInfo.suffix() != "gpg") { + bool ok; + QString text = + QInputDialog::getText(this, _("Origin file to verify"), _("Filepath"), + QLineEdit::Normal, dataFilePath, &ok); + if (ok && !text.isEmpty()) { + dataFilePath = text; + } else { + return; + } } QFileInfo dataFileInfo(dataFilePath), signFileInfo(signFilePath); @@ -395,13 +397,23 @@ void MainWindow::slotFileDecryptVerify() { if (!file_pre_check(this, path)) return; - QString outFileName, fileExtension = QFileInfo(path).suffix(); - - if (fileExtension == "asc" || fileExtension == "gpg") { - int pos = path.lastIndexOf(QChar('.')); - outFileName = path.left(pos); + boost::filesystem::path out_path(path.toStdString()); + if (out_path.extension() == ".asc" || out_path.extension() == ".gpg") { + out_path = out_path.parent_path() / out_path.filename(); } else { - outFileName = path + ".out"; + out_path = out_path.replace_extension(".out").string(); + } + LOG(INFO) << "out path" << out_path; + + if (QFile::exists(out_path.string().c_str())) { + auto ret = + QMessageBox::warning(this, _("Warning"), + QString(_("The output file %1 already exists, do " + "you need to overwrite it?")) + .arg(out_path.filename().string().c_str()), + QMessageBox::Ok | QMessageBox::Cancel); + + if (ret == QMessageBox::Cancel) return; } GpgDecrResult d_result = nullptr; |