From d1138c18940be04190a51bf28cc2ad998f6c96f4 Mon Sep 17 00:00:00 2001 From: Norbert Moutarde Date: Tue, 29 Mar 2016 20:22:03 +0200 Subject: [PATCH] edit and add buttons is now a buttons (add buttons and edit buttons) --- mainwindow.cpp | 29 +++++++++++++++-------------- mainwindow.h | 2 +- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index 70f88f0..7f1477d 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -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="<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()); diff --git a/mainwindow.h b/mainwindow.h index 87941f0..d5ab20f 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -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(); -- 2.45.1