if((conf->value(QString("first")).toInt()==1)){
qDebug()<<"second";
+ QString ser=QInputDialog::getText(this, "fichier initial", "Entrez l'adresse du serveur où télécharger les premier boutons", QLineEdit::Normal, conf->value(QString("download")).toString());
+ if(ser!="")conf->setValue(QString("download"), ser);
createDB();
downloadUi();
conf->setValue(QString("first"), 2);
FileMenu->addAction(trUtf8("sendRAW"), this, SLOT(sendRAW()),QKeySequence(trUtf8("Ctrl+L", "File|Upload")));
//FileMenu->addAction(trUtf8("Rest&ore"), this, SLOT(restoreDB()),QKeySequence(trUtf8("Ctrl+O", "File|Restore")));
FileMenu->addAction(trUtf8("Reset Ui"), this, SLOT(resetUi()), QKeySequence(trUtf8("Ctrl+Z", "File|ResetUi")));
+ FileMenu->addAction(trUtf8("Reset RAW"), this, SLOT(resetRAW()));
FileMenu->addAction(trUtf8("&Quit..."), this, SLOT(quit()),QKeySequence(trUtf8("Ctrl+Q", "File|Quit")));
menuBar()->addMenu(FileMenu);
EditMenu=new QMenu(QString("&Buttons"));
}
void MainWindow::downloadUi(){
qDebug()<<"updateUi() : "<<conf->value(QString("download"), QVariant("https://raw.github.com/Nothing2Do/diary-mobile-android/master/ui.sql")).toString();
- download(conf->value(QString("download"), QVariant("https://raw.github.com/Nothing2Do/diary-mobile-android/master/ui.sql")).toString());
+ download(conf->value(QString("download")).toString());
connect(m, SIGNAL(downloaded()), SLOT(writeUi()));
}
void MainWindow::writeUi(){
QMessageBox::information(this, "RAWsent", "sendRAW finish");
}
void MainWindow::back(){
+ flush();
if(way.size()-1>0){
- flush();
for(int i=0; i<way.size(); i++){
- addWidget(QString(way[i]), new CLabel(QString(way[i])));
+ addWidget(QString(way[i]), new CLabel(QString(way[i]), conf->value(QString("button")).toString()));
}
}
else {
- flush();
getButtons(conf->value(QString("start")).toString());
//QMessageBox::information(this, QString("Erreur"), QString("Vous êtes déja au départ."));
}
void MainWindow::keyReleaseEvent(QKeyEvent *event)
{
static bool accepted=true;
+ if(accepted==false)quit();
event->setAccepted(accepted); // don't close my Top Level Widget !
int k=event->key();
qDebug()<<"key pressed="<<k;
void MainWindow::writeDB(){
system("su");
disconnect(m, SIGNAL(downloaded()));
- QFile a(conf->value(QString("db"), QVariant("/data/data/eu.nothing2do.diarymobile/files/db")).toString());
+ QFile a(conf->value(QString("db")).toString());
a.open(QIODevice::WriteOnly | QIODevice::Text);
QDataStream b(&a);
b<<m->downloadedData();
}
void MainWindow::Uisent(){
qDebug()<<"Uisend";
- //QString texte="savbuttons finish";
- //texte=texte+conf->value(QString("uploadUi")).toString();
QMessageBox::information(this, "Uisent", "savbuttons finish");
}
+void MainWindow::resetRAW(){
+ exec(QList<QString>({"delete from raw;"}));
+}