X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=bacula%2Fsrc%2Fqt-console%2Ffileset%2Ffileset.cpp;h=ded84d15d64fda8c7b8e9f0fd93163c72c8c9cb6;hb=0814c96da7cd32509cf182667b4b124dea4aab2b;hp=567ca77b81b7b1d3368beee2ed2b459db7de9e15;hpb=ab54e24ec150b9593621e898207605a94f135b29;p=bacula%2Fbacula diff --git a/bacula/src/qt-console/fileset/fileset.cpp b/bacula/src/qt-console/fileset/fileset.cpp index 567ca77b81..ded84d15d6 100644 --- a/bacula/src/qt-console/fileset/fileset.cpp +++ b/bacula/src/qt-console/fileset/fileset.cpp @@ -50,10 +50,12 @@ FileSet::FileSet() m_populated = false; m_checkcurwidget = true; m_closeable = false; + readSettings(); } FileSet::~FileSet() { + writeSettings(); } /* @@ -64,8 +66,9 @@ void FileSet::populateTree() { QTreeWidgetItem *filesetItem, *topItem; + if (!m_console->preventInUseConnect()) + return; - Dmsg0(000, "Populate fileset tree called.\n"); m_checkcurwidget = false; mp_treeWidget->clear(); m_checkcurwidget = true; @@ -80,8 +83,6 @@ void FileSet::populateTree() mp_treeWidget->setColumnCount(headerlist.count()); mp_treeWidget->setHeaderLabels(headerlist); - /* This could be a log item */ - //printf("In FileSet::populateTree()\n"); foreach(QString filesetName, m_console->fileset_list) { filesetItem = new QTreeWidgetItem(topItem); @@ -98,8 +99,9 @@ void FileSet::populateTree() query += " ORDER BY FileSet"; QStringList results; - /* This could be a log item */ - //printf("FileSet query cmd : %s\n",query.toUtf8().data()); + if (mainWin->m_sqlDebug) { + Pmsg1(000, "FileSet query cmd : %s\n",query.toUtf8().data()); + } if (m_console->sql_cmd(query, results)) { int resultCount = results.count(); if (resultCount == 1){ @@ -113,10 +115,10 @@ void FileSet::populateTree() /* Iterate through fields in the record */ foreach (field, fieldlist) { field = field.trimmed(); /* strip leading & trailing spaces */ - filesetItem->setData(index+1, Qt::UserRole, 1); + filesetItem->setData(index, Qt::UserRole, 1); /* Put media fields under the pool tree item */ - filesetItem->setData(index+1, Qt::UserRole, 1); - filesetItem->setText(index+1, field); + filesetItem->setData(index, Qt::UserRole, 1); + filesetItem->setText(index, field); index++; } } @@ -124,7 +126,7 @@ void FileSet::populateTree() } } /* Resize the columns */ - for(int cnter=1; cnterresizeColumnToContents(cnter); } @@ -208,7 +210,7 @@ void FileSet::currentStackItem() if(!m_populated) { populateTree(); /* add context sensitive menu items specific to this classto the page - * selector tree. m_m_contextActions is QList of QActions, so this is + * selector tree. m_contextActions is QList of QActions, so this is * only done once with the first population. */ m_contextActions.append(actionRefreshFileSet); /* Create the context menu for the fileset tree */ @@ -216,3 +218,25 @@ void FileSet::currentStackItem() m_populated=true; } } + +/* + * Save user settings associated with this page + */ +void FileSet::writeSettings() +{ + QSettings settings(m_console->m_dir->name(), "bat"); + settings.beginGroup("FileSet"); + settings.setValue("geometry", saveGeometry()); + settings.endGroup(); +} + +/* + * Read and restore user settings associated with this page + */ +void FileSet::readSettings() +{ + QSettings settings(m_console->m_dir->name(), "bat"); + settings.beginGroup("FileSet"); + restoreGeometry(settings.value("geometry").toByteArray()); + settings.endGroup(); +}