Changeset View
Changeset View
Standalone View
Standalone View
src/ViewManager.cpp
Show First 20 Lines • Show All 965 Lines • ▼ Show 20 Line(s) | 965 | if (container != nullptr) { | |||
---|---|---|---|---|---|
966 | container->setCurrentWidget(i.key()); | 966 | container->setCurrentWidget(i.key()); | ||
967 | } | 967 | } | ||
968 | } | 968 | } | ||
969 | } | 969 | } | ||
970 | } | 970 | } | ||
971 | 971 | | |||
972 | int ViewManager::newSession() | 972 | int ViewManager::newSession() | ||
973 | { | 973 | { | ||
974 | Profile::Ptr profile = ProfileManager::instance()->defaultProfile(); | 974 | return newSession(QString()); | ||
hindenburg: simpler toalso add the , QString() as below? | |||||
975 | Session *session = SessionManager::instance()->createSession(profile); | | |||
976 | | ||||
977 | session->addEnvironmentEntry(QStringLiteral("KONSOLE_DBUS_WINDOW=/Windows/%1").arg(managerId())); | | |||
978 | | ||||
979 | createView(session); | | |||
980 | session->run(); | | |||
981 | | ||||
982 | return session->sessionId(); | | |||
983 | } | 975 | } | ||
984 | 976 | | |||
985 | int ViewManager::newSession(const QString &profile) | 977 | int ViewManager::newSession(const QString &profile) | ||
986 | { | 978 | { | ||
987 | const QList<Profile::Ptr> profilelist = ProfileManager::instance()->allProfiles(); | 979 | return newSession(profile, QString()); | ||
988 | Profile::Ptr profileptr = ProfileManager::instance()->defaultProfile(); | | |||
989 | | ||||
990 | for (const auto &i : profilelist) { | | |||
991 | if (i->name() == profile) { | | |||
992 | profileptr = i; | | |||
993 | break; | | |||
994 | } | | |||
995 | } | | |||
996 | | ||||
997 | Session *session = SessionManager::instance()->createSession(profileptr); | | |||
998 | | ||||
999 | session->addEnvironmentEntry(QStringLiteral("KONSOLE_DBUS_WINDOW=/Windows/%1").arg(managerId())); | | |||
1000 | | ||||
1001 | createView(session); | | |||
1002 | session->run(); | | |||
1003 | | ||||
1004 | return session->sessionId(); | | |||
1005 | } | 980 | } | ||
1006 | 981 | | |||
1007 | int ViewManager::newSession(const QString &profile, const QString &directory) | 982 | int ViewManager::newSession(const QString &profile, const QString &directory) | ||
1008 | { | 983 | { | ||
1009 | const QList<Profile::Ptr> profilelist = ProfileManager::instance()->allProfiles(); | 984 | const QList<Profile::Ptr> profilelist = ProfileManager::instance()->allProfiles(); | ||
1010 | Profile::Ptr profileptr = ProfileManager::instance()->defaultProfile(); | 985 | Profile::Ptr profileptr = profile.isEmpty() | ||
1011 | 986 | ? ProfileManager::instance()->defaultProfile() | |||
1012 | for (const auto &i : profilelist) { | 987 | : ProfileManager::instance()->loadProfile(profile); | ||
1013 | if (i->name() == profile) { | | |||
1014 | profileptr = i; | | |||
1015 | break; | | |||
1016 | } | | |||
1017 | } | | |||
1018 | 988 | | |||
1019 | Session *session = SessionManager::instance()->createSession(profileptr); | 989 | Session *session = SessionManager::instance()->createSession(profileptr); | ||
990 | if (!directory.isEmpty()) { | ||||
1020 | session->setInitialWorkingDirectory(directory); | 991 | session->setInitialWorkingDirectory(directory); | ||
1021 | 992 | } | |||
1022 | session->addEnvironmentEntry(QStringLiteral("KONSOLE_DBUS_WINDOW=/Windows/%1").arg(managerId())); | 993 | session->addEnvironmentEntry(QStringLiteral("KONSOLE_DBUS_WINDOW=/Windows/%1").arg(managerId())); | ||
1023 | 994 | | |||
1024 | createView(session); | 995 | createView(session); | ||
1025 | session->run(); | 996 | session->run(); | ||
1026 | 997 | | |||
1027 | return session->sessionId(); | 998 | return session->sessionId(); | ||
1028 | } | 999 | } | ||
1029 | 1000 | | |||
▲ Show 20 Lines • Show All 76 Lines • Show Last 20 Lines |
simpler toalso add the , QString() as below?