diff --git a/src/ProfileList.cpp b/src/ProfileList.cpp index c9714534a..83a0addb8 100644 --- a/src/ProfileList.cpp +++ b/src/ProfileList.cpp @@ -65,6 +65,8 @@ ProfileList::ProfileList(bool addShortcuts , QObject* parent) // listen for future changes to the session list connect( manager , SIGNAL(favoriteStatusChanged(const QString&,bool)) , this , SLOT(favoriteChanged(const QString&,bool)) ); + connect( manager , SIGNAL(shortcutChanged(QString,QKeySequence)) , this , + SLOT(shortcutChanged(QString,QKeySequence)) ); connect( manager , SIGNAL(profileChanged(const QString&)) , this , SLOT(profileChanged(const QString&)) ); } @@ -107,7 +109,18 @@ void ProfileList::updateAction(QAction* action , Profile* info) action->setText(info->name()); action->setIcon(KIcon(info->icon())); } +void ProfileList::shortcutChanged(const QString& key,const QKeySequence& sequence) +{ + if ( !_addShortcuts ) + return; + QAction* action = actionForKey(key); + + if ( action ) + { + action->setShortcut(sequence); + } +} void ProfileList::favoriteChanged(const QString& key,bool isFavorite) { SessionManager* manager = SessionManager::instance(); diff --git a/src/ProfileList.h b/src/ProfileList.h index d39bd2716..a393b678b 100644 --- a/src/ProfileList.h +++ b/src/ProfileList.h @@ -25,6 +25,7 @@ class QAction; class QActionGroup; +class QKeySequence; namespace Konsole { @@ -79,7 +80,8 @@ signals: private slots: void triggered(QAction* action); void favoriteChanged(const QString& key , bool isFavorite); - void profileChanged(const QString& key); + void profileChanged(const QString& key); + void shortcutChanged(const QString& key, const QKeySequence& sequence); private: QAction* actionForKey(const QString& key) const; diff --git a/src/SessionManager.cpp b/src/SessionManager.cpp index 80232a548..b7625618d 100644 --- a/src/SessionManager.cpp +++ b/src/SessionManager.cpp @@ -593,6 +593,8 @@ void SessionManager::setShortcut(const QString& profileKey , // TODO - This won't work if the profile doesn't // have a path yet _shortcuts.insert(keySequence,data); + + emit shortcutChanged(profileKey,keySequence); } void SessionManager::loadFavorites() {