]> git.sur5r.net Git - bacula/bacula/commitdiff
dhb Medialist : created context menu function and moved lines which create
authorDirk H Bartley <dbartley@schupan.com>
Thu, 5 Apr 2007 02:41:42 +0000 (02:41 +0000)
committerDirk H Bartley <dbartley@schupan.com>
Thu, 5 Apr 2007 02:41:42 +0000 (02:41 +0000)
     the context menu function there.  Call this function from
     MediaList::PgSeltreeWidgetClicked() so that the menu items only get added
     once instead of every time the tree gets repopulated.  Otherwise the popup
     menu ends up with repeats.
     Joblist : Set all flags of the table items to 0 so that the defaults of
     editable are not active.

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

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

index 96c863376c45f7d676bf2fdcca41f5540b7e870a..2c54b893d5de35c6973bd7ca797e6a956564b2da 100644 (file)
@@ -92,6 +92,7 @@ void JobList::populateTable()
          foreach (field, fieldlist) {
             field = field.trimmed();  /* strip leading & trailing spaces */
             p_tableitem = new QTableWidgetItem(field,1);
+            p_tableitem->setFlags(0);
             mp_tableWidget->setItem(row, column, p_tableitem);
             column++;
          }
index 855f66b1a55a6d235373a52ae4607f04c8acbb34..3489e8aa440cd0a041f229ae49e39d3fc9a4b769 100644 (file)
@@ -88,29 +88,8 @@ void MediaList::populateTree()
    topItem->setData(0, Qt::UserRole, 0);
    topItem->setExpanded( true );
 
-#ifdef xxx
-#include <QSize>
-*****    FIXME   *****
-//how to get the size of a column to be larger
-//topItem->setSizeHint(0,QSize(1050,50));
-#endif
-
    mp_treeWidget->setHeaderLabels(headerlist);
 
-   /* 
-    * Setup a context menu 
-    */
-   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()));
-   mp_treeWidget->setContextMenuPolicy(Qt::ActionsContextMenu);
-   connect(mp_treeWidget, SIGNAL(
-           currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)),
-           this, SLOT(treeItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)));
-
    if (mp_console->sql_cmd(query, results)) {
       QString field;
       QStringList fieldlist;
@@ -197,6 +176,7 @@ void MediaList::PgSeltreeWidgetClicked()
 {
    if(!m_populated) {
       populateTree();
+      createContextMenu();
       m_populated=true;
    }
 }
@@ -228,3 +208,20 @@ void MediaList::treeItemChanged(QTreeWidgetItem *currentwidgetitem, QTreeWidgetI
       }
    }
 }
+
+/* 
+ * Setup a context menu 
+ */
+void MediaList::createContextMenu()
+{
+   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()));
+   mp_treeWidget->setContextMenuPolicy(Qt::ActionsContextMenu);
+   connect(mp_treeWidget, SIGNAL(
+           currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)),
+           this, SLOT(treeItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)));
+}
index a29e30dbcca44a89164b791a799156b28f3d69f2..7d66bba80a7963313f0dd4b574a2b0c038a190b7 100644 (file)
@@ -58,6 +58,7 @@ public slots:
 private:
    void createConnections();
    void populateTree();
+   void createContextMenu();
 
 private:
    Console *mp_console;