mp_console = console;
createConnections();
m_populated = false;
+ m_checkcurwidget = true;
}
MediaList::~MediaList()
<< "Volume Bytes" << "Volume Files" << "Volume Retention"
<< "Media Type" << "Last Written");
+ m_checkcurwidget = false;
mp_treeWidget->clear();
+ m_checkcurwidget = true;
mp_treeWidget->setColumnCount(9);
topItem = new QTreeWidgetItem(mp_treeWidget);
topItem->setText(0, "Pools");
*/
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_currentlyselected??*/
MediaEdit* edit = new MediaEdit(mp_console, m_currentlyselected);
edit->show();
}
/*
* Added to set the context menu policy based on currently active treeWidgetItem
+ * signaled by currentItemChanged
*/
void MediaList::treeItemChanged(QTreeWidgetItem *currentwidgetitem, QTreeWidgetItem *) /*previouswidgetitem*/
{
- int treedepth = currentwidgetitem->data(0, Qt::UserRole).toInt();
- if (treedepth == 2){
- mp_treeWidget->setContextMenuPolicy(Qt::ActionsContextMenu);
- m_currentlyselected=currentwidgetitem->text(1);
- } else {
- mp_treeWidget->setContextMenuPolicy(Qt::NoContextMenu);
+ if ( m_checkcurwidget ) {
+ int treedepth = currentwidgetitem->data(0, Qt::UserRole).toInt();
+ if (treedepth == 2){
+ mp_treeWidget->setContextMenuPolicy(Qt::ActionsContextMenu);
+ m_currentlyselected=currentwidgetitem->text(1);
+ } else {
+ mp_treeWidget->setContextMenuPolicy(Qt::NoContextMenu);
+ }
}
}