25 #include <QApplication>
27 #include <QtGui/QKeyEvent>
29 #include <QPrintDialog>
34 #include <KActionMenu>
35 #include <KActionCollection>
37 #include <KLocalizedString>
39 #include <KMessageBox>
42 #include <KToolInvocation>
43 #include <KStandardDirs>
44 #include <KToggleAction>
45 #include <KSelectAction>
47 #include <KXmlGuiWindow>
48 #include <KXMLGUIFactory>
49 #include <KXMLGUIBuilder>
52 #include <KStringHandler>
53 #include <KConfigGroup>
56 #include <kdeversion.h>
57 #if KDE_IS_VERSION(4, 9, 1)
58 #include <KCodecAction>
60 #include <kcodecaction.h>
81 #include <KFileDialog>
89 using namespace Konsole;
93 const KIcon SessionController::_activityIcon(
"dialog-information");
94 const KIcon SessionController::_silenceIcon(
"dialog-information");
95 const KIcon SessionController::_broadcastIcon(
"emblem-important");
97 QSet<SessionController*> SessionController::_allControllers;
98 int SessionController::_lastControllerId;
110 , _copyInputToAllTabsAction(0)
113 , _findPreviousAction(0)
114 , _urlFilterUpdateRequired(false)
115 , _searchStartLine(0)
116 , _prevSearchResultLine(0)
119 , _switchProfileMenu(0)
121 , _listenForScreenWindowUpdates(false)
122 , _preventClose(false)
123 , _keepIconUntilInteraction(false)
125 , _isSearchBarEnabled(false)
131 if (isKonsolePart()) {
132 setXMLFile(
"konsole/partui.rc");
133 setupCommonActions();
135 setXMLFile(
"konsole/sessionui.rc");
136 setupCommonActions();
140 actionCollection()->addAssociatedWidget(view);
141 foreach(QAction * action, actionCollection()->actions()) {
142 action->setShortcutContext(Qt::WidgetWithChildrenShortcut);
146 sessionTitleChanged();
148 view->installEventFilter(
this);
152 connect(_session, SIGNAL(resizeRequest(QSize)),
this,
153 SLOT(sessionResizeRequest(QSize)));
156 connect(_view, SIGNAL(configureRequest(QPoint)),
this,
157 SLOT(showDisplayContextMenu(QPoint)));
160 connect(_view, SIGNAL(keyPressedSignal(QKeyEvent*)),
this,
161 SLOT(trackOutput(QKeyEvent*)));
164 connect(_session, SIGNAL(stateChanged(
int)),
this,
165 SLOT(sessionStateChanged(
int)));
167 connect(_session, SIGNAL(
titleChanged()),
this, SLOT(sessionTitleChanged()));
173 connect(_session, SIGNAL(changeBackgroundColorRequest(QColor)), _view, SLOT(setBackgroundColor(QColor)));
174 connect(_session, SIGNAL(changeForegroundColorRequest(QColor)), _view, SLOT(setForegroundColor(QColor)));
177 connect(_session, SIGNAL(started()),
this, SLOT(snapshot()));
180 connect(_session->emulation(), SIGNAL(outputChanged()),
this,
184 connect(_session, SIGNAL(zmodemDetected()),
this, SLOT(zmodemDownload()));
187 connect(_session, SIGNAL(flowControlEnabledChanged(
bool)), _view,
188 SLOT(setFlowControlWarningEnabled(
bool)));
189 _view->setFlowControlWarningEnabled(_session->flowControlEnabled());
196 _interactionTimer =
new QTimer(_session);
197 _interactionTimer->setSingleShot(
true);
198 _interactionTimer->setInterval(500);
199 connect(_interactionTimer, SIGNAL(timeout()),
this, SLOT(snapshot()));
200 connect(_view, SIGNAL(keyPressedSignal(QKeyEvent*)),
this, SLOT(interactionHandler()));
203 QTimer* backgroundTimer =
new QTimer(_session);
204 backgroundTimer->setSingleShot(
false);
205 backgroundTimer->setInterval(2000);
206 connect(backgroundTimer, SIGNAL(timeout()),
this, SLOT(snapshot()));
207 backgroundTimer->start();
209 _allControllers.insert(
this);
213 _bookmarkValidProgramsToClear <<
"bash" <<
"fish" <<
"sh";
214 _bookmarkValidProgramsToClear <<
"tcsh" <<
"zsh";
220 _view->setScreenWindow(0);
222 _allControllers.remove(
this);
224 if (!_editProfileDialog.isNull()) {
225 delete _editProfileDialog.data();
228 void SessionController::trackOutput(QKeyEvent* event)
230 Q_ASSERT(_view->screenWindow());
235 switch (event->key()) {
237 case Qt::Key_Control:
241 _view->screenWindow()->setTrackOutput(
true);
244 void SessionController::interactionHandler()
250 _keepIconUntilInteraction =
false;
251 _interactionTimer->start();
254 void SessionController::requireUrlFilterUpdate()
259 _urlFilterUpdateRequired =
true;
261 void SessionController::snapshot()
263 Q_ASSERT(_session != 0);
265 QString
title = _session->getDynamicTitle();
266 title = title.simplified();
269 if (_copyToGroup && _copyToGroup->
sessions().count() > 1) {
274 if (title.isEmpty()) {
287 return _session->currentWorkingDirectory();
292 return _session->getUrl();
303 if (!_session->isForegroundProcessActive()
304 && _bookmarkValidProgramsToClear.contains(_session->foregroundProcessName())) {
305 _session->emulation()->sendText(QChar(0x03));
306 _session->emulation()->sendText(QChar(
'\n'));
310 if (url.isLocalFile()) {
311 QString path = url.toLocalFile();
312 _session->emulation()->sendText(
"cd " + KShell::quoteArg(path) +
'\r');
313 }
else if (url.protocol().isEmpty()) {
316 QString command = url.prettyUrl();
317 if (!command.isEmpty())
318 _session->emulation()->sendText(command +
'\r');
319 }
else if (url.protocol() ==
"ssh") {
320 QString sshCommand =
"ssh ";
322 if (url.port() > -1) {
323 sshCommand += QString(
"-p %1 ").arg(url.port());
326 sshCommand += (url.user() +
'@');
329 sshCommand += url.host();
332 _session->sendText(sshCommand +
'\r');
334 }
else if (url.protocol() ==
"telnet") {
335 QString telnetCommand =
"telnet ";
338 telnetCommand += QString(
"-l %1 ").arg(url.user());
341 telnetCommand += (url.host() +
' ');
343 if (url.port() > -1) {
344 telnetCommand += QString::number(url.port());
347 _session->sendText(telnetCommand +
'\r');
352 KMessageBox::sorry(_view->window(),
353 i18n(
"Konsole does not know how to open the bookmark: ") +
356 kWarning() <<
"Unable to open bookmark at url" << url <<
", I do not know"
357 <<
" how to handle the protocol " << url.protocol();
363 KActionCollection* collection = actionCollection();
364 QAction* clearAction = collection->action(
"clear-history");
365 QAction* resetAction = collection->action(
"clear-history-and-reset");
366 QAction* selectAllAction = collection->action(
"select-all");
369 clearAction->setEnabled(use);
370 resetAction->setEnabled(use);
371 selectAllAction->setEnabled(use);
376 _selectedText = selectedText;
377 updateCopyAction(selectedText);
380 void SessionController::updateCopyAction(
const QString& selectedText)
382 QAction* copyAction = actionCollection()->action(
"edit_copy");
385 copyAction->setEnabled(!selectedText.isEmpty());
388 void SessionController::updateWebSearchMenu()
391 _webSearchMenu->setVisible(
false);
392 _webSearchMenu->menu()->clear();
394 if (_selectedText.isEmpty())
397 QString searchText = _selectedText;
398 searchText = searchText.replace(
'\n',
' ').replace(
'\r',
' ').simplified();
400 if (searchText.isEmpty())
403 KUriFilterData filterData(searchText);
404 filterData.setSearchFilteringOptions(KUriFilterData::RetrievePreferredSearchProvidersOnly);
406 if (KUriFilter::self()->filterSearchUri(filterData, KUriFilter::NormalTextFilter)) {
407 const QStringList searchProviders = filterData.preferredSearchProviders();
408 if (!searchProviders.isEmpty()) {
409 _webSearchMenu->setText(i18n(
"Search for '%1' with", KStringHandler::rsqueeze(searchText, 16)));
413 foreach(
const QString& searchProvider, searchProviders) {
414 action =
new KAction(searchProvider, _webSearchMenu);
415 action->setIcon(KIcon(filterData.iconNameForPreferredSearchProvider(searchProvider)));
416 action->setData(filterData.queryForPreferredSearchProvider(searchProvider));
417 connect(action, SIGNAL(triggered()),
this, SLOT(handleWebShortcutAction()));
418 _webSearchMenu->addAction(action);
421 _webSearchMenu->addSeparator();
423 action =
new KAction(i18n(
"Configure Web Shortcuts..."), _webSearchMenu);
424 action->setIcon(KIcon(
"configure"));
425 connect(action, SIGNAL(triggered()),
this, SLOT(configureWebShortcuts()));
426 _webSearchMenu->addAction(action);
428 _webSearchMenu->setVisible(
true);
433 void SessionController::handleWebShortcutAction()
435 KAction* action = qobject_cast<KAction*>(sender());
439 KUriFilterData filterData(action->data().toString());
441 if (KUriFilter::self()->filterUri(filterData, QStringList() <<
"kurisearchfilter")) {
442 const KUrl&
url = filterData.uri();
443 new KRun(url, QApplication::activeWindow());
447 void SessionController::configureWebShortcuts()
449 KToolInvocation::kdeinitExec(
"kcmshell4", QStringList() <<
"ebrowsing");
452 void SessionController::sendSignal(QAction* action)
454 const int signal = action->data().value<
int>();
455 _session->sendSignal(signal);
460 if (watched == _view) {
461 if (event->type() == QEvent::FocusIn) {
470 disconnect(_session, SIGNAL(bellRequest(QString)), 0, 0);
472 connect(_session, SIGNAL(bellRequest(QString)),
473 _view, SLOT(bell(QString)));
475 if (_copyInputToAllTabsAction && _copyInputToAllTabsAction->isChecked()) {
478 copyInputToAllTabs();
487 if (event->type() == QEvent::MouseMove &&
488 (!_viewUrlFilter || _urlFilterUpdateRequired) &&
489 ((QMouseEvent*)event)->buttons() == Qt::NoButton) {
490 if (_view->screenWindow() && !_viewUrlFilter) {
491 connect(_view->screenWindow(), SIGNAL(scrolled(
int)),
this,
492 SLOT(requireUrlFilterUpdate()));
493 connect(_view->screenWindow(), SIGNAL(outputChanged()),
this,
494 SLOT(requireUrlFilterUpdate()));
498 _view->filterChain()->addFilter(_viewUrlFilter);
501 _view->processFilters();
502 _urlFilterUpdateRequired =
false;
509 void SessionController::removeSearchFilter()
514 _view->filterChain()->removeFilter(_searchFilter);
515 delete _searchFilter;
523 disconnect(
this, 0, _searchBar, 0);
524 disconnect(_searchBar, 0,
this, 0);
530 connect(_searchBar, SIGNAL(unhandledMovementKeyPressed(QKeyEvent*)),
this, SLOT(movementKeyFromSearchBarReceived(QKeyEvent*)));
531 connect(_searchBar, SIGNAL(closeClicked()),
this, SLOT(searchClosed()));
532 connect(_searchBar, SIGNAL(searchFromClicked()),
this, SLOT(searchFrom()));
533 connect(_searchBar, SIGNAL(findNextClicked()),
this, SLOT(findNextInHistory()));
534 connect(_searchBar, SIGNAL(findPreviousClicked()),
this, SLOT(findPreviousInHistory()));
535 connect(_searchBar, SIGNAL(highlightMatchesToggled(
bool)) ,
this , SLOT(highlightMatches(
bool)));
536 connect(_searchBar, SIGNAL(matchCaseToggled(
bool)),
this, SLOT(changeSearchMatch()));
540 enableSearchBar(_isSearchBarEnabled);
550 _showMenuAction = action;
553 void SessionController::setupCommonActions()
556 KActionCollection* collection = actionCollection();
559 action = collection->addAction(
"close-session",
this, SLOT(
closeSession()));
561 action->setText(i18n(
"&Close Session"));
563 action->setText(i18n(
"&Close Tab"));
565 action->setIcon(KIcon(
"tab-close"));
566 action->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_W));
569 action = collection->addAction(
"open-browser",
this, SLOT(openBrowser()));
570 action->setText(i18n(
"Open File Manager"));
571 action->setIcon(KIcon(
"system-file-manager"));
574 action = KStandardAction::copy(
this, SLOT(copy()), collection);
575 action->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_C));
577 action->setEnabled(
false);
579 action = KStandardAction::paste(
this, SLOT(paste()), collection);
580 KShortcut pasteShortcut = action->shortcut();
581 pasteShortcut.setPrimary(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_V));
582 pasteShortcut.setAlternate(QKeySequence(Qt::SHIFT + Qt::Key_Insert));
583 action->setShortcut(pasteShortcut);
585 action = collection->addAction(
"paste-selection",
this, SLOT(pasteFromX11Selection()));
586 action->setText(i18n(
"Paste Selection"));
587 action->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_Insert));
589 _webSearchMenu =
new KActionMenu(i18n(
"Web Search"),
this);
590 _webSearchMenu->setIcon(KIcon(
"preferences-web-browser-shortcuts"));
591 _webSearchMenu->setVisible(
false);
592 collection->addAction(
"web-search", _webSearchMenu);
595 action = collection->addAction(
"select-all",
this, SLOT(selectAll()));
596 action->setText(i18n(
"&Select All"));
597 action->setIcon(KIcon(
"edit-select-all"));
599 action = KStandardAction::saveAs(
this, SLOT(saveHistory()), collection);
600 action->setText(i18n(
"Save Output &As..."));
602 action = KStandardAction::print(
this, SLOT(print_screen()), collection);
603 action->setText(i18n(
"&Print Screen..."));
604 action->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_P));
606 action = collection->addAction(
"adjust-history",
this, SLOT(showHistoryOptions()));
607 action->setText(i18n(
"Adjust Scrollback..."));
608 action->setIcon(KIcon(
"configure"));
610 action = collection->addAction(
"clear-history",
this, SLOT(clearHistory()));
611 action->setText(i18n(
"Clear Scrollback"));
612 action->setIcon(KIcon(
"edit-clear-history"));
614 action = collection->addAction(
"clear-history-and-reset",
this, SLOT(clearHistoryAndReset()));
615 action->setText(i18n(
"Clear Scrollback and Reset"));
616 action->setIcon(KIcon(
"edit-clear-history"));
617 action->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_K));
620 action = collection->addAction(
"edit-current-profile",
this, SLOT(editCurrentProfile()));
621 action->setText(i18n(
"Edit Current Profile..."));
622 action->setIcon(KIcon(
"document-properties"));
624 _switchProfileMenu =
new KActionMenu(i18n(
"Switch Profile"),
this);
625 collection->addAction(
"switch-profile", _switchProfileMenu);
626 connect(_switchProfileMenu->menu(), SIGNAL(aboutToShow()),
this, SLOT(prepareSwitchProfileMenu()));
629 _findAction = KStandardAction::find(
this, SLOT(searchBarEvent()), collection);
630 _findAction->setShortcut(QKeySequence());
632 _findNextAction = KStandardAction::findNext(
this, SLOT(findNextInHistory()), collection);
633 _findNextAction->setShortcut(QKeySequence());
634 _findNextAction->setEnabled(
false);
636 _findPreviousAction = KStandardAction::findPrev(
this, SLOT(findPreviousInHistory()), collection);
637 _findPreviousAction->setShortcut(QKeySequence());
638 _findPreviousAction->setEnabled(
false);
641 _codecAction =
new KCodecAction(i18n(
"Set &Encoding"),
this);
642 _codecAction->setIcon(KIcon(
"character-set"));
643 collection->addAction(
"set-encoding", _codecAction);
644 connect(_codecAction->menu(), SIGNAL(aboutToShow()),
this, SLOT(updateCodecAction()));
645 connect(_codecAction, SIGNAL(triggered(QTextCodec*)),
this, SLOT(changeCodec(QTextCodec*)));
648 void SessionController::setupExtraActions()
651 KToggleAction* toggleAction = 0;
652 KActionCollection* collection = actionCollection();
655 action = collection->addAction(
"rename-session",
this, SLOT(renameSession()));
656 action->setText(i18n(
"&Rename Tab..."));
657 action->setIcon(KIcon(
"edit-rename"));
658 action->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_S));
661 KToggleAction* copyInputToAllTabsAction = collection->add<KToggleAction>(
"copy-input-to-all-tabs");
662 copyInputToAllTabsAction->setText(i18n(
"&All Tabs in Current Window"));
665 _copyInputToAllTabsAction = copyInputToAllTabsAction;
668 KToggleAction* copyInputToSelectedTabsAction = collection->add<KToggleAction>(
"copy-input-to-selected-tabs");
669 copyInputToSelectedTabsAction->setText(i18n(
"&Select Tabs..."));
670 copyInputToSelectedTabsAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_Period));
674 KToggleAction* copyInputToNoneAction = collection->add<KToggleAction>(
"copy-input-to-none");
675 copyInputToNoneAction->setText(i18nc(
"@action:inmenu Do not select any tabs",
"&None"));
676 copyInputToNoneAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_Slash));
678 copyInputToNoneAction->setChecked(
true);
682 KSelectAction* copyInputActions = collection->add<KSelectAction>(
"copy-input-to");
683 copyInputActions->setText(i18n(
"Copy Input To"));
684 copyInputActions->addAction(copyInputToAllTabsAction);
685 copyInputActions->addAction(copyInputToSelectedTabsAction);
686 copyInputActions->addAction(copyInputToNoneAction);
687 connect(copyInputActions, SIGNAL(triggered(QAction*)),
this, SLOT(copyInputActionsTriggered(QAction*)));
689 action = collection->addAction(
"zmodem-upload",
this, SLOT(zmodemUpload()));
690 action->setText(i18n(
"&ZModem Upload..."));
691 action->setIcon(KIcon(
"document-open"));
692 action->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_U));
695 toggleAction =
new KToggleAction(i18n(
"Monitor for &Activity"),
this);
696 toggleAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_A));
697 action = collection->addAction(
"monitor-activity", toggleAction);
698 connect(action, SIGNAL(toggled(
bool)),
this, SLOT(monitorActivity(
bool)));
700 toggleAction =
new KToggleAction(i18n(
"Monitor for &Silence"),
this);
701 toggleAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_I));
702 action = collection->addAction(
"monitor-silence", toggleAction);
703 connect(action, SIGNAL(toggled(
bool)),
this, SLOT(monitorSilence(
bool)));
706 action = collection->addAction(
"enlarge-font",
this, SLOT(
increaseFontSize()));
707 action->setText(i18n(
"Enlarge Font"));
708 action->setIcon(KIcon(
"format-font-size-more"));
709 KShortcut enlargeFontShortcut = action->shortcut();
710 enlargeFontShortcut.setPrimary(QKeySequence(Qt::CTRL + Qt::Key_Plus));
711 enlargeFontShortcut.setAlternate(QKeySequence(Qt::CTRL + Qt::Key_Equal));
712 action->setShortcut(enlargeFontShortcut);
714 action = collection->addAction(
"shrink-font",
this, SLOT(
decreaseFontSize()));
715 action->setText(i18n(
"Shrink Font"));
716 action->setIcon(KIcon(
"format-font-size-less"));
717 action->setShortcut(KShortcut(Qt::CTRL | Qt::Key_Minus));
720 KSelectAction* sendSignalActions = collection->add<KSelectAction>(
"send-signal");
721 sendSignalActions->setText(i18n(
"Send Signal"));
722 connect(sendSignalActions, SIGNAL(triggered(QAction*)),
this, SLOT(sendSignal(QAction*)));
724 action = collection->addAction(
"sigstop-signal");
725 action->setText(i18n(
"&Suspend Task") +
" (STOP)");
726 action->setData(SIGSTOP);
727 sendSignalActions->addAction(action);
729 action = collection->addAction(
"sigcont-signal");
730 action->setText(i18n(
"&Continue Task") +
" (CONT)");
731 action->setData(SIGCONT);
732 sendSignalActions->addAction(action);
734 action = collection->addAction(
"sighup-signal");
735 action->setText(i18n(
"&Hangup") +
" (HUP)");
736 action->setData(SIGHUP);
737 sendSignalActions->addAction(action);
739 action = collection->addAction(
"sigint-signal");
740 action->setText(i18n(
"&Interrupt Task") +
" (INT)");
741 action->setData(SIGINT);
742 sendSignalActions->addAction(action);
744 action = collection->addAction(
"sigterm-signal");
745 action->setText(i18n(
"&Terminate Task") +
" (TERM)");
746 action->setData(SIGTERM);
747 sendSignalActions->addAction(action);
749 action = collection->addAction(
"sigkill-signal");
750 action->setText(i18n(
"&Kill Task") +
" (KILL)");
751 action->setData(SIGKILL);
752 sendSignalActions->addAction(action);
754 action = collection->addAction(
"sigusr1-signal");
755 action->setText(i18n(
"User Signal &1") +
" (USR1)");
756 action->setData(SIGUSR1);
757 sendSignalActions->addAction(action);
759 action = collection->addAction(
"sigusr2-signal");
760 action->setText(i18n(
"User Signal &2") +
" (USR2)");
761 action->setData(SIGUSR2);
762 sendSignalActions->addAction(action);
764 _findAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_F));
765 _findNextAction->setShortcut(QKeySequence(Qt::Key_F3));
766 _findPreviousAction->setShortcut(QKeySequence(Qt::SHIFT + Qt::Key_F3));
769 void SessionController::switchProfile(
Profile::Ptr profile)
774 void SessionController::prepareSwitchProfileMenu()
776 if (_switchProfileMenu->menu()->isEmpty()) {
781 _switchProfileMenu->menu()->clear();
782 _switchProfileMenu->menu()->addActions(_profileList->
actions());
784 void SessionController::updateCodecAction()
786 _codecAction->setCurrentCodec(QString(_session->codec()));
789 void SessionController::changeCodec(QTextCodec* codec)
791 _session->setCodec(codec);
796 return _editProfileDialog.data();
799 void SessionController::editCurrentProfile()
811 if (!_editProfileDialog.isNull()) {
813 delete _editProfileDialog.data();
818 _editProfileDialog.data()->show();
821 void SessionController::renameSession()
823 QScopedPointer<RenameTabDialog> dialog(
new RenameTabDialog(QApplication::activeWindow()));
827 if (_session->isRemote()) {
828 dialog->focusRemoteTabTitleText();
830 dialog->focusTabTitleText();
833 QPointer<Session> guard(_session);
834 int result = dialog->exec();
839 QString tabTitle = dialog->tabTitleText();
840 QString remoteTabTitle = dialog->remoteTabTitleText();
852 if (_session->isForegroundProcessActive()) {
853 QString title = _session->foregroundProcessName();
857 QStringList ignoreList;
858 ignoreList << QString(qgetenv(
"SHELL")).section(
'/', -1);
859 if (ignoreList.contains(title))
864 question = i18n(
"A program is currently running in this session."
865 " Are you sure you want to close it?");
867 question = i18n(
"The program '%1' is currently running in this session."
868 " Are you sure you want to close it?", title);
870 int result = KMessageBox::warningYesNo(_view->window(), question, i18n(
"Confirm Close"));
871 return (result == KMessageBox::Yes) ?
true :
false;
877 if (_session->isRunning()) {
878 QString title = _session->program();
882 QStringList ignoreList;
883 ignoreList << QString(qgetenv(
"SHELL")).section(
'/', -1);
884 if (ignoreList.contains(title))
889 question = i18n(
"A program in this session would not die."
890 " Are you sure you want to kill it by force?");
892 question = i18n(
"The program '%1' is in this session would not die."
893 " Are you sure you want to kill it by force?", title);
895 int result = KMessageBox::warningYesNo(_view->window(), question, i18n(
"Confirm Close"));
896 return (result == KMessageBox::Yes) ?
true :
false;
906 if (_session->closeInNormalWay()) {
909 if (_session->closeInForceWay())
912 kWarning() <<
"Konsole failed to close a session in any way.";
921 void SessionController::openBrowser()
923 KUrl currentUrl =
url();
925 if (currentUrl.isLocalFile())
926 new KRun(currentUrl, QApplication::activeWindow(), 0,
true,
true);
928 new KRun(KUrl(QDir::homePath()), QApplication::activeWindow(), 0,
true,
true);
931 void SessionController::copy()
933 _view->copyToClipboard();
936 void SessionController::paste()
938 _view->pasteFromClipboard();
940 void SessionController::pasteFromX11Selection()
942 _view->pasteFromX11Selection();
944 void SessionController::selectAll()
948 _view->copyToX11Selection();
953 while (
object != 0) {
958 object =
object->parent();
976 void SessionController::copyInputActionsTriggered(QAction* action)
978 const int mode = action->data().value<
int>();
982 copyInputToAllTabs();
985 copyInputToSelectedTabs();
995 void SessionController::copyInputToAllTabs()
1004 QSet<Session*> group =
1006 for (QSet<Session*>::iterator iterator = group.begin();
1007 iterator != group.end(); ++iterator) {
1025 void SessionController::copyInputToSelectedTabs()
1027 if (!_copyToGroup) {
1035 dialog->setMasterSession(_session);
1037 QSet<Session*> currentGroup = QSet<Session*>::fromList(_copyToGroup->
sessions());
1038 currentGroup.remove(_session);
1040 dialog->setChosenSessions(currentGroup);
1042 QPointer<Session> guard(_session);
1043 int result = dialog->exec();
1047 if (result == QDialog::Accepted) {
1048 QSet<Session*> newGroup = dialog->chosenSessions();
1049 newGroup.remove(_session);
1051 QSet<Session*> completeGroup = newGroup | currentGroup;
1052 foreach(
Session * session, completeGroup) {
1053 if (newGroup.contains(session) && !currentGroup.contains(session))
1055 else if (!newGroup.contains(session) && currentGroup.contains(session))
1065 void SessionController::copyInputToNone()
1070 QSet<Session*> group =
1072 for (QSet<Session*>::iterator iterator = group.begin();
1073 iterator != group.end(); ++iterator) {
1076 if (session != _session) {
1080 delete _copyToGroup;
1085 void SessionController::searchClosed()
1087 _isSearchBarEnabled =
false;
1088 searchHistory(
false);
1098 _searchStartLine = line;
1099 _prevSearchResultLine = line;
1102 void SessionController::listenForScreenWindowUpdates()
1104 if (_listenForScreenWindowUpdates)
1107 connect(_view->screenWindow(), SIGNAL(outputChanged()),
this,
1108 SLOT(updateSearchFilter()));
1109 connect(_view->screenWindow(), SIGNAL(scrolled(
int)),
this,
1110 SLOT(updateSearchFilter()));
1111 connect(_view->screenWindow(), SIGNAL(currentResultLineChanged()), _view,
1114 _listenForScreenWindowUpdates =
true;
1117 void SessionController::updateSearchFilter()
1119 if (_searchFilter && _searchBar) {
1120 _view->processFilters();
1124 void SessionController::searchBarEvent()
1126 QString selectedText = _view->screenWindow()->selectedText(
true,
true);
1127 if (!selectedText.isEmpty())
1128 _searchBar->setSearchText(selectedText);
1130 if (_searchBar->isVisible()) {
1131 _searchBar->focusLineEdit();
1133 searchHistory(
true);
1134 _isSearchBarEnabled =
true;
1138 void SessionController::enableSearchBar(
bool showSearchBar)
1143 if (showSearchBar && !_searchBar->isVisible()) {
1147 _searchBar->setVisible(showSearchBar);
1148 if (showSearchBar) {
1149 connect(_searchBar, SIGNAL(searchChanged(QString)),
this,
1150 SLOT(searchTextChanged(QString)));
1151 connect(_searchBar, SIGNAL(searchReturnPressed(QString)),
this,
1152 SLOT(findPreviousInHistory()));
1153 connect(_searchBar, SIGNAL(searchShiftPlusReturnPressed()),
this,
1154 SLOT(findNextInHistory()));
1156 disconnect(_searchBar, SIGNAL(searchChanged(QString)),
this,
1157 SLOT(searchTextChanged(QString)));
1158 disconnect(_searchBar, SIGNAL(searchReturnPressed(QString)),
this,
1159 SLOT(findPreviousInHistory()));
1160 disconnect(_searchBar, SIGNAL(searchShiftPlusReturnPressed()),
this,
1161 SLOT(findNextInHistory()));
1162 if (_view && _view->screenWindow()) {
1163 _view->screenWindow()->setCurrentResultLine(-1);
1169 bool SessionController::reverseSearchChecked()
const
1171 Q_ASSERT(_searchBar);
1173 QBitArray options = _searchBar->optionsChecked();
1177 QRegExp SessionController::regexpFromSearchBarOptions()
1179 QBitArray options = _searchBar->optionsChecked();
1184 QRegExp regExp(_searchBar->searchText(), caseHandling , syntax);
1190 void SessionController::searchHistory(
bool showSearchBar)
1192 enableSearchBar(showSearchBar);
1195 if (showSearchBar) {
1196 removeSearchFilter();
1198 listenForScreenWindowUpdates();
1201 _searchFilter->
setRegExp(regexpFromSearchBarOptions());
1202 _view->filterChain()->addFilter(_searchFilter);
1203 _view->processFilters();
1205 setFindNextPrevEnabled(
true);
1207 setFindNextPrevEnabled(
false);
1209 removeSearchFilter();
1211 _view->setFocus(Qt::ActiveWindowFocusReason);
1216 void SessionController::setFindNextPrevEnabled(
bool enabled)
1218 _findNextAction->setEnabled(enabled);
1219 _findPreviousAction->setEnabled(enabled);
1221 void SessionController::searchTextChanged(
const QString& text)
1223 Q_ASSERT(_view->screenWindow());
1225 if (_searchText == text)
1230 if (text.isEmpty()) {
1231 _view->screenWindow()->clearSelection();
1232 _view->screenWindow()->scrollTo(_searchStartLine);
1239 void SessionController::searchCompleted(
bool success)
1241 _prevSearchResultLine = _view->screenWindow()->currentResultLine();
1244 _searchBar->setFoundMatch(success);
1247 void SessionController::beginSearch(
const QString& text ,
int direction)
1249 Q_ASSERT(_searchBar);
1250 Q_ASSERT(_searchFilter);
1252 QRegExp regExp = regexpFromSearchBarOptions();
1255 if (_searchStartLine == -1) {
1259 setSearchStartTo(_view->screenWindow()->currentLine() + _view->screenWindow()->windowLines());
1263 if (!regExp.isEmpty()) {
1264 _view->screenWindow()->setCurrentResultLine(-1);
1267 connect(task, SIGNAL(completed(
bool)),
this, SLOT(searchCompleted(
bool)));
1275 }
else if (text.isEmpty()) {
1276 searchCompleted(
false);
1279 _view->processFilters();
1281 void SessionController::highlightMatches(
bool highlight)
1284 _view->filterChain()->addFilter(_searchFilter);
1285 _view->processFilters();
1287 _view->filterChain()->removeFilter(_searchFilter);
1293 void SessionController::searchFrom()
1295 Q_ASSERT(_searchBar);
1296 Q_ASSERT(_searchFilter);
1298 if (reverseSearchChecked()) {
1307 void SessionController::findNextInHistory()
1309 Q_ASSERT(_searchBar);
1310 Q_ASSERT(_searchFilter);
1316 void SessionController::findPreviousInHistory()
1318 Q_ASSERT(_searchBar);
1319 Q_ASSERT(_searchFilter);
1325 void SessionController::changeSearchMatch()
1327 Q_ASSERT(_searchBar);
1328 Q_ASSERT(_searchFilter);
1331 _view->screenWindow()->clearSelection();
1334 void SessionController::showHistoryOptions()
1336 QScopedPointer<HistorySizeDialog> dialog(
new HistorySizeDialog(QApplication::activeWindow()));
1337 const HistoryType& currentHistory = _session->historyType();
1350 QPointer<Session> guard(_session);
1351 int result = dialog->exec();
1356 scrollBackOptionsChanged(dialog->mode(), dialog->lineCount());
1359 void SessionController::sessionResizeRequest(
const QSize& size)
1362 _view->setSize(size.width(), size.height());
1364 void SessionController::scrollBackOptionsChanged(
int mode,
int lines)
1379 void SessionController::print_screen()
1383 QPointer<QPrintDialog> dialog =
new QPrintDialog(&printer, _view);
1387 dialog->setWindowTitle(i18n(
"Print Shell"));
1388 connect(dialog, SIGNAL(accepted()), options, SLOT(saveSettings()));
1389 if (dialog->exec() != QDialog::Accepted)
1393 painter.begin(&printer);
1395 KConfigGroup configGroup(KGlobal::config(),
"PrintOptions");
1397 if (configGroup.readEntry(
"ScaleOutput",
true)) {
1398 double scale = qMin(printer.pageRect().width() /
static_cast<double>(_view->width()),
1399 printer.pageRect().height() /
static_cast<double>(_view->height()));
1400 painter.scale(scale, scale);
1403 _view->printContent(painter, configGroup.readEntry(
"PrinterFriendly",
true));
1406 void SessionController::saveHistory()
1414 void SessionController::clearHistory()
1416 _session->clearHistory();
1417 _view->updateImage();
1420 void SessionController::clearHistoryAndReset()
1423 QByteArray name = profile->defaultEncoding().toUtf8();
1425 Emulation* emulation = _session->emulation();
1427 _session->refresh();
1428 _session->setCodec(QTextCodec::codecForName(name));
1434 _view->increaseFontSize();
1439 _view->decreaseFontSize();
1442 void SessionController::monitorActivity(
bool monitor)
1444 _session->setMonitorActivity(monitor);
1446 void SessionController::monitorSilence(
bool monitor)
1448 _session->setMonitorSilence(monitor);
1450 void SessionController::updateSessionIcon()
1453 if (_copyToGroup && _copyToGroup->
sessions().count() > 1) {
1457 if (!_keepIconUntilInteraction) {
1463 void SessionController::sessionTitleChanged()
1465 if (_sessionIconName != _session->iconName()) {
1466 _sessionIconName = _session->iconName();
1467 _sessionIcon = KIcon(_sessionIconName);
1468 updateSessionIcon();
1475 title.replace(
"%w", _session->userTitle());
1478 title.replace(
"%#", QString::number(_session->sessionId()));
1480 if (title.isEmpty())
1487 void SessionController::showDisplayContextMenu(
const QPoint& position)
1492 if (!clientBuilder()) {
1493 setClientBuilder(
new KXMLGUIBuilder(_view));
1496 KXMLGUIFactory* factory =
new KXMLGUIFactory(clientBuilder(),
this);
1497 factory->addClient(
this);
1501 QPointer<QMenu> popup = qobject_cast<QMenu*>(factory()->container(
"session-popup-menu",
this));
1505 QAction* contentSeparator =
new QAction(popup);
1506 contentSeparator->setSeparator(
true);
1507 contentActions << contentSeparator;
1508 popup->insertActions(popup->actions().value(0, 0), contentActions);
1513 updateWebSearchMenu();
1515 _preventClose =
true;
1517 if (_showMenuAction) {
1518 if ( _showMenuAction->isChecked() ) {
1519 popup->removeAction( _showMenuAction);
1521 popup->insertAction(_switchProfileMenu, _showMenuAction);
1525 QAction* chosen = popup->exec(_view->mapToGlobal(position));
1534 foreach(QAction * action, contentActions) {
1535 popup->removeAction(action);
1538 delete contentSeparator;
1541 _preventClose =
false;
1543 if (chosen && chosen->objectName() ==
"close-session")
1546 kWarning() <<
"Unable to display popup menu for session"
1548 <<
", no GUI factory available to build the popup.";
1552 void SessionController::movementKeyFromSearchBarReceived(QKeyEvent *event)
1554 QCoreApplication::sendEvent(_view, event);
1558 void SessionController::sessionStateChanged(
int state)
1560 if (state == _previousState)
1565 _keepIconUntilInteraction =
true;
1568 _keepIconUntilInteraction =
true;
1570 if (_sessionIconName != _session->iconName()) {
1571 _sessionIconName = _session->iconName();
1572 _sessionIcon = KIcon(_sessionIconName);
1575 updateSessionIcon();
1578 _previousState = state;
1581 void SessionController::zmodemDownload()
1583 QString zmodem = KStandardDirs::findExe(
"rz");
1584 if (zmodem.isEmpty()) {
1585 zmodem = KStandardDirs::findExe(
"lrz");
1587 if (!zmodem.isEmpty()) {
1588 const QString path = KFileDialog::getExistingDirectory(
1590 i18n(
"Save ZModem Download to..."));
1592 if (!path.isEmpty()) {
1593 _session->startZModem(zmodem, path, QStringList());
1597 KMessageBox::error(_view,
1598 i18n(
"<p>A ZModem file transfer attempt has been detected, "
1599 "but no suitable ZModem software was found on this system.</p>"
1600 "<p>You may wish to install the 'rzsz' or 'lrzsz' package.</p>"));
1602 _session->cancelZModem();
1606 void SessionController::zmodemUpload()
1608 if (_session->isZModemBusy()) {
1609 KMessageBox::sorry(_view,
1610 i18n(
"<p>The current session already has a ZModem file transfer in progress.</p>"));
1613 QString zmodem = KStandardDirs::findExe(
"sz");
1614 if (zmodem.isEmpty()) {
1615 zmodem = KStandardDirs::findExe(
"lsz");
1617 if (zmodem.isEmpty()) {
1618 KMessageBox::sorry(_view,
1619 i18n(
"<p>No suitable ZModem software was found on this system.</p>"
1620 "<p>You may wish to install the 'rzsz' or 'lrzsz' package.</p>"));
1624 QStringList files = KFileDialog::getOpenFileNames(KUrl(), QString(), _view,
1625 i18n(
"Select Files for ZModem Upload"));
1626 if (!files.isEmpty()) {
1627 _session->startZModem(zmodem, QString(), files);
1631 bool SessionController::isKonsolePart()
const
1634 if (QString(qApp->metaObject()->className()) ==
"Konsole::Application")
1642 , _autoDelete(false)
1647 _autoDelete = enable;
1655 _sessions << session;
1678 KFileDialog* dialog =
new KFileDialog(QString(
":konsole") ,
1679 QString(), QApplication::activeWindow());
1680 dialog->setOperationMode(KFileDialog::Saving);
1681 dialog->setConfirmOverwrite(
true);
1683 QStringList mimeTypes;
1684 mimeTypes <<
"text/plain";
1685 mimeTypes <<
"text/html";
1686 dialog->setMimeFilter(mimeTypes,
"text/plain");
1692 dialog->setCaption(i18n(
"Save Output From %1", session->title(
Session::NameRole)));
1694 int result = dialog->exec();
1696 if (result != QDialog::Accepted)
1699 KUrl url = dialog->selectedUrl();
1701 if (!url.isValid()) {
1703 KMessageBox::sorry(0 , i18n(
"%1 is an invalid URL, the output could not be saved.", url.url()));
1707 KIO::TransferJob* job = KIO::put(url,
1713 KIO::Overwrite | (url.isLocalFile() ? KIO::HideProgressInfo : KIO::DefaultFlags)
1722 jobInfo.session = session;
1723 jobInfo.lastLineFetched = -1;
1729 if (dialog->currentMimeFilter() ==
"text/html")
1734 _jobSession.insert(job, jobInfo);
1736 connect(job, SIGNAL(dataReq(KIO::Job*,QByteArray&)),
1737 this, SLOT(jobDataRequested(KIO::Job*,QByteArray&)));
1738 connect(job, SIGNAL(result(KJob*)),
1739 this, SLOT(jobResult(KJob*)));
1742 dialog->deleteLater();
1744 void SaveHistoryTask::jobDataRequested(KIO::Job* job , QByteArray& data)
1749 const int LINES_PER_REQUEST = 500;
1751 SaveJob& info = _jobSession[job];
1759 int sessionLines = info.session->emulation()->lineCount();
1761 if (sessionLines - 1 == info.lastLineFetched)
1764 int copyUpToLine = qMin(info.lastLineFetched + LINES_PER_REQUEST ,
1767 QTextStream stream(&data, QIODevice::ReadWrite);
1768 info.decoder->begin(&stream);
1769 info.session->emulation()->writeToStream(info.decoder , info.lastLineFetched + 1 , copyUpToLine);
1770 info.decoder->end();
1772 info.lastLineFetched = copyUpToLine;
1775 void SaveHistoryTask::jobResult(KJob* job)
1778 KMessageBox::sorry(0 , i18n(
"A problem occurred when saving the output.\n%1", job->errorString()));
1783 _jobSession.remove(job);
1795 _windows.insert(session, searchWindow);
1799 QMapIterator< SessionPtr , ScreenWindowPtr > iter(_windows);
1801 while (iter.hasNext()) {
1803 executeOnScreenWindow(iter.key() , iter.value());
1807 void SearchHistoryTask::executeOnScreenWindow(
SessionPtr session , ScreenWindowPtr window)
1812 Emulation* emulation = session->emulation();
1814 if (!_regExp.isEmpty()) {
1817 const int lastLine = window->
lineCount() - 1;
1820 if (forwards && (_startLine == lastLine)) {
1822 }
else if (!forwards && (_startLine == 0)) {
1823 startLine = lastLine;
1825 startLine = _startLine + (forwards ? 1 : -1);
1831 QTextStream searchStream(&
string);
1837 int line = startLine;
1843 const int maxDelta = qMin(window->lineCount(), 10000);
1844 int delta = forwards ? maxDelta : -maxDelta;
1847 bool hasWrapped =
false;
1855 QApplication::processEvents();
1859 if (endLine == lastLine)
1861 else if (endLine == 0)
1867 endLine = qMin(startLine , endLine);
1869 endLine = qMax(startLine , endLine);
1873 if (endLine > lastLine) {
1876 }
else if (endLine < 0) {
1882 decoder.
begin(&searchStream);
1883 emulation->
writeToStream(&decoder, qMin(endLine, line) , qMax(endLine, line));
1887 string.append(
'\n');
1890 pos =
string.indexOf(_regExp);
1892 pos =
string.lastIndexOf(_regExp);
1898 while (newLines < linePositions.count() && linePositions[newLines] <= pos)
1904 int findPos = qMin(line, endLine) + newLines;
1906 highlightResult(window, findPos);
1916 }
while (startLine != endLine);
1919 window->clearSelection();
1920 window->notifyOutputChanged();
1925 void SearchHistoryTask::highlightResult(ScreenWindowPtr window ,
int findPos)
1933 if ((findPos < window->currentLine()) ||
1934 (findPos >= (window->currentLine() + window->windowLines()))) {
1935 int centeredScrollPos = findPos - window->windowLines() / 2;
1936 if (centeredScrollPos < 0) {
1937 centeredScrollPos = 0;
1940 window->scrollTo(centeredScrollPos);
1943 window->setTrackOutput(
false);
1944 window->notifyOutputChanged();
1945 window->setCurrentResultLine(findPos);
1950 , _direction(BackwardsSearch)
1956 _direction = direction;
1968 _regExp = expression;
1978 return _session->userTitle();
1984 #include "SessionController.moc"
A terminal character decoder which produces pretty HTML markup.
SaveHistoryTask(QObject *parent=0)
Constructs a new task to save session output to URLs.
SessionTask(QObject *parent=0)
virtual void end()
End decoding.
static SessionManager * instance()
Returns the session manager instance.
void setRecordLinePositions(bool record)
Enables recording of character positions at which new lines are added.
Represents a terminal session consisting of a pseudo-teletype and a terminal emulation.
Provides the menu actions to manipulate a single terminal session and view pair.
QString title() const
Returns the title associated with a view.
void setSessionProfile(Session *session, Profile::Ptr profile)
Sets the profile associated with a session.
Searches are case-sensitive or not.
void setStartLine(int startLine)
The line from which the search will be done.
Searches backwards through the output, starting at the current selection.
QList< QAction * > actions()
Returns a list of actions representing profiles.
virtual bool isEnabled() const =0
Returns true if the history is enabled ( can store lines of output ) or false otherwise.
Searches use regular expressions.
void setShowMenuAction(QAction *action)
Sets the action displayed in the session's context menu to hide or show the menu bar.
virtual KUrl url() const
Returns the URL current associated with a view.
QRegExp regExp() const
Returns the regular expression which is searched for when execute() is called.
void setIdentifier(int id)
Subclasses may call this method to change the identifier.
Abstract class representing a task which can be performed on a group of sessions. ...
virtual int maximumLineCount() const =0
Returns the maximum number of lines which this history type can store or -1 if the history can store ...
static const KXmlGuiWindow * findWindow(const QObject *object)
SessionController(Session *session, TerminalDisplay *view, QObject *parent)
Constructs a new SessionController which operates on session and view.
ProfileList provides a list of actions which represent session profiles that a SessionManager can cre...
QList< Session * > sessions() const
Returns the list of sessions currently in the group.
The title of the session which is displayed in tabs etc.
void setTitle(const QString &title)
Subclasses may call this method to change the title.
virtual void execute()=0
Executes the task on each of the sessions in the group.
void setIcon(const QIcon &icon)
Subclasses may call this method to change the icon.
SearchDirection searchDirection() const
Returns the current search direction.
void titleChanged(ViewProperties *properties)
Emitted when the title for a view changes.
virtual ~SaveHistoryTask()
QList< TerminalDisplay * > views() const
Returns the views connected to this session.
virtual void reset()=0
Resets the state of the terminal.
Profile::Ptr sessionProfile(Session *session) const
Returns the profile associated with a session.
static bool hasTerminalDisplayInSameWindow(const Session *session, const KXmlGuiWindow *window)
virtual void writeToStream(TerminalCharacterDecoder *decoder, int startLine, int endLine)
Copies the output history from startLine to endLine into stream, using decoder to convert the termina...
void setSelectionByLineRange(int start, int end)
Sets the selection as the range specified by line start and line end in the whole history...
A dialog which allows the user to edit a profile.
virtual void rename()
Requests the renaming of this view.
A terminal character decoder which produces plain text, ignoring colors and other appearance-related ...
void increaseFontSize()
Increase font size.
void focused(SessionController *controller)
Emitted when the view associated with the controller is focused.
The emulation is currently receiving data from its terminal input.
EditProfileDialog * profileDialogPointer()
Do not copy keyboard input to other tabs.
void setSearchDirection(SearchDirection direction)
Specifies the direction to search in when execute() is called.
Base class for terminal character decoders.
void setSearchStartToWindowCurrentLine()
set start line to the first or last line (depending on the reverse search setting) in the terminal di...
QList< SessionPtr > sessions() const
Returns a list of sessions in the group.
Provides a group of sessions which is divided into master and slave sessions.
void selectionChanged(const QString &selectedText)
update actions which are closely related with the selected text.
virtual bool confirmForceClose() const
void addScreenWindow(Session *session, ScreenWindow *searchWindow)
Adds a screen window to the list to search when execute() is called.
void addSession(Session *session)
Adds a new session to the group.
Provides a window onto a section of a terminal screen.
Searches forwards through the output, starting at the current selection.
void setMasterStatus(Session *session, bool master)
Sets whether a particular session is a master within the group.
SearchHistoryTask(QObject *parent=0)
Constructs a new search task.
void fireActivity()
Emits the activity() signal.
Base class for terminal emulation back-ends.
The emulation is currently receiving user input.
QPointer< Session > session()
Returns the session associated with this controller.
void setSearchStartTo(int line)
Set the start line from which the next search will be done.
Tab title format used session currently contains a connection to a remote computer (via SSH) ...
void setupPrimaryScreenSpecificActions(bool use)
update actions which are meaningful only when primary screen is in use.
A task which searches through the output of sessions for matches for a given regular expression...
void setSessionController(SessionController *controller)
int lineCount() const
Returns the total number of lines, including those stored in the history.
virtual void execute()
Performs a search through the session's history, starting at the position of the current selection...
virtual bool eventFilter(QObject *watched, QEvent *event)
Encapsulates user-visible information about the terminal session currently being displayed in a view...
void setMasterMode(int mode)
Specifies which activity in the group's master sessions is propagated to all sessions in the group...
void removeSession(Session *session)
Removes a session from the group.
A widget which allows users to search incrementally through a document for a a text string or regular...
void setRegExp(const QRegExp &text)
Sets the regular expression which the filter searches for in blocks of text.
A filter which searches for sections of text matching a regular expression and creates a new RegExpFi...
Copy keyboard input to all the other tabs in current window.
QList< int > linePositions() const
Returns of character positions in the output stream at which new lines where added.
QPointer< Session > SessionPtr
const Profile::Ptr lookupProfile() const
KSharedPtr< Profile > Ptr
virtual void begin(QTextStream *output)
Begin decoding characters.
void openUrl(const KUrl &url)
Issues a command to the session to navigate to the specified URL.
void setSearchBar(IncrementalSearchBar *searchBar)
Sets the widget used for searches through the session's output.
Default tab title format.
A filter which matches URLs in blocks of text.
virtual void execute()
Opens a save file dialog for each session in the group and begins saving each session's history to th...
void closeSession()
close the associated session.
SearchDirection
This enum describes the strategies available for searching through the session's output.
Search from the bottom and up.
All output is remembered for the duration of the session.
void addSession(Session *session)
Adds a session to the group.
A fixed number of lines of output are remembered.
bool isUnlimited() const
Returns true if the history size is unlimited.
QString userTitle() const
Returns the "window title" of the associated session.
Copy keyboard input to user selected tabs in current window.
Any input key presses in the master sessions are sent to all sessions in the group.
A task which prompts for a URL for each session and saves that session's output to the given URL...
void setRegExp(const QRegExp ®Exp)
Sets the regular expression which is searched for when execute() is called.
IncrementalSearchBar * searchBar() const
see setSearchBar()
A widget which displays output from a terminal emulation and sends input keypresses and mouse activit...
void setAutoDelete(bool enable)
Sets whether the task automatically deletes itself when the task has been finished.
bool autoDelete() const
Returns true if the task automatically deletes itself.
virtual bool confirmClose() const
Sub-classes may re-implement this method to display a message to the user to allow them to confirm wh...
void completed(bool success)
Emitted when the task has completed.
void decreaseFontSize()
Decrease font size.
virtual QString currentDir() const
Returns the current directory associated with a view.
void currentDirectoryChanged(const QString &dir)
Emitted when the current working directory of the session associated with the controller is changed...