diff options
author | deva <deva> | 2008-09-08 14:10:08 +0000 |
---|---|---|
committer | deva <deva> | 2008-09-08 14:10:08 +0000 |
commit | 9ed90a1ee0f9605d197f95f9234b40ad6a9b9084 (patch) | |
tree | 289a4466a419f7fa3bccc4546ad103e429762457 /client/widgets/dbwidget.cc | |
parent | f85025ffc6dca58e87b2cb2cc3522a987b519ad8 (diff) |
Added timeout. Fixed setValue/getValue functions.
Diffstat (limited to 'client/widgets/dbwidget.cc')
-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() |