[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: playground/base/keyboard2
From: Andriy Rysin <arysin () gmail ! com>
Date: 2010-04-13 2:41:37
Message-ID: 20100413024137.707C3AC897 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1114208 by rysin:
add 'show flag' configuration
M +3 -2 README
M +8 -14 TODO
M +8 -1 kcm_keyboard.ui
M +4 -0 kcm_keyboard_widget.cpp
M +2 -1 kcm_view_models.cpp
M +15 -1 keyboard_applet.cpp
M +1 -0 keyboard_applet.h
M +1 -1 keyboard_config.cpp
--- trunk/playground/base/keyboard2/README #1114207:1114208
@@ -28,12 +28,13 @@
* allows to configure keyboard hardware, layouts and xkb options (advanced)
-Advantages:
+Advantages (over old code):
* One UI module to configure keyboard layouts and hardware
* Allows to configure keyboard model/xkb options without configuring layouts
* Less cluttered layout configuration control (add layout is separate)
* Layout control/DBus interface is separate from the indicator
* Does not require libxklvier
+* Takes country/language names/translations from iso-codes project
* Information about current layouts is always taken from X server, so should be more \
robust
* Cleaner code (rewritten from scratch)
* Due to many points above should start faster (though no benchmarks performed)
@@ -44,4 +45,4 @@
Regressions:
* can't configure layout short names displayed in applet (reading the previously \
configured names is fine)
* applet does not start automatically when keyboard layouts are configured (first \
time)
-* kcm does not allow changing layout variant (need to re-add)
+* kcm does not allow changing layout variant (need to remove and then re-add)
--- trunk/playground/base/keyboard2/TODO #1114207:1114208
@@ -1,28 +1,22 @@
Arch:
* start applet from kxkb kcm
-* merge kcm_keyboard.desktop and keyboard.desktop ?
-
KCM UI
+* allow specifying display names
+* allow changing variant without re-adding layout
* allow changing layout order
-* allow changing variant without readding layout
-* send configChanged() (for flag) to applet
-* show flag config
+kxkb part
+* honor display names for layouts
+* tooltip
+* flag
-plasma applet & part
-* auto layout name (DisplayNames) for dup layouts
-* tooltip
-
-plasma applet
-* config UI (showFlag/bring kcm)
-
Cleanup:
* rules, iso_codes:
- better error handling
+ better error handling
Improvement:
+* merge kcm_keyboard.desktop and keyboard.desktop ?
* remove XInput libs from plasma applet and layout widget (find a nicer way)
* optimize fetching groups and layouts (cache them) / fetch current group directly
* show current layouts when "configure layouts" disabled
-
--- trunk/playground/base/keyboard2/kcm_keyboard.ui #1114207:1114208
@@ -14,7 +14,7 @@
<string>TabWidget</string>
</property>
<property name="currentIndex">
- <number>2</number>
+ <number>1</number>
</property>
<widget class="QWidget" name="tabHardware">
<attribute name="title">
@@ -156,6 +156,13 @@
</attribute>
</widget>
</item>
+ <item row="2" column="0">
+ <widget class="QCheckBox" name="showFlagChk">
+ <property name="text">
+ <string>Show Flag</string>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
</item>
--- trunk/playground/base/keyboard2/kcm_keyboard_widget.cpp #1114207:1114208
@@ -98,6 +98,7 @@
keyboardConfig->configureLayouts = uiWidget->configureLayoutsChk->isChecked();
keyboardConfig->keyboardModel = \
uiWidget->keyboardModelComboBox->itemData(uiWidget->keyboardModelComboBox->currentIndex()).toString();
+ keyboardConfig->showFlag = uiWidget->showFlagChk->isChecked();
keyboardConfig->resetOldXkbOptions = \
uiWidget->configureKeyboardOptionsChk->isChecked(); // if( \
keyboardConfig->resetOldXkbOptions ) { @@ -178,6 +179,8 @@
// connect(uiWidget->layoutsTable, SIGNAL(itemSelectionChanged ()), this, \
SLOT(layoutSelectionChanged())); \
connect(uiWidget->layoutsTableView->selectionModel(), SIGNAL(selectionChanged ( const \
QItemSelection &, const QItemSelection &)), this, SLOT(layoutSelectionChanged()));
+ connect(uiWidget->showFlagChk, SIGNAL(clicked(bool)), this, SLOT(uiChanged()));
+
connect(uiWidget->xkbGrpClearBtn, SIGNAL(clicked(bool)), this, \
SLOT(clearGroupShortcuts())); connect(uiWidget->xkb3rdLevelClearBtn, \
SIGNAL(clicked(bool)), this, SLOT(clear3rdLevelShortcuts()));
@@ -303,6 +306,7 @@
void KCMKeyboardWidget::updateLayoutsUI()
{
uiWidget->configureLayoutsChk->setChecked(keyboardConfig->configureLayouts);
+ uiWidget->showFlagChk->setChecked(keyboardConfig->showFlag);
// int i = 0;
// uiWidget->layoutsTable->setRowCount(keyboardConfig->layouts.size());
--- trunk/playground/base/keyboard2/kcm_view_models.cpp #1114207:1114208
@@ -18,6 +18,7 @@
#include "kcm_view_models.h"
+#include <klocalizedstring.h>
#include <QtGui/QTreeView>
#include <QtGui/QComboBox>
@@ -32,7 +33,7 @@
static const int VARIANT_COLUMN = 2;
static const int DISPLAY_NAME_COLUMN = 3;
-static const char* headers[] = {i18n("Map"), i18n("Layout"), i18n("Variant"), \
i18n("Label")}; +static const QString headers[] = {i18n("Map"), i18n("Layout"), \
i18n("Variant"), i18n("Label")};
LayoutsTableModel::LayoutsTableModel(Rules* rules_, Flags *flags_, KeyboardConfig* \
keyboardConfig_, QObject* parent): QAbstractTableModel(parent),
--- trunk/playground/base/keyboard2/keyboard_applet.cpp #1114207:1114208
@@ -26,10 +26,12 @@
#include <QtGui/QAction>
#include <QtGui/QActionGroup>
#include <QtGui/QCheckBox>
+#include <QtDBus/QtDBus>
#include "x11_helper.h"
#include "xkb_rules.h"
#include "keyboard_config.h"
+#include "keyboard_dbus.h"
K_EXPORT_PLASMA_APPLET(keyboard, KeyboardApplet)
@@ -56,14 +58,26 @@
setBackgroundHints(DefaultBackground);
rules = Rules::readRules();
+
+ QDBusConnection dbus = QDBusConnection::sessionBus();
+ dbus.connect(QString(), KEYBOARD_DBUS_OBJECT_PATH, KEYBOARD_DBUS_SERVICE_NAME, \
KEYBOARD_DBUS_CONFIG_RELOAD_MESSAGE, this, SLOT( configChanged() )); }
KeyboardApplet::~KeyboardApplet()
{
- delete actionGroup;
+ QDBusConnection dbus = QDBusConnection::sessionBus();
+ dbus.disconnect(QString(), KEYBOARD_DBUS_OBJECT_PATH, \
KEYBOARD_DBUS_SERVICE_NAME, KEYBOARD_DBUS_CONFIG_RELOAD_MESSAGE, this, SLOT( \
configChanged() )); +
+ delete actionGroup;
delete rules;
}
+void KeyboardApplet::keyboardConfigChanged()
+{
+ readConfig();
+ update();
+}
+
void KeyboardApplet::readConfig()
{
// KConfigGroup config = Plasma::Applet::config("KeyboardLayout");
--- trunk/playground/base/keyboard2/keyboard_applet.h #1114207:1114208
@@ -60,6 +60,7 @@
private Q_SLOTS:
void actionTriggered(QAction* action);
+ void keyboardConfigChanged();
private:
void readConfig();
--- trunk/playground/base/keyboard2/keyboard_config.cpp #1114207:1114208
@@ -153,7 +153,7 @@
config.writeEntry("SwitchMode", SWITCHING_POLICIES[switchingPolicy]);
- config.writeEntry("ShowFlag", true);
+ config.writeEntry("ShowFlag", showFlag);
config.sync();
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic