[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdebase/workspace/kcontrol/keyboard
From:       Andriy Rysin <arysin () gmail ! com>
Date:       2010-09-21 21:20:31
Message-ID: 20100921212031.BEC3AAC88C () svn ! kde ! org
[Download RAW message or body]

SVN commit 1177978 by rysin:

switch layouts with mouse scroll

 M  +7 -3      TODO  
 M  +7 -0      layout_widget.cpp  
 M  +1 -0      layout_widget.h  
 M  +9 -4      x11_helper.cpp  
 M  +1 -0      x11_helper.h  


--- trunk/KDE/kdebase/workspace/kcontrol/keyboard/TODO #1177977:1177978
@@ -1,3 +1,6 @@
+Tests:
+* tests
+
 Core:
 * better handling when layouts set manually and not present in config
 
@@ -3,15 +6,17 @@
 KCM UI:
 * use listboxes instead of combos in add layout dialog 
+* allow multiple layouts to be added in same dialog?
 
 KCM UI cleanup:
-* show nicer flag in the table
 * layouts, sizes, alignment etc in kcm
 
 plasma applet:
-* make applet show nicely in taskbar (not just desktop)
+* make applet use shadowed text
 
 kxkb part
 * tooltip (currently does not work in lockdlg for some reason)
 
+tray icon
+
 Code cleanup:
 * rules, iso_codes:
@@ -25,7 +30,6 @@
 * refactor client code for D-BUS API to use library instead?
 
 External improvements:
-* Change KStatusNotifierItem menu window to be real popup window
 * Add KSharedConfig::configChanged() signal
 * make iso-codes external package 
 * make flags external package
--- trunk/KDE/kdebase/workspace/kcontrol/keyboard/layout_widget.cpp #1177977:1177978
@@ -154,6 +154,7 @@
 void LayoutTrayIcon::init()
 {
     connect(m_notifierItem, SIGNAL(activateRequested(bool, QPoint)), this, \
SLOT(toggleLayout())); +    connect(m_notifierItem, SIGNAL(scrollRequested(int, \
Qt::Orientation)), this, SLOT(scrollRequested(int, Qt::Orientation)));  \
connect(&xEventNotifier, SIGNAL(layoutChanged()), this, SLOT(layoutChanged()));  \
connect(&xEventNotifier, SIGNAL(layoutMapChanged()), this, SLOT(layoutMapChanged())); \
xEventNotifier.start(); @@ -164,6 +165,7 @@
 	xEventNotifier.stop();
 	disconnect(&xEventNotifier, SIGNAL(layoutMapChanged()), this, \
SLOT(layoutMapChanged()));  disconnect(&xEventNotifier, SIGNAL(layoutChanged()), \
this, SLOT(layoutChanged())); +    disconnect(m_notifierItem, \
SIGNAL(scrollRequested(int, Qt::Orientation)), this, SLOT(scrollRequested(int, \
                Qt::Orientation)));
     disconnect(m_notifierItem, SIGNAL(activateRequested(bool, QPoint)), this, \
SLOT(toggleLayout()));  }
 
@@ -204,6 +206,11 @@
 	X11Helper::switchToNextLayout();
 }
 
+void LayoutTrayIcon::scrollRequested(int delta, Qt::Orientation /*orientation*/)
+{
+	X11Helper::scrollLayouts(delta > 0 ? 1 : -1);
+}
+
 const QIcon LayoutTrayIcon::getFlag(const QString& layout) const
 {
 	return keyboardConfig->showFlag ? flags->getIcon(layout) : QIcon();
--- trunk/KDE/kdebase/workspace/kcontrol/keyboard/layout_widget.h #1177977:1177978
@@ -76,6 +76,7 @@
     void layoutChanged();
     void layoutMapChanged();
     void actionTriggered(QAction* action);
+    void scrollRequested(int, Qt::Orientation);
 
 private:
 	void init();
--- trunk/KDE/kdebase/workspace/kcontrol/keyboard/x11_helper.cpp #1177977:1177978
@@ -69,11 +69,16 @@
 void X11Helper::switchToNextLayout()
 {
 	int size = getLayoutsList().size();	//TODO: could optimize a bit as we don't need \
                the layouts - just count
-	int group = X11Helper::getGroup() + 1;
+	int group = (X11Helper::getGroup() + 1) % size;
+	X11Helper::setGroup(group);
+}
 
-	if( group >= size ) {
-		group = 0;
-	}
+void X11Helper::scrollLayouts(int delta)
+{
+	int size = getLayoutsList().size();	//TODO: could optimize a bit as we don't need \
the layouts - just count +	int group = X11Helper::getGroup() + delta;
+	group = group < 0 ? size - ((-group) % size) : group % size;
+
 	X11Helper::setGroup(group);
 }
 
--- trunk/KDE/kdebase/workspace/kcontrol/keyboard/x11_helper.h #1177977:1177978
@@ -105,6 +105,7 @@
 	static bool xkbSupported(int* xkbOpcode);
 
 	static void switchToNextLayout();
+	static void scrollLayouts(int delta);
 	static bool isDefaultLayout();
 	static bool setDefaultLayout();
 	static bool setLayout(const LayoutUnit& layout);


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic