Added global shortcuts for switching to previous/next group

Signed-off-by: Mavridis Philippe <mavridisf@gmail.com>
(cherry picked from commit 4dabd7ae638954e27ac7d2f1390f7d22c26a0928)
r14.1.x
Mavridis Philippe 1 year ago
parent 29ed3556f9
commit d0cbee5154
No known key found for this signature in database
GPG Key ID: F8D2D7E2F989A494

@ -109,6 +109,16 @@ void KBConfig::load(TDEConfig *config){
TQString::null, TQt::ALT+TQt::CTRL+TQt::Key_1 + i, KKey::QtWIN+TQt::CTRL+TQt::Key_1 + i,
kapp, SLOT(slotGroupSelected(int)));
}
m_keys->insert("NextGroup", i18n("Cycle keyboard layouts"),
i18n("Activates the next keyboard layout or, if the current layout is the last one, "
"activates the first layout."),
TQt::SHIFT+TQt::CTRL+TQt::Key_Plus, TQt::SHIFT+TQt::CTRL+TQt::Key_Plus,
kapp, SLOT(slotSelectNextGroup()));
m_keys->insert("PrevGroup", i18n("Cycle keyboard layouts (reverse)"),
i18n("Activates the previous keyboard layout or, if the current layout is the first one, "
"activates the last layout."),
TQt::SHIFT+TQt::CTRL+TQt::Key_Minus, TQt::SHIFT+TQt::CTRL+TQt::Key_Minus,
kapp, SLOT(slotSelectPrevGroup()));
m_keys->readSettings(config);
checkKeysEnabled();
}

@ -85,9 +85,12 @@ public:
void drawIcons(IconStyle icon_style, TQValueVector<TQPixmap> *icons,
TQStringList *iconpaths);
void checkKeysEnabled();
int getPrevGroup(int groupno) {
return groupno == 0 ? groupCount() - 1 : groupno - 1;
}
int getNextGroup(int groupno) {
return groupno >= groupCount() - 1 ? 0 : groupno + 1;
}
}
private: // Private methods
/** No descriptions */
//void guessGroupPixmaps();

@ -130,15 +130,25 @@ void KBSwitchApp::forceSetGroup(int groupno)
m_xkb.setGroupNo(groupno);
}
/** No descriptions */
/** Select the next keyboard layout (wraps around) */
void KBSwitchApp::slotSelectNextGroup()
{
#ifdef HAVE_LIBXKLAVIER
m_xkb.setGroupNo(XklGetNextGroup());
#else
#else
//forceSetGroup(m_next_groupno);
m_xkb.setGroupNo(m_next_groupno);
#endif
#endif
}
/** Select the previous keyboard layout (wraps around) */
void KBSwitchApp::slotSelectPrevGroup()
{
#ifdef HAVE_LIBXKLAVIER
m_xkb.setGroupNo(XklGetPrevGroup());
#else
m_xkb.setGroupNo(m_kbconf.getPrevGroup(m_cur_groupno));
#endif
}
/** No descriptions */

@ -110,8 +110,10 @@ private: // Private methods
private slots: // Private slots
/** No descriptions */
void slotGroupSelected(int groupno);
/** No descriptions */
/** Select the next keyboard layout (wraps around) */
void slotSelectNextGroup();
/** Select the previous keyboard layout (wraps around) */
void slotSelectPrevGroup();
/** No descriptions */
void slotPreferences();
/** No descriptions */

Loading…
Cancel
Save