]> git.nothing2do.fr Git - diary-mobile.git/commitdiff
added the ability to customize sql sentence on the fly
authorNorbert Moutarde <norbert.moutarde@nothing2do.eu>
Sat, 24 May 2014 08:48:17 +0000 (10:48 +0200)
committerNorbert Moutarde <norbert.moutarde@nothing2do.eu>
Sat, 24 May 2014 08:48:17 +0000 (10:48 +0200)
mainwindow.cpp

index 8ba3c2b557142f51a10b9825f7f8714df95fbfb4..fe7c7d627a4c9c3e3ae40803ee96ffb4470ae342 100644 (file)
@@ -218,7 +218,17 @@ void MainWindow::action(const QString &a){
         way.clear();
     }
     else if(b[0]==QString("sql")){
-        exec(QList<QString> ({c}));
+        int value=c.count(QString("?"));
+        QList<QString> cmd({c});
+        if (value){
+            for(int d=0; d<=value; d++){
+                bool ok;
+                QString e=QInputDialog::getText(this, "set", "value ?", QLineEdit::Normal, QString(""), &ok);
+                if(ok)cmd.append(e);
+                else break;// in case of break, exec complain about cmd size
+            }
+        }
+        exec(cmd);
     }
     else if(b[0]==QString("edit")){
         QString e;