From ed364ce86bf2ad133a2f8ae91e2883ab2c009273 Mon Sep 17 00:00:00 2001 From: Norbert Moutarde Date: Fri, 24 Oct 2014 16:22:42 +0200 Subject: [PATCH] I've added the ability to launch a command by clicking on button (output is loose at the moment) --- mainwindow.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index 01b6923..3b13e1f 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -227,10 +227,9 @@ void MainWindow::action(const QString &a){ else if(b[0]==QString("new")){ entry(c); } - else if(b[0]==QString("a/b")){ - bool ok; - QString e=QInputDialog::getItem(this, trUtf8("choice", "title of box who ask multiple choice"), trUtf8("Please choose an action.", "text to ask multiple choice"), c.split(conf->value(QString("sepchc")).toString()), 0, 0, &ok); - if(ok)action(e); + else if(b[0]==QString("cmd")){ + system(c.toStdString().c_str()); + } else if(b[0]==QString("sav")){ sav(c); @@ -701,7 +700,7 @@ void MainWindow::writeData(){ conf->setValue(QString("lastdownload"), QDateTime::currentDateTime().toString(Qt::ISODate)); } void MainWindow::sendRAW(){ - //sav(QString("raw")) + //sav(QString("raw")), it's the new way to "sendRAW" exec(QList ({conf->value(QString("selectraw")).toString()})); QFile a(conf->value(QString("fileraw")).toString()); a.open(QIODevice::WriteOnly/*|QIODevice::Text*/); @@ -826,17 +825,17 @@ void MainWindow::writeDB(){ system("su"); disconnect(m, SIGNAL(downloaded())); QFile a(conf->value(QString("db")).toString()); - a.open(QIODevice::WriteOnly | QIODevice::Text); + a.open(QIODevice::WriteOnly); QDataStream b(&a); b<downloadedData(); system("exit"); } -void MainWindow::download(const QString & a){ +void MainWindow::download(const QString & a){//keep downloaded data into m->downloadedData(). You've to connect(m, SIGNAL(downloaded()), target,SLOT(targetFunc())); qDebug()<<"download() : "<