summaryrefslogtreecommitdiff
path: root/core/applets/multikeyapplet/multikey.cpp
Unidiff
Diffstat (limited to 'core/applets/multikeyapplet/multikey.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/multikeyapplet/multikey.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/core/applets/multikeyapplet/multikey.cpp b/core/applets/multikeyapplet/multikey.cpp
index d304f54..b36ee12 100644
--- a/core/applets/multikeyapplet/multikey.cpp
+++ b/core/applets/multikeyapplet/multikey.cpp
@@ -5,29 +5,32 @@
5** This file may be distributed and/or modified under the terms of the 5** This file may be distributed and/or modified under the terms of the
6** GNU General Public License version 2 as published by the Free Software 6** GNU General Public License version 2 as published by the Free Software
7** Foundation and appearing in the file LICENSE.GPL included in the 7** Foundation and appearing in the file LICENSE.GPL included in the
8** packaging of this file. 8** packaging of this file.
9** 9**
10** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 10** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
11** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 11** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
12** 12**
13**********************************************************************/ 13**********************************************************************/
14 14
15#include "multikey.h" 15#include "multikey.h"
16 16
17/* OPIE */
18#include <opie2/otaskbarapplet.h>
17#include <qpe/global.h> 19#include <qpe/global.h>
18#include <qpe/config.h> 20#include <qpe/config.h>
19#include <qpe/qcopenvelope_qws.h> 21#include <qpe/qcopenvelope_qws.h>
20#include <qpe/qpeapplication.h> 22#include <qpe/qpeapplication.h>
21 23
24/* QT */
22#include <qlabel.h> 25#include <qlabel.h>
23#include <qdir.h> 26#include <qdir.h>
24#include <qfileinfo.h> 27#include <qfileinfo.h>
25#include <qcopchannel_qws.h> 28#include <qcopchannel_qws.h>
26 29
27Multikey::Multikey(QWidget *parent) : QLabel(parent), popupMenu(this), current("EN") 30Multikey::Multikey(QWidget *parent) : QLabel(parent), popupMenu(this), current("EN")
28{ 31{
29 QCopChannel* swChannel = new QCopChannel("MultiKey/Switcher", this); 32 QCopChannel* swChannel = new QCopChannel("MultiKey/Switcher", this);
30 connect( swChannel, SIGNAL(received(const QCString &, const QByteArray &)), 33 connect( swChannel, SIGNAL(received(const QCString &, const QByteArray &)),
31 this, SLOT(message(const QCString &, const QByteArray &))); 34 this, SLOT(message(const QCString &, const QByteArray &)));
32 35
33 setFont( QFont( "Helvetica", 10, QFont::Normal ) ); 36 setFont( QFont( "Helvetica", 10, QFont::Normal ) );
@@ -103,34 +106,44 @@ void Multikey::message(const QCString &message, const QByteArray &data)
103 } 106 }
104 keymap_map = sw[i]; 107 keymap_map = sw[i];
105 } 108 }
106 109
107 QFile map(keymap_map); 110 QFile map(keymap_map);
108 if (map.open(IO_ReadOnly)) { 111 if (map.open(IO_ReadOnly)) {
109 QString line; 112 QString line;
110 113
111 map.readLine(line, 1024); 114 map.readLine(line, 1024);
112 while (!map.atEnd()) { 115 while (!map.atEnd()) {
113 116
114 if (line.find(QRegExp("^sw\\s*=\\s*")) != -1) { 117 if (line.find(QRegExp("^sw\\s*=\\s*")) != -1) {
115 118
116 if (i != sw.count()-1) { 119 if (i != sw.count()-1) {
117 if (keymap_map == current_map) { 120 if (keymap_map == current_map) {
118 lang = i; 121 lang = i;
119 } 122 }
120 sw_maps.append(keymap_map); 123 sw_maps.append(keymap_map);
121 labels.append(line.right(line.length() - line.find(QChar('=')) - 1).stripWhiteSpace()); 124 labels.append(line.right(line.length() - line.find(QChar('=')) - 1).stripWhiteSpace());
122 popupMenu.insertItem(labels[labels.count()-1], labels.count()-1); 125 popupMenu.insertItem(labels[labels.count()-1], labels.count()-1);
123 } else { 126 } else {
124 current = line.right(line.length() - line.find(QChar('=')) - 1).stripWhiteSpace(); 127 current = line.right(line.length() - line.find(QChar('=')) - 1).stripWhiteSpace();
125 } 128 }
126 break; 129 break;
127 } 130 }
128 map.readLine(line, 1024); 131 map.readLine(line, 1024);
129 } 132 }
130 map.close(); 133 map.close();
131 } 134 }
132 } 135 }
133 136
134 setText(current); 137 setText(current);
135 } 138 }
136} 139}
140
141int Multikey::position()
142{
143 return 10;
144}
145
146Q_EXPORT_INTERFACE()
147{
148 Q_CREATE_INSTANCE( OTaskbarAppletWrapper<Multikey> );
149}