From 171603595ef7ab2d8f4fb1eb0096b63c9bab3d5a Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Fri, 30 Mar 2007 16:59:23 +0000 Subject: [PATCH] Add context menu to media tree item git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4462 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/qt-console/main.ui | 11 ++++++++--- bacula/src/qt-console/mainwin.cpp | 4 ++-- bacula/src/qt-console/medialist/medialist.cpp | 16 +++++++++++++++- 3 files changed, 25 insertions(+), 6 deletions(-) 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(); } -- 2.39.5