author | sandman <sandman> | 2002-10-22 11:38:47 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-10-22 11:38:47 (UTC) |
commit | 1ee836bd1bb777dded54810909e508dc0470ada3 (patch) (unidiff) | |
tree | 7bba0cd910c49c7f7dc7ca61f80c471b039861af | |
parent | bbb2c5fee87baa345ff5c16404204054442f5c11 (diff) | |
download | opie-1ee836bd1bb777dded54810909e508dc0470ada3.zip opie-1ee836bd1bb777dded54810909e508dc0470ada3.tar.gz opie-1ee836bd1bb777dded54810909e508dc0470ada3.tar.bz2 |
- Always try to load the "en" keymap, if a user specified one cannot be
found
- Fix the divison by zero error in resizeEvent, in case there is a keymap
with 0 rows or no keymap at all.
-rw-r--r-- | inputmethods/multikey/keyboard.cpp | 7 | ||||
-rw-r--r-- | inputmethods/multikey/keyboardimpl.cpp | 1 |
2 files changed, 5 insertions, 3 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 | |||
@@ -88,25 +88,25 @@ Keyboard::~Keyboard() { | |||
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 */ |
96 | void Keyboard::resizeEvent(QResizeEvent*) | 96 | void 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 | ||
@@ -1312,25 +1312,28 @@ Keys::Keys() { | |||
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 | 1324 | if (map.isNull() || !(QFile(map).exists())) { | |
1325 | map = QPEApplication::qpeDir() + "/share/multikey/en.keymap"; | ||
1326 | } | ||
1327 | |||
1325 | setKeysFromFile(map); | 1328 | setKeysFromFile(map); |
1326 | } | 1329 | } |
1327 | 1330 | ||
1328 | Keys::Keys(const char * filename) { | 1331 | Keys::Keys(const char * filename) { |
1329 | 1332 | ||
1330 | setKeysFromFile(filename); | 1333 | setKeysFromFile(filename); |
1331 | } | 1334 | } |
1332 | 1335 | ||
1333 | // Keys::setKeysFromFile {{{2 | 1336 | // Keys::setKeysFromFile {{{2 |
1334 | void Keys::setKeysFromFile(const char * filename) { | 1337 | void Keys::setKeysFromFile(const char * filename) { |
1335 | 1338 | ||
1336 | QFile f(filename); | 1339 | QFile f(filename); |
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 | |||
@@ -69,25 +69,24 @@ void KeyboardImpl::resetState() | |||
69 | } | 69 | } |
70 | 70 | ||
71 | QPixmap *KeyboardImpl::icon() | 71 | QPixmap *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 | ||
78 | QString KeyboardImpl::name() | 78 | QString 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 | ||
84 | void KeyboardImpl::onKeyPress( QObject *receiver, const char *slot ) | 83 | void 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 |
91 | QRESULT KeyboardImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) | 90 | QRESULT KeyboardImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) |
92 | { | 91 | { |
93 | *iface = 0; | 92 | *iface = 0; |