Commit 11192201 authored by Eike Hein's avatar Eike Hein
Browse files

Better menu arrangement.

parent 92aaa62b
......@@ -360,16 +360,16 @@ void MainWindow::setupActions()
connect(action, SIGNAL(triggered(bool)), this, SLOT(handleContextDependentToggleAction(bool)));
m_contextDependentActions << action;
action = actionCollection()->addAction("toggle-session-monitor-silence");
action->setText(i18nc("@action", "Monitor for Silence"));
action->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_I));
action = actionCollection()->addAction("toggle-session-monitor-activity");
action->setText(i18nc("@action", "Monitor for Activity"));
action->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_A));
action->setCheckable(true);
connect(action, SIGNAL(triggered(bool)), this, SLOT(handleContextDependentToggleAction(bool)));
m_contextDependentActions << action;
action = actionCollection()->addAction("toggle-session-monitor-activity");
action->setText(i18nc("@action", "Monitor for Activity"));
action->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_A));
action = actionCollection()->addAction("toggle-session-monitor-silence");
action->setText(i18nc("@action", "Monitor for Silence"));
action->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_I));
action->setCheckable(true);
connect(action, SIGNAL(triggered(bool)), this, SLOT(handleContextDependentToggleAction(bool)));
m_contextDependentActions << action;
......@@ -448,11 +448,11 @@ void MainWindow::handleContextDependentToggleAction(bool checked, QAction* actio
m_tabBar->repaint();
}
if (action == actionCollection()->action("toggle-session-monitor-silence"))
m_sessionStack->setSessionMonitorSilenceEnabled(sessionId, checked);
if (action == actionCollection()->action("toggle-session-monitor-activity"))
m_sessionStack->setSessionMonitorActivityEnabled(sessionId, checked);
if (action == actionCollection()->action("toggle-session-monitor-silence"))
m_sessionStack->setSessionMonitorSilenceEnabled(sessionId, checked);
}
void MainWindow::setContextDependentActionsQuiet(bool quiet)
......@@ -475,7 +475,7 @@ void MainWindow::handleToggleTerminalKeyboardInput(bool checked)
m_sessionStack->setTerminalKeyboardInputEnabled(terminalId, !checked);
}
void MainWindow::handleToggleTerminalMonitorSilence(bool checked)
void MainWindow::handleToggleTerminalMonitorActivity(bool checked)
{
QAction* action = qobject_cast<QAction*>(QObject::sender());
......@@ -485,10 +485,10 @@ void MainWindow::handleToggleTerminalMonitorSilence(bool checked)
int terminalId = action->data().toInt(&ok);
if (!ok) return;
m_sessionStack->setTerminalMonitorSilenceEnabled(terminalId, checked);
m_sessionStack->setTerminalMonitorActivityEnabled(terminalId, checked);
}
void MainWindow::handleToggleTerminalMonitorActivity(bool checked)
void MainWindow::handleToggleTerminalMonitorSilence(bool checked)
{
QAction* action = qobject_cast<QAction*>(QObject::sender());
......@@ -498,35 +498,35 @@ void MainWindow::handleToggleTerminalMonitorActivity(bool checked)
int terminalId = action->data().toInt(&ok);
if (!ok) return;
m_sessionStack->setTerminalMonitorActivityEnabled(terminalId, checked);
m_sessionStack->setTerminalMonitorSilenceEnabled(terminalId, checked);
}
void MainWindow::handleTerminalSilence(Terminal* terminal)
void MainWindow::handleTerminalActivity(Terminal* terminal)
{
Session* session = qobject_cast<Session*>(sender());
if (session)
{
QString message(i18nc("@info", "Silence detected in monitored terminal in session \"%1\".",
disconnect(terminal, SIGNAL(activityDetected(Terminal*)), session, SIGNAL(activityDetected(Terminal*)));
QString message(i18nc("@info", "Activity detected in monitored terminal in session \"%1\".",
m_tabBar->tabTitle(session->id())));
KNotification::event(QLatin1String("silence"), message, QPixmap(), terminal->partWidget(),
KNotification::event(QLatin1String("activity"), message, QPixmap(), terminal->partWidget(),
KNotification::CloseWhenWidgetActivated);
}
}
void MainWindow::handleTerminalActivity(Terminal* terminal)
void MainWindow::handleTerminalSilence(Terminal* terminal)
{
Session* session = qobject_cast<Session*>(sender());
if (session)
{
disconnect(terminal, SIGNAL(activityDetected(Terminal*)), session, SIGNAL(activityDetected(Terminal*)));
QString message(i18nc("@info", "Activity detected in monitored terminal in session \"%1\".",
QString message(i18nc("@info", "Silence detected in monitored terminal in session \"%1\".",
m_tabBar->tabTitle(session->id())));
KNotification::event(QLatin1String("activity"), message, QPixmap(), terminal->partWidget(),
KNotification::event(QLatin1String("silence"), message, QPixmap(), terminal->partWidget(),
KNotification::CloseWhenWidgetActivated);
}
}
......
......@@ -74,11 +74,11 @@ class MainWindow : public KMainWindow
void handleContextDependentAction(QAction* action = 0, int sessionId = -1);
void handleContextDependentToggleAction(bool checked, QAction* action = 0, int sessionId = -1);
void handleToggleTerminalKeyboardInput(bool checked);
void handleToggleTerminalMonitorSilence(bool checked);
void handleToggleTerminalMonitorActivity(bool checked);
void handleToggleTerminalMonitorSilence(bool checked);
void handleTerminalSilence(Terminal* terminal);
void handleTerminalActivity(Terminal* terminal);
void handleTerminalSilence(Terminal* terminal);
signals:
......
......@@ -519,45 +519,6 @@ bool Session::hasTerminalsWithKeyboardInputDisabled()
return false;
}
bool Session::monitorSilenceEnabled()
{
int monitorSilenceEnabledCount = 0;
QMapIterator<int, Terminal*> i(m_terminals);
while (i.hasNext())
{
i.next();
if (!i.value()->monitorSilenceEnabled())
++monitorSilenceEnabledCount;
}
return m_terminals.count() != monitorSilenceEnabledCount;
}
void Session::setMonitorSilenceEnabled(bool enabled)
{
QMapIterator<int, Terminal*> i(m_terminals);
while (i.hasNext())
setMonitorSilenceEnabled(i.next().key(), enabled);
}
bool Session::monitorSilenceEnabled(int terminalId)
{
if (!m_terminals.contains(terminalId)) return false;
return m_terminals.value(terminalId)->monitorSilenceEnabled();
}
void Session::setMonitorSilenceEnabled(int terminalId, bool enabled)
{
if (!m_terminals.contains(terminalId)) return;
m_terminals.value(terminalId)->setMonitorSilenceEnabled(enabled);
}
bool Session::monitorActivityEnabled()
{
int monitorActivityEnabledCount = 0;
......@@ -614,3 +575,42 @@ void Session::reconnectMonitorActivitySignals()
Qt::UniqueConnection);
}
}
bool Session::monitorSilenceEnabled()
{
int monitorSilenceEnabledCount = 0;
QMapIterator<int, Terminal*> i(m_terminals);
while (i.hasNext())
{
i.next();
if (!i.value()->monitorSilenceEnabled())
++monitorSilenceEnabledCount;
}
return m_terminals.count() != monitorSilenceEnabledCount;
}
void Session::setMonitorSilenceEnabled(bool enabled)
{
QMapIterator<int, Terminal*> i(m_terminals);
while (i.hasNext())
setMonitorSilenceEnabled(i.next().key(), enabled);
}
bool Session::monitorSilenceEnabled(int terminalId)
{
if (!m_terminals.contains(terminalId)) return false;
return m_terminals.value(terminalId)->monitorSilenceEnabled();
}
void Session::setMonitorSilenceEnabled(int terminalId, bool enabled)
{
if (!m_terminals.contains(terminalId)) return;
m_terminals.value(terminalId)->setMonitorSilenceEnabled(enabled);
}
......@@ -60,16 +60,16 @@ class Session : public QObject
void setKeyboardInputEnabled(int terminalId, bool enabled);
bool hasTerminalsWithKeyboardInputDisabled();
bool monitorSilenceEnabled();
void setMonitorSilenceEnabled(bool enabled);
bool monitorSilenceEnabled(int terminalId);
void setMonitorSilenceEnabled(int terminalId, bool enabled);
bool monitorActivityEnabled();
void setMonitorActivityEnabled(bool enabled);
bool monitorActivityEnabled(int terminalId);
void setMonitorActivityEnabled(int terminalId, bool enabled);
bool monitorSilenceEnabled();
void setMonitorSilenceEnabled(bool enabled);
bool monitorSilenceEnabled(int terminalId);
void setMonitorSilenceEnabled(int terminalId, bool enabled);
bool closable() { return m_closable; }
void setClosable(bool closable) { m_closable = closable; }
......@@ -98,8 +98,8 @@ class Session : public QObject
void titleChanged(int sessionId, const QString& title);
void terminalManuallyActivated(Terminal* terminal);
void keyboardInputBlocked(Terminal* terminal);
void silenceDetected(Terminal* terminal);
void activityDetected(Terminal* terminal);
void silenceDetected(Terminal* terminal);
void destroyed(int sessionId);
......
......@@ -50,8 +50,8 @@ int SessionStack::addSession(Session::SessionType type)
connect(session, SIGNAL(titleChanged(int,QString)), this, SIGNAL(titleChanged(int,QString)));
connect(session, SIGNAL(terminalManuallyActivated(Terminal*)), this, SLOT(handleManualTerminalActivation(Terminal*)));
connect(session, SIGNAL(keyboardInputBlocked(Terminal*)), m_visualEventOverlay, SLOT(indicateKeyboardInputBlocked(Terminal*)));
connect(session, SIGNAL(silenceDetected(Terminal*)), parentWidget(), SLOT(handleTerminalSilence(Terminal*)));
connect(session, SIGNAL(activityDetected(Terminal*)), parentWidget(), SLOT(handleTerminalActivity(Terminal*)));
connect(session, SIGNAL(silenceDetected(Terminal*)), parentWidget(), SLOT(handleTerminalSilence(Terminal*)));
connect(parentWidget(), SIGNAL(windowClosed()), session, SLOT(reconnectMonitorActivitySignals()));
connect(session, SIGNAL(destroyed(int)), this, SLOT(cleanup(int)));
......@@ -335,76 +335,76 @@ bool SessionStack::hasUnclosableSessions() const
return false;
}
bool SessionStack::isSessionMonitorSilenceEnabled(int sessionId)
bool SessionStack::isSessionMonitorActivityEnabled(int sessionId)
{
if (sessionId == -1) sessionId = m_activeSessionId;
if (sessionId == -1) return false;
if (!m_sessions.contains(sessionId)) return false;
return m_sessions.value(sessionId)->monitorSilenceEnabled();
return m_sessions.value(sessionId)->monitorActivityEnabled();
}
void SessionStack::setSessionMonitorSilenceEnabled(int sessionId, bool enabled)
void SessionStack::setSessionMonitorActivityEnabled(int sessionId, bool enabled)
{
if (sessionId == -1) sessionId = m_activeSessionId;
if (sessionId == -1) return;
if (!m_sessions.contains(sessionId)) return;
m_sessions.value(sessionId)->setMonitorSilenceEnabled(enabled);
m_sessions.value(sessionId)->setMonitorActivityEnabled(enabled);
}
bool SessionStack::isTerminalMonitorSilenceEnabled(int terminalId)
bool SessionStack::isTerminalMonitorActivityEnabled(int terminalId)
{
int sessionId = sessionIdForTerminalId(terminalId);
if (sessionId == -1) return false;
if (!m_sessions.contains(sessionId)) return false;
return m_sessions.value(sessionId)->monitorSilenceEnabled(terminalId);
return m_sessions.value(sessionId)->monitorActivityEnabled(terminalId);
}
void SessionStack::setTerminalMonitorSilenceEnabled(int terminalId, bool enabled)
void SessionStack::setTerminalMonitorActivityEnabled(int terminalId, bool enabled)
{
int sessionId = sessionIdForTerminalId(terminalId);
if (sessionId == -1) return;
if (!m_sessions.contains(sessionId)) return;
m_sessions.value(sessionId)->setMonitorSilenceEnabled(terminalId, enabled);
m_sessions.value(sessionId)->setMonitorActivityEnabled(terminalId, enabled);
}
bool SessionStack::isSessionMonitorActivityEnabled(int sessionId)
bool SessionStack::isSessionMonitorSilenceEnabled(int sessionId)
{
if (sessionId == -1) sessionId = m_activeSessionId;
if (sessionId == -1) return false;
if (!m_sessions.contains(sessionId)) return false;
return m_sessions.value(sessionId)->monitorActivityEnabled();
return m_sessions.value(sessionId)->monitorSilenceEnabled();
}
void SessionStack::setSessionMonitorActivityEnabled(int sessionId, bool enabled)
void SessionStack::setSessionMonitorSilenceEnabled(int sessionId, bool enabled)
{
if (sessionId == -1) sessionId = m_activeSessionId;
if (sessionId == -1) return;
if (!m_sessions.contains(sessionId)) return;
m_sessions.value(sessionId)->setMonitorActivityEnabled(enabled);
m_sessions.value(sessionId)->setMonitorSilenceEnabled(enabled);
}
bool SessionStack::isTerminalMonitorActivityEnabled(int terminalId)
bool SessionStack::isTerminalMonitorSilenceEnabled(int terminalId)
{
int sessionId = sessionIdForTerminalId(terminalId);
if (sessionId == -1) return false;
if (!m_sessions.contains(sessionId)) return false;
return m_sessions.value(sessionId)->monitorActivityEnabled(terminalId);
return m_sessions.value(sessionId)->monitorSilenceEnabled(terminalId);
}
void SessionStack::setTerminalMonitorActivityEnabled(int terminalId, bool enabled)
void SessionStack::setTerminalMonitorSilenceEnabled(int terminalId, bool enabled)
{
int sessionId = sessionIdForTerminalId(terminalId);
if (sessionId == -1) return;
if (!m_sessions.contains(sessionId)) return;
m_sessions.value(sessionId)->setMonitorActivityEnabled(terminalId, enabled);
m_sessions.value(sessionId)->setMonitorSilenceEnabled(terminalId, enabled);
}
void SessionStack::editProfile(int sessionId)
......
......@@ -93,16 +93,16 @@ class SessionStack : public QStackedWidget
Q_SCRIPTABLE void setSessionClosable(int sessionId, bool closable);
Q_SCRIPTABLE bool hasUnclosableSessions() const;
Q_SCRIPTABLE bool isSessionMonitorSilenceEnabled(int sessionId);
Q_SCRIPTABLE void setSessionMonitorSilenceEnabled(int sessionId, bool enabled);
Q_SCRIPTABLE bool isTerminalMonitorSilenceEnabled(int terminalId);
Q_SCRIPTABLE void setTerminalMonitorSilenceEnabled(int terminalId, bool enabled);
Q_SCRIPTABLE bool isSessionMonitorActivityEnabled(int sessionId);
Q_SCRIPTABLE void setSessionMonitorActivityEnabled(int sessionId, bool enabled);
Q_SCRIPTABLE bool isTerminalMonitorActivityEnabled(int terminalId);
Q_SCRIPTABLE void setTerminalMonitorActivityEnabled(int terminalId, bool enabled);
Q_SCRIPTABLE bool isSessionMonitorSilenceEnabled(int sessionId);
Q_SCRIPTABLE void setSessionMonitorSilenceEnabled(int sessionId, bool enabled);
Q_SCRIPTABLE bool isTerminalMonitorSilenceEnabled(int terminalId);
Q_SCRIPTABLE void setTerminalMonitorSilenceEnabled(int terminalId, bool enabled);
void handleTerminalHighlightRequest(int terminalId);
......
......@@ -66,8 +66,8 @@ TabBar::TabBar(MainWindow* mainWindow) : QWidget(mainWindow)
connect(m_tabContextMenu, SIGNAL(hovered(QAction*)), this, SLOT(contextMenuActionHovered(QAction*)));
m_toggleKeyboardInputMenu = new KMenu(i18nc("@title:menu", "Disable Keyboard Input"), this);
m_toggleMonitorSilenceMenu = new KMenu(i18nc("@title:menu", "Monitor for Silence"), this);
m_toggleMonitorActivityMenu = new KMenu(i18nc("@title:menu", "Monitor for Activity"), this);
m_toggleMonitorSilenceMenu = new KMenu(i18nc("@title:menu", "Monitor for Silence"), this);
m_sessionMenu = new KMenu(this);
connect(m_sessionMenu, SIGNAL(aboutToShow()), this, SLOT(readySessionMenu()));
......@@ -124,10 +124,10 @@ void TabBar::readyTabContextMenu()
m_tabContextMenu->addSeparator();
m_tabContextMenu->addAction(m_mainWindow->actionCollection()->action("edit-profile"));
m_tabContextMenu->addAction(m_mainWindow->actionCollection()->action("rename-session"));
m_tabContextMenu->addMenu(m_toggleKeyboardInputMenu);
m_tabContextMenu->addAction(m_mainWindow->actionCollection()->action("toggle-session-prevent-closing"));
m_tabContextMenu->addMenu(m_toggleMonitorSilenceMenu);
m_tabContextMenu->addMenu(m_toggleKeyboardInputMenu);
m_tabContextMenu->addMenu(m_toggleMonitorActivityMenu);
m_tabContextMenu->addMenu(m_toggleMonitorSilenceMenu);
m_tabContextMenu->addSeparator();
m_tabContextMenu->addAction(m_mainWindow->actionCollection()->action("move-session-left"));
m_tabContextMenu->addAction(m_mainWindow->actionCollection()->action("move-session-right"));
......@@ -176,11 +176,11 @@ void TabBar::updateToggleActions(int sessionId)
toggleAction = actionCollection->action("toggle-session-prevent-closing");
toggleAction->setChecked(!sessionStack->isSessionClosable(sessionId));
toggleAction = actionCollection->action("toggle-session-monitor-silence");
toggleAction->setChecked(sessionStack->isSessionMonitorSilenceEnabled(sessionId));
toggleAction = actionCollection->action("toggle-session-monitor-activity");
toggleAction->setChecked(sessionStack->isSessionMonitorActivityEnabled(sessionId));
toggleAction = actionCollection->action("toggle-session-monitor-silence");
toggleAction->setChecked(sessionStack->isSessionMonitorSilenceEnabled(sessionId));
}
void TabBar::updateToggleKeyboardInputMenu(int sessionId)
......@@ -231,34 +231,34 @@ void TabBar::updateToggleKeyboardInputMenu(int sessionId)
}
}
void TabBar::updateToggleMonitorSilenceMenu(int sessionId)
void TabBar::updateToggleMonitorActivityMenu(int sessionId)
{
if (!m_tabs.contains(sessionId)) return;
QAction* toggleMonitorSilenceAction = m_mainWindow->actionCollection()->action("toggle-session-monitor-silence");
QAction* anchor = m_toggleMonitorSilenceMenu->menuAction();
QAction* toggleMonitorActivityAction = m_mainWindow->actionCollection()->action("toggle-session-monitor-activity");
QAction* anchor = m_toggleMonitorActivityMenu->menuAction();
SessionStack* sessionStack = m_mainWindow->sessionStack();
QStringList terminalIds = sessionStack->terminalIdsForSessionId(sessionId).split(',', QString::SkipEmptyParts);
m_toggleMonitorSilenceMenu->clear();
m_toggleMonitorActivityMenu->clear();
if (terminalIds.count() <= 1)
{
toggleMonitorSilenceAction->setText(i18nc("@action", "Monitor for Silence"));
m_tabContextMenu->insertAction(anchor, toggleMonitorSilenceAction);
m_toggleMonitorSilenceMenu->menuAction()->setVisible(false);
toggleMonitorActivityAction->setText(i18nc("@action", "Monitor for Activity"));
m_tabContextMenu->insertAction(anchor, toggleMonitorActivityAction);
m_toggleMonitorActivityMenu->menuAction()->setVisible(false);
}
else
{
toggleMonitorSilenceAction->setText(i18nc("@action", "In This Session"));
m_toggleMonitorSilenceMenu->menuAction()->setVisible(true);
toggleMonitorActivityAction->setText(i18nc("@action", "In This Session"));
m_toggleMonitorActivityMenu->menuAction()->setVisible(true);
m_tabContextMenu->removeAction(toggleMonitorSilenceAction);
m_toggleMonitorSilenceMenu->addAction(toggleMonitorSilenceAction);
m_tabContextMenu->removeAction(toggleMonitorActivityAction);
m_toggleMonitorActivityMenu->addAction(toggleMonitorActivityAction);
m_toggleMonitorSilenceMenu->addSeparator();
m_toggleMonitorActivityMenu->addSeparator();
int count = 0;
......@@ -270,43 +270,43 @@ void TabBar::updateToggleMonitorSilenceMenu(int sessionId)
++count;
QAction* action = m_toggleMonitorSilenceMenu->addAction(i18nc("@action", "In Terminal %1", count));
QAction* action = m_toggleMonitorActivityMenu->addAction(i18nc("@action", "In Terminal %1", count));
action->setCheckable(true);
action->setChecked(sessionStack->isTerminalMonitorSilenceEnabled(terminalId));
action->setChecked(sessionStack->isTerminalMonitorActivityEnabled(terminalId));
action->setData(terminalId);
connect(action, SIGNAL(triggered(bool)), m_mainWindow, SLOT(handleToggleTerminalMonitorSilence(bool)));
connect(action, SIGNAL(triggered(bool)), m_mainWindow, SLOT(handleToggleTerminalMonitorActivity(bool)));
}
}
}
void TabBar::updateToggleMonitorActivityMenu(int sessionId)
void TabBar::updateToggleMonitorSilenceMenu(int sessionId)
{
if (!m_tabs.contains(sessionId)) return;
QAction* toggleMonitorActivityAction = m_mainWindow->actionCollection()->action("toggle-session-monitor-activity");
QAction* anchor = m_toggleMonitorActivityMenu->menuAction();
QAction* toggleMonitorSilenceAction = m_mainWindow->actionCollection()->action("toggle-session-monitor-silence");
QAction* anchor = m_toggleMonitorSilenceMenu->menuAction();
SessionStack* sessionStack = m_mainWindow->sessionStack();
QStringList terminalIds = sessionStack->terminalIdsForSessionId(sessionId).split(',', QString::SkipEmptyParts);
m_toggleMonitorActivityMenu->clear();
m_toggleMonitorSilenceMenu->clear();
if (terminalIds.count() <= 1)
{
toggleMonitorActivityAction->setText(i18nc("@action", "Monitor for Activity"));
m_tabContextMenu->insertAction(anchor, toggleMonitorActivityAction);
m_toggleMonitorActivityMenu->menuAction()->setVisible(false);
toggleMonitorSilenceAction->setText(i18nc("@action", "Monitor for Silence"));
m_tabContextMenu->insertAction(anchor, toggleMonitorSilenceAction);
m_toggleMonitorSilenceMenu->menuAction()->setVisible(false);
}
else
{
toggleMonitorActivityAction->setText(i18nc("@action", "In This Session"));
m_toggleMonitorActivityMenu->menuAction()->setVisible(true);
toggleMonitorSilenceAction->setText(i18nc("@action", "In This Session"));
m_toggleMonitorSilenceMenu->menuAction()->setVisible(true);
m_tabContextMenu->removeAction(toggleMonitorActivityAction);
m_toggleMonitorActivityMenu->addAction(toggleMonitorActivityAction);
m_tabContextMenu->removeAction(toggleMonitorSilenceAction);
m_toggleMonitorSilenceMenu->addAction(toggleMonitorSilenceAction);
m_toggleMonitorActivityMenu->addSeparator();
m_toggleMonitorSilenceMenu->addSeparator();
int count = 0;
......@@ -318,11 +318,11 @@ void TabBar::updateToggleMonitorActivityMenu(int sessionId)
++count;
QAction* action = m_toggleMonitorActivityMenu->addAction(i18nc("@action", "In Terminal %1", count));
QAction* action = m_toggleMonitorSilenceMenu->addAction(i18nc("@action", "In Terminal %1", count));
action->setCheckable(true);
action->setChecked(sessionStack->isTerminalMonitorActivityEnabled(terminalId));
action->setChecked(sessionStack->isTerminalMonitorSilenceEnabled(terminalId));
action->setData(terminalId);
connect(action, SIGNAL(triggered(bool)), m_mainWindow, SLOT(handleToggleTerminalMonitorActivity(bool)));
connect(action, SIGNAL(triggered(bool)), m_mainWindow, SLOT(handleToggleTerminalMonitorSilence(bool)));
}
}
}
......@@ -358,8 +358,8 @@ void TabBar::contextMenuEvent(QContextMenuEvent* event)
int sessionId = sessionAtTab(index);
updateToggleActions(sessionId);
updateToggleKeyboardInputMenu(sessionId);
updateToggleMonitorSilenceMenu(sessionId);
updateToggleMonitorActivityMenu(sessionId);
updateToggleMonitorSilenceMenu(sessionId);
m_mainWindow->setContextDependentActionsQuiet(true);
......@@ -380,8 +380,8 @@ void TabBar::contextMenuEvent(QContextMenuEvent* event)
updateMoveActions(m_tabs.indexOf(m_selectedSessionId));
updateToggleActions(m_selectedSessionId);
updateToggleKeyboardInputMenu(m_selectedSessionId);
updateToggleMonitorSilenceMenu(m_selectedSessionId);
updateToggleMonitorActivityMenu(m_selectedSessionId);
updateToggleMonitorSilenceMenu(m_selectedSessionId);
}
QWidget::contextMenuEvent(event);
......
......@@ -136,8 +136,8 @@ class TabBar : public QWidget
KMenu* m_tabContextMenu;
KMenu* m_toggleKeyboardInputMenu;
KMenu* m_toggleMonitorSilenceMenu;
KMenu* m_toggleMonitorActivityMenu;
KMenu* m_toggleMonitorSilenceMenu;
KMenu* m_sessionMenu;
KLineEdit* m_lineEdit;
......
......@@ -49,8 +49,8 @@ Terminal::Terminal(QWidget* parent) : QObject(parent)
m_keyboardInputEnabled = true;
m_monitorSilenceEnabled = false;
m_monitorActivityEnabled = false;
m_monitorSilenceEnabled = false;
m_part = NULL;
m_terminalInterface = NULL;
......@@ -247,54 +247,54 @@ void Terminal::overrideShortcut(QKeyEvent* /* event */, bool& override)
override = false;
}
void Terminal::setMonitorSilenceEnabled(bool enabled)
void Terminal::setMonitorActivityEnabled(bool enabled)
{
m_monitorSilenceEnabled = enabled;
m_monitorActivityEnabled = enabled;
if (enabled)
{
connect(m_part, SIGNAL(silenceDetected()), this, SLOT(silenceDetected()),
connect(m_part, SIGNAL(activityDetected()), this, SLOT(activityDetected()),
Qt::UniqueConnection);
QMetaObject::invokeMethod(m_part, "setMonitorSilenceEnabled",
QMetaObject::invokeMethod(m_part, "setMonitorActivityEnabled",
Qt::QueuedConnection, Q_ARG(bool, true));
}
else
{
disconnect(m_part, SIGNAL(silenceDetected()), this, SLOT(silenceDetected()));
disconnect(m_part, SIGNAL(activityDetected()), this, SLOT(activityDetected()));
QMetaObject::invokeMethod(m_part, "setMonitorSilenceEnabled",
QMetaObject::invokeMethod(m_part, "setMonitorActivityEnabled",
Qt::QueuedConnection, Q_ARG(bool, false));
}
}
void Terminal::setMonitorActivityEnabled(bool enabled)
void Terminal::setMonitorSilenceEnabled(bool enabled)
{
m_monitorActivityEnabled = enabled;
m_monitorSilenceEnabled = enabled;
if (enabled)
{
connect(m_part, SIGNAL(activityDetected()), this, SLOT(activityDetected()),
connect(m_part, SIGNAL<