mirror of
https://github.com/KDE/konsole.git
synced 2026-05-07 14:16:40 -04:00
Create runtime profile only once per session.
The patch is provied by Gu Rui <chaos.proton@gmail.com> REVIEW: 102506
This commit is contained in:
@@ -758,18 +758,23 @@ Profile::Ptr SessionManager::findByShortcut(const QKeySequence& shortcut)
|
||||
|
||||
void SessionManager::sessionProfileCommandReceived(const QString& text)
|
||||
{
|
||||
// FIXME: This is inefficient, it creates a new profile instance for
|
||||
// each set of changes applied. Instead a new profile should be created
|
||||
// only the first time changes are applied to a session
|
||||
|
||||
Session* session = qobject_cast<Session*>(sender());
|
||||
Q_ASSERT( session );
|
||||
|
||||
ProfileCommandParser parser;
|
||||
QHash<Profile::Property,QVariant> changes = parser.parse(text);
|
||||
|
||||
Profile::Ptr newProfile = Profile::Ptr(new Profile(_sessionProfiles[session]));
|
||||
|
||||
Profile::Ptr newProfile;
|
||||
if ( !_sessionRuntimeProfiles.contains(session) )
|
||||
{
|
||||
newProfile = new Profile(_sessionProfiles[session]);
|
||||
_sessionRuntimeProfiles.insert(session,newProfile);
|
||||
}
|
||||
else
|
||||
{
|
||||
newProfile = _sessionRuntimeProfiles[session];
|
||||
}
|
||||
|
||||
QHashIterator<Profile::Property,QVariant> iter(changes);
|
||||
while ( iter.hasNext() )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user