Changeset View
Changeset View
Standalone View
Standalone View
src/ViewManager.cpp
Show First 20 Lines • Show All 1060 Lines • ▼ Show 20 Line(s) | 1060 | if (i.value()->sessionId() == sessionId) { | |||
---|---|---|---|---|---|
1061 | ViewContainer *container = _viewSplitter->activeContainer(); | 1061 | ViewContainer *container = _viewSplitter->activeContainer(); | ||
1062 | if (container != nullptr) { | 1062 | if (container != nullptr) { | ||
1063 | container->setActiveView(i.key()); | 1063 | container->setActiveView(i.key()); | ||
1064 | } | 1064 | } | ||
1065 | } | 1065 | } | ||
1066 | } | 1066 | } | ||
1067 | } | 1067 | } | ||
1068 | 1068 | | |||
1069 | int ViewManager::newSession() | 1069 | int ViewManager::newSession(const QString &profile, const QString &directory, bool runSession) | ||
1070 | { | 1070 | { | ||
1071 | Profile::Ptr profile = ProfileManager::instance()->defaultProfile(); | | |||
1072 | Session *session = SessionManager::instance()->createSession(profile); | | |||
1073 | | ||||
1074 | session->addEnvironmentEntry(QStringLiteral("KONSOLE_DBUS_WINDOW=/Windows/%1").arg(managerId())); | | |||
1075 | | ||||
1076 | createView(session); | | |||
1077 | session->run(); | | |||
1078 | | ||||
1079 | return session->sessionId(); | | |||
1080 | } | | |||
1081 | | ||||
1082 | int ViewManager::newSession(const QString &profile) | | |||
1083 | { | | |||
1084 | const QList<Profile::Ptr> profilelist = ProfileManager::instance()->allProfiles(); | | |||
1085 | Profile::Ptr profileptr = ProfileManager::instance()->defaultProfile(); | 1071 | Profile::Ptr profileptr = ProfileManager::instance()->defaultProfile(); | ||
1086 | 1072 | | |||
1087 | for (const auto &i : profilelist) { | 1073 | if (!profile.isEmpty()) { | ||
1088 | if (i->name() == profile) { | | |||
1089 | profileptr = i; | | |||
1090 | break; | | |||
1091 | } | | |||
1092 | } | | |||
1093 | | ||||
1094 | Session *session = SessionManager::instance()->createSession(profileptr); | | |||
1095 | | ||||
1096 | session->addEnvironmentEntry(QStringLiteral("KONSOLE_DBUS_WINDOW=/Windows/%1").arg(managerId())); | | |||
1097 | | ||||
1098 | createView(session); | | |||
1099 | session->run(); | | |||
1100 | | ||||
1101 | return session->sessionId(); | | |||
1102 | } | | |||
1103 | | ||||
1104 | int ViewManager::newSession(const QString &profile, const QString &directory) | | |||
1105 | { | | |||
1106 | const QList<Profile::Ptr> profilelist = ProfileManager::instance()->allProfiles(); | 1074 | const QList<Profile::Ptr> profilelist = ProfileManager::instance()->allProfiles(); | ||
1107 | Profile::Ptr profileptr = ProfileManager::instance()->defaultProfile(); | | |||
1108 | | ||||
1109 | for (const auto &i : profilelist) { | 1075 | for (const auto &i : profilelist) { | ||
1110 | if (i->name() == profile) { | 1076 | if (i->name() == profile) { | ||
1111 | profileptr = i; | 1077 | profileptr = i; | ||
1112 | break; | 1078 | break; | ||
1113 | } | 1079 | } | ||
1114 | } | 1080 | } | ||
1081 | } | ||||
1115 | 1082 | | |||
1116 | Session *session = SessionManager::instance()->createSession(profileptr); | 1083 | Session *session = SessionManager::instance()->createSession(profileptr); | ||
1084 | if (!directory.isEmpty()) | ||||
1117 | session->setInitialWorkingDirectory(directory); | 1085 | session->setInitialWorkingDirectory(directory); | ||
1118 | 1086 | | |||
1119 | session->addEnvironmentEntry(QStringLiteral("KONSOLE_DBUS_WINDOW=/Windows/%1").arg(managerId())); | 1087 | session->addEnvironmentEntry(QStringLiteral("KONSOLE_DBUS_WINDOW=/Windows/%1").arg(managerId())); | ||
1120 | 1088 | | |||
1121 | createView(session); | 1089 | createView(session); | ||
1090 | if (runSession) | ||||
1122 | session->run(); | 1091 | session->run(); | ||
hindenburg: did you mean runSession here? This currently doesn't compile. | |||||
tcanabrava: "never commit code while sleeping", yes, sorry. fixed. | |||||
1123 | 1092 | | |||
1124 | return session->sessionId(); | 1093 | return session->sessionId(); | ||
1125 | } | 1094 | } | ||
1126 | 1095 | | |||
1127 | QString ViewManager::defaultProfile() | 1096 | QString ViewManager::defaultProfile() | ||
1128 | { | 1097 | { | ||
1129 | return ProfileManager::instance()->defaultProfile()->name(); | 1098 | return ProfileManager::instance()->defaultProfile()->name(); | ||
1130 | } | 1099 | } | ||
▲ Show 20 Lines • Show All 104 Lines • Show Last 20 Lines |
did you mean runSession here? This currently doesn't compile.