summaryrefslogtreecommitdiffhomepage
path: root/facetracknoir
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2015-08-22 23:00:59 +0200
committerStanislaw Halik <sthalik@misaki.pl>2015-08-22 23:00:59 +0200
commitc15a456ac6df79a001250fc5b877751db4a30875 (patch)
tree4b6323f442854670297af033af3019ee7eb6b81b /facetracknoir
parent9cd5ab67dbe347d1f4dcf4a6eb3f4fd7e3d89dab (diff)
ui: append extension in the right place
Otherwise, file can be overwritten accidentally
Diffstat (limited to 'facetracknoir')
-rw-r--r--facetracknoir/new_file_dialog.h2
-rw-r--r--facetracknoir/ui.cpp5
2 files changed, 3 insertions, 4 deletions
diff --git a/facetracknoir/new_file_dialog.h b/facetracknoir/new_file_dialog.h
index dc821592..d72b8741 100644
--- a/facetracknoir/new_file_dialog.h
+++ b/facetracknoir/new_file_dialog.h
@@ -34,6 +34,8 @@ private slots:
QString text = ui.lineEdit->text();
text = text.replace('/', "");
text = text.replace('\\', "");
+ if (text != "" && !text.endsWith(".ini"))
+ text += ".ini";
if (text == "" || QFile(options::group::ini_directory() + "/" + text).exists())
{
QMessageBox::warning(this,
diff --git a/facetracknoir/ui.cpp b/facetracknoir/ui.cpp
index a204f36d..e22fee7a 100644
--- a/facetracknoir/ui.cpp
+++ b/facetracknoir/ui.cpp
@@ -109,10 +109,7 @@ bool MainWindow::get_new_config_name_from_dialog(QString& ret)
{
new_file_dialog dlg;
dlg.exec();
- bool b = dlg.is_ok(ret);
- if (b && !ret.endsWith(".ini"))
- ret += ".ini";
- return b;
+ return dlg.is_ok(ret);
}
MainWindow::~MainWindow()