]> git.siccegge.de Git - frida/frida.git/commitdiff
Properly handle abort of open dialog
authorChristoph Egger <Christoph.Egger@fau.de>
Wed, 25 Mar 2015 13:04:21 +0000 (14:04 +0100)
committerChristoph Egger <Christoph.Egger@fau.de>
Wed, 25 Mar 2015 13:04:21 +0000 (14:04 +0100)
src/gui/Mainwindow.cxx

index 33e48bc694dc19981a1dc7e889bcf36c4a3e98d1..7ea9012bf9ed8fe45e3dd4578234d59160d48237 100644 (file)
@@ -129,15 +129,29 @@ void Mainwindow::quit()
 }
 
 void Mainwindow::open() {
-       QString fileName = QFileDialog::getOpenFileName(this, tr("Open File"), "",
-                                                       tr("Binaries (*)"));
-       manager->reset(fileName.toStdString());
+       QFileDialog dialog(this, tr("Open bianry"), "", tr("Binaries (*)"));
+
+       if (dialog.exec()) {
+               QStringList files = dialog.selectedFiles();
+               if(1 != files.size()) {
+                       LOG4CXX_ERROR(logger, "Needs exactly one file name")
+               } else {
+                       manager->reset(files[0].toStdString());
+               }
+       }
 }
 
 void Mainwindow::load() {
-       QString fileName = QFileDialog::getOpenFileName(this, tr("Open File"), "",
-                                                       tr("Frida Archives (*.frida)"));
-       manager->load(fileName.toStdString());
+       QFileDialog dialog(this, tr("Open saved FrIDa file"), "", tr("Frida Archives (*.frida)"));
+
+       if (dialog.exec()) {
+               QStringList files = dialog.selectedFiles();
+               if(1 != files.size()) {
+                       LOG4CXX_ERROR(logger, "Needs exactly one file name")
+               } else {
+                       manager->load(files[0].toStdString());
+               }
+       }
 }
 
 void Mainwindow::save() {