if(bs==1){
d=QInputDialog::getText(this, "setInt", tr("Variable's name ?", "text to ask value's name before changing it (setint)"), QLineEdit::Normal, QString(""), &ok);
if(!ok)return;
- e=QInputDialog::getInt(this, "setInt", d, QLineEdit::Normal, conf->value(d).toInt(), &ok);
+ e=QInputDialog::getInt(this, "setInt", d, QLineEdit::Normal, conf->value(d).toInt(), *&ok);
if(!ok)return;
}else if(bs==2){
d=b[1];
int max=conf->value(QString("maxcolumn")).toInt()*conf->value(QString("maxline")).toInt();
if(!page)tmp=q->seek(0);
else tmp=q->seek(page*(max-2));
- if(deb)QMessageBox::information(this, tr("result", "box title to debug prevpage"), int(tmp));
+ //if(deb)QMessageBox::information(this, tr("result", "box title to debug prevpage"), int(tmp));
printItem(*q);
}
for(int i=0; i<way.size(); i++){
wi=way[i];
addWidget(wi, new CLabel(wi, *conf));
- addWidget(QString("rm %1").arg(i), new CLabel(QString("del"), *conf));
+ QString tmp(i);
+ addWidget(tmp, new CLabel(QString("del"), *conf));
}
}
if(b[1]==QString("list")){
flush();
for(int a=0;a<valeur->size();a++){
- addWidget(QString("box "+tmpvalues[a]+"#"), new CLabel(tmpkeys[a], *conf));
+ QString tmp("box "+tmpvalues[a]+"#");
+ addWidget(tmp, new CLabel(tmpkeys[a], *conf));
//if(deb)QMessageBox::information(this, QString("val"), QString(tmpkeys[a]+"=="+tmpvalues[a]));
}
}else if(b[1]==QString("edit")){
flush();
for(int a=0;a<valeur->size();a++){
- addWidget(QString("val "+tmpkeys[a]+"#"), new CLabel(tmpkeys[a], *conf));
+ QString tmp("val "+tmpkeys[a]+"#");
+ addWidget(tmp, new CLabel(tmpkeys[a], *conf));
//if(deb)QMessageBox::information(this, QString("val"), QString(tmpkeys[a]+"=="+tmpvalues[a]));
}
}else if(bs==2){
conf->setValue(QString("start"), QVariant("begin"));
conf->setValue(QString("restore"), QVariant("http://www.abc.de/db"));
conf->setValue(QString("db"), QVariant("/data/data/fr.nothing2do.diarymobile/files/db"));
- conf->setValue(QString("selectbuttons"), QVariant("select keyword,label,action from buttons order by id;"));
- conf->setValue(QString("sqlbuttons"), QVariant("INSERT INTO buttons (keyword,label,action) VALUES(?,?,?);"));
- conf->setValue(QString("selectraw"), QVariant("select date,texte from raw order by date;"));
+ conf->setValue(QString("selectbuttons"), QVariant("select keyword,label,action from buttons order by id"));
+ conf->setValue(QString("sqlbuttons"), QVariant("INSERT INTO buttons (keyword,label,action) VALUES(?,?,?)"));
+ conf->setValue(QString("selectraw"), QVariant("select date,texte from raw order by date"));
conf->setValue(QString("menuback"), QVariant("-menuback"));
- conf->setValue(QString("choosebuttons"), QVariant("select id,label from buttons where keyword like ? order by label;"));
+ conf->setValue(QString("choosebuttons"), QVariant("select id,label from buttons where keyword like ? order by label"));
conf->setValue(QString("addbuttons"), QVariant("insert into buttons (keyword, label, action) values (:keyword, :label, :action)"));
- conf->setValue(QString("addraw"), QVariant("INSERT INTO raw (date, texte) VALUES (:date, :txt);"));
- conf->setValue(QString("getbuttons"), QVariant("select label,action,id from buttons where keyword like ? order by label;"));
- conf->setValue(QString("editbuttons"), QVariant("select id,keyword,label,action from buttons where id=?;"));
- conf->setValue(QString("updatebuttons"), QVariant("update buttons set keyword=?, label=?, action=? where id=?;"));
+ conf->setValue(QString("addraw"), QVariant("INSERT INTO raw (date, texte) VALUES (:date, :txt)"));
+ conf->setValue(QString("getbuttons"), QVariant("select label,action,id from buttons where keyword like ? order by label"));
+ conf->setValue(QString("editbuttons"), QVariant("select id,keyword,label,action from buttons where id=?"));
+ conf->setValue(QString("updatebuttons"), QVariant("update buttons set keyword=?, label=?, action=? where id=?"));
conf->setValue(QString("deletebuttons"), QVariant("delete from buttons where id=?"));
- conf->setValue(QString("testbuttons"), QVariant("select id,keyword from buttons where label=? and action=?;"));
- conf->setValue(QString("changekeyword"), QVariant("select keyword,label,action,id from buttons where keyword like ?;"));
+ conf->setValue(QString("testbuttons"), QVariant("select id,keyword from buttons where label=? and action=?"));
+ conf->setValue(QString("changekeyword"), QVariant("select keyword,label,action,id from buttons where keyword like ?"));
conf->setValue(QString("volumdown"), QVariant("back"));
conf->setValue(QString("volumup"), QVariant("begin"));
conf->setValue(QString("askkeyword"), QVariant(0));
return qq->value(column).toString();
}
int MainWindow::exec(const QList<QString> & a){
- qDebug()<<"exec("<<a[0]<<") size="<<a.size()<<", q->prepare: "<<q->prepare(a[0]);
+ qDebug()<<"exec("<<a[0]<<") size="<<a.size()<<", q->prepare: "<<q->prepare(a.at(0));
for (int j=1; j<a.size(); j++){
- q->bindValue(j-1, a[j]);
- qDebug()<<"bind "<<j-1<<" and"<<a[j];
+ q->bindValue(j-1, a.at(j));
+ qDebug()<<"bind "<<j-1<<" and "<<a.at(j);
}
qDebug()<<"exec():"<<q->exec();
QSqlError b=q->lastError();
QString c="%"+b+"%", a="buttons";
qDebug()<<"exec()="<<exec(QList<QString>({conf->value(QString("choose"+a)).toString(), c}));
while (q->next()) {
- const QString action="edit "+q->value(0).toString();
+ QString action="edit "+q->value(0).toString();
addWidget(action, new CLabel(q->value(1).toString(), *conf));
}
}
qDebug()<<"exec()="<<exec(QList<QString>({conf->value(QString("choose"+a)).toString(), c}));
while (q->next()) {
- const QString action="edit "+q->value(0).toString();
+ QString action="edit "+q->value(0).toString();
addWidget(action, new CLabel(q->value(1).toString(), *conf));
}
}
QList<QString> b({"delete from buttons;"});
exec(b);
}
-bool MainWindow::printItem(const QSqlQuery & a){
+bool MainWindow::printItem(QSqlQuery & a){
int labCol = 0;//r.indexOf("label");
int actCol = 1;//r.indexOf("action");
int idcol = 2;//r.indexOf("id");
int i=0;
qDebug()<<"printItem()";
if(page){
- addWidget(QString("prevpage"), new CLabel(tr("Prev"), *conf));
+ QString tmp("prevpage");
+ addWidget(tmp, new CLabel(tr("Prev"), *conf));
};
+ bool t;
do{
int tmp=0;
- if(a.isValid())tmp=addWidget(a.value(actCol).toString(), new CLabel(a.value(labCol).toString(), *conf, a.value(idcol).toInt()));
+ QString tmp4=a.value(actCol).toString();
+ if(a.isValid())tmp=addWidget(tmp4, new CLabel(a.value(labCol).toString(), *conf, a.value(idcol).toInt()));
if(tmp==1){
- addWidget(QString("nextpage"), new CLabel(tr("Next"), *conf));
+ QString tmp3("nextpage");
+ addWidget(tmp3, new CLabel(tr("Next"), *conf));
return 1;
};
i++;
- }while(a.next());
+ t=a.next();
+ }while(t);
qDebug()<<"end printItem : "<<i<<" button(s) way.size()"<<way.size()<<" page : "<<page;
//showExpanded();
return 0;