Summary: | deleted session shortcuts are remembered | ||
---|---|---|---|
Product: | [Applications] konsole | Reporter: | Kurt Hindenburg <khindenburg> |
Component: | general | Assignee: | Kurt Hindenburg <khindenburg> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | mikmach |
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Compiled Sources | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: | |||
Attachments: | Fix removing shortcuts for deleted sessions |
Description
Kurt Hindenburg
2004-12-18 20:34:34 UTC
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; }; |