summaryrefslogtreecommitdiffstats
path: root/kxkb/kxkbtraywindow.h
diff options
context:
space:
mode:
authorMavridis Philippe <mavridisf@gmail.com>2024-10-28 14:40:20 +0200
committerMavridis Philippe <mavridisf@gmail.com>2024-11-12 22:29:51 +0200
commit71068b3b258a340be30a91c3a5af92718da70cdd (patch)
tree6ba4afb1b1b254f21cef141321a51b5605ba54c4 /kxkb/kxkbtraywindow.h
parent1afb78e598cc0d8c320e98c963cb98ab7935435f (diff)
downloadtdebase-71068b3b258a340be30a91c3a5af92718da70cdd.tar.gz
tdebase-71068b3b258a340be30a91c3a5af92718da70cdd.zip
Kxkb: improve system tray code and fix various switching-related bugs
- Improved layout change logic (indicator is now always updated when the actual switch occurs). This fixes layout switching triggered by the X11 shortcut not being synchronized with layout switching from the tray icon click and the TDE shortcut. - Kxkb will ignore XkbStateNotify events not related to XkbGroupState which caused strange behaviour with the system tray context menu. - Merged KxkbLabelController into KxkbSystemTray This resolves #547. Signed-off-by: Mavridis Philippe <mavridisf@gmail.com>
Diffstat (limited to 'kxkb/kxkbtraywindow.h')
-rw-r--r--kxkb/kxkbtraywindow.h81
1 files changed, 20 insertions, 61 deletions
diff --git a/kxkb/kxkbtraywindow.h b/kxkb/kxkbtraywindow.h
index 46d66c44b..484bae632 100644
--- a/kxkb/kxkbtraywindow.h
+++ b/kxkb/kxkbtraywindow.h
@@ -1,7 +1,7 @@
//
// C++ Interface: kxkbtraywindow
//
-// Description:
+// Description:
//
//
// Author: Andriy Rysin <rysin@kde.org>, (C) 2006
@@ -19,75 +19,34 @@
#include "kxkbconfig.h"
-
-class TQLabel;
-class TDEPopupMenu;
class XkbRules;
-/* This class is responsible for displaying flag/label for the layout,
- catching keyboard/mouse events and displaying menu when selected
-*/
-
-class KxkbLabelController: public TQObject
+class KxkbSystemTray : public KSystemTray
{
-// TQ_OBJECT
-
-public:
- enum { START_MENU_ID = 100, CONFIG_MENU_ID = 130, HELP_MENU_ID = 131 };
-
- KxkbLabelController(TQLabel *label, TDEPopupMenu* contextMenu);
+ TQ_OBJECT
- void initLayoutList(const TQValueList<LayoutUnit>& layouts, const XkbRules& rule);
- void setCurrentLayout(const LayoutUnit& layout);
-// void setCurrentLayout(const TQString& layout, const TQString &variant);
- void setError(const TQString& layoutInfo="");
- void setShowFlag(bool showFlag) { m_showFlag = showFlag; }
- void show() { label->show(); }
+ public:
+ KxkbSystemTray();
+ void initLayoutList(const TQValueList<LayoutUnit>& layouts, const XkbRules& rule);
+ void setCurrentLayout(const LayoutUnit& layout);
+ void setError(const TQString& layoutInfo = TQString::null);
- WId winId() { return label->winId(); }
-
-// signals:
-//
-// void menuActivated(int);
-// void toggled();
+ enum { START_MENU_ID = 100, CONFIG_MENU_ID = 130, HELP_MENU_ID = 131 };
-// protected:
-//
-// void mouseReleaseEvent(TQMouseEvent *);
-
-private:
- TQLabel* label;
- TDEPopupMenu* contextMenu;
-
- const int m_menuStartIndex;
- bool m_showFlag;
- int m_prevLayoutCount;
- TQMap<TQString, TQString> m_descriptionMap;
-
- void setToolTip(const TQString& tip);
- void setPixmap(const TQPixmap& pixmap);
-};
+ protected:
+ void mouseReleaseEvent(TQMouseEvent *ev);
+ private slots:
+ void setToolTip(const TQString& tip);
+ void setPixmap(const TQPixmap& pix);
-class KxkbSystemTray : public KSystemTray
-{
- TQ_OBJECT
-
- public:
- KxkbSystemTray():
- KSystemTray(NULL)
- {}
-
- void mouseReleaseEvent(TQMouseEvent *ev)
- {
- if (ev->button() == TQt::LeftButton)
- emit toggled();
- KSystemTray::mouseReleaseEvent(ev);
- }
+ signals:
+ void menuActivated(int);
+ void toggled();
- signals:
- void menuActivated(int);
- void toggled();
+ private:
+ int m_prevLayoutCount;
+ TQMap<TQString, TQString> m_descriptionMap;
};