diff options
Diffstat (limited to 'client/widgets/dbwidget.cc')
-rw-r--r-- | client/widgets/dbwidget.cc | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/client/widgets/dbwidget.cc b/client/widgets/dbwidget.cc index 9ec0c0d..31a6a42 100644 --- a/client/widgets/dbwidget.cc +++ b/client/widgets/dbwidget.cc @@ -78,7 +78,7 @@ DBWidget::DBWidget(QDomNode &node, MacroWindow *macrowindow) setEditable(true); // Make empty default selection. - addItem("Skriv noget i søgefeltet."); + addItem(tr("Write something in the searchfield")); setCurrentIndex(-1); QStringListModel *strlst = new QStringListModel(); @@ -123,9 +123,15 @@ void DBWidget::setValue(QString value, QString source) bool DBWidget::isValid() { + + return currentText() != tr("Write something in the searchfield") + && findText(currentText()) != -1; + + /* QSqlQuery query = db.exec("SELECT " + select + " FROM " + from + " WHERE LOWER(" + where + ") = '" + currentText().toLower() + "';"); return query.size() != 0; + */ } void DBWidget::changed() @@ -147,14 +153,13 @@ void DBWidget::changed() void DBWidget::update_list(QString prefix) { - /* if(prefix == "") { clear(); - addItem("Skriv noget i søgefeltet."); + addItem(tr("Write something in the searchfield")); setCurrentIndex(-1); return; } - */ + QSqlQuery query = db.exec("SELECT " + select + " FROM " + from + " WHERE LOWER(" + where + ") LIKE '" + prefix.toLower() + "%';"); QStringList lst; |