]> git.nothing2do.fr Git - diary-mobile.git/commitdiff
I've added conf("sepcmd"), conf("sepchc") and conf("sqlval")
authorNorbert Moutarde <norbert.moutarde@nothing2do.eu>
Thu, 29 May 2014 18:46:01 +0000 (20:46 +0200)
committerNorbert Moutarde <norbert.moutarde@nothing2do.eu>
Thu, 29 May 2014 18:46:01 +0000 (20:46 +0200)
mainwindow.cpp

index b55446b461a2f14586fcc5ce621c7146b34283f7..188ef3f7219a9fea210fbe7ac22c62f898a1e614 100644 (file)
@@ -166,10 +166,10 @@ void MainWindow::action(const QString &a){
     QStringList b=a.split(QString(" "));
     QString c=a;
     c.remove(0,4);
-    int part=a.count(QString("!@!"));
+    int part=a.count(conf->value(QString("sepcmd")).toString());
     if(part){
         for(int d=0; d<=part; d++){
-            action(a.split(QString("!@!"))[d]);
+            action(a.split(conf->value(QString("sepcmd")).toString())[d]);
         }
     }
     else if(b[0]==QString("set")){
@@ -193,7 +193,7 @@ void MainWindow::action(const QString &a){
     }
     else if(b[0]==QString("a/b")){
         bool ok;
-        QString e=QInputDialog::getItem(this, QString("choice"), QString("On vous offre un choix."), c.split(QString("!#!")), 0, 0, &ok);
+        QString e=QInputDialog::getItem(this, QString("choice"), QString("Veuillez choisir une action."), c.split(conf->value(QString("sepchc")).toString()), 0, 0, &ok);
         if(ok)action(e);
     }
     else if(b[0]==QString("back")){
@@ -218,12 +218,12 @@ void MainWindow::action(const QString &a){
         way.clear();
     }
     else if(b[0]==QString("sql")){
-        int value=c.count(QString("?"));
+        int value=c.count(conf->value(QString("sqlval")).toString());
         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);
+                QString e=QInputDialog::getText(this, "set", c+" : "+d, QLineEdit::Normal, QString(""), &ok);
                 if(ok)cmd.append(e);
                 else break;// in case of break, exec complain about cmd size
             }
@@ -371,6 +371,9 @@ void MainWindow::firstrun(){
     conf->setValue(QString("volumdown"), QVariant("back"));
     conf->setValue(QString("volumup"), QVariant("Montpellier"));
     conf->setValue(QString("askkeyword"), QVariant(1));
+    conf->setValue(QString("sepcmd"), QVariant("!@!"));
+    conf->setValue(QString("sepchc"), QVariant("!#!"));
+    conf->setValue(QString("sqlval"), QVariant("?"));
     qDebug()<<"firstrun() finished";
 }
 QString &MainWindow::get(int row, int column){
@@ -441,7 +444,7 @@ void MainWindow::getButtons(const QString &b){
     else a.remove(0, 1);
 
     qDebug()<<"getButtons("<<a<<") way.size()"<<way.size();
-    if(b[0]!='+')flush();
+    if((b[0]!='+')||(b[0]=='%'))flush();
     if(updatelocker.tryLock(60000))updatelocker.unlock();
     else{qDebug()<<"updatelocker is locked more than 1mn";}
     QString c="%"+a+"%";