diff options
-rw-r--r-- | client/widgets/dbwidget.cc | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/client/widgets/dbwidget.cc b/client/widgets/dbwidget.cc index 1c0a0d2..1a68d2a 100644 --- a/client/widgets/dbwidget.cc +++ b/client/widgets/dbwidget.cc @@ -64,6 +64,7 @@ DBWidget::DBWidget(QDomNode &node, MacroWindow *macrowindow) db.setDatabaseName(elem.attribute("database")); db.setUserName(elem.attribute("user")); if(elem.hasAttribute("password")) db.setPassword(elem.attribute("password")); + db.setConnectOptions("connect_timeout=2000"); bool ok = db.open(); if(!ok) { printf("DB connect failed!\n"); @@ -102,26 +103,14 @@ QString DBWidget::getValue() { QString value; - int idx = currentIndex(); - - if(idx != -1 && itemText(idx) == currentText()) value = itemData(idx).toString(); - else value = currentText(); + value = currentText(); return value; } -/* -void DBWidget::focusInEvent(QFocusEvent *) -{ - if(currentText() == "Skriv noget i søgefeltet.") { - setEditText(""); - } -} -*/ + void DBWidget::setValue(QString value) { - int idx = findData(value); - - if(idx != -1) setCurrentIndex(idx); + setEditText(value); } bool DBWidget::isValid() |