author | mickeyl <mickeyl> | 2004-10-29 12:38:37 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-10-29 12:38:37 (UTC) |
commit | dca4423e3b0966fe26ba4183e5b6ad4666c61e86 (patch) (side-by-side diff) | |
tree | 8a06619edc609164f45b6a2d92ec3fe264fc3fb1 | |
parent | e1ab37a7bc09619958037be7ecddc67fd334227d (diff) | |
download | opie-dca4423e3b0966fe26ba4183e5b6ad4666c61e86.zip opie-dca4423e3b0966fe26ba4183e5b6ad4666c61e86.tar.gz opie-dca4423e3b0966fe26ba4183e5b6ad4666c61e86.tar.bz2 |
- no longer hardcode the font size
- add fixme for initial keyboard setting
-rw-r--r-- | core/applets/multikeyapplet/multikey.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/core/applets/multikeyapplet/multikey.cpp b/core/applets/multikeyapplet/multikey.cpp index 8cb9083..f3d8375 100644 --- a/core/applets/multikeyapplet/multikey.cpp +++ b/core/applets/multikeyapplet/multikey.cpp @@ -1,96 +1,96 @@ /********************************************************************** ** Copyright (C) 2004 Anton Kachalov mouse@altlinux.ru ** All rights reserved. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** **********************************************************************/ #include "multikey.h" /* OPIE */ #include <opie2/otaskbarapplet.h> #include <qpe/qcopenvelope_qws.h> #include <qpe/qpeapplication.h> +using namespace Opie::Ui; /* QT */ #include <qdir.h> -using namespace Opie::Ui; +//FIXME: Better read appropriate initial setting from LOCALE, not hardcode it "EN" Multikey::Multikey(QWidget *parent) : QLabel(parent), popupMenu(this), current("EN") { QCopChannel* swChannel = new QCopChannel("MultiKey/Switcher", this); connect( swChannel, SIGNAL(received(const QCString&,const QByteArray&)), this, SLOT(message(const QCString&,const QByteArray&))); - setFont( QFont( "Helvetica", 10, QFont::Normal ) ); QPEApplication::setStylusOperation(this, QPEApplication::RightOnHold); lang = 0; QCopEnvelope e("MultiKey/Keyboard", "getmultikey()"); setText("EN"); popupMenu.insertItem("EN", 0); show(); } void Multikey::mousePressEvent(QMouseEvent *ev) { if (!sw_maps.count()) return; if (ev->button() == RightButton) { QPoint p = mapToGlobal(QPoint(0, 0)); QSize s = popupMenu.sizeHint(); int opt = popupMenu.exec(QPoint(p.x() + (width() / 2) - (s.width() / 2), p.y() - s.height()), 0); if (opt == -1) return; lang = opt; QCopEnvelope e("MultiKey/Keyboard", "setmultikey(QString)"); e << sw_maps[lang]; setText(labels[lang]); } QWidget::mousePressEvent(ev); } void Multikey::mouseReleaseEvent(QMouseEvent *ev) { if (!sw_maps.count()) return; lang = lang < sw_maps.count()-1 ? lang+1 : 0; QCopEnvelope e("MultiKey/Keyboard", "setmultikey(QString)"); //odebug << "Lang=" << lang << ", count=" << sw_maps.count() << ", lab=" << labels[lang].ascii() << "" << oendl; e << sw_maps[lang]; setText(labels[lang]); } void Multikey::message(const QCString &message, const QByteArray &data) { if ( message == "setsw(QString,QString)" ) { QDataStream stream(data, IO_ReadOnly); QString maps, current_map; stream >> maps >> current_map; QStringList sw = QStringList::split(QChar('|'), maps); sw.append(current_map); QDir map_dir(QPEApplication::qpeDir() + "share/multikey/", "*.keymap"); lang = 0; labels.clear(); sw_maps.clear(); popupMenu.clear(); for (uint i = 0; i < sw.count(); ++i) { QString keymap_map; if (sw[i][0] != '/') { keymap_map = map_dir.absPath() + "/" + sw[i]; |