From 9ed90a1ee0f9605d197f95f9234b40ad6a9b9084 Mon Sep 17 00:00:00 2001 From: deva Date: Mon, 8 Sep 2008 14:10:08 +0000 Subject: Added timeout. Fixed setValue/getValue functions. --- client/widgets/dbwidget.cc | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) (limited to 'client/widgets') 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() -- cgit v1.2.3