[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-12-28 13:24:09
Message-ID: 20101228132409.C0359AC8AD () svn ! kde ! org
[Download RAW message or body]

SVN commit 1209890 by rysin:

Export layout change signal via DBUS API

 M  +12 -1     keyboard_daemon.cpp  
 M  +5 -0      keyboard_daemon.h  


--- trunk/KDE/kdebase/workspace/kcontrol/keyboard/keyboard_daemon.cpp \
#1209889:1209890 @@ -57,7 +57,7 @@
 
     QDBusConnection dbus = QDBusConnection::sessionBus();
 	dbus.registerService(KEYBOARD_DBUS_SERVICE_NAME);
-	dbus.registerObject(KEYBOARD_DBUS_OBJECT_PATH, this, \
QDBusConnection::ExportScriptableSlots); \
+	dbus.registerObject(KEYBOARD_DBUS_OBJECT_PATH, this, \
                QDBusConnection::ExportScriptableSlots | \
                QDBusConnection::ExportScriptableSignals);
     dbus.connect(QString(), KEYBOARD_DBUS_OBJECT_PATH, KEYBOARD_DBUS_SERVICE_NAME, \
KEYBOARD_DBUS_CONFIG_RELOAD_MESSAGE, this, SLOT( configureKeyboard() ));  
 	configureKeyboard();
@@ -149,6 +149,7 @@
 	connect(xEventNotifier, SIGNAL(newKeyboardDevice()), this, \
SLOT(configureKeyboard()));  connect(xEventNotifier, SIGNAL(layoutChanged()), \
&layoutMemory, SLOT(layoutChanged()));  connect(xEventNotifier, \
SIGNAL(layoutMapChanged()), &layoutMemory, SLOT(layoutMapChanged())); \
+	connect(xEventNotifier, SIGNAL(layoutChanged()), this, SLOT(layoutChanged()));  \
xEventNotifier->start();  }
 
@@ -163,6 +164,7 @@
 		disconnect(xEventNotifier, SIGNAL(newKeyboardDevice()), this, \
SLOT(configureKeyboard()));  disconnect(xEventNotifier, SIGNAL(layoutChanged()), \
&layoutMemory, SLOT(layoutChanged()));  disconnect(xEventNotifier, \
SIGNAL(layoutMapChanged()), &layoutMemory, SLOT(layoutMapChanged())); \
+		disconnect(xEventNotifier, SIGNAL(layoutChanged()), this, SLOT(layoutChanged()));  \
}  }
 
@@ -175,6 +177,15 @@
 	}
 }
 
+void KeyboardDaemon::layoutChanged()
+{
+	LayoutUnit newLayout = X11Helper::getCurrentLayout();
+	if( newLayout != currentLayout ) {
+		currentLayout = newLayout;
+		emit currentLayoutChanged(newLayout.toString());
+	}
+}
+
 void KeyboardDaemon::switchToNextLayout()
 {
 	X11Helper::switchToNextLayout();
--- trunk/KDE/kdebase/workspace/kcontrol/keyboard/keyboard_daemon.h #1209889:1209890
@@ -42,6 +42,7 @@
     XInputEventNotifier* xEventNotifier;
     LayoutTrayIcon* layoutTrayIcon;
     LayoutMemory layoutMemory;
+    LayoutUnit currentLayout;
 
     void registerListeners();
     void registerShortcut();
@@ -54,12 +55,16 @@
 	void globalSettingsChanged(int category);
     void configureKeyboard();
     void configureMouse();
+    void layoutChanged();
 
 public Q_SLOTS:
 	Q_SCRIPTABLE bool setLayout(const QString& layout);
 	Q_SCRIPTABLE QString getCurrentLayout();
 	Q_SCRIPTABLE QStringList getLayoutsList();
 
+Q_SIGNALS:
+	Q_SCRIPTABLE void currentLayoutChanged(QString layout);
+
 public:
     KeyboardDaemon(QObject *parent, const QList<QVariant>&);
     virtual ~KeyboardDaemon();


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

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