From f9a0092b2b294ad56da17a8e1194a77025a1ddef Mon Sep 17 00:00:00 2001 From: Norbert Moutarde Date: Sat, 22 Nov 2014 14:21:22 +0100 Subject: [PATCH] I've added "multiline" and "onlylast" switch --- mainwindow.cpp | 43 +++++++++++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index e1f36e8..6624435 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -396,10 +396,10 @@ void MainWindow::action(const QString &a){ } } else if(b[0]==QString("wri")){ - QFile tmp(conf->value(QString("file")).toString()); + QFile tmp(c); tmp.open(QIODevice::WriteOnly); QTextStream stream(&tmp); - stream<downloadedData(); tmp.close(); } @@ -574,6 +574,8 @@ void MainWindow::firstrun(){ conf->setValue(QString("sqlval"), QVariant("?")); conf->setValue(QString("always"), QVariant("+always")); conf->setValue(QString("currenttype"), QVariant("buttons")); + conf->setValue(QString("multiline"), QVariant(0)); + qDebug()<<"firstrun() finished"; } QString MainWindow::get(int column){ @@ -615,16 +617,22 @@ int MainWindow::exec2(const QList & a){ void MainWindow::entry(const QString &a){ QString label, time=QDateTime::currentDateTime().toString(QString("yyyy-MM-dd hh:mm:ss")), entry, context; bool ok=0; - for(int b=0; b"); - } + //if(!conf->value(QString("onlylast")).toBool()){ + for(int b=0; bvalue(QString("onlylast")).toBool()))label=context+" : "; + else if((a=="")&&(conf->value(QString("onlylast")).toBool()))label=way.last()+" : "; + else if((a!="")&&(!conf->value(QString("onlylast")).toBool()))label=context+", "+ a +" : "; + else label=way.last()+", "+a+" : "; + if(conf->value(QString("multiline")).toBool())entry=QInputDialog::getMultiLineText(this, trUtf8("New entry"), label, QString(""), &ok); + else entry=QInputDialog::getText(this, trUtf8("New entry"), label, QLineEdit::Normal, "", &ok); + if(!ok)return; QString c; if(a=="")c=context+" : "+entry; @@ -705,12 +713,19 @@ void MainWindow::editDB(const QString & a, const QString & b){ QString keyword=q->value(1).toString(); QString label=q->value(2).toString(); QString action=q->value(3).toString(); - const QString tmpkeyword=QInputDialog::getText(this, trUtf8("keyword", "Title of box where ask for button's keyword"), trUtf8("new keyword", "question to get new button's keyword"), QLineEdit::Normal, keyword, &ok); + QString tmpkeyword, tmplabel, tmpaction; + if(conf->value(QString("multiline")).toBool())tmpkeyword=QInputDialog::getMultiLineText(this, trUtf8("keyword", "Title of box where ask for button's keyword"), trUtf8("new keyword", "question to get new button's keyword"), keyword, &ok); + else tmpkeyword=QInputDialog::getText(this, trUtf8("keyword", "Title of box where ask for button's keyword"), trUtf8("new keyword", "question to get new button's keyword"), QLineEdit::Normal, keyword, &ok); if(!ok)return; - const QString tmplabel=QInputDialog::getText(this, trUtf8("label", "Title of box where ask for button's label"), trUtf8("new label", "question to get new button's label"), QLineEdit::Normal, label, &ok); + + if(conf->value(QString("multiline")).toBool())tmplabel=QInputDialog::getMultiLineText(this, trUtf8("label", "Title of box where ask for button's label"), trUtf8("new label", "question to get new button's label"), label, &ok); + else tmplabel=QInputDialog::getText(this, trUtf8("label", "Title of box where ask for button's label"), trUtf8("new label", "question to get new button's label"), QLineEdit::Normal, label, &ok); if(!ok)return; - const QString tmpaction=QInputDialog::getText(this, trUtf8("action", "Title of box where ask for button's action"), trUtf8("new action", "question to get new button's action"), QLineEdit::Normal, action, &ok); + + if(conf->value(QString("multiline")).toBool())const QString tmpaction=QInputDialog::getMultiLineText(this, trUtf8("action", "Title of box where ask for button's action"), trUtf8("new action", "question to get new button's action"), action, &ok); + else tmpaction=QInputDialog::getText(this, trUtf8("action", "Title of box where ask for button's action"), trUtf8("new action", "question to get new button's action"), QLineEdit::Normal, action, &ok); if(!ok)return; + if((tmpkeyword=="")||(tmplabel=="")||(tmpaction=="")){ remove(a, keyword, label, action); return; -- 2.45.1