Commit f360d020 authored by Kurt Hindenburg's avatar Kurt Hindenburg

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.
parent 51cc49e9
......@@ -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();
......
......@@ -234,6 +234,12 @@ public Q_SLOTS:
/** DBus slot that returns the current (active) session window */
Q_SCRIPTABLE int currentSession();
/** DBus slot that creates a new session in the current view.
* @param profile the name of the profile to be used
* started.
*/
Q_SCRIPTABLE int newSession(const QString &profile);
/** DBus slot that creates a new session in the current view.
* @param profile the name of the profile to be used
* @param directory the working directory where the session is
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment