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