/* Update page selector to green to indicate that Console is connected */
mainWin->actionConnect->setIcon(QIcon(QString::fromUtf8("images/connected.png")));
QBrush greenBrush(Qt::green);
- m_treeItem->setForeground(0, greenBrush);
+ m_consoleItem->setForeground(0, greenBrush);
}
jcr.dir_bsock = m_sock;
mainWin->set_status(" Director not connected. Click on connect button.");
mainWin->actionConnect->setIcon(QIcon(QString::fromUtf8("images/disconnected.png")));
QBrush redBrush(Qt::red);
- m_treeItem->setForeground(0, redBrush);
+ m_consoleItem->setForeground(0, redBrush);
m_at_prompt = false;
}
}
m_sock = NULL;
mainWin->actionConnect->setIcon(QIcon(QString::fromUtf8("images/disconnected.png")));
QBrush redBrush(Qt::red);
- m_treeItem->setForeground(0, redBrush);
+ m_consoleItem->setForeground(0, redBrush);
m_notifier->setEnabled(false);
delete m_notifier;
m_notifier = NULL;
m_notifier->setEnabled(enable);
}
+void Console::setTreeItem(QTreeWidgetItem *item)
+{
+ m_consoleItem = item;
+}
+
void Console::setDirRes(DIRRES *dir)
{
m_dir = dir;
}
-#ifdef xxx
-******FIXME****** Just Delete me
-void Console::dosql(QString* sqlcmd, QStringList& strlstret)
-{
- int stat;
- /* don't effect the string coming in */
- QString cmd(*sqlcmd);
-
- cmd = ".sql \"" + cmd + "\"";
-
- write_dir(cmd.toUtf8().data());
- while ((stat=read()) > 0) {
- QString line = msg();
- QRegExp regex("^Using Catalog");
- if ( regex.indexIn(line) < 0 ){
- strlstret.append(line);
- }
- }
-}
-#endif
treeWidget->setHeaderLabel("Select Page");
treeWidget->setContextMenuPolicy(Qt::ActionsContextMenu);
- m_pages = 0;
createPages();
resetFocus();
/* The top tree item representing the director */
topItem = createTopPage(dir->name());
- topItem->setData(0, Qt::UserRole, QVariant(m_pages));
- m_pages++;
topItem->setIcon(0, QIcon(QString::fromUtf8("images/server.png")));
/* Create Tree Widget Item */
item = createPage("Console", topItem);
- m_console->SetPassedValues(stackedWidget, item, m_pages );
+ m_console->setTreeItem(item);
/* Append to pagelist */
- m_pagehash.insert(m_pages, m_console);
+ m_pagehash.insert(item, m_console);
+ m_widgethash.insert(m_console, item);
/* Set Color of treeWidgetItem for the console
* It will be set to gree in the console class if the connection is made.
*/
/* brestore */
- m_pages++;
item=createPage("brestore", topItem);
- bRestore* brestore=new bRestore(stackedWidget, item, m_pages);
- m_pagehash.insert(m_pages, brestore);
+ bRestore* brestore=new bRestore(stackedWidget);
+ m_pagehash.insert(item, brestore);
+ m_widgethash.insert(brestore, item);
/* lastly for now, the medialist */
- m_pages++;
item=createPage("Media", topItem );
- MediaList* medialist=new MediaList(stackedWidget, m_console, item, m_pages);
- m_pagehash.insert(m_pages, medialist);
+ MediaList* medialist=new MediaList(stackedWidget, m_console);
+ m_pagehash.insert(item, medialist);
+ m_widgethash.insert(medialist, item);
/* Iterate through and add to the stack */
foreach(Pages *page, m_pagehash)
* This subroutine is called with an item in the Page Selection window
* is clicked
*/
-void MainWin::treeItemClicked(QTreeWidgetItem *item, int column)
+void MainWin::treeItemClicked(QTreeWidgetItem *item, int /*column*/)
{
- /* Use tree item's Qt::UserRole to get treeindex */
- int treeindex = item->data(column, Qt::UserRole).toInt();
-
/* Is this one of the first level pages */
- if( m_pagehash.value(treeindex) ){
- Pages* page = m_pagehash.value(treeindex);
+ if( m_pagehash.value(item) ){
+ Pages* page = m_pagehash.value(item);
int stackindex=stackedWidget->indexOf(page);
if( stackindex >= 0 ){
stackedWidget->setCurrentWidget(page);
}
/* run the virtual function in case this class overrides it */
- if( treeindex > 0 ){
- page->PgSeltreeWidgetClicked();
- }
+ page->PgSeltreeWidgetClicked();
}
}
*/
void MainWin::treeItemChanged(QTreeWidgetItem *currentitem, QTreeWidgetItem *previousitem)
{
- int treeindex;
/* The Previous item */
- /* Use tree item's Qt::UserRole to get treeindex now for the previousitem */
if ( previousitem ){
- treeindex = previousitem->data(0, Qt::UserRole).toInt();
/* Is this one of the first level pages */
- if( m_pagehash.value(treeindex) ){
- Pages* page = m_pagehash.value(treeindex);
+ if( m_pagehash.value(previousitem) ){
+ Pages* page = m_pagehash.value(previousitem);
treeWidget->removeAction(actionToggleDock);
foreach( QAction* pageaction, page->m_contextActions ){
treeWidget->removeAction(pageaction);
}
}
- /* Use tree item's Qt::UserRole to get treeindex */
- treeindex = currentitem->data(0, Qt::UserRole).toInt();
-
/* Is this one of the first level pages */
- if( m_pagehash.value(treeindex) ){
- Pages* page = m_pagehash.value(treeindex);
+ if( m_pagehash.value(currentitem) ){
+ Pages* page = m_pagehash.value(currentitem);
int stackindex = stackedWidget->indexOf(page);
/* Is this page currently on the stack */
{
QTreeWidgetItem *currentitem = treeWidget->currentItem();
- /* Use tree item's Qt::UserRole to get treeindex */
- int treeindex = currentitem->data(0, Qt::UserRole).toInt();
-
/* Is this one of the first level pages */
- if( m_pagehash.value(treeindex) ){
- Pages* page = m_pagehash.value(treeindex);
+ if( m_pagehash.value(currentitem) ){
+ Pages* page = m_pagehash.value(currentitem);
page->togglePageDocking();
if ( page->isDocked() ){
stackedWidget->setCurrentWidget(page);
{
QTreeWidgetItem *currentitem = treeWidget->currentItem();
- /* Use tree item's Qt::UserRole to get treeindex */
- int treeindex = currentitem->data(0, Qt::UserRole).toInt();
-
/* Is this one of the first level pages */
- if( m_pagehash.value(treeindex) ){
- Pages* page = m_pagehash.value(treeindex);
+ if( m_pagehash.value(currentitem) ){
+ Pages* page = m_pagehash.value(currentitem);
setContextMenuDockText(page, currentitem);
}
}