66
71
connect(m_tabContextMenu, SIGNAL(hovered(QAction*)), this, SLOT(contextMenuActionHovered(QAction*)));
68
73
m_toggleKeyboardInputMenu = new KMenu(i18nc("@title:menu", "Disable Keyboard Input"), this);
74
m_toggleMonitorActivityMenu = new KMenu(i18nc("@title:menu", "Monitor for Activity"), this);
75
m_toggleMonitorSilenceMenu = new KMenu(i18nc("@title:menu", "Monitor for Silence"), this);
70
77
m_sessionMenu = new KMenu(this);
71
78
connect(m_sessionMenu, SIGNAL(aboutToShow()), this, SLOT(readySessionMenu()));
122
129
m_tabContextMenu->addSeparator();
123
130
m_tabContextMenu->addAction(m_mainWindow->actionCollection()->action("edit-profile"));
124
131
m_tabContextMenu->addAction(m_mainWindow->actionCollection()->action("rename-session"));
132
m_tabContextMenu->addAction(m_mainWindow->actionCollection()->action("toggle-session-prevent-closing"));
125
133
m_tabContextMenu->addMenu(m_toggleKeyboardInputMenu);
126
m_tabContextMenu->addAction(m_mainWindow->actionCollection()->action("toggle-session-prevent-closing"));
134
m_tabContextMenu->addMenu(m_toggleMonitorActivityMenu);
135
m_tabContextMenu->addMenu(m_toggleMonitorSilenceMenu);
127
136
m_tabContextMenu->addSeparator();
128
137
m_tabContextMenu->addAction(m_mainWindow->actionCollection()->action("move-session-left"));
129
138
m_tabContextMenu->addAction(m_mainWindow->actionCollection()->action("move-session-right"));
166
175
KActionCollection* actionCollection = m_mainWindow->actionCollection();
167
176
SessionStack* sessionStack = m_mainWindow->sessionStack();
169
QAction* toggleAction = actionCollection->action("toggle-session-keyboard-input");
170
toggleAction->setChecked(!sessionStack->isSessionKeyboardInputEnabled(sessionId));
172
toggleAction = actionCollection->action("toggle-session-prevent-closing");
178
QAction* toggleAction = actionCollection->action("toggle-session-prevent-closing");
173
179
toggleAction->setChecked(!sessionStack->isSessionClosable(sessionId));
181
toggleAction = actionCollection->action("toggle-session-keyboard-input");
182
toggleAction->setChecked(!sessionStack->hasTerminalsWithKeyboardInputEnabled(sessionId));
184
toggleAction = actionCollection->action("toggle-session-monitor-activity");
185
toggleAction->setChecked(!sessionStack->hasTerminalsWithMonitorActivityDisabled(sessionId));
187
toggleAction = actionCollection->action("toggle-session-monitor-silence");
188
toggleAction->setChecked(!sessionStack->hasTerminalsWithMonitorSilenceDisabled(sessionId));
176
191
void TabBar::updateToggleKeyboardInputMenu(int sessionId)
239
void TabBar::updateToggleMonitorActivityMenu(int sessionId)
241
if (!m_tabs.contains(sessionId)) return;
243
QAction* toggleMonitorActivityAction = m_mainWindow->actionCollection()->action("toggle-session-monitor-activity");
244
QAction* anchor = m_toggleMonitorActivityMenu->menuAction();
246
SessionStack* sessionStack = m_mainWindow->sessionStack();
248
QStringList terminalIds = sessionStack->terminalIdsForSessionId(sessionId).split(',', QString::SkipEmptyParts);
250
m_toggleMonitorActivityMenu->clear();
252
if (terminalIds.count() <= 1)
254
toggleMonitorActivityAction->setText(i18nc("@action", "Monitor for Activity"));
255
m_tabContextMenu->insertAction(anchor, toggleMonitorActivityAction);
256
m_toggleMonitorActivityMenu->menuAction()->setVisible(false);
260
toggleMonitorActivityAction->setText(i18nc("@action", "In This Session"));
261
m_toggleMonitorActivityMenu->menuAction()->setVisible(true);
263
m_tabContextMenu->removeAction(toggleMonitorActivityAction);
264
m_toggleMonitorActivityMenu->addAction(toggleMonitorActivityAction);
266
m_toggleMonitorActivityMenu->addSeparator();
270
QStringListIterator i(terminalIds);
274
int terminalId = i.next().toInt();
278
QAction* action = m_toggleMonitorActivityMenu->addAction(i18nc("@action", "In Terminal %1", count));
279
action->setCheckable(true);
280
action->setChecked(sessionStack->isTerminalMonitorActivityEnabled(terminalId));
281
action->setData(terminalId);
282
connect(action, SIGNAL(triggered(bool)), m_mainWindow, SLOT(handleToggleTerminalMonitorActivity(bool)));
287
void TabBar::updateToggleMonitorSilenceMenu(int sessionId)
289
if (!m_tabs.contains(sessionId)) return;
291
QAction* toggleMonitorSilenceAction = m_mainWindow->actionCollection()->action("toggle-session-monitor-silence");
292
QAction* anchor = m_toggleMonitorSilenceMenu->menuAction();
294
SessionStack* sessionStack = m_mainWindow->sessionStack();
296
QStringList terminalIds = sessionStack->terminalIdsForSessionId(sessionId).split(',', QString::SkipEmptyParts);
298
m_toggleMonitorSilenceMenu->clear();
300
if (terminalIds.count() <= 1)
302
toggleMonitorSilenceAction->setText(i18nc("@action", "Monitor for Silence"));
303
m_tabContextMenu->insertAction(anchor, toggleMonitorSilenceAction);
304
m_toggleMonitorSilenceMenu->menuAction()->setVisible(false);
308
toggleMonitorSilenceAction->setText(i18nc("@action", "In This Session"));
309
m_toggleMonitorSilenceMenu->menuAction()->setVisible(true);
311
m_tabContextMenu->removeAction(toggleMonitorSilenceAction);
312
m_toggleMonitorSilenceMenu->addAction(toggleMonitorSilenceAction);
314
m_toggleMonitorSilenceMenu->addSeparator();
318
QStringListIterator i(terminalIds);
322
int terminalId = i.next().toInt();
326
QAction* action = m_toggleMonitorSilenceMenu->addAction(i18nc("@action", "In Terminal %1", count));
327
action->setCheckable(true);
328
action->setChecked(sessionStack->isTerminalMonitorSilenceEnabled(terminalId));
329
action->setData(terminalId);
330
connect(action, SIGNAL(triggered(bool)), m_mainWindow, SLOT(handleToggleTerminalMonitorSilence(bool)));
224
335
void TabBar::contextMenuActionHovered(QAction* action)
370
485
painter.drawTiledPixmap(x, y,
371
486
m_skin->tabBarPreventClosingImagePosition().x() +
372
m_skin->tabBarPreventClosingImage().width(), height(),
487
m_skin->tabBarPreventClosingImage().width(), height(),
373
488
m_skin->tabBarSelectedBackgroundImage());
375
painter.drawTiledPixmap(x, y,
490
painter.drawTiledPixmap(x, y,
376
491
m_skin->tabBarPreventClosingImagePosition().x() +
377
492
m_skin->tabBarPreventClosingImage().width(), height(),
378
493
m_skin->tabBarUnselectedBackgroundImage());