treeWidget->setColumnCount(1);
treeWidget->setHeaderLabel( tr("Select Page") );
treeWidget->setContextMenuPolicy(Qt::ActionsContextMenu);
- // tabWidget->setTabsClosable(true); /* wait for QT 4.5 */
+ tabWidget->setTabsClosable(true); /* wait for QT 4.5 */
createPages();
resetFocus(); /* lineEdit->setFocus() */
foreach(Console *console, m_consoleHash) {
console->connect_dir();
}
+ /*
+ * Note, the notifier is now a global flag, although each notifier
+ * can be individually turned on and off at a socket level. Once
+ * the notifier is turned off, we don't accept anything from anyone
+ * this prevents unwanted messages from getting into the input
+ * dialogs such as restore that read from the director and "know"
+ * what to expect.
+ */
+ m_notify = true;
m_currentConsole = (Console*)getFromHash(m_firstItem);
QTimer::singleShot(2000, this, SLOT(popLists()));
if (m_miscDebug) {
* Create instances in alphabetic order of the rest
* of the classes that will by default exist under each Director.
*/
-// new bRestore();
+ new bRestore();
new Clients();
new FileSet();
new Jobs();
new MediaList();
new MediaView();
new Storage();
- if (m_openBrowser) {
- new restoreTree();
- }
+// if (m_openBrowser) {
+// new restoreTree();
+// }
if (m_openDirStat) {
new DirStat();
}
connect(treeWidget, SIGNAL(itemClicked(QTreeWidgetItem *, int)), this, SLOT(treeItemClicked(QTreeWidgetItem *, int)));
connect(treeWidget, SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)), this, SLOT(treeItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)));
connect(tabWidget, SIGNAL(currentChanged(int)), this, SLOT(stackItemChanged(int)));
+ connect(tabWidget, SIGNAL(tabCloseRequested(int)), this, SLOT(closePage(int)));
connect(actionQuit, SIGNAL(triggered()), app, SLOT(closeAllWindows()));
connect(actionLabel, SIGNAL(triggered()), this, SLOT(labelButtonClicked()));
connect(actionRun, SIGNAL(triggered()), this, SLOT(runButtonClicked()));
connect(actionRestore, SIGNAL(triggered()), this, SLOT(restoreButtonClicked()));
connect(actionUndock, SIGNAL(triggered()), this, SLOT(undockWindowButton()));
connect(actionToggleDock, SIGNAL(triggered()), this, SLOT(toggleDockContextWindow()));
- connect(actionClosePage, SIGNAL(triggered()), this, SLOT(closePage()));
+ connect(actionClosePage, SIGNAL(triggered()), this, SLOT(closeCurrentPage()));
connect(actionPreferences, SIGNAL(triggered()), this, SLOT(setPreferences()));
connect(actionRepopLists, SIGNAL(triggered()), this, SLOT(repopLists()));
connect(actionReloadRepop, SIGNAL(triggered()), this, SLOT(reloadRepopLists()));
disconnect(treeWidget, SIGNAL(itemClicked(QTreeWidgetItem *, int)), this, SLOT(treeItemClicked(QTreeWidgetItem *, int)));
disconnect(treeWidget, SIGNAL( currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)), this, SLOT(treeItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)));
disconnect(tabWidget, SIGNAL(currentChanged(int)), this, SLOT(stackItemChanged(int)));
+ disconnect(tabWidget, SIGNAL(tabCloseRequested(int)), this, SLOT(closePage(int)));
disconnect(actionQuit, SIGNAL(triggered()), app, SLOT(closeAllWindows()));
disconnect(actionLabel, SIGNAL(triggered()), this, SLOT(labelButtonClicked()));
disconnect(actionRun, SIGNAL(triggered()), this, SLOT(runButtonClicked()));
disconnect(actionRestore, SIGNAL(triggered()), this, SLOT(restoreButtonClicked()));
disconnect(actionUndock, SIGNAL(triggered()), this, SLOT(undockWindowButton()));
disconnect(actionToggleDock, SIGNAL(triggered()), this, SLOT(toggleDockContextWindow()));
- disconnect(actionClosePage, SIGNAL(triggered()), this, SLOT(closePage()));
+ disconnect(actionClosePage, SIGNAL(triggered()), this, SLOT(closeCurrentPage()));
disconnect(actionPreferences, SIGNAL(triggered()), this, SLOT(setPreferences()));
disconnect(actionRepopLists, SIGNAL(triggered()), this, SLOT(repopLists()));
disconnect(actionReloadRepop, SIGNAL(triggered()), this, SLOT(reloadRepopLists()));
*/
void MainWin::waitEnter()
{
- if (m_waitState){
- if (mainWin->m_connDebug)
- Pmsg0(000, "Should Never Get Here DANGER DANGER, for now I'll return\n");
+ if (m_waitState || m_isClosing) {
return;
}
m_waitState = true;
if (!m_waitState || m_isClosing) {
return;
}
- m_waitState = false;
if (mainWin->m_connDebug) Pmsg0(000, "Exiting Wait State\n");
if (m_waitTreeItem && (m_waitTreeItem != treeWidget->currentItem())) {
treeWidget->setCurrentItem(m_waitTreeItem);
connectConsoleSignals();
}
app->restoreOverrideCursor();
+ m_waitState = false;
}
void MainWin::connectConsoleSignals()
void MainWin::treeItemClicked(QTreeWidgetItem *item, int /*column*/)
{
/* Is this a page that has been inserted into the hash */
- if (getFromHash(item)) {
- Pages* page = getFromHash(item);
- int stackindex=tabWidget->indexOf(page);
+ Pages* page = getFromHash(item);
+ if (page) {
+ int stackindex = tabWidget->indexOf(page);
if (stackindex >= 0) {
tabWidget->setCurrentWidget(page);
}
+ page->dockPage();
/* run the virtual function in case this class overrides it */
page->PgSeltreeWidgetClicked();
+ } else {
+ Dmsg0(000, "Page not in hash");
}
}
void MainWin::browseButtonClicked()
{
- new restoreTree();
+// new restoreTree();
}
void MainWin::statusPageButtonClicked()
{
va_list arg_ptr;
char buf[1000];
- int len;
va_start(arg_ptr, fmt);
- len = bvsnprintf(buf, sizeof(buf), fmt, arg_ptr);
+ bvsnprintf(buf, sizeof(buf), fmt, arg_ptr);
va_end(arg_ptr);
set_status(buf);
}
void MainWin::undockWindowButton()
{
Pages* page = (Pages*)tabWidget->currentWidget();
- page->togglePageDocking();
+ if (page) {
+ page->togglePageDocking();
+ }
}
/*
/* Is this a page that has been inserted into the hash */
if (getFromHash(currentitem)) {
Pages* page = getFromHash(currentitem);
- page->togglePageDocking();
+ if (page) {
+ page->togglePageDocking();
+ }
}
}
if (m_isClosing) return; /* if closing the application, do nothing here */
Pages* page = (Pages*)tabWidget->currentWidget();
/* run the virtual function in case this class overrides it */
- page->currentStackItem();
+ if (page) {
+ page->currentStackItem();
+ }
if (!m_waitState) {
disconnect(treeWidget, SIGNAL(itemClicked(QTreeWidgetItem *, int)), this, SLOT(treeItemClicked(QTreeWidgetItem *, int)));
disconnect(treeWidget, SIGNAL( currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)), this, SLOT(treeItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)));
return m_widgethash.value(page);
}
+void MainWin::closeCurrentPage()
+{
+ closePage(-1);
+}
+
/*
* Function to respond to action on page selector context menu to close the
* current window.
*/
-void MainWin::closePage()
+void MainWin::closePage(int item)
{
- QTreeWidgetItem *currentitem = treeWidget->currentItem();
+ QTreeWidgetItem *currentitem;
+ Pages *page = NULL;
+
+ if (item >= 0) {
+ page = (Pages *)tabWidget->widget(item);
+ } else {
+ currentitem = treeWidget->currentItem();
+ /* Is this a page that has been inserted into the hash */
+ if (getFromHash(currentitem)) {
+ page = getFromHash(currentitem);
+ }
+ }
- /* Is this a page that has been inserted into the hash */
- if (getFromHash(currentitem)) {
- Pages* page = getFromHash(currentitem);
+ if (page) {
if (page->isCloseable()) {
page->closeStackPage();
+ } else {
+ page->hidePage();
}
}
}
}
/* Preferences dialog */
-prefsDialog::prefsDialog()
+prefsDialog::prefsDialog() : QDialog()
{
setupUi(this);
}
settings.endGroup();
settings.beginGroup("JobList");
m_recordLimitCheck = settings.value("recordLimitCheck", true).toBool();
- m_recordLimitVal = settings.value("recordLimitVal", 150).toInt();
+ m_recordLimitVal = settings.value("recordLimitVal", 50).toInt();
m_daysLimitCheck = settings.value("daysLimitCheck", false).toBool();
m_daysLimitVal = settings.value("daysLimitVal", 28).toInt();
settings.endGroup();