From: Norbert Moutarde Date: Tue, 10 Jun 2014 06:22:06 +0000 (+0200) Subject: I've added send(QString) to remplace savbuttons and sendRAW X-Git-Url: https://git.nothing2do.fr/?a=commitdiff_plain;h=072aa1c504b755738dae628e54cfb28728b564b6;p=diary-mobile.git I've added send(QString) to remplace savbuttons and sendRAW --- diff --git a/mainwindow.cpp b/mainwindow.cpp index 60708df..d854af3 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -197,7 +197,7 @@ void MainWindow::action(const QString &a){ if(!ok)return; }else if(bs==2){ d=b[1]; - e=QInputDialog::getInt(this, "setInt", b[1] , conf->value(QString(d)).toInt(), 0, 100, 1, &ok); + e=QInputDialog::getInt(this, "setInt", b[1] , conf->value(QString(d)).toInt(), -100, 100, 1, &ok); if(!ok)return; }else if(bs==3){ d=b[1]; @@ -221,6 +221,9 @@ void MainWindow::action(const QString &a){ 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("send")){ + if(bs==2)send(b[1]); + } else if(b[0]==QString("back")){ if(way.size()>=2){ way.removeLast(); @@ -616,6 +619,7 @@ void MainWindow::writeData(){ conf->setValue(QString("lastdownload"), QDateTime::currentDateTime().toString(Qt::ISODate)); } void MainWindow::sendRAW(){ + //send(QString("raw")) exec(QList ({conf->value(QString("selectraw")).toString()})); QFile a(conf->value(QString("rawfile")).toString()); a.open(QIODevice::WriteOnly|QIODevice::Text); @@ -630,7 +634,7 @@ void MainWindow::sendRAW(){ a.close(); qDebug()<<"a.open()="<value(QString("uploadRAW")).toString()); - QUrl upload(QString("ftp://")+conf->value(QString("userftp")).toString()+QString(":")+conf->value(QString("passftp")).toString()+QString("@")+conf->value(QString("hostftp")).toString()+QString("/")+conf->value(QString("file")).toString()); + QUrl upload(QString("ftp://")+conf->value(QString("userftp")).toString()+QString(":")+conf->value(QString("passftp")).toString()+QString("@")+conf->value(QString("hostftp")).toString()+QString("/")+conf->value(QString("rawfile")).toString()); net=new QNetworkAccessManager(this); //a.open(QIODevice::ReadOnly | QIODevice::Text); rep=net->put(QNetworkRequest(upload), a.readAll()); @@ -834,10 +838,10 @@ void MainWindow::removeButton(const QString & keyword, const QString & label, co void MainWindow::writeTr(){ QString a="diary-mobile_" + QLocale::system().name()+".qm"; qDebug()<<"writeTr->a="<downloadedData()); - file.close(); + QFile tmp(a); + tmp.open(QIODevice::WriteOnly); + tmp.write(m->downloadedData()); + tmp.close(); } void MainWindow::writeFile(){ QFile tmp(file); @@ -891,7 +895,7 @@ void MainWindow::resizeEvent(QResizeEvent *event) } void MainWindow::tmpdown(){ bool ok; - QString url=QInputDialog::getText(this, trUtf8("tmp URL", "Title of box where ask for button tmp's URL"), trUtf8("Enter URL", "Label of box where ask for button tmp's URL"), QLineEdit::Normal, QString(""), &ok), tmp="tmp"; + QString url=QInputDialog::getText(this, trUtf8("tmp URL", "Title of box where ask for button file's URL"), trUtf8("Enter URL", "Label of box where ask for button file's URL"), QLineEdit::Normal, QString(""), &ok), file="file"; download(url); connect(m, SIGNAL(downloaded()), this, SLOT(readData())); @@ -900,3 +904,29 @@ void MainWindow::readData(){ readData(m->downloadedData()); m->disconnect(m, SIGNAL(downloaded()),this, SLOT(readData())); } +void MainWindows::send(const QString & a){ + QString t="select"+a; + exec(QList ({conf->value(t).toString()})); + t=a+"file"; + QFile tmp(conf->value(t).toString()); + tmp.open(QIODevice::WriteOnly|QIODevice::Text); + QTextStream b(&tmp); + t="column"+a; + int c=conf->value(t).toInt()-1; + + while (q->next()) { + for (int i=0; ivalue(i).toString()<<" "; + } + b<value(1).toString()<<"\n"; + } + tmp.close(); + qDebug()<<"a.open()="<value(QString("uploadRAW")).toString()); + QUrl upload(QString("ftp://")+conf->value(QString("userftp")).toString()+QString(":")+conf->value(QString("passftp")).toString()+QString("@")+conf->value(QString("hostftp")).toString()+QString("/")+conf->value(t).toString()); + net=new QNetworkAccessManager(this); + //a.open(QIODevice::ReadOnly | QIODevice::Text); + rep=net->put(QNetworkRequest(upload), tmp.readAll()); + qDebug()<<"net->put : "<