Commit f0e9efa4 authored by Tomaz  Canabrava's avatar Tomaz Canabrava Committed by Kurt Hindenburg
Browse files

Change the Profile when the SSH Session changes

This is still missing a bit: When the user get's back from ssh
to the localhost, we are activating the default profile, not the
previous profile.
parent f4d35d07
......@@ -23,6 +23,11 @@
#include "profile/ProfileManager.h"
#include "session/Session.h"
#include "session/SessionController.h"
#include "session/SessionManager.h"
#include "profile/ProfileManager.h"
#include "profile/ProfileModel.h"
#include "sshconfigurationdata.h"
Q_LOGGING_CATEGORY(SshManagerPlugin, "org.kde.konsole.plugin.sshmanager")
......@@ -174,7 +179,25 @@ void SSHManagerModel::setSessionController(Konsole::SessionController *controlle
void SSHManagerModel::triggerProfileChange(const QString &sshHost)
qDebug() << "Localhost changed to" << sshHost;
auto *sm = Konsole::SessionManager::instance();
std::optional<QString> profileName = profileForHost(sshHost);
Konsole::Profile::Ptr profile;
if (profileName) {
for (auto pr : Konsole::ProfileManager::instance()->allProfiles()) {
if (pr->name() == profileName.value()) {
profile = pr;
} else {
// TODO: Return to the profile that was active on `localhost` prior to
// activating the profile for the ssh manager. but I need to store a list of
// sessions and profiles to save. Currently, this is enough.
profile = Konsole::ProfileManager::instance()->defaultProfile();
sm->setSessionProfile(m_session, profile);
void SSHManagerModel::load()
Supports Markdown
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