conf->setValue(QString("selectbuttons"), QVariant("select keyword,label,action from ui order by keyword;"));
conf->setValue(QString("selectraw"), QVariant("select date,texte from raw;"));
conf->setValue(QString("menuback"), QVariant("-menuback"));
+ conf->setValue(QString("choosebuttons"), QVariant("select id,label from ui where keyword like ? order by id;"));
+ conf->setValue(QString("addbuttons"), QVariant("insert into ui (label, keyword, action) values (:label, :keyword, :action)"));
+ conf->setValue(QString("getbuttons"), QVariant("select label,action from ui where keyword like ? order by label;"));
+ conf->setValue(QString("editbuttons"), QVariant("select id,keyword,label,action from ui where id=?;"));
+ conf->setValue(QString("updatebuttons"), QVariant("update ui set keyword=?, label=?, action=? where id=?;"));
+ conf->setValue(QString("deletebuttons"), QVariant("delete from ui where id=?"));
}
QString &MainWindow::get(int row, int column){
q->seek(row);
//QMutexLocker locker(&addblock);
QList<QString> cmd;
bool ok=0;
- cmd.append("insert into ui (label, keyword, action) values (:label, :keyword, :action)");
+ cmd.append(conf->value(QString("addbuttons")).toString());
QString cur=way.last();
QString a, b, c=QInputDialog::getText(this, QString("label"), QString("Entrez son label"),QLineEdit::Normal, QString(""), &ok);
if ((c=="")||(ok==0))return;
if(updatelocker.tryLock(60000))updatelocker.unlock();
else{qDebug()<<"updatelocker is locked more than 1mn";}
QString c="%"+a+"%";
- QList<QString> tmp({"select label,action from ui where keyword like ? order by id;", c});
+ QList<QString> tmp({conf->value(QString("getbuttons")).toString(), c});
label->setText(a);
exec(tmp);
int labCol = 0;//r.indexOf("label");
void MainWindow::chooseButtonDB(const QString & a){
flush();
QString b="%"+a+"%";
- qDebug()<<"exec()="<<exec(QList<QString>({"select id,label from ui where keyword like ? order by id;", b}));
+ qDebug()<<"exec()="<<exec(QList<QString>({conf->value(QString("choosebuttons")).toString(), b}));
while (q->next()) {
const QString action="edit "+q->value(0).toString();
addWidget(action, new CLabel(q->value(1).toString(), conf->value(QString("button")).toString()));
}
}
void MainWindow::editButtonDB(const QString & a){
- exec(QList<QString>({"select id,keyword,label,action from ui where id=?;", a}));
+ exec(QList<QString>({conf->value(QString("editbuttons")).toString(), a}));
q->next();
const QString keyword=QInputDialog::getText(this, "keyword", "new keyword", QLineEdit::Normal, q->value(1).toString());
const QString label=QInputDialog::getText(this, "label", "new label", QLineEdit::Normal, q->value(2).toString());
const QString action=QInputDialog::getText(this, "action", "new action", QLineEdit::Normal, q->value(3).toString());
if((keyword=="")||(label=="")||(action=="")){
- exec(QList<QString>({"delete from ui where id=?", a}));
+ exec(QList<QString>({conf->value(QString("deletebuttons")).toString(), a}));
return;
}
- exec(QList<QString>({"update ui set keyword=?, label=?, action=? where id=?;", keyword, label, action, a}));
+ exec(QList<QString>({conf->value(QString("updatebuttons")).toString(), keyword, label, action, a}));
}
void MainWindow::downloadUi(){