summaryrefslogtreecommitdiff
path: root/inputmethods/multikey
Unidiff
Diffstat (limited to 'inputmethods/multikey') (more/less context) (show whitespace changes)
-rw-r--r--inputmethods/multikey/keyboard.cpp5
-rw-r--r--inputmethods/multikey/keyboardimpl.cpp1
2 files changed, 4 insertions, 2 deletions
diff --git a/inputmethods/multikey/keyboard.cpp b/inputmethods/multikey/keyboard.cpp
index 1dd8ca1..de3aa52 100644
--- a/inputmethods/multikey/keyboard.cpp
+++ b/inputmethods/multikey/keyboard.cpp
@@ -76,49 +76,49 @@ Keyboard::Keyboard(QWidget* parent, const char* _name, WFlags f) :
76 76
77 loadKeyboardColors(); 77 loadKeyboardColors();
78 78
79 keys = new Keys(); 79 keys = new Keys();
80 80
81 repeatTimer = new QTimer( this ); 81 repeatTimer = new QTimer( this );
82 connect( repeatTimer, SIGNAL(timeout()), this, SLOT(repeat()) ); 82 connect( repeatTimer, SIGNAL(timeout()), this, SLOT(repeat()) );
83 83
84} 84}
85 85
86Keyboard::~Keyboard() { 86Keyboard::~Keyboard() {
87 87
88 if ( configdlg ) { 88 if ( configdlg ) {
89 delete (ConfigDlg *) configdlg; 89 delete (ConfigDlg *) configdlg;
90 configdlg = 0; 90 configdlg = 0;
91 } 91 }
92 92
93} 93}
94 94
95/* Keyboard::resizeEvent {{{1 */ 95/* Keyboard::resizeEvent {{{1 */
96void Keyboard::resizeEvent(QResizeEvent*) 96void Keyboard::resizeEvent(QResizeEvent*)
97{ 97{
98 int ph = picks->sizeHint().height(); 98 int ph = picks->sizeHint().height();
99 picks->setGeometry( 0, 0, width(), ph ); 99 picks->setGeometry( 0, 0, width(), ph );
100 keyHeight = (height()-(usePicks ? ph : 0))/keys->rows(); 100 keyHeight = (height()-(usePicks ? ph : 0))/(keys->rows()?keys->rows():1);
101 101
102 int nk; // number of keys? 102 int nk; // number of keys?
103 if ( useLargeKeys ) { 103 if ( useLargeKeys ) {
104 nk = 15; 104 nk = 15;
105 } else { 105 } else {
106 nk = 19; 106 nk = 19;
107 } 107 }
108 defaultKeyWidth = (width()/nk)/2; 108 defaultKeyWidth = (width()/nk)/2;
109 xoffs = (width()-defaultKeyWidth*nk)/2; // empty key spaces? 109 xoffs = (width()-defaultKeyWidth*nk)/2; // empty key spaces?
110 110
111} 111}
112 112
113/* KeyboardPicks::initialize {{{1 */ 113/* KeyboardPicks::initialize {{{1 */
114void KeyboardPicks::initialise() 114void KeyboardPicks::initialise()
115{ 115{
116 setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed)); 116 setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed));
117 mode = 0; 117 mode = 0;
118 dc = new KeyboardConfig(this); 118 dc = new KeyboardConfig(this);
119 configs.append(dc); 119 configs.append(dc);
120} 120}
121 121
122/* KeyboardPicks::sizeHint {{{1 */ 122/* KeyboardPicks::sizeHint {{{1 */
123QSize KeyboardPicks::sizeHint() const 123QSize KeyboardPicks::sizeHint() const
124{ 124{
@@ -1300,48 +1300,51 @@ ushort Keyboard::constoe(const ushort c) {
1300 } 1300 }
1301} 1301}
1302 1302
1303 1303
1304// Keys::Keys {{{1 1304// Keys::Keys {{{1
1305 1305
1306Keys::Keys() { 1306Keys::Keys() {
1307 1307
1308 Config *config = new Config ("multikey"); 1308 Config *config = new Config ("multikey");
1309 config->setGroup( "keymaps" ); 1309 config->setGroup( "keymaps" );
1310 QString map = config->readEntry( "current" ); 1310 QString map = config->readEntry( "current" );
1311 delete config; 1311 delete config;
1312 1312
1313 if (map.isNull() || !(QFile(map).exists())) { 1313 if (map.isNull() || !(QFile(map).exists())) {
1314 1314
1315 Config *config = new Config("locale"); 1315 Config *config = new Config("locale");
1316 config->setGroup( "Language" ); 1316 config->setGroup( "Language" );
1317 QString l = config->readEntry( "Language" , "en" ); 1317 QString l = config->readEntry( "Language" , "en" );
1318 delete config; 1318 delete config;
1319 1319
1320 map = QPEApplication::qpeDir() + "/share/multikey/" 1320 map = QPEApplication::qpeDir() + "/share/multikey/"
1321 + l + ".keymap"; 1321 + l + ".keymap";
1322 1322
1323 } 1323 }
1324 if (map.isNull() || !(QFile(map).exists())) {
1325 map = QPEApplication::qpeDir() + "/share/multikey/en.keymap";
1326 }
1324 1327
1325 setKeysFromFile(map); 1328 setKeysFromFile(map);
1326} 1329}
1327 1330
1328Keys::Keys(const char * filename) { 1331Keys::Keys(const char * filename) {
1329 1332
1330 setKeysFromFile(filename); 1333 setKeysFromFile(filename);
1331} 1334}
1332 1335
1333// Keys::setKeysFromFile {{{2 1336// Keys::setKeysFromFile {{{2
1334void Keys::setKeysFromFile(const char * filename) { 1337void Keys::setKeysFromFile(const char * filename) {
1335 1338
1336 QFile f(filename); 1339 QFile f(filename);
1337 1340
1338 if (f.open(IO_ReadOnly)) { 1341 if (f.open(IO_ReadOnly)) {
1339 1342
1340 QTextStream t(&f); 1343 QTextStream t(&f);
1341 int row; 1344 int row;
1342 int qcode; 1345 int qcode;
1343 ushort unicode; 1346 ushort unicode;
1344 int width; 1347 int width;
1345 QString buf; 1348 QString buf;
1346 QString comment; 1349 QString comment;
1347 char * xpm[256]; //couldnt be larger than that... could it? 1350 char * xpm[256]; //couldnt be larger than that... could it?
diff --git a/inputmethods/multikey/keyboardimpl.cpp b/inputmethods/multikey/keyboardimpl.cpp
index 2bcb0fa..cebd43d 100644
--- a/inputmethods/multikey/keyboardimpl.cpp
+++ b/inputmethods/multikey/keyboardimpl.cpp
@@ -57,49 +57,48 @@ KeyboardImpl::~KeyboardImpl()
57 57
58QWidget *KeyboardImpl::inputMethod( QWidget *parent, Qt::WFlags f ) 58QWidget *KeyboardImpl::inputMethod( QWidget *parent, Qt::WFlags f )
59{ 59{
60 if ( !input ) 60 if ( !input )
61 input = new Keyboard( parent, "Keyboard", f ); 61 input = new Keyboard( parent, "Keyboard", f );
62 return input; 62 return input;
63} 63}
64 64
65void KeyboardImpl::resetState() 65void KeyboardImpl::resetState()
66{ 66{
67 if ( input ) 67 if ( input )
68 input->resetState(); 68 input->resetState();
69} 69}
70 70
71QPixmap *KeyboardImpl::icon() 71QPixmap *KeyboardImpl::icon()
72{ 72{
73 if ( !icn ) 73 if ( !icn )
74 icn = new QPixmap( (const char **)kb_xpm ); 74 icn = new QPixmap( (const char **)kb_xpm );
75 return icn; 75 return icn;
76} 76}
77 77
78QString KeyboardImpl::name() 78QString KeyboardImpl::name()
79{ 79{
80 return qApp->translate( "InputMethods", "Multikey" ); 80 return qApp->translate( "InputMethods", "Multikey" );
81// return qApp->translate( "InputMethods", "Opti" );
82} 81}
83 82
84void KeyboardImpl::onKeyPress( QObject *receiver, const char *slot ) 83void KeyboardImpl::onKeyPress( QObject *receiver, const char *slot )
85{ 84{
86 if ( input ) 85 if ( input )
87 QObject::connect( input, SIGNAL(key(ushort,ushort,ushort,bool,bool)), receiver, slot ); 86 QObject::connect( input, SIGNAL(key(ushort,ushort,ushort,bool,bool)), receiver, slot );
88} 87}
89 88
90#ifndef QT_NO_COMPONENT 89#ifndef QT_NO_COMPONENT
91QRESULT KeyboardImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) 90QRESULT KeyboardImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface )
92{ 91{
93 *iface = 0; 92 *iface = 0;
94 if ( uuid == IID_QUnknown ) 93 if ( uuid == IID_QUnknown )
95 *iface = this; 94 *iface = this;
96 else if ( uuid == IID_InputMethod ) 95 else if ( uuid == IID_InputMethod )
97 *iface = this; 96 *iface = this;
98 97
99 if ( *iface ) 98 if ( *iface )
100 (*iface)->addRef(); 99 (*iface)->addRef();
101 return QS_OK; 100 return QS_OK;
102} 101}
103 102
104Q_EXPORT_INTERFACE() 103Q_EXPORT_INTERFACE()
105{ 104{