- switch (m_sock->msglen) {
- case BNET_MSGS_PENDING:
- if (g_commDebug) Pmsg0(000, "MSGS PENDING\n");
- write_dir(".messages");
- displayToPrompt();
- m_messages_pending = false;
- continue;
- case BNET_CMD_OK:
- if (g_commDebug) Pmsg0(000, "CMD OK\n");
- m_at_prompt = false;
- m_at_main_prompt = false;
- continue;
- case BNET_CMD_BEGIN:
- if (g_commDebug) Pmsg0(000, "CMD BEGIN\n");
- m_at_prompt = false;
- m_at_main_prompt = false;
- continue;
- case BNET_MAIN_PROMPT:
- if (g_commDebug) Pmsg0(000, "PROMPT\n");
- m_at_prompt = true;
- m_at_main_prompt = true;
- mainWin->set_status(_("At prompt waiting for input ..."));
- update_cursor();
- QApplication::restoreOverrideCursor();
- break;
- case BNET_PROMPT:
- if (g_commDebug) Pmsg0(000, "PROMPT\n");
- m_at_prompt = true;
- m_at_main_prompt = false;
- mainWin->set_status(_("At prompt waiting for input ..."));
- update_cursor();
- QApplication::restoreOverrideCursor();
- break;
- case BNET_CMD_FAILED:
- if (g_commDebug) Pmsg0(000, "CMD FAIL\n");
- mainWin->set_status(_("Command failed. At prompt waiting for input ..."));
- update_cursor();
- QApplication::restoreOverrideCursor();
- break;
- /* We should not get this one */
- case BNET_EOD:
- if (g_commDebug) Pmsg0(000, "EOD\n");
- mainWin->set_status_ready();
- update_cursor();
- QApplication::restoreOverrideCursor();
- if (!m_api_set) {
- break;
- }
- continue;
- case BNET_START_SELECT:
- new selectDialog(this);
- break;
- case BNET_RUN_CMD:
- new runCmdPage();
- break;
- case BNET_ERROR_MSG:
- m_sock->recv(); /* get the message */
- display_text(msg());
- QMessageBox::critical(this, "Error", msg(), QMessageBox::Ok);
- break;
- case BNET_WARNING_MSG:
- m_sock->recv(); /* get the message */
- display_text(msg());
- QMessageBox::critical(this, "Warning", msg(), QMessageBox::Ok);
- break;
- case BNET_INFO_MSG:
- m_sock->recv(); /* get the message */
- display_text(msg());
- mainWin->set_status(msg());
- break;
- }
- if (is_bnet_stop(m_sock)) { /* error or term request */
- m_sock->close();
- m_sock = NULL;
- mainWin->actionConnect->setIcon(QIcon(":images/disconnected.png"));
- QBrush redBrush(Qt::red);
- QTreeWidgetItem *item = mainWin->getFromHash(this);
- item->setForeground(0, redBrush);
- m_notifier->setEnabled(false);
- delete m_notifier;
- m_notifier = NULL;
- mainWin->set_status(_("Director disconnected."));
- QApplication::restoreOverrideCursor();
- stat = BNET_HARDEOF;
- }
- break;
- }
- return stat;