mirror of
https://github.com/KDE/konsole.git
synced 2026-06-11 07:26:10 -04:00
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:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user