Changeset View
Changeset View
Standalone View
Standalone View
src/Session.cpp
Show First 20 Lines • Show All 615 Lines • ▼ Show 20 Line(s) | 610 | { | |||
---|---|---|---|---|---|
616 | 616 | | |||
617 | //FIXME: Make message text for this notification and the activity notification more descriptive. | 617 | //FIXME: Make message text for this notification and the activity notification more descriptive. | ||
618 | if (!_monitorSilence) { | 618 | if (!_monitorSilence) { | ||
619 | emit stateChanged(NOTIFYNORMAL); | 619 | emit stateChanged(NOTIFYNORMAL); | ||
620 | return; | 620 | return; | ||
621 | } | 621 | } | ||
622 | 622 | | |||
623 | bool hasFocus = false; | 623 | bool hasFocus = false; | ||
624 | foreach(TerminalDisplay *display, _views) { | 624 | for (auto *display : _views) { | ||
625 | if (display->hasFocus()) { | 625 | if (display->hasFocus()) { | ||
626 | hasFocus = true; | 626 | hasFocus = true; | ||
627 | break; | 627 | break; | ||
628 | } | 628 | } | ||
629 | } | 629 | } | ||
630 | 630 | | |||
631 | KNotification::event(hasFocus ? QStringLiteral("Silence") : QStringLiteral("SilenceHidden"), | 631 | KNotification::event(hasFocus ? QStringLiteral("Silence") : QStringLiteral("SilenceHidden"), | ||
632 | i18n("Silence in session '%1'", _nameTitle), QPixmap(), | 632 | i18n("Silence in session '%1'", _nameTitle), QPixmap(), | ||
633 | QApplication::activeWindow(), | 633 | QApplication::activeWindow(), | ||
634 | KNotification::CloseWhenWidgetActivated); | 634 | KNotification::CloseWhenWidgetActivated); | ||
635 | emit stateChanged(NOTIFYSILENCE); | 635 | emit stateChanged(NOTIFYSILENCE); | ||
636 | } | 636 | } | ||
637 | 637 | | |||
638 | void Session::activityTimerDone() | 638 | void Session::activityTimerDone() | ||
639 | { | 639 | { | ||
640 | _notifiedActivity = false; | 640 | _notifiedActivity = false; | ||
641 | } | 641 | } | ||
642 | 642 | | |||
643 | void Session::updateFlowControlState(bool suspended) | 643 | void Session::updateFlowControlState(bool suspended) | ||
644 | { | 644 | { | ||
645 | if (suspended) { | 645 | if (suspended) { | ||
646 | if (flowControlEnabled()) { | 646 | if (flowControlEnabled()) { | ||
647 | foreach(TerminalDisplay * display, _views) { | 647 | for (auto *display : _views) { | ||
648 | if (display->flowControlWarningEnabled()) { | 648 | if (display->flowControlWarningEnabled()) { | ||
649 | display->outputSuspended(true); | 649 | display->outputSuspended(true); | ||
650 | } | 650 | } | ||
651 | } | 651 | } | ||
652 | } | 652 | } | ||
653 | } else { | 653 | } else { | ||
654 | foreach(TerminalDisplay * display, _views) { | 654 | for (auto *display : _views) { | ||
655 | display->outputSuspended(false); | 655 | display->outputSuspended(false); | ||
656 | } | 656 | } | ||
657 | } | 657 | } | ||
658 | } | 658 | } | ||
659 | 659 | | |||
660 | void Session::changeTabTextColor(int i) | 660 | void Session::changeTabTextColor(int i) | ||
661 | { | 661 | { | ||
662 | qCDebug(KonsoleDebug) << "Changing tab text color is not implemented "<<i; | 662 | qCDebug(KonsoleDebug) << "Changing tab text color is not implemented "<<i; | ||
Show All 25 Lines | 687 | { | |||
688 | // TODO: should this hardcoded interval be user configurable? | 688 | // TODO: should this hardcoded interval be user configurable? | ||
689 | const int activityMaskInSeconds = 15; | 689 | const int activityMaskInSeconds = 15; | ||
690 | 690 | | |||
691 | if (state == NOTIFYBELL) { | 691 | if (state == NOTIFYBELL) { | ||
692 | emit bellRequest(i18n("Bell in session '%1'", _nameTitle)); | 692 | emit bellRequest(i18n("Bell in session '%1'", _nameTitle)); | ||
693 | } else if (state == NOTIFYACTIVITY) { | 693 | } else if (state == NOTIFYACTIVITY) { | ||
694 | // Don't notify if the terminal is active | 694 | // Don't notify if the terminal is active | ||
695 | bool hasFocus = false; | 695 | bool hasFocus = false; | ||
696 | foreach(TerminalDisplay *display, _views) { | 696 | for (auto *display : _views) { | ||
697 | if (display->hasFocus()) { | 697 | if (display->hasFocus()) { | ||
698 | hasFocus = true; | 698 | hasFocus = true; | ||
699 | break; | 699 | break; | ||
700 | } | 700 | } | ||
701 | } | 701 | } | ||
702 | 702 | | |||
703 | if (_monitorActivity && !_notifiedActivity) { | 703 | if (_monitorActivity && !_notifiedActivity) { | ||
704 | KNotification::event(hasFocus ? QStringLiteral("Activity") : QStringLiteral("ActivityHidden"), | 704 | KNotification::event(hasFocus ? QStringLiteral("Activity") : QStringLiteral("ActivityHidden"), | ||
Show All 34 Lines | 736 | { | |||
739 | 739 | | |||
740 | // minimum number of lines and columns that views require for | 740 | // minimum number of lines and columns that views require for | ||
741 | // their size to be taken into consideration ( to avoid problems | 741 | // their size to be taken into consideration ( to avoid problems | ||
742 | // with new view widgets which haven't yet been set to their correct size ) | 742 | // with new view widgets which haven't yet been set to their correct size ) | ||
743 | const int VIEW_LINES_THRESHOLD = 2; | 743 | const int VIEW_LINES_THRESHOLD = 2; | ||
744 | const int VIEW_COLUMNS_THRESHOLD = 2; | 744 | const int VIEW_COLUMNS_THRESHOLD = 2; | ||
745 | 745 | | |||
746 | //select largest number of lines and columns that will fit in all visible views | 746 | //select largest number of lines and columns that will fit in all visible views | ||
747 | foreach(TerminalDisplay* view, _views) { | 747 | for (auto* view : _views) { | ||
748 | if (!view->isHidden() && | 748 | if (!view->isHidden() && | ||
749 | view->lines() >= VIEW_LINES_THRESHOLD && | 749 | view->lines() >= VIEW_LINES_THRESHOLD && | ||
750 | view->columns() >= VIEW_COLUMNS_THRESHOLD) { | 750 | view->columns() >= VIEW_COLUMNS_THRESHOLD) { | ||
751 | minLines = (minLines == -1) ? view->lines() : qMin(minLines , view->lines()); | 751 | minLines = (minLines == -1) ? view->lines() : qMin(minLines , view->lines()); | ||
752 | minColumns = (minColumns == -1) ? view->columns() : qMin(minColumns , view->columns()); | 752 | minColumns = (minColumns == -1) ? view->columns() : qMin(minColumns , view->columns()); | ||
753 | view->processFilters(); | 753 | view->processFilters(); | ||
754 | } | 754 | } | ||
755 | } | 755 | } | ||
▲ Show 20 Lines • Show All 823 Lines • ▼ Show 20 Line(s) | 1570 | { | |||
1579 | } else { | 1579 | } else { | ||
1580 | return 0; | 1580 | return 0; | ||
1581 | } | 1581 | } | ||
1582 | } | 1582 | } | ||
1583 | 1583 | | |||
1584 | 1584 | | |||
1585 | void Session::setProfile(const QString &profileName) | 1585 | void Session::setProfile(const QString &profileName) | ||
1586 | { | 1586 | { | ||
1587 | const QList<Profile::Ptr> profiles = ProfileManager::instance()->allProfiles(); | 1587 | for (const auto &profile : ProfileManager::instance()->allProfiles()) { | ||
1588 | foreach (const Profile::Ptr &profile, profiles) { | | |||
1589 | if (profile->name() == profileName) { | 1588 | if (profile->name() == profileName) { | ||
1590 | SessionManager::instance()->setSessionProfile(this, profile); | 1589 | SessionManager::instance()->setSessionProfile(this, profile); | ||
1591 | } | 1590 | } | ||
1592 | } | 1591 | } | ||
1593 | } | 1592 | } | ||
1594 | 1593 | | |||
1595 | int Session::foregroundProcessId() | 1594 | int Session::foregroundProcessId() | ||
1596 | { | 1595 | { | ||
▲ Show 20 Lines • Show All 163 Lines • ▼ Show 20 Line(s) | 1758 | if (_inForwardData) { // Avoid recursive calls among session groups! | |||
1760 | // A recursive call happens when a master in group A calls forwardData() | 1759 | // A recursive call happens when a master in group A calls forwardData() | ||
1761 | // in group B. If one of the destination sessions in group B is also a | 1760 | // in group B. If one of the destination sessions in group B is also a | ||
1762 | // master of a group including the master session of group A, this would | 1761 | // master of a group including the master session of group A, this would | ||
1763 | // again call forwardData() in group A, and so on. | 1762 | // again call forwardData() in group A, and so on. | ||
1764 | return; | 1763 | return; | ||
1765 | } | 1764 | } | ||
1766 | 1765 | | |||
1767 | _inForwardData = true; | 1766 | _inForwardData = true; | ||
1768 | const QList<Session*> sessionsKeys = _sessions.keys(); | 1767 | for (auto* other : _sessions.keys()) { | ||
1769 | foreach(Session* other, sessionsKeys) { | | |||
1770 | if (!_sessions[other]) { | 1768 | if (!_sessions[other]) { | ||
1771 | other->emulation()->sendString(data); | 1769 | other->emulation()->sendString(data); | ||
1772 | } | 1770 | } | ||
1773 | } | 1771 | } | ||
1774 | _inForwardData = false; | 1772 | _inForwardData = false; | ||
1775 | } | 1773 | } | ||
1776 | 1774 | |