Add new DBus method newSession(profile)

This seems more useful then newSession(profile, directory) as the
working directory from the profile should be used.
A lot of duplicated code ATM.
This commit is contained in:
Kurt Hindenburg
2017-07-08 16:54:55 -04:00
parent 51cc49e95e
commit f360d02016
2 changed files with 28 additions and 0 deletions

View File

@@ -1107,6 +1107,28 @@ int ViewManager::newSession()
return session->sessionId();
}
int ViewManager::newSession(const QString &profile)
{
const QList<Profile::Ptr> profilelist = ProfileManager::instance()->allProfiles();
Profile::Ptr profileptr = ProfileManager::instance()->defaultProfile();
for (const auto &i : profilelist) {
if (i->name() == profile) {
profileptr = i;
break;
}
}
Session *session = SessionManager::instance()->createSession(profileptr);
session->addEnvironmentEntry(QStringLiteral("KONSOLE_DBUS_WINDOW=/Windows/%1").arg(managerId()));
this->createView(session);
session->run();
return session->sessionId();
}
int ViewManager::newSession(const QString &profile, const QString &directory)
{
const QList<Profile::Ptr> profilelist = ProfileManager::instance()->allProfiles();