]> git.sur5r.net Git - bacula/bacula/commitdiff
Add context menu to media tree item
authorKern Sibbald <kern@sibbald.com>
Fri, 30 Mar 2007 16:59:23 +0000 (16:59 +0000)
committerKern Sibbald <kern@sibbald.com>
Fri, 30 Mar 2007 16:59:23 +0000 (16:59 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4462 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/src/qt-console/main.ui
bacula/src/qt-console/mainwin.cpp
bacula/src/qt-console/medialist/medialist.cpp

index 46be6b9a1822b10763a52dbf9ac14637e74c1736..91a384d490bf57010ae789250240b5af3f329224 100644 (file)
    <addaction name="actionLabel" />
    <addaction name="actionRestore" />
    <addaction name="actionRun" />
-   <addaction name="actionPullWindowOut" />
+   <addaction name="actionUndock" />
   </widget>
   <widget class="QDockWidget" name="dockWidget" >
    <property name="sizePolicy" >
     <string>&amp;Select Font ...</string>
    </property>
   </action>
-  <action name="actionPullWindowOut" >
+  <action name="actionUndock" >
    <property name="icon" >
     <iconset>images/up.png</iconset>
    </property>
    <property name="text" >
-    <string>Pull Window Out</string>
+    <string>Undock Window</string>
+   </property>
+  </action>
+  <action name="actionActionMediaPopUp" >
+   <property name="text" >
+    <string>actionMediaPopUp</string>
    </property>
   </action>
  </widget>
index e0a7a1015d91912347d364661d99ed9531142fb1..c1c5658e57c7d0b3824f05eea411fc86c4b9792d 100644 (file)
@@ -45,7 +45,7 @@ MainWin::MainWin(QWidget *parent) : QMainWindow(parent)
    treeWidget->clear();
    treeWidget->setColumnCount(1);
    treeWidget->setHeaderLabel("Select Page");
-   treeWidget->addAction(actionPullWindowOut);
+   treeWidget->addAction(actionUndock);
    treeWidget->setContextMenuPolicy(Qt::ActionsContextMenu);
 
    m_pages = 0;
@@ -199,7 +199,7 @@ void MainWin::createConnections()
    connect(actionLabel, SIGNAL(triggered()), this,  SLOT(labelDialogClicked()));
    connect(actionRun, SIGNAL(triggered()), this,  SLOT(runDialogClicked()));
    connect(actionRestore, SIGNAL(triggered()), this,  SLOT(restoreDialogClicked()));
-   connect(actionPullWindowOut, SIGNAL(triggered()), this,  SLOT(undockWindowButton()));
+   connect(actionUndock, SIGNAL(triggered()), this,  SLOT(undockWindowButton()));
 }
 
 /* 
index 0a1099559b3556fe32237ef59519e099fd8b55fe..612ea85912f4a2d3d0ae5e8db33cd3feb5ba608e 100644 (file)
@@ -90,6 +90,17 @@ void MediaList::populateTree()
 
    m_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);
+   connect(editAction, SIGNAL(triggered()), this, SLOT(editMedia()));
+   connect(listAction, SIGNAL(triggered()), this, SLOT(showJobs()));
+   m_treeWidget->setContextMenuPolicy(Qt::ActionsContextMenu);
+
    if (m_console->sql_cmd(query, results)) {
       QString field;
       QStringList fieldlist;
@@ -135,8 +146,9 @@ void MediaList::createConnections()
                 SLOT(treeItemDoubleClicked(QTreeWidgetItem *, int)));
 }
 
-void MediaList::treeItemClicked(QTreeWidgetItem *item, int column)
+void MediaList::treeItemClicked(QTreeWidgetItem * /*item*/, int /*column*/)
 {
+#ifdef xxx
    int treedepth = item->data(column, Qt::UserRole).toInt();
    switch (treedepth) {
    case 1:
@@ -150,6 +162,7 @@ void MediaList::treeItemClicked(QTreeWidgetItem *item, int column)
       popup->exec(QCursor::pos());
       break;
    }
+#endif
 }
 
 void MediaList::treeItemDoubleClicked(QTreeWidgetItem *item, int column)
@@ -161,6 +174,7 @@ void MediaList::treeItemDoubleClicked(QTreeWidgetItem *item, int column)
 
 void MediaList::editMedia()
 {
+   /* ***FIXME*** make sure a valid tree item is selected -- check currentItem */
    MediaEdit* edit = new MediaEdit(m_console, m_popuptext);
    edit->show();
 }