Version: (using KDE Devel) Installed from: Compiled sources OS: Linux This bug is from the patch I applied for BR66737. ------- Additional Comment #16 From Mikolaj Machowski 2004-12-17 00:18 ------- > The creating/deleting sessions problem should be fixed. > Please test this fully... Works really pretty now. But still one thing :) - new session, Vim (calling vim) - assign shortcut 'Ctrl-L,V' - remove session with name Vim - create session with the same name 'Vim' old shortcut is automatically reassigned; even after restart of Konsole. Looks like patch doesn't remove shortcut assignments and they are automatically recalled when session with that name is visible again. Things go astray when: - new session, Vim (calling vim) - assign shortcut 'Ctrl-L,V' - remove session with name Vim - create new session 'top' (with top command) - assign shortcut 'Ctrl-L,V' - create new-old session 'Vim' No crashes but after pressing 'Ctrl-L,V' Konsole doesn't know what to do.
Created attachment 8716 [details] Fix removing shortcuts for deleted sessions Mikolaj, can you test this patch? Is is the bug from my code to implement shortcuts for sessions. Have you noticed any other oddities with the shortcuts?
> Mikolaj, can you test this patch? Is is the bug from my code to > implement shortcuts for sessions. > Have you noticed any other oddities with the shortcuts? WORKSFORME ;)
CVS commit by hindenburg: BUG: 95407 Fix deleted session shortcuts are remembered. M +25 -10 konsole.cpp 1.491 M +1 -0 konsole.h 1.189 --- kdebase/konsole/konsole/konsole.cpp #1.490:1.491 @@ -263,4 +263,5 @@ Konsole::Konsole(const char* name, const ,m_removeSessionButton(0) ,sessionNumberMapper(0) +,sl_sessionShortCuts(0) { isRestored = b_inRestore; @@ -367,6 +368,4 @@ Konsole::Konsole(const char* name, const Konsole::~Konsole() { - delete sessionNumberMapper; - while (detached.count()) { KonsoleChild* child=detached.first(); @@ -2092,19 +2091,35 @@ void Konsole::reparseConfiguration() this, SLOT( newSessionTabbar( int ) ) ); - // Should be a better way to traverse KActionCollection + sl_sessionShortCuts.clear(); + buildSessionMenus(); + + // FIXME: Should be a better way to traverse KActionCollection uint count = m_shortcuts->count(); for ( uint i = 0; i < count; i++ ) { KAction* action = m_shortcuts->action( i ); - // Delete all session shortcuts... + bool b_foundSession = false; if ( QString(action->name()).startsWith("SSC_") ) { + QString name = QString(action->name()); + + // Check to see if shortcut's session has been loaded. + for ( QStringList::Iterator it = sl_sessionShortCuts.begin(); it != sl_sessionShortCuts.end(); ++it ) { + if ( QString::compare( *it, name ) == 0 ) { + b_foundSession = true; + break; + } + } + if ( ! b_foundSession ) { +// kdDebug()<< "Session "<<name<<" is not valid anymore... deleting"<<endl; + action->setShortcut( KShortcut() ); // Clear shortcut + m_shortcuts->writeShortcutSettings(); delete action; // Remove Action and Accel - if ( i == 0 ) i = 0; + if ( i == 0 ) i = 0; // Reset index else i--; count--; // = m_shortcuts->count(); } } + } - buildSessionMenus(); m_shortcuts->readShortcutSettings(); @@ -3340,5 +3355,5 @@ void Konsole::addSessionCommand(const QS name.prepend("SSC_"); // Allows easy searching for Session ShortCuts name.replace(" ", "_"); - QString cmd_id = QString("%1").arg(cmd_serial); + sl_sessionShortCuts << name; // Is there already this shortcut? --- kdebase/konsole/konsole/konsole.h #1.188:1.189 @@ -419,4 +419,5 @@ private: QSignalMapper* sessionNumberMapper; + QStringList sl_sessionShortCuts; };