Browse Source

Fix wrong default config export path (#1848)

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>
Haris Gušić 3 years ago
parent
commit
e4f067b86d
1 changed files with 6 additions and 4 deletions
  1. 6 4
      src/config/generalconf.cpp

+ 6 - 4
src/config/generalconf.cpp

@@ -11,6 +11,7 @@
 #include <QLineEdit>
 #include <QMessageBox>
 #include <QPushButton>
+#include <QSettings>
 #include <QSizePolicy>
 #include <QSpinBox>
 #include <QStandardPaths>
@@ -149,11 +150,12 @@ void GeneralConf::importConfiguration()
 
 void GeneralConf::exportFileConfiguration()
 {
-    QString fileName = QFileDialog::getSaveFileName(
-      this, tr("Save File"), QStringLiteral("flameshot.conf"));
+    QString defaultFileName = QSettings().fileName();
+    QString fileName =
+      QFileDialog::getSaveFileName(this, tr("Save File"), defaultFileName);
 
-    // Cancel button
-    if (fileName.isNull()) {
+    // Cancel button or target same as source
+    if (fileName.isNull() || fileName == defaultFileName) {
         return;
     }