summaryrefslogtreecommitdiff
path: root/client/macrowindow.cc
diff options
context:
space:
mode:
Diffstat (limited to 'client/macrowindow.cc')
-rw-r--r--client/macrowindow.cc19
1 files changed, 10 insertions, 9 deletions
diff --git a/client/macrowindow.cc b/client/macrowindow.cc
index 6588416..4513483 100644
--- a/client/macrowindow.cc
+++ b/client/macrowindow.cc
@@ -42,9 +42,8 @@ extern QString user;
extern QString host;
extern quint16 port;
-#define DEBUG(fmt...) printf("MacroWindow (%p)", this); \
- printf(fmt); fflush(stdout)
-//#define DEBUG(ftm...)
+//#define DEBUG(fmt...) printf("MacroWindow (%p)",this);printf(fmt);fflush(stdout)
+#define DEBUG(ftm...)
MacroWindow::MacroWindow(NetCom &n, QDomNode &xml_doc, QString templ,
bool collapsed, bool compact)
@@ -116,21 +115,21 @@ void MacroWindow::initMacro(QDomNode &node)
} else if(elem.tagName() == "widgets") {
if(mainwidget) {
- DEBUG("ERROR!!!!!!\n\tmainwidget already exists!\n");
+ DEBUG("WARNING: mainwidget already exists! Calling clear().\n");
+ clear();
}
Window *window = new Window(elem, this);
connect(window, SIGNAL(wasChanged()), this, SLOT(macroChanged()));
macrotitle = elem.attribute("caption");
- clear();
mainwidget = window;
mainwidget->setValues();
if(waschanged == true) macroChanged();
- return; // No further recursion.
+ return; // No further recursion here.
}
QDomNodeList children = node.childNodes();
@@ -145,7 +144,8 @@ void MacroWindow::initMacro(QDomNode &node)
bool MacroWindow::doCommit()
{
if(mainwidget->valid()) {
- QVector< Widget* > wlist = mainwidget->widgetList();
+ QVector< Widget* > wlist;
+ if(mainwidget) wlist = mainwidget->widgetList();
QDomDocument doc = netcom.send(wlist, templ, macro, version);
QDomNodeList nl = doc.documentElement().childNodes();
@@ -223,7 +223,8 @@ void MacroWindow::expandWrapper()
expand();
// Set keyboard focus on the first focusable widget in the macro.
- QVector< Widget* > widgets = mainwidget->widgetList(true);
+ QVector< Widget* > widgets;
+ if(mainwidget) widgets = mainwidget->widgetList(true);
QVector< Widget* >::iterator i = widgets.begin();
while (i != widgets.end()) {
if(*i) {
@@ -242,7 +243,7 @@ void MacroWindow::collapseWrapper()
if(waschanged) {
switch(MessageBox::warning(NULL,
"Gem ændringerne i makroen?",
- "Du har valgt at ukke makroen " +
+ "Du har valgt at lukke makroen " +
macrotitle + ".\n"
"Ønsker du at gemme inden du lukker?",
MessageBox::Save | MessageBox::Close |