From: Kern Sibbald Date: Fri, 30 Mar 2007 16:59:23 +0000 (+0000) Subject: Add context menu to media tree item X-Git-Tag: Release-7.0.0~6663 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=171603595ef7ab2d8f4fb1eb0096b63c9bab3d5a;p=bacula%2Fbacula Add context menu to media tree item git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4462 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/src/qt-console/main.ui b/bacula/src/qt-console/main.ui index 46be6b9a18..91a384d490 100644 --- a/bacula/src/qt-console/main.ui +++ b/bacula/src/qt-console/main.ui @@ -136,7 +136,7 @@ - + @@ -446,12 +446,17 @@ &Select Font ... - + images/up.png - Pull Window Out + Undock Window + + + + + actionMediaPopUp diff --git a/bacula/src/qt-console/mainwin.cpp b/bacula/src/qt-console/mainwin.cpp index e0a7a1015d..c1c5658e57 100644 --- a/bacula/src/qt-console/mainwin.cpp +++ b/bacula/src/qt-console/mainwin.cpp @@ -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())); } /* diff --git a/bacula/src/qt-console/medialist/medialist.cpp b/bacula/src/qt-console/medialist/medialist.cpp index 0a1099559b..612ea85912 100644 --- a/bacula/src/qt-console/medialist/medialist.cpp +++ b/bacula/src/qt-console/medialist/medialist.cpp @@ -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(); }