summaryrefslogtreecommitdiff
path: root/client/widgets/dbwidget.cc
diff options
context:
space:
mode:
authordeva <deva>2009-03-19 12:46:24 +0000
committerdeva <deva>2009-03-19 12:46:24 +0000
commit2cab37c3bfffc6a17fbae61a2b4599fa533d2775 (patch)
tree674fb5a98fe45ab634f54718938eadd85d6eff14 /client/widgets/dbwidget.cc
parent2808e7950a35935aa04abffa44e0340d58d6a8df (diff)
Optmized number of queries in dbwidget.
Diffstat (limited to 'client/widgets/dbwidget.cc')
-rw-r--r--client/widgets/dbwidget.cc13
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;