From: Norbert Moutarde Date: Tue, 7 Oct 2014 16:47:30 +0000 (+0200) Subject: replace "a" var (senseless) by type (has sense) X-Git-Url: https://git.nothing2do.fr/?a=commitdiff_plain;h=fec3b1db7576fdab5ed6c0f9ed0836c3239c1c6e;p=diary-mobile.git replace "a" var (senseless) by type (has sense) --- diff --git a/mainwindow.cpp b/mainwindow.cpp index 46a581b..df58f4e 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -42,7 +42,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { qDebug()<<"begin of MainWindows"; conf=new QSettings(QString("FwF"), QString("diary-mobile"), this); - + orientation=0; if(conf->allKeys().size()==0){ qDebug()<<"first"; firstrun(); @@ -367,7 +367,7 @@ void MainWindow::action(const QString &a){ } else if(b[0]==QString("wri")){ QFile tmp(conf->value(QString("file")).toString()); - tmp.open(QIODevice::WriteOnly|QIODevice::Text); + tmp.open(QIODevice::WriteOnly/*|QIODevice::Text*/); QTextStream stream(&tmp); stream<setValue(QString("menu"), QVariant(0)); conf->setValue(QString("download"), QVariant("http://www.nothing2do.eu/"+conf->value(QString("filebuttons")).toString())); conf->setValue(QString("init"), QVariant("http://www.nothing2do.eu/init")); - conf->setValue(QString("userftp"), QVariant("")); - conf->setValue(QString("hostftp"), QVariant("")); - conf->setValue(QString("passftp"), QVariant("")); + conf->setValue(QString("userftp"), QVariant("")); + conf->setValue(QString("hostftp"), QVariant("")); + conf->setValue(QString("passftp"), QVariant("")); conf->setValue(QString("start"), QVariant("begin")); conf->setValue(QString("restore"), QVariant("http://www.abc.de/db")); conf->setValue(QString("db"), QVariant("/data/data/eu.nothing2do.diarymobile/files/db")); @@ -598,11 +598,6 @@ void MainWindow::entry(const QString &a){ void MainWindow::entry(){ entry(QString("")); } -/*void MainWindow::createDB(){ - qDebug()<<"createDB()"; - exec(QList({"create table ui(id INTEGER PRIMARY KEY AUTOINCREMENT, keyword text, label text, action text);"})); - exec(QList({"create table raw(id INTEGER PRIMARY KEY AUTOINCREMENT, date timestamp, texte text);"})); -}*/ void MainWindow::addDB(const QString & tmp){ if(deb)QMessageBox::information(this, trUtf8("addDB", "box title to debug addDB"), "type : "+tmp); bool ok=0; @@ -706,7 +701,7 @@ void MainWindow::sendRAW(){ //sav(QString("raw")) exec(QList ({conf->value(QString("selectraw")).toString()})); QFile a(conf->value(QString("fileraw")).toString()); - a.open(QIODevice::WriteOnly|QIODevice::Text); + a.open(QIODevice::WriteOnly/*|QIODevice::Text*/); QTextStream b(&a); //int c=conf->value(QString("columnraw")).toInt()-1; int c=q->record().count()-1; @@ -850,7 +845,7 @@ void MainWindow::sav(const QString & a){ exec(QList ({conf->value(QString("select")+a).toString()})); QString tmp="file"+a; QFile b(conf->value(tmp).toString()); - b.open(QIODevice::WriteOnly|QIODevice::Text); + b.open(QIODevice::WriteOnly/*|QIODevice::Text*/); QTextStream c(&b); //int d=conf->value(QString("column")+a).toInt()-1; int d=q->record().count()-1; @@ -864,7 +859,7 @@ void MainWindow::sav(const QString & a){ b.close(); 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")+a).toString()); net=new QNetworkAccessManager(this); - b.open(QIODevice::ReadOnly | QIODevice::Text); + b.open(QIODevice::ReadOnly /*| QIODevice::Text*/); rep=net->put(QNetworkRequest(upload), b.readAll()); qDebug()<<"net->put : "< tmp; - tmp.append(conf->value(QString("test")+a).toString()); + tmp.append(conf->value(QString("test")+type).toString()); tmp.append(label); tmp.append(action); exec(tmp); @@ -896,14 +891,14 @@ void MainWindow::insert(const QString & a, const QString & keyword, const QStrin } if(!key.contains(keyword))key=key+" "+keyword;// it is possible to have 2 buttons with same label and action ? I've sayd "no" if(deb)QMessageBox::information(this, trUtf8("action", "box title to debug insert"), trUtf8("insert : key="+key.toLocal8Bit()+" label="+label.toLocal8Bit()+" action="+action.toLocal8Bit(), "label to debug insert")); - if(!id.isValid())exec(QList({conf->value(QString("add")+a).toString(), key, label, action})); - else{exec(QList({conf->value(QString("update")+a).toString(), key, label, action, id.toString()})); + if(!id.isValid())exec(QList({conf->value(QString("add")+type).toString(), key, label, action})); + else{exec(QList({conf->value(QString("update")+type).toString(), key, label, action, id.toString()})); }; } -void MainWindow::remove(const QString & a, const QString & keyword, const QString & label, const QString & action){ +void MainWindow::remove(const QString & type, const QString & keyword, const QString & label, const QString & action){ QList tmp; - tmp.append(conf->value(QString("test")+a).toString()); + tmp.append(conf->value(QString("test")+type).toString()); tmp.append(label); tmp.append(action); qDebug()<<"tmp.size()="<({conf->value(QString("delete")+a).toString(), id.toString()})); + if(key==QString(" ").repeated(key.size()))exec(QList({conf->value(QString("delete")+type).toString(), id.toString()})); else{ - exec(QList({conf->value(QString("update")+a).toString(), key, label, action, id.toString()})); + exec(QList({conf->value(QString("update")+type).toString(), key, label, action, id.toString()})); } } void MainWindow::writeTr(){