]> git.sur5r.net Git - bacula/bacula/commitdiff
dhb removed regex which is no longer needed.
authorDirk H Bartley <dbartley@schupan.com>
Sat, 31 Mar 2007 12:40:15 +0000 (12:40 +0000)
committerDirk H Bartley <dbartley@schupan.com>
Sat, 31 Mar 2007 12:40:15 +0000 (12:40 +0000)
     renamed m_popuptext to m_currently selected
     set m_currentlyselected in new treeItemChanged member function.
     renamed memeber pointers to mp_ prefix
     mp_treewidget was an inherited member, renamed in ui and removed from .h

git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4475 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/src/qt-console/medialist/medialist.cpp
bacula/src/qt-console/medialist/medialist.h
bacula/src/qt-console/medialist/medialist.ui

index cf028e36abdb2efcb649113cfb34b1b1c7fc3c2c..628b89782b68cba78fac9bb2bb4b3d21ee4c61b5 100644 (file)
@@ -47,8 +47,8 @@ MediaList::MediaList(QStackedWidget *parent, Console *console, QTreeWidgetItem *
    SetPassedValues(parent, treeItem, indexseq );
    setupUi(this);
 
-   m_treeWidget = treeWidget;   /* our Storage Tree Tree Widget */
-   m_console = console;
+   /* mp_treeWidget, Storage Tree Tree Widget inherited from ui_medialist.h */
+   mp_console = console;
    createConnections();
    m_populated = false;
 }
@@ -78,9 +78,9 @@ void MediaList::populateTree()
       << "Volume Bytes" << "Volume Files" << "Volume Retention" 
       << "Media Type" << "Last Written");
 
-   m_treeWidget->clear();
-   m_treeWidget->setColumnCount(9);
-   topItem = new QTreeWidgetItem(m_treeWidget);
+   mp_treeWidget->clear();
+   mp_treeWidget->setColumnCount(9);
+   topItem = new QTreeWidgetItem(mp_treeWidget);
    topItem->setText(0, "Pools");
    topItem->setData(0, Qt::UserRole, 0);
    topItem->setExpanded( true );
@@ -92,55 +92,52 @@ void MediaList::populateTree()
 //topItem->setSizeHint(0,QSize(1050,50));
 #endif
 
-   m_treeWidget->setHeaderLabels(headerlist);
+   mp_treeWidget->setHeaderLabels(headerlist);
 
    /* 
     * Setup a context menu 
     */
-   QAction *editAction = new QAction("Edit Properties", m_treeWidget);
-   QAction *listAction = new QAction("List Jobs On Media", m_treeWidget);
-   m_treeWidget->addAction(editAction);
-   m_treeWidget->addAction(listAction);
+   QAction *editAction = new QAction("Edit Properties", mp_treeWidget);
+   QAction *listAction = new QAction("List Jobs On Media", mp_treeWidget);
+   mp_treeWidget->addAction(editAction);
+   mp_treeWidget->addAction(listAction);
    connect(editAction, SIGNAL(triggered()), this, SLOT(editMedia()));
    connect(listAction, SIGNAL(triggered()), this, SLOT(showJobs()));
-   m_treeWidget->setContextMenuPolicy(Qt::ActionsContextMenu);
-   connect(m_treeWidget, SIGNAL(
+   mp_treeWidget->setContextMenuPolicy(Qt::ActionsContextMenu);
+   connect(mp_treeWidget, SIGNAL(
            currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)),
            this, SLOT(treeItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)));
 
-   if (m_console->sql_cmd(query, results)) {
+   if (mp_console->sql_cmd(query, results)) {
       QString field;
       QStringList fieldlist;
-      QRegExp regex("^Using Catalog");
 
       foreach (resultline, results) {
          fieldlist = resultline.split("\t");
-         if (regex.indexIn(resultline) < 0) {
-            int index = 0;
-            /* Iterate through fields in the record */
-            foreach (field, fieldlist) {
-               field = field.trimmed();  /* strip leading & trailing spaces */
-               if (field != "") {
-                  /* The first field is the pool name */
-                  if (index == 0) {
-                     /* If new pool name, create new Pool item */
-                     if (currentpool != field) {
-                        currentpool = field;
-                        pooltreeitem = new QTreeWidgetItem(topItem);
-                        pooltreeitem->setText(0, field);
-                        pooltreeitem->setData(0, Qt::UserRole, 1);
-                        pooltreeitem->setExpanded(true);
-                     }
-                     mediatreeitem = new QTreeWidgetItem(pooltreeitem);
-                     mediatreeitem->setData(index, Qt::UserRole, 2);
-                  } else {
-                     /* Put media fields under the pool tree item */
-                     mediatreeitem->setData(index, Qt::UserRole, 2);
-                     mediatreeitem->setText(index, field);
+         int index = 0;
+         /* Iterate through fields in the record */
+         foreach (field, fieldlist) {
+            field = field.trimmed();  /* strip leading & trailing spaces */
+            if (field != "") {
+               /* The first field is the pool name */
+               if (index == 0) {
+                  /* If new pool name, create new Pool item */
+                  if (currentpool != field) {
+                     currentpool = field;
+                     pooltreeitem = new QTreeWidgetItem(topItem);
+                     pooltreeitem->setText(0, field);
+                     pooltreeitem->setData(0, Qt::UserRole, 1);
+                     pooltreeitem->setExpanded(true);
                   }
+                  mediatreeitem = new QTreeWidgetItem(pooltreeitem);
+                  mediatreeitem->setData(index, Qt::UserRole, 2);
+               } else {
+                  /* Put media fields under the pool tree item */
+                  mediatreeitem->setData(index, Qt::UserRole, 2);
+                  mediatreeitem->setText(index, field);
                }
-               index++;
             }
+            index++;
          }
       }
    }
@@ -151,9 +148,9 @@ void MediaList::populateTree()
  */
 void MediaList::createConnections()
 {
-   connect(treeWidget, SIGNAL(itemPressed(QTreeWidgetItem *, int)), this,
+   connect(mp_treeWidget, SIGNAL(itemPressed(QTreeWidgetItem *, int)), this,
                 SLOT(treeItemClicked(QTreeWidgetItem *, int)));
-   connect(treeWidget, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)), this,
+   connect(mp_treeWidget, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)), this,
                 SLOT(treeItemDoubleClicked(QTreeWidgetItem *, int)));
 }
 
@@ -177,8 +174,8 @@ void MediaList::treeItemDoubleClicked(QTreeWidgetItem * /*item*/, int /*column*/
 void MediaList::editMedia()
 {
    /* ***FIXME*** make sure a valid tree item is selected -- check currentItem
- *    ??? Should this be a check in the database for the existence of m_popuptext??*/
-   MediaEdit* edit = new MediaEdit(m_console, m_popuptext);
+ *    ??? Should this be a check in the database for the existence of m_currentlyselected??*/
+   MediaEdit* edit = new MediaEdit(mp_console, m_currentlyselected);
    edit->show();
 }
 
@@ -187,7 +184,7 @@ void MediaList::editMedia()
  */
 void MediaList::showJobs()
 {
-   JobList* joblist = new JobList(m_console, m_popuptext);
+   JobList* joblist = new JobList(mp_console, m_currentlyselected);
    joblist->show();
 }
 
@@ -221,9 +218,9 @@ void MediaList::treeItemChanged(QTreeWidgetItem *currentwidgetitem, QTreeWidgetI
 {
    int treedepth = currentwidgetitem->data(0, Qt::UserRole).toInt();
    if (treedepth == 2){
-      m_treeWidget->setContextMenuPolicy(Qt::ActionsContextMenu);
+      mp_treeWidget->setContextMenuPolicy(Qt::ActionsContextMenu);
+      m_currentlyselected=currentwidgetitem->text(1);
    } else {
-      m_treeWidget->setContextMenuPolicy(Qt::NoContextMenu);
+      mp_treeWidget->setContextMenuPolicy(Qt::NoContextMenu);
    }
 }
-
index 50ca7edc2609e1e34e6b790c8bd96affd4bae5a8..ce933fcff778ff97b237910bc9c26c8a79be3bb1 100644 (file)
@@ -59,9 +59,8 @@ private:
    void createConnections();
 
 private:
-   Console *m_console;
-   QTreeWidget *m_treeWidget;
-   QString m_popuptext;
+   Console *mp_console;
+   QString m_currentlyselected;
    bool m_populated;
    void populateTree();
 };
index e5ca563cfa0a9a2a99f714ae0ed64e46e512b83c..a60e2dd76a4b66734ec9946e66be63bd0a87d5e8 100644 (file)
@@ -20,7 +20,7 @@
     <number>6</number>
    </property>
    <item row="0" column="0" >
-    <widget class="QTreeWidget" name="treeWidget" />
+    <widget class="QTreeWidget" name="mp_treeWidget" />
    </item>
   </layout>
  </widget>