summaryrefslogtreecommitdiff
path: root/inputmethods/multikey/keyboard.cpp
authorsandman <sandman>2002-10-22 11:38:47 (UTC)
committer sandman <sandman>2002-10-22 11:38:47 (UTC)
commit1ee836bd1bb777dded54810909e508dc0470ada3 (patch) (side-by-side diff)
tree7bba0cd910c49c7f7dc7ca61f80c471b039861af /inputmethods/multikey/keyboard.cpp
parentbbb2c5fee87baa345ff5c16404204054442f5c11 (diff)
downloadopie-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.
Diffstat (limited to 'inputmethods/multikey/keyboard.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--inputmethods/multikey/keyboard.cpp7
1 files changed, 5 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
@@ -88,25 +88,25 @@ Keyboard::~Keyboard() {
if ( configdlg ) {
delete (ConfigDlg *) configdlg;
configdlg = 0;
}
}
/* Keyboard::resizeEvent {{{1 */
void Keyboard::resizeEvent(QResizeEvent*)
{
int ph = picks->sizeHint().height();
picks->setGeometry( 0, 0, width(), ph );
- keyHeight = (height()-(usePicks ? ph : 0))/keys->rows();
+ keyHeight = (height()-(usePicks ? ph : 0))/(keys->rows()?keys->rows():1);
int nk; // number of keys?
if ( useLargeKeys ) {
nk = 15;
} else {
nk = 19;
}
defaultKeyWidth = (width()/nk)/2;
xoffs = (width()-defaultKeyWidth*nk)/2; // empty key spaces?
}
@@ -1312,25 +1312,28 @@ Keys::Keys() {
if (map.isNull() || !(QFile(map).exists())) {
Config *config = new Config("locale");
config->setGroup( "Language" );
QString l = config->readEntry( "Language" , "en" );
delete config;
map = QPEApplication::qpeDir() + "/share/multikey/"
+ l + ".keymap";
}
-
+ if (map.isNull() || !(QFile(map).exists())) {
+ map = QPEApplication::qpeDir() + "/share/multikey/en.keymap";
+ }
+
setKeysFromFile(map);
}
Keys::Keys(const char * filename) {
setKeysFromFile(filename);
}
// Keys::setKeysFromFile {{{2
void Keys::setKeysFromFile(const char * filename) {
QFile f(filename);