summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authordeva <deva>2008-09-04 12:25:09 +0000
committerdeva <deva>2008-09-04 12:25:09 +0000
commit26dc58fb696ac1f96e018fbae7083d1ba2a1a55a (patch)
tree8fd6e55c2428c883d023677134b7a6e558246546 /client
parent4dd7add65ed2648e7c139df3138e489f8dbd8e43 (diff)
Made macrowindow clean up proprely when closed (thus terminating dangling db connections through dbwidget).
Diffstat (limited to 'client')
-rw-r--r--client/formatparser.cc15
-rw-r--r--client/macrowindow.cc17
-rw-r--r--client/widgets/dbwidget.cc1
3 files changed, 22 insertions, 11 deletions
diff --git a/client/formatparser.cc b/client/formatparser.cc
index 233a694..0f04d0a 100644
--- a/client/formatparser.cc
+++ b/client/formatparser.cc
@@ -127,17 +127,12 @@ QString format_parser(QString format, QSqlQuery &query)
p++;
}
{
- int fieldNo = query.record().indexOf(var);
- resume += query.value(fieldNo).toString();
-
- /*
- QVector< Widget* >::iterator i = widgets.begin();
- while (i != widgets.end()) {
- Widget* w = *i;
- if(w->getName() == var) resume += w->getValue();
- i++;
+ int idx = query.record().indexOf(var);
+ if(idx == -1) {
+ printf("Unknown field in format string %s\n", var.toStdString().c_str());
+ } else {
+ resume += query.value(idx).toString();
}
- */
}
break;
diff --git a/client/macrowindow.cc b/client/macrowindow.cc
index b0eab65..5ef342d 100644
--- a/client/macrowindow.cc
+++ b/client/macrowindow.cc
@@ -61,6 +61,21 @@ MacroWindow::MacroWindow(QDomNode &xml_doc)
MacroWindow::~MacroWindow()
{
delete lua;
+
+ QVector< Widget* >::iterator i = widgets.begin();
+ while (i != widgets.end()) {
+ Widget* w = *i;
+ delete w;
+ i++;
+ }
+
+ QVector< Widget* >::iterator j = auxwidgets.begin();
+ while (j != auxwidgets.end()) {
+ Widget* w = *j;
+ delete w;
+ j++;
+ }
+
}
void MacroWindow::initMacro(QDomNode &node)
@@ -200,7 +215,7 @@ void MacroWindow::cont(QString name)
bool MacroWindow::isClosed()
{
- return isclosed;
+ return isclosed || mainwidget->isVisible() == false;
}
Widget *MacroWindow::getWidget(QString name)
diff --git a/client/widgets/dbwidget.cc b/client/widgets/dbwidget.cc
index 69c868e..1c0a0d2 100644
--- a/client/widgets/dbwidget.cc
+++ b/client/widgets/dbwidget.cc
@@ -94,6 +94,7 @@ DBWidget::DBWidget(QDomNode &node, MacroWindow *macrowindow)
DBWidget::~DBWidget()
{
db.close();
+ db = QSqlDatabase();
}