]> git.nothing2do.fr Git - diary-mobile.git/commitdiff
I've added the ability to launch a command by clicking on button (output
authorNorbert Moutarde <norbert.moutarde@nothing2do.eu>
Fri, 24 Oct 2014 14:22:42 +0000 (16:22 +0200)
committerNorbert Moutarde <norbert.moutarde@nothing2do.eu>
Fri, 24 Oct 2014 14:22:42 +0000 (16:22 +0200)
is loose at the moment)

mainwindow.cpp

index 01b69232ef30cb3bc9b3c6644013fe68bc58451a..3b13e1f807a8a26659fc9cfcae1ed4364967fe3f 100644 (file)
@@ -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<QString> ({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<<m->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() : "<<a;
     QUrl url(a);
     m = new FileDownloader(url, this);
 }
-void MainWindow::download(const QString & a, const QString & b){
+void MainWindow::download(const QString & a, const QString & b){//write downloaded data into "b"
     qDebug()<<"download("<<a<<") in "<<b;
     d.lock();
     QUrl url(a);