else if(b[0]==QString("clear")){
way.clear();
}
+ else if(b[0]==QString("sql")){
+ exec(QList<QString> ({c}));
+ }
+
else if(b[0]==QString("edit")){
const QString a=QInputDialog::getText(this, QString("ID"), QString("Entrez l'ID du bouton à éditez"), QLineEdit::Normal, b[1]);
editButtonDB(a);
connect(m, SIGNAL(downloaded()), SLOT(writeUi()));
}
void MainWindow::writeUi(){
- q->exec("PRAGMA foreign_keys=OFF;");
- q->exec("BEGIN TRANSACTION;");
readButtons(m->downloadedData());
m->deleteLater();
conf->setValue(QString("lastdownload"), QDateTime::currentDateTime().toString(Qt::ISODate));
}
void MainWindow::readButtons(const QByteArray &in){
qDebug()<<"readButtons";
+ q->exec("PRAGMA foreign_keys=OFF;");
+ q->exec("BEGIN TRANSACTION;");
int a=in.count('\n');
QString d=in.split('\n').at(0);
conf->setValue(QString("firstline"), d);
qDebug()<<"q->exec() : "<<q->exec()<<" lastError()="<<q->lastError();
};
- db.commit();
- flush();
/*QDomDocument a("buttons");
if (!a.setContent(in)){
return;
}
QDomElement root = a.documentElement();
- QDomNode n = root.firstChildElement();
+ QDomNode n = root.firstChild();
QList<QString> cmd;
while(!n.isNull()) {
- QDomNode e = n.firstChildElement();
- if((cmd.size()<1)&&(n.isText()))e.toText().nodeValue();
- qDebug()<<"n.nodeName()="<<n.nodeName()<<" n.nodevalue="<<n.nodeValue();
+ QDomNode e = n.firstChild();
+ //if((cmd.size()<1)&&(n.isText()))e.toText().nodeValue();
+ qDebug()<<"n.nodeName()="<<n.nodeName()<<" e.nodevalue="<<qPrintable(e.nodeValue());
+ if(n.nodeName()=="sql"){
+ cmd.insert(0, e.nodeValue());
+ qDebug()<<"cmd[0]="<<cmd[0];
+ }
+ else if(n.nodeName()=="b"){
+ QDomNode f=e.firstChild();
+ while(!f.isNull()){
+ qDebug()<<"f.nodeName()="<<f.nodeName()<<" e.nodeValue()="<<qPrintable(e.nodeValue())<<" e.nodeType()="<<e.nodeType();
+ f=f.nextSibling();
+ }
+ }
while(!e.isNull()){
qDebug()<<"e.nodeName = "<<e.nodeName()<<" e.nodevalue="<<e.nodeValue();
- e.nextSiblingElement();
+
+ e=e.nextSibling();
}
- n.nextSiblingElement();
+ n=n.nextSibling();
}*/
-
+ db.commit();
+ flush();
emit datafilled();
}
void MainWindow::datasent(){