]> git.nothing2do.fr Git - diary-mobile.git/commitdiff
edit and add buttons is now a buttons (add buttons and edit buttons)
authorNorbert Moutarde <norbert.moutarde@nothing2do.eu>
Tue, 29 Mar 2016 18:22:03 +0000 (20:22 +0200)
committerNorbert Moutarde <norbert.moutarde@nothing2do.eu>
Tue, 29 Mar 2016 18:22:03 +0000 (20:22 +0200)
mainwindow.cpp
mainwindow.h

index 70f88f0af3e28f2bddde6af8512c1a7366dde7fd..7f1477d8e7aed00e9d8db26c9a5bcd5e846df97e 100644 (file)
@@ -346,6 +346,7 @@ void MainWindow::action(const QString &a){
     else if(b[0]==QString("edit")){
         //QString e;
         //bool ok;
+        action(beforekey);
         if(bs==1){
             /*e=QInputDialog::getText(this, QString("ID"), trUtf8("Enter ID of button to edit"), QLineEdit::Normal, QString(""), &ok);
             if(!ok)return;*/
@@ -509,7 +510,7 @@ void MainWindow::action(const QString &a){
        if(deb)QMessageBox::information(this, QString("val"), tmp);
     }
     else if(b[0]==QString("add")){
-        addDB(c);
+        addDB(c, beforekey);
     }
     else if (b[0]==QString("hac")){
         if (c=="")action();
@@ -747,14 +748,14 @@ void MainWindow::entry(const QString &a){
 void MainWindow::entry(){
     entry(QString(""));
 }
-void MainWindow::addDB(const QString & tmp){
-    qDebug()<<"addDB";
+void MainWindow::addDB(const QString & tmp, const QString & cur){
+    qDebug()<<"addDB : tmp="<<tmp<<" cur="<<cur;
     if(deb)QMessageBox::information(this, trUtf8("addDB", "box title to debug addDB"), "type : "+tmp);
     bool ok=0;
-    QString cur=label->text();
+    //QString cur=label->text();
     QString a, b, c=QInputDialog::getText(this, trUtf8("label", "Title of box where ask for new label"), trUtf8("Enter his label", "his/her/?they? I've forget my school lesson"), QLineEdit::Normal, QString(""), &ok);
     if ((c=="")||(ok==0))return;
-    b=QInputDialog::getText(this, trUtf8("keyword", "Title of box where ask for new keyword"), trUtf8("Enter they keyword (no limit !)"), QLineEdit::Normal, cur, &ok);
+    b=QInputDialog::getText(this, trUtf8("keyword", "Title of box where ask for new keyword"), trUtf8("Enter they keyword (no limit !)"), QLineEdit::Normal, *&cur, &ok);
     if ((b=="")||(ok==0))return;
     a=QInputDialog::getText(this, trUtf8("action", "Title of box where ask for new action"), trUtf8("Enter his action"), QLineEdit::Normal, QString("new idem"), &ok);
     if ((a=="")||(ok==0))return;
@@ -899,38 +900,38 @@ void MainWindow::keyReleaseEvent(QKeyEvent *event)
         const QString a=conf->value(QString("actionmenu")).toString();
         if(a!="")accepted=true;
         if(a!=lastprint){
-            beforeactionmenu=lastprint;
+            beforekey=lastprint;
             action(a);
         }else{
-            action(beforeactionmenu);
+            action(beforekey);
         };
     }else if(k==Qt::Key_Back){
         const QString a=conf->value(QString("menuback"), QString("")).toString();
         if(a!="")accepted=true;
         if(a!=lastprint){
-            beforekeyback=lastprint;
+            beforekey=lastprint;
             action(a);
         }else{
-            action(beforekeyback);
+            action(beforekey);
         };
     }else if(k==Qt::Key_VolumeDown){
         qDebug()<<"keyvolumdown";
         const QString a=conf->value(QString("volumdown")).toString();
         if(a!="")accepted=true;
         if(a!=lastprint){
-            beforevolumedown=lastprint;
+            beforekey=lastprint;
             action(a);
         }else{
-            action(beforevolumedown);
+            action(beforekey);
         };
     }else if(k==Qt::Key_VolumeUp){
         const QString a=conf->value(QString("volumup")).toString();
         if(a!="")accepted=true;
         if(a!=lastprint){
-            beforevolumeup=lastprint;
+            beforekey=lastprint;
             action(a);
         }else{
-            action(beforevolumeup);
+            action(beforekey);
         };
     };
     event->setAccepted(accepted);
@@ -1218,7 +1219,7 @@ void MainWindow::mass(const QString & type, const QString & column, const QStrin
     get(conf->value(QString("currenttype")).toString(), lastprint);
 }
 void MainWindow::addDB(){
-    addDB(conf->value(QString("currenttype")).toString());
+    addDB(conf->value(QString("currenttype")).toString(), label->text());
 }
 void MainWindow::savData(){
     sav(conf->value(QString("currenttype")).toString());
index 87941f0f2431b976f9a41e5c5bd9f860f364e21f..d5ab20f2f29b87b7930cd2b7db55fb577e350086 100644 (file)
@@ -152,7 +152,7 @@ private slots:
     void entry(const QString &);
     void entry();
     //void createDB();
-    void addDB(const QString &);
+    void addDB(const QString &, const QString &);
     void addDB();
     void writeDB();
     void chooseDB();