else if(b[0]==QString("start")){
getButtons(conf->value(QString("start")).toString());
}
- else if(b[0]=="new"){
+ else if(b[0]==QString("new")){
entry(c);
}
else if(b[0]==QString("a/b")){
QString e=QInputDialog::getItem(this, QString("choice"), QString("On vous offre un choix."), c.split(QString("!q!")), 0, 1, &ok);
if(ok)action(e);
}
- else if(b[0]=="back"){
+ else if(b[0]==QString("back")){
if(way.size()>=2){
way.removeLast();
getButtons(way.takeLast());
}
}
- else if(b[0]=="run"){
+ else if(b[0]==QString("run")){
for(int d=0; d<=a.count(QString("!q!")); d++){
action(c.split(QString("!q!"))[d]);
}
}
- else if(b[0]=="setfile"){
+ else if(b[0]==QString("setfile")){
bool ok;
QString e=QFileDialog::getSaveFileName(this, QString("get file"), conf->value(b[1]).toString());
if(ok)conf->setValue(b[1], e);
QMessageBox::information(this, QString("box"), c);
}
- else if(b[0]=="quit"){
+ else if(b[0]==QString("quit")){
quit();
}
else if(b[0]==QString("clear")){
else editButtonDB(b[1]);
}
+ else if(b[0]==QString("buttons")){
+ download(b[1]);
+ connect(m, SIGNAL(downloaded()), SLOT(writeUi()));
+ }
else getButtons(a);
}
void MainWindow::createMenuBar(){
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=?"));
+ conf->setValue(QString("deletebutton"), QVariant("delete from ui where id=?"));
conf->setValue(QString("testbuttons"), QVariant("select id,keyword from ui where label=? and action=?;"));
conf->setValue(QString("volumdown"), QVariant("back"));
conf->setValue(QString("volumup"), QVariant("begin"));
const QString action=QInputDialog::getText(this, "action", "new action", QLineEdit::Normal, q->value(3).toString(), &ok);
if(!ok)return;
if((keyword=="")||(label=="")||(action=="")){
- exec(QList<QString>({conf->value(QString("deletebuttons")).toString(), a}));
+ //exec(QList<QString>({conf->value(QString("deletebuttons")).toString(), a}));
+ removebutton(keyword, label, action);
return;
}
exec(QList<QString>({conf->value(QString("updatebuttons")).toString(), keyword, label, action, a}));
}
}
+void MainWindow::removebutton(const QString & keyword, const QString &label, const QString &action){
+ QList<QString> tmp;
+ tmp.append(conf->value(QString("testbuttons")).toString());
+ tmp.append(label);
+ tmp.append(action);
+ exec(tmp);
+ q->first();
+ int count=0;
+ QString key=keyword, id=q->value(0).toString(), cur;
+ while(q->isValid()){
+ count++;
+ cur=q->value(1).toString();
+ if(cur!=keyword)key=key+" "+cur;
+ q->next();
+ }
+ if(count==1)exec(QList<QString>({conf->value(QString("deletebutton")).toString(), id}));
+ else{exec(QList<QString>({conf->value(QString("updatebuttons")).toString(), key, label, action, id}));
+
+ }
+}