diff --git a/src/Session.h b/src/Session.h --- a/src/Session.h +++ b/src/Session.h @@ -587,6 +587,11 @@ */ Q_SCRIPTABLE int historySize() const; + /** + * Sets the current session's profile + */ + Q_SCRIPTABLE void setProfile(const QString &profile); + Q_SIGNALS: /** Emitted when the terminal process starts. */ diff --git a/src/Session.cpp b/src/Session.cpp --- a/src/Session.cpp +++ b/src/Session.cpp @@ -56,6 +56,9 @@ #include "ZModemDialog.h" #include "History.h" #include "konsoledebug.h" +#include "SessionManager.h" +#include "ProfileManager.h" +#include "Profile.h" using namespace Konsole; @@ -1574,6 +1577,17 @@ } } + +void Session::setProfile(const QString &profileName) +{ + const QList profiles = ProfileManager::instance()->allProfiles(); + foreach (const Profile::Ptr &profile, profiles) { + if (profile->name() == profileName) { + SessionManager::instance()->setSessionProfile(this, profile); + } + } +} + int Session::foregroundProcessId() { int pid;