return;
DirComm *dircomm = m_dircommHash.value(conn);
- if (mainWin->m_checkMessages && dircomm->m_at_main_prompt && hasFocus()){
+ if (mainWin->m_checkMessages && dircomm->m_at_main_prompt && hasFocus() && !mainWin->getWaitState()){
messagesPending(true);
dircomm->write(".messages");
displayToPrompt(conn);
bool Console::dir_cmd(const char *cmd, QStringList &results)
{
int conn;
- if(availableDirComm(conn)) {
+ if (availableDirComm(conn)) {
dir_cmd(conn, cmd, results);
return true;
} else {
return true; /* ***FIXME*** return any command error */
}
-/* Send a command to the Director */
+/*
+ * Overloads for
+ * Sending a command to the Director
+ */
int Console::write_dir(const char *msg)
{
int conn;
- if(availableDirComm(conn))
+ if (availableDirComm(conn))
write_dir(conn, msg);
return conn;
}
-/* Send a command to the Director */
+int Console::write_dir(const char *msg, bool dowait)
+{
+ int conn;
+ if (availableDirComm(conn))
+ write_dir(conn, msg, dowait);
+ return conn;
+}
+
void Console::write_dir(int conn, const char *msg)
+{
+ write_dir(conn, msg, true);
+}
+
+/*
+ * Send a command to the Director
+ */
+void Console::write_dir(int conn, const char *msg, bool dowait)
{
DirComm *dircomm = m_dircommHash.value(conn);
if (dircomm->m_sock) {
mainWin->set_status(_("Processing command ..."));
- mainWin->waitEnter();
+ if (dowait)
+ mainWin->waitEnter();
dircomm->write(msg);
- mainWin->waitExit();
+ if (dowait)
+ mainWin->waitExit();
} else {
mainWin->set_status( tr(" Director not connected. Click on connect button."));
mainWin->actionConnect->setIcon(QIcon(":images/disconnected.png"));
/* Position cursor to end of screen */
void Console::update_cursor()
{
-// QApplication::restoreOverrideCursor();
m_textEdit->moveCursor(QTextCursor::End);
m_textEdit->ensureCursorVisible();
}
displayToPrompt(conn);
} else {
while (!dircomm->m_at_prompt) {
- stat=dircomm->read();
+ stat = dircomm->read();
+ if (stat < 0) {
+ break;
+ }
}
}
if (mainWin->m_commDebug) Pmsg2(000, "endDiscardToPrompt=%d %s\n", stat, m_dir->name());
int Console::notifyOff()
{
int conn = 0;
- if(availableDirComm(conn))
+ if (availableDirComm(conn))
notify(conn, false);
return conn;
}