]> git.nothing2do.fr Git - diary-mobile.git/commitdiff
replace "a" var (senseless) by type (has sense)
authorNorbert Moutarde <norbert.moutarde@nothing2do.eu>
Tue, 7 Oct 2014 16:47:30 +0000 (18:47 +0200)
committerNorbert Moutarde <norbert.moutarde@nothing2do.eu>
Tue, 7 Oct 2014 16:47:30 +0000 (18:47 +0200)
mainwindow.cpp

index 46a581bb9c0da2980540c532c3ae8f4cacc8882f..df58f4e4591e191ba8ddc365a539d09c7a0b22c7 100644 (file)
@@ -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<<c;
         tmp.close();
@@ -506,9 +506,9 @@ void MainWindow::firstrun(){
     conf->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("<user>"));
-    conf->setValue(QString("hostftp"), QVariant("<host>"));
-    conf->setValue(QString("passftp"), QVariant("<pass>"));
+    conf->setValue(QString("userftp"), QVariant("<userftp>"));
+    conf->setValue(QString("hostftp"), QVariant("<hostftp>"));
+    conf->setValue(QString("passftp"), QVariant("<passftp>"));
     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<QString>({"create table ui(id INTEGER PRIMARY KEY AUTOINCREMENT, keyword text, label text, action text);"}));
-    exec(QList<QString>({"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<QString> ({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<QString> ({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 : "<<rep<< " upload : "<<upload.url();
     connect(rep, SIGNAL(finished()), this, SLOT(Uisent()));
@@ -880,9 +875,9 @@ void MainWindow::get(const QString & a){
     const QString b=QInputDialog::getText(this, trUtf8("get", "title to ask keyword fot get"), trUtf8("Enter the keyword : ", "ask keyword to get buttons"));
     get(a, b);
 }
-void MainWindow::insert(const QString & a, const QString & keyword, const QString & label, const QString & action){
+void MainWindow::insert(const QString & type, const QString & keyword, const QString & label, const QString & action){
     QList<QString> 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<QString>({conf->value(QString("add")+a).toString(), key, label, action}));
-    else{exec(QList<QString>({conf->value(QString("update")+a).toString(), key, label, action, id.toString()}));
+    if(!id.isValid())exec(QList<QString>({conf->value(QString("add")+type).toString(), key, label, action}));
+    else{exec(QList<QString>({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<QString> 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()="<<tmp.size()<<" tmp[0]="<<tmp[0];
@@ -921,9 +916,9 @@ void MainWindow::remove(const QString & a, const QString & keyword, const QStrin
     //key.replace(keyword, QString(""));
     key.remove(keyword);
     if(deb)QMessageBox::information(this, trUtf8("key", "box title to debug remove"), QString("remove : id="+id.toString()+" key="+key+" label="+label+" action="+action));
-    if(key==QString(" ").repeated(key.size()))exec(QList<QString>({conf->value(QString("delete")+a).toString(), id.toString()}));
+    if(key==QString(" ").repeated(key.size()))exec(QList<QString>({conf->value(QString("delete")+type).toString(), id.toString()}));
     else{
-        exec(QList<QString>({conf->value(QString("update")+a).toString(), key, label, action, id.toString()}));
+        exec(QList<QString>({conf->value(QString("update")+type).toString(), key, label, action, id.toString()}));
     }
 }
 void MainWindow::writeTr(){