]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/qt-console/mainwin.cpp
d2201fb86ea3b8f2fb1fe014df6ee903c999e16e
[bacula/bacula] / bacula / src / qt-console / mainwin.cpp
1 /*
2    Bacula® - The Network Backup Solution
3
4    Copyright (C) 2007-2007 Free Software Foundation Europe e.V.
5
6    The main author of Bacula is Kern Sibbald, with contributions from
7    many others, a complete list can be found in the file AUTHORS.
8    This program is Free Software; you can redistribute it and/or
9    modify it under the terms of version two of the GNU General Public
10    License as published by the Free Software Foundation plus additions
11    that are listed in the file LICENSE.
12
13    This program is distributed in the hope that it will be useful, but
14    WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16    General Public License for more details.
17
18    You should have received a copy of the GNU General Public License
19    along with this program; if not, write to the Free Software
20    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21    02110-1301, USA.
22
23    Bacula® is a registered trademark of John Walker.
24    The licensor of Bacula is the Free Software Foundation Europe
25    (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
26    Switzerland, email:ftf@fsfeurope.org.
27 */
28
29 /*
30  *   Version $Id$
31  *
32  *  Main Window control for bat (qt-console)
33  *
34  *   Kern Sibbald, January MMVII
35  *
36  */ 
37
38 #include "bat.h"
39 #include "joblist/joblist.h"
40 #include "storage/storage.h"
41 #include "fileset/fileset.h"
42 #include "label/label.h"
43 #include "run/run.h"
44 #include "pages.h"
45 #include "restore/restore.h"
46 #include "medialist/medialist.h"
47 #include "joblist/joblist.h"
48 #include "clients/clients.h"
49
50 MainWin::MainWin(QWidget *parent) : QMainWindow(parent)
51 {
52    m_dtformat = "yyyy-MM-dd HH:mm:ss";
53    mainWin = this;
54    setupUi(this);                     /* Setup UI defined by main.ui (designer) */
55    readPreferences();
56    treeWidget->clear();
57    treeWidget->setColumnCount(1);
58    treeWidget->setHeaderLabel("Select Page");
59    treeWidget->setContextMenuPolicy(Qt::ActionsContextMenu);
60
61    createPages();
62
63    resetFocus();
64
65    createConnections();
66
67    this->show();
68
69    readSettings();
70
71    foreach(Console *console, m_consoleHash) {
72       console->connect();
73    }
74    m_currentConsole = (Console*)getFromHash(m_firstItem);
75    m_currentConsole->setCurrent();
76    if (m_miscDebug) {
77       QString directoryResourceName;
78       m_currentConsole->getDirResName(directoryResourceName);
79       Pmsg1(000, "Setting initial window to %s\n", directoryResourceName.toUtf8().data());
80    }
81 }
82
83 void MainWin::createPages()
84 {
85    DIRRES *dir;
86    QTreeWidgetItem *item, *topItem;
87    m_firstItem = NULL;
88
89    LockRes();
90    foreach_res(dir, R_DIRECTOR) {
91
92       /* Create console tree stacked widget item */
93       m_currentConsole = new Console(stackedWidget);
94       m_currentConsole->setDirRes(dir);
95       m_currentConsole->readSettings();
96
97       /* The top tree item representing the director */
98       topItem = createTopPage(dir->name());
99       topItem->setIcon(0, QIcon(":images/server.png"));
100       /* Set background to grey for ease of identification of inactive Director */
101       QBrush greyBrush(Qt::lightGray);
102       topItem->setBackground(0, greyBrush);
103       m_currentConsole->setDirectorTreeItem(topItem);
104       m_consoleHash.insert(topItem, m_currentConsole);
105
106       /* Create Tree Widget Item */
107       item = createPage("Console", topItem);
108       if (!m_firstItem){ m_firstItem = item; }
109
110       /* insert the cosole and tree widget item into the hashes */
111       hashInsert(item, m_currentConsole);
112
113       /* Set Color of treeWidgetItem for the console
114       * It will be set to green in the console class if the connection is made.
115       */
116       QBrush redBrush(Qt::red);
117       item->setForeground(0, redBrush);
118       m_currentConsole->dockPage();
119
120       /*
121        * Create instances in alphabetic order of the rest 
122        *  of the classes that will by default exist under each Director.  
123        */
124 //    createPagebRestore();
125       createPageClients();
126       createPageFileSet();
127       QString emptymedia(""), emptyclient("");
128       createPageJobList(emptymedia, emptyclient, NULL);
129       createPageMediaList();
130       createPageStorage();
131
132       treeWidget->expandItem(topItem);
133       stackedWidget->setCurrentWidget(m_currentConsole);
134    }
135    UnlockRes();
136 }
137
138 /*
139  * create an instance of the the brestore class on the stack
140  */
141 void MainWin::createPagebRestore()
142 {
143    bRestore* brestore = new bRestore();
144    brestore->dockPage();
145 }
146
147 /*
148  * create an instance of the the medialist class on the stack
149  */
150 void MainWin::createPageMediaList()
151 {
152    MediaList* medialist = new MediaList();
153    medialist->dockPage();
154 }
155
156 /*
157  * create an instance of the the joblist class on the stack
158  */
159 void MainWin::createPageJobList(QString &media, QString &client,
160               QTreeWidgetItem *parentTreeWidgetItem)
161 {
162    QTreeWidgetItem *holdItem;
163
164    /* save current tree widget item in case query produces no results */
165    holdItem = treeWidget->currentItem();
166    JobList* joblist = new JobList(media, client, parentTreeWidgetItem);
167    joblist->dockPage();
168    /* If this is a query of jobs on a specific media */
169    if ((media != "") || (client != "")) {
170       joblist->setCurrent();
171       /* did query produce results, if not close window and set back to hold */
172       if (joblist->m_resultCount == 0) {
173          joblist->closeStackPage();
174          treeWidget->setCurrentItem(holdItem);
175       }
176    }
177 }
178
179 /*
180  * create an instance of the the Clients class on the stack
181  */
182 void MainWin::createPageClients()
183 {
184    Clients* clients = new Clients();
185    clients->dockPage();
186 }
187
188 /*
189  * create an instance of the the storage class on the stack
190  */
191 void MainWin::createPageStorage()
192 {
193    Storage* storage = new Storage();
194    storage->dockPage();
195 }
196
197 /*
198  * create an instance of the the fileset class on the stack
199  */
200 void MainWin::createPageFileSet()
201 {
202    FileSet* fileset = new FileSet();
203    fileset->dockPage();
204 }
205
206 /* Create a root Tree Widget */
207 QTreeWidgetItem *MainWin::createTopPage(char *name)
208 {
209    QTreeWidgetItem *item = new QTreeWidgetItem(treeWidget);
210    item->setText(0, name);
211    return item;
212 }
213
214 /* Create A Tree Widget Item which will be associated with a Page in the stacked widget */
215 QTreeWidgetItem *MainWin::createPage(char *name, QTreeWidgetItem *parent)
216 {
217    QTreeWidgetItem *item = new QTreeWidgetItem(parent);
218    item->setText(0, name);
219    return item;
220 }
221
222 /*
223  * Handle up and down arrow keys for the command line
224  *  history.
225  */
226 void MainWin::keyPressEvent(QKeyEvent *event)
227 {
228    if (m_cmd_history.size() == 0) {
229       event->ignore();
230       return;
231    }
232    switch (event->key()) {
233    case Qt::Key_Down:
234       if (m_cmd_last < 0 || m_cmd_last >= (m_cmd_history.size()-1)) {
235          event->ignore();
236          return;
237       }
238       m_cmd_last++;
239       break;
240    case Qt::Key_Up:
241       if (m_cmd_last == 0) {
242          event->ignore();
243          return;
244       }
245       if (m_cmd_last < 0 || m_cmd_last > (m_cmd_history.size()-1)) {
246          m_cmd_last = m_cmd_history.size() - 1;
247       } else {
248          m_cmd_last--;
249       }
250       break;
251    default:
252       event->ignore();
253       return;
254    }
255    lineEdit->setText(m_cmd_history[m_cmd_last]);
256 }
257
258 void MainWin::createConnections()
259 {
260    /* Connect signals to slots */
261    connect(lineEdit, SIGNAL(returnPressed()), this, SLOT(input_line()));
262    connect(actionAbout_bat, SIGNAL(triggered()), this, SLOT(about()));
263    connect(treeWidget, SIGNAL(itemClicked(QTreeWidgetItem *, int)), this, 
264            SLOT(treeItemClicked(QTreeWidgetItem *, int)));
265    connect(treeWidget, SIGNAL(
266            currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)),
267            this, SLOT(treeItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)));
268    connect(stackedWidget, SIGNAL(currentChanged(int)),
269            this, SLOT(stackItemChanged(int)));
270    connect(actionQuit, SIGNAL(triggered()), app, SLOT(closeAllWindows()));
271    connect(actionLabel, SIGNAL(triggered()), this,  SLOT(labelButtonClicked()));
272    connect(actionRun, SIGNAL(triggered()), this,  SLOT(runButtonClicked()));
273    connect(actionRestore, SIGNAL(triggered()), this,  SLOT(restoreButtonClicked()));
274    connect(actionUndock, SIGNAL(triggered()), this,  SLOT(undockWindowButton()));
275    connect(actionToggleDock, SIGNAL(triggered()), this,  SLOT(toggleDockContextWindow()));
276    connect(actionClosePage, SIGNAL(triggered()), this,  SLOT(closePage()));
277    connect(actionPreferences, SIGNAL(triggered()), this,  SLOT(setPreferences()));
278 }
279
280 /* 
281  * Reimplementation of QWidget closeEvent virtual function   
282  */
283 void MainWin::closeEvent(QCloseEvent *event)
284 {
285    writeSettings();
286    foreach(Console *console, m_consoleHash){
287       console->writeSettings();
288       console->terminate();
289    }
290    event->accept();
291    foreach(Pages *page, m_pagehash) {
292       if (!page->isDocked())
293          page->close();
294    }
295 }
296
297 void MainWin::writeSettings()
298 {
299    QSettings settings("bacula.org", "bat");
300
301    settings.beginGroup("MainWin");
302    settings.setValue("winSize", size());
303    settings.setValue("winPos", pos());
304    settings.setValue("state", saveState());
305    settings.endGroup();
306 }
307
308 void MainWin::readSettings()
309
310    QSettings settings("bacula.org", "bat");
311
312    settings.beginGroup("MainWin");
313    resize(settings.value("winSize", QSize(1041, 801)).toSize());
314    move(settings.value("winPos", QPoint(200, 150)).toPoint());
315    restoreState(settings.value("state").toByteArray());
316    settings.endGroup();
317 }
318
319 /*
320  * This subroutine is called with an item in the Page Selection window
321  *   is clicked 
322  */
323 void MainWin::treeItemClicked(QTreeWidgetItem *item, int /*column*/)
324 {
325    /* Is this a page that has been inserted into the hash  */
326    if (getFromHash(item)) {
327       Pages* page = getFromHash(item);
328       int stackindex=stackedWidget->indexOf(page);
329
330       if (stackindex >= 0) {
331          stackedWidget->setCurrentWidget(page);
332       }
333       /* run the virtual function in case this class overrides it */
334       page->PgSeltreeWidgetClicked();
335    }
336 }
337
338 /*
339  * Called with a change of the highlighed tree widget item in the page selector.
340  */
341 void MainWin::treeItemChanged(QTreeWidgetItem *currentitem, QTreeWidgetItem *previousitem)
342 {
343    Pages *previousPage, *nextPage;
344    Console *previousConsole, *nextConsole;
345
346    /* first determine the next item */
347
348    /* knowing the treeWidgetItem, get the page from the hash */
349    nextPage = getFromHash(currentitem);
350    nextConsole = m_consoleHash.value(currentitem);
351    /* Is this a page that has been inserted into the hash  */
352    if (nextPage) {
353       nextConsole = nextPage->console();
354       /* then is it a treeWidgetItem representing a director */
355    } else if (nextConsole) {
356       /* let the next page BE the console */
357       nextPage = nextConsole;
358    } else {
359       /* Should never get here */
360       nextPage = NULL;
361       nextConsole = NULL;
362    }
363           
364    /* The Previous item */
365
366    /* this condition prevents a segfault.  The first time there is no previousitem*/
367    if (previousitem) {
368       /* knowing the treeWidgetItem, get the page from the hash */
369       previousPage = getFromHash(previousitem);
370       previousConsole = m_consoleHash.value(previousitem);
371       if (previousPage) {
372          previousConsole = previousPage->console();
373       } else if (previousConsole) {
374          previousPage = previousConsole;
375       }
376       if ((previousPage) || (previousConsole)) {
377          if (nextConsole != previousConsole) {
378             /* remove connections to the current console */
379             disconnect(actionConnect, SIGNAL(triggered()), previousConsole, SLOT(connect()));
380             disconnect(actionStatusDir, SIGNAL(triggered()), previousConsole, SLOT(status_dir()));
381             disconnect(actionMessages, SIGNAL(triggered()), previousConsole, SLOT(messages()));
382             disconnect(actionSelectFont, SIGNAL(triggered()), previousConsole, SLOT(set_font()));
383             QTreeWidgetItem *dirItem = previousConsole->directorTreeItem();
384             QBrush greyBrush(Qt::lightGray);
385             dirItem->setBackground(0, greyBrush);
386          }
387          /* make sure the close window and toggle dock options are removed */
388          treeWidget->removeAction(actionClosePage);
389          treeWidget->removeAction(actionToggleDock);
390          /* Is this a page that has been inserted into the hash  */
391          if (previousPage) {
392             foreach(QAction* pageaction, previousPage->m_contextActions) {
393                treeWidget->removeAction(pageaction);
394             }
395          } 
396       }
397    }
398
399    /* process the current (next) item */
400    
401    if ((nextPage) || (nextConsole)) {
402       if (nextConsole != previousConsole) {
403          /* make connections to the current console */
404          m_currentConsole = nextConsole;
405          connect(actionConnect, SIGNAL(triggered()), m_currentConsole, SLOT(connect()));
406          connect(actionSelectFont, SIGNAL(triggered()), m_currentConsole, SLOT(set_font()));
407          connect(actionStatusDir, SIGNAL(triggered()), m_currentConsole, SLOT(status_dir()));
408          connect(actionMessages, SIGNAL(triggered()), m_currentConsole, SLOT(messages()));
409          /* Set director's tree widget background to magenta for ease of identification */
410          QTreeWidgetItem *dirItem = m_currentConsole->directorTreeItem();
411          QBrush magentaBrush(Qt::magenta);
412          dirItem->setBackground(0, magentaBrush);
413       }
414       /* set the value for the currently active console */
415       int stackindex = stackedWidget->indexOf(nextPage);
416    
417       /* Is this page currently on the stack or is it undocked */
418       if (stackindex >= 0) {
419          /* put this page on the top of the stack */
420          stackedWidget->setCurrentIndex(stackindex);
421       } else {
422          /* it is undocked, raise it to the front */
423          nextPage->raise();
424       }
425       /* for the page selectors menu action to dock or undock, set the text */
426       nextPage->setContextMenuDockText();
427
428       treeWidget->addAction(actionToggleDock);
429       /* if this page is closeable, then add that action */
430       if (nextPage->isCloseable()) {
431          treeWidget->addAction(actionClosePage);
432       }
433
434       /* Add the actions to the Page Selectors tree widget that are part of the
435        * current items list of desired actions regardless of whether on top of stack*/
436       treeWidget->addActions(nextPage->m_contextActions);
437    }
438 }
439
440 void MainWin::labelButtonClicked() 
441 {
442    new labelPage();
443 }
444
445 void MainWin::runButtonClicked() 
446 {
447    new runPage();
448 }
449
450 void MainWin::restoreButtonClicked() 
451 {
452    new prerestorePage();
453 }
454
455 /*
456  * The user just finished typing a line in the command line edit box
457  */
458 void MainWin::input_line()
459 {
460    QString cmdStr = lineEdit->text();    /* Get the text */
461    lineEdit->clear();                    /* clear the lineEdit box */
462    if (m_currentConsole->is_connected()) {
463       m_currentConsole->display_text(cmdStr + "\n");
464       m_currentConsole->write_dir(cmdStr.toUtf8().data());         /* send to dir */
465    } else {
466       set_status("Director not connected. Click on connect button.");
467    }
468    m_cmd_history.append(cmdStr);
469    m_cmd_last = -1;
470    if (treeWidget->currentItem() != getFromHash(m_currentConsole))
471       m_currentConsole->setCurrent();
472 }
473
474
475 void MainWin::about()
476 {
477    QMessageBox::about(this, tr("About bat"),
478       tr("<br><h2>bat 1.0, by Dirk H Bartley and Kern Sibbald</h2>"
479          "<p>Copyright &copy; " BYEAR " Free Software Foundation Europe e.V."
480          "<p>The <b>bat</b> is an administrative console"
481          " interface to the Director."));
482 }
483
484 void MainWin::set_statusf(const char *fmt, ...)
485 {
486    va_list arg_ptr;
487    char buf[1000];
488    int len;
489    va_start(arg_ptr, fmt);
490    len = bvsnprintf(buf, sizeof(buf), fmt, arg_ptr);
491    va_end(arg_ptr);
492    set_status(buf);
493 }
494
495 void MainWin::set_status_ready()
496 {
497    set_status(" Ready");
498 }
499
500 void MainWin::set_status(const char *buf)
501 {
502    statusBar()->showMessage(buf);
503 }
504
505 /*
506  * Function to respond to the button bar button to undock
507  */
508 void MainWin::undockWindowButton()
509 {
510    Pages* page = (Pages*)stackedWidget->currentWidget();
511    page->togglePageDocking();
512 }
513
514 /*
515  * Function to respond to action on page selector context menu to toggle the 
516  * dock status of the window associated with the page selectors current
517  * tree widget item.
518  */
519 void MainWin::toggleDockContextWindow()
520 {
521    QTreeWidgetItem *currentitem = treeWidget->currentItem();
522    
523    /* Is this a page that has been inserted into the hash  */
524    if (getFromHash(currentitem)) {
525       Pages* page = getFromHash(currentitem);
526       page->togglePageDocking();
527    }
528 }
529
530 /*
531  * This function is called when the stack item is changed.  Call
532  * the virtual function here.  Avoids a window being undocked leaving
533  * a window at the top of the stack unpopulated.
534  */
535 void MainWin::stackItemChanged(int)
536 {
537    Pages* page = (Pages*)stackedWidget->currentWidget();
538    /* run the virtual function in case this class overrides it */
539    page->currentStackItem();
540 }
541
542 /*
543  * Function to simplify insertion of QTreeWidgetItem <-> Page association
544  * into a double direction hash.
545  */
546 void MainWin::hashInsert(QTreeWidgetItem *item, Pages *page)
547 {
548    m_pagehash.insert(item, page);
549    m_widgethash.insert(page, item);
550 }
551
552 /*
553  * Function to simplify removal of QTreeWidgetItem <-> Page association
554  * into a double direction hash.
555  */
556 void MainWin::hashRemove(QTreeWidgetItem *item, Pages *page)
557 {
558    /* I had all sorts of return status checking code here.  Do we have a log
559     * level capability in bat.  I would have left it in but it used printf's
560     * and it should really be some kind of log level facility ???
561     * ******FIXME********/
562    m_pagehash.remove(item);
563    m_widgethash.remove(page);
564 }
565
566 /*
567  * Function to retrieve a Page* when the item in the page selector's tree is
568  * known.
569  */
570 Pages* MainWin::getFromHash(QTreeWidgetItem *item)
571 {
572    return m_pagehash.value(item);
573 }
574
575 /*
576  * Function to retrieve the page selectors tree widget item when the page is
577  * known.
578  */
579 QTreeWidgetItem* MainWin::getFromHash(Pages *page)
580 {
581    return m_widgethash.value(page);
582 }
583
584 /*
585  * Function to respond to action on page selector context menu to close the
586  * current window.
587  */
588 void MainWin::closePage()
589 {
590    QTreeWidgetItem *currentitem = treeWidget->currentItem();
591    
592    /* Is this a page that has been inserted into the hash  */
593    if (getFromHash(currentitem)) {
594       Pages* page = getFromHash(currentitem);
595       if (page->isCloseable()) {
596          page->closeStackPage();
597       }
598    }
599 }
600
601 /* Quick function to return the current console */
602 Console *MainWin::currentConsole()
603 {
604    return m_currentConsole;
605 }
606 /* Quick function to return the tree item for the director */
607 QTreeWidgetItem *MainWin::currentTopItem()
608 {
609    return m_currentConsole->directorTreeItem();
610 }
611
612 /* Preferences menu item clicked */
613 void MainWin::setPreferences()
614 {
615    prefsDialog prefs;
616    prefs.commDebug->setCheckState(m_commDebug ? Qt::Checked : Qt::Unchecked);
617    prefs.displayAll->setCheckState(m_displayAll ? Qt::Checked : Qt::Unchecked);
618    prefs.sqlDebug->setCheckState(m_sqlDebug ? Qt::Checked : Qt::Unchecked);
619    prefs.commandDebug->setCheckState(m_commandDebug ? Qt::Checked : Qt::Unchecked);
620    prefs.miscDebug->setCheckState(m_miscDebug ? Qt::Checked : Qt::Unchecked);
621    prefs.recordLimit->setCheckState(m_recordLimitCheck ? Qt::Checked : Qt::Unchecked);
622    prefs.recordSpinBox->setValue(m_recordLimitVal);
623    prefs.daysLimit->setCheckState(m_daysLimitCheck ? Qt::Checked : Qt::Unchecked);
624    prefs.daysSpinBox->setValue(m_daysLimitVal);
625    prefs.checkMessages->setCheckState(m_checkMessages ? Qt::Checked : Qt::Unchecked);
626    prefs.checkMessagesSpin->setValue(m_checkMessagesInterval);
627    prefs.exec();
628 }
629
630 /* Preferences dialog */
631 prefsDialog::prefsDialog()
632 {
633    setupUi(this);
634 }
635
636 void prefsDialog::accept()
637 {
638    this->hide();
639    mainWin->m_commDebug = this->commDebug->checkState() == Qt::Checked;
640    mainWin->m_displayAll = this->displayAll->checkState() == Qt::Checked;
641    mainWin->m_sqlDebug = this->sqlDebug->checkState() == Qt::Checked;
642    mainWin->m_commandDebug = this->commandDebug->checkState() == Qt::Checked;
643    mainWin->m_miscDebug = this->miscDebug->checkState() == Qt::Checked;
644    mainWin->m_recordLimitCheck = this->recordLimit->checkState() == Qt::Checked;
645    mainWin->m_recordLimitVal = this->recordSpinBox->value();
646    mainWin->m_daysLimitCheck = this->daysLimit->checkState() == Qt::Checked;
647    mainWin->m_daysLimitVal = this->daysSpinBox->value();
648    mainWin->m_checkMessages = this->checkMessages->checkState() == Qt::Checked;
649    mainWin->m_checkMessagesInterval = this->checkMessagesSpin->value();
650    QSettings settings("www.bacula.org", "bat");
651    settings.beginGroup("Debug");
652    settings.setValue("commDebug", mainWin->m_commDebug);
653    settings.setValue("displayAll", mainWin->m_displayAll);
654    settings.setValue("sqlDebug", mainWin->m_sqlDebug);
655    settings.setValue("commandDebug", mainWin->m_commandDebug);
656    settings.setValue("miscDebug", mainWin->m_miscDebug);
657    settings.endGroup();
658    settings.beginGroup("JobList");
659    settings.setValue("recordLimitCheck", mainWin->m_recordLimitCheck);
660    settings.setValue("recordLimitVal", mainWin->m_recordLimitVal);
661    settings.setValue("daysLimitCheck", mainWin->m_daysLimitCheck);
662    settings.setValue("daysLimitVal", mainWin->m_daysLimitVal);
663    settings.endGroup();
664    settings.beginGroup("Messages");
665    settings.setValue("checkMessages", mainWin->m_checkMessages);
666    settings.setValue("checkMessagesInterval", mainWin->m_checkMessagesInterval);
667    settings.endGroup();
668    foreach(Console *console, mainWin->m_consoleHash) {
669       console->startTimer();
670    }
671 }
672
673 void prefsDialog::reject()
674 {
675    this->hide();
676    mainWin->set_status("Canceled");
677 }
678
679 /* read preferences for the prefences dialog box */
680 void MainWin::readPreferences()
681 {
682    QSettings settings("www.bacula.org", "bat");
683    settings.beginGroup("Debug");
684    m_commDebug = settings.value("commDebug", false).toBool();
685    m_displayAll = settings.value("displayAll", false).toBool();
686    m_sqlDebug = settings.value("sqlDebug", false).toBool();
687    m_commandDebug = settings.value("commandDebug", false).toBool();
688    m_miscDebug = settings.value("miscDebug", false).toBool();
689    settings.endGroup();
690    settings.beginGroup("JobList");
691    m_recordLimitCheck = settings.value("recordLimitCheck", true).toBool();
692    m_recordLimitVal = settings.value("recordLimitVal", 150).toInt();
693    m_daysLimitCheck = settings.value("daysLimitCheck", false).toBool();
694    m_daysLimitVal = settings.value("daysLimitVal", 28).toInt();
695    settings.endGroup();
696    settings.beginGroup("Messages");
697    m_checkMessages = settings.value("checkMessages", false).toBool();
698    m_checkMessagesInterval = settings.value("checkMessagesInterval", 28).toInt();
699    settings.endGroup();
700 }