[kde-edu]: branches/KDE/3.5/kdeedu/kvoctrain/kvoctrain
Peter Hedlund
peter at peterandlinda.com
Mon Dec 12 02:47:55 CET 2005
SVN commit 487802 by hedlund:
Make keyboard layout switching work again.
BUG:117391
CCMAIL:kde-edu at kde.org
M +49 -22 kvoctraintable.cpp
M +3 -2 kvoctraintable.h
--- branches/KDE/3.5/kdeedu/kvoctrain/kvoctrain/kvoctraintable.cpp #487801:487802
@@ -66,6 +66,8 @@
QHeader *header = horizontalHeader();
connect(header, SIGNAL(pressed(int)), this, SLOT(headerPressEvent(int)));
connect(header, SIGNAL(released(int)), this, SLOT(headerReleaseEvent(int)));
+
+ connect(this, SIGNAL(currentChanged(int, int)), this, SLOT(slotCurrentChanged(int, int)));
}
@@ -73,28 +75,30 @@
{
setCurrentRow(row, currentColumn());
}
-
+/*
QWidget* KVocTrainTable::beginEdit(int row, int col, bool replace)
{
- if (KApplication::dcopClient()->isApplicationRegistered("kxkb")) {
+ if (KApplication::dcopClient()->isApplicationRegistered("kxkb"))
+ {
+ if (m_doc)
+ {
+ QString id = (col == KV_COL_ORG) ? m_doc->getOriginalIdent() : m_doc->getIdent(col - KV_EXTRA_COLS);
- if (m_doc) {
- QString id = (col == KV_COL_ORG) ? m_doc->getOriginalIdent()
- : m_doc->getIdent(col - KV_EXTRA_COLS);
-
- if (langs) {
+ if (langs)
+ {
QString kbLayout(langs->keyboardLayout(langs->indexShortId(id)));
- if (!kbLayout.isEmpty()) {
+ kdDebug() << "Keyboard Layout: " << kbLayout << endl;
+ if (!kbLayout.isEmpty())
+ {
QByteArray data, replyData;
QCString replyType;
QDataStream arg(data, IO_WriteOnly);
arg << kbLayout;
- if (!KApplication::dcopClient()->call("kxkb", "kxkb",
- "setLayout(QString)",
- data, replyType, replyData)) {
- kdDebug() << "kskb dcop error" << endl;
- }
+ if (!KApplication::dcopClient()->call("kxkb", "kxkb", "setLayout(QString)", data, replyType, replyData))
+ {
+ kdDebug() << "kxkb dcop error: beginEdit()" << endl;
+ }
}
}
}
@@ -104,17 +108,9 @@
void KVocTrainTable::endEdit(int row, int col, bool accept, bool replace)
{
-// if (KApplication::dcopClient()->isApplicationRegistered("kxkb")) {
-// QByteArray data, replyData;
-// QCString replyType;
-
-// if (!KApplication::dcopClient()->call("kxkb", "kxkb",
-// "setLayout(QString)",
-// data, replyType, replyData)) {
-// }
QTable::endEdit(row, col, accept, replace);
}
-
+*/
void KVocTrainTable::sortByColumn(int header, bool alpha) {
if (header == KV_COL_MARK)
return;
@@ -569,4 +565,35 @@
}
+void KVocTrainTable::slotCurrentChanged(int row, int col)
+{
+ Q_UNUSED(row);
+ if (KApplication::dcopClient()->isApplicationRegistered("kxkb"))
+ {
+ if (m_doc)
+ {
+ QString id = (col == KV_COL_ORG) ? m_doc->getOriginalIdent() : m_doc->getIdent(col - KV_EXTRA_COLS);
+
+ if (langs)
+ {
+ QString kbLayout(langs->keyboardLayout(langs->indexShortId(id)));
+ //kdDebug() << "Keyboard Layout: " << kbLayout << endl;
+ if (!kbLayout.isEmpty())
+ {
+ QByteArray data, replyData;
+ QCString replyType;
+ QDataStream arg(data, IO_WriteOnly);
+ arg << kbLayout;
+
+ if (!KApplication::dcopClient()->call("kxkb", "kxkb", "setLayout(QString)", data, replyType, replyData))
+ {
+ kdDebug() << "kxkb dcop error: beginEdit()" << endl;
+ }
+ }
+ }
+ }
+ }
+
+}
+
#include "kvoctraintable.moc"
--- branches/KDE/3.5/kdeedu/kvoctrain/kvoctrain/kvoctraintable.h #487801:487802
@@ -71,6 +71,7 @@
void sortByColumn_alpha(int index);
void sortByColumn_index(int index);
void slotSelectionChanged();
+ void slotCurrentChanged(int, int);
protected slots:
void menuTriggerTimeout();
@@ -79,8 +80,8 @@
protected:
int current;
- QWidget* beginEdit(int row, int col, bool replace);
- void endEdit(int row, int col, bool accept, bool replace);
+ //QWidget* beginEdit(int row, int col, bool replace);
+ //void endEdit(int row, int col, bool accept, bool replace);
void paintCell(QPainter *p, int row, int col, const QRect &cr, bool selected, const QColorGroup &cg);
void setItem(int row, int col, QTableItem * item);
QTableItem* item (int row, int col) const;
More information about the kde-edu
mailing list