]> git.nothing2do.fr Git - diary-mobile.git/commitdiff
remove useless QFile and little tweak
authorNorbert Moutarde <norbert.moutarde@nothing2do.eu>
Wed, 21 May 2014 13:26:29 +0000 (15:26 +0200)
committerNorbert Moutarde <norbert.moutarde@nothing2do.eu>
Wed, 21 May 2014 13:26:29 +0000 (15:26 +0200)
README.md
mainwindow.cpp

index fcf7f3a128b11733ef3778b703e17e827b344979..5ab6559b3e13eb18eea38caab315aa55e7572b1a 100644 (file)
--- a/README.md
+++ b/README.md
@@ -1,15 +1,15 @@
-diary-mobile-android
+diary-mobile
 ====================
 
 a GUI to use diary-shell on android (or computer, or IOS, or symbian,
 or whatever Qt works on if you want, it's so Qt !)
 
 The first time this soft is launched, it will ask an URL to download the buttons 
-(read ui.sql to undertand what is expected).<br>
+(read ui.sql to understand what is expected).<br>
 To upload in real time, you've to set the "upload" to a ftp server where
 you've an account with syntax :
 ftp://[user]:[pass]@[hostname]/[filename]
 
 todo :
 
-add autoupdate feature, and ...
+add autoupdate feature, buttons <URL> in action, and ...
index 1fb067199c924b64cd909246520413fc187d3379..e08c37655d091bdbf70dce7b8bb7b569deeda9b8 100644 (file)
@@ -148,13 +148,13 @@ void MainWindow::quit(){
 }
 const CLabel* MainWindow::addWidget(const QString &key, const CLabel *a){
     qDebug()<<"addWidget("<<key<<")";
-    int maxc=conf->value(QString("maxcolumn")).toInt();
-    int maxl=conf->value(QString("maxline")).toInt();
     int c=grid->count();
+    int maxc=conf->value(QString("maxcolumn")).toInt();
+    /*int maxl=conf->value(QString("maxline")).toInt();
     if(c>=maxc*maxl){
         QMessageBox::information(this, QString("lourd !"), QString("il y a trop de boutons sur cette page"));
         return 0;
-    }
+    }*/
     grid->addWidget(a, c/maxc, c%maxc, 1, 1, Qt::AlignJustify| Qt::AlignVCenter | Qt::AlignHCenter);
     //QObject::connect(a, SIGNAL(pressed()), signalmap, SLOT(map()));
     QObject::connect(a, SIGNAL(released()), signalmap, SLOT(map()));
@@ -353,7 +353,7 @@ void MainWindow::firstrun(){
     conf->setValue(QString("updatebuttons"), QVariant("update ui set keyword=?, label=?, action=? where id=?;"));
     conf->setValue(QString("deletebuttons"), QVariant("delete from ui where id=?"));
     conf->setValue(QString("testbuttons"), QVariant("select id,keyword from ui where label=? and action=?;"));
-    conf->setValue(QString("volumdown"), QVariant("config"));
+    conf->setValue(QString("volumdown"), QVariant("back"));
     conf->setValue(QString("volumup"), QVariant("begin"));
     qDebug()<<"firstrun() finished";
 }
@@ -393,7 +393,7 @@ void MainWindow::entry(const QString &a){
     if(a=="")c=context+" : "+entry;
     else c=context+", "+a+" : "+entry;
     QList<QString> d({"INSERT INTO raw (date, texte) VALUES (:date, :txt);", time, c});
-    if(!exec(d))qDebug()<<"exec don't works (l370)";
+    if(!exec(d))qDebug()<<"exec don't works (entry(QString))";
     QSqlError b=q->lastError();
     if (b.isValid())qDebug()<<"q->lastError():"<<b.text();
 }
@@ -659,21 +659,17 @@ void MainWindow::download(const QString & a){
 }
 void MainWindow::savButtons(){
     exec(QList<QString> ({conf->value(QString("selectbuttons")).toString()}));
-    QFile a(conf->value(QString("buttonfile"), QVariant("ui.sql")).toString());
-    a.open(QIODevice::WriteOnly|QIODevice::Text);
-    QTextStream b(&a);
-    b<<conf->value("firstline", "INSERT INTO ui (keyword, label, action) VALUES(?, ?, ?);").toString()<<"\n";
+    QTextStream b;
+    b<<conf->value("firstline").toString()<<"\n";
     while (q->next()) {
         for (int i=0; i<2; i++){
             b<<q->value(i).toString()<<"$";
         }
         b<<q->value(2).toString()<<"\n";
     }
-    a.close();
-    qDebug()<<"a.open()="<<a.open(QIODevice::ReadOnly | QIODevice::Text);
     QUrl upload(conf->value(QString("uploadUi")).toString());
     net=new QNetworkAccessManager(this);
-    rep=net->put(QNetworkRequest(upload), a.readAll());
+    rep=net->put(QNetworkRequest(upload), b.device());
     qDebug()<<"net->put : "<<rep<< " upload : "<<upload.url();
     connect(rep, SIGNAL(finished()), this, SLOT(Uisent()));
 }