summaryrefslogtreecommitdiff
authortreke <treke>2003-07-19 16:38:27 (UTC)
committer treke <treke>2003-07-19 16:38:27 (UTC)
commit67b69b7aede83ccb0d933dec9bd959f01eb6ea06 (patch) (side-by-side diff)
tree6e404164453172adc58d088f72c58e6f38e4b4c3
parentcf3921fe77f87e94ff821df65bb80b02487a9f9b (diff)
downloadopie-67b69b7aede83ccb0d933dec9bd959f01eb6ea06.zip
opie-67b69b7aede83ccb0d933dec9bd959f01eb6ea06.tar.gz
opie-67b69b7aede83ccb0d933dec9bd959f01eb6ea06.tar.bz2
* Adds a keyboard layout with a configure button to multikey when it is
unable to load the selected layout. Fixes (#920)
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--inputmethods/multikey/keyboard.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/inputmethods/multikey/keyboard.cpp b/inputmethods/multikey/keyboard.cpp
index bded447..2ce6dd3 100644
--- a/inputmethods/multikey/keyboard.cpp
+++ b/inputmethods/multikey/keyboard.cpp
@@ -18,48 +18,60 @@
**
**********************************************************************/
#include "keyboard.h"
#include "configdlg.h"
#include <qpe/global.h>
#include <qpe/qcopenvelope_qws.h>
#include <qwindowsystem_qws.h>
#include <qpainter.h>
#include <qfontmetrics.h>
#include <qtimer.h>
#include <qpe/qpeapplication.h>
#include <qpe/config.h>
#include <ctype.h>
#include <qfile.h>
#include <qtextstream.h>
#include <qstringlist.h>
#include <sys/utsname.h>
using namespace MultiKey;
+static const char * const kb_config_xpm[] = {
+"13 7 2 1",
+" c None",
+". c #000000",
+" ",
+" . ",
+" ... ",
+" ..... ",
+" . ",
+" . ",
+" "};
+
/* Keyboard::Keyboard {{{1 */
Keyboard::Keyboard(QWidget* parent, const char* _name, WFlags f) :
QFrame(parent, _name, f), shift(0), lock(0), ctrl(0), alt(0),
meta(0), circumflex(0), diaeresis(0), baccent(0), accent(0),
useLargeKeys(TRUE), usePicks(0), useRepeat(0),
pressedKeyRow(-1), pressedKeyCol(-1),
unicode(-1), qkeycode(0), modifiers(0), schar(0), mchar(0), echar(0),
configdlg(0)
{
// get the default font
Config *config = new Config( "qpe" );
config->setGroup( "Appearance" );
QString familyStr = config->readEntry( "FontFamily", "smallsmooth" );
delete config;
config = new Config("multikey");
config->setGroup ("general");
usePicks = config->readBoolEntry ("usePickboard", 0); // default closed
useRepeat = config->readBoolEntry ("useRepeat", 1);
delete config;
@@ -1501,53 +1513,59 @@ void Keys::setKeysFromFile(const char * filename) {
QString name, equals, value;
tmp >> name >> equals >> value;
if (name == "lang") {
lang = value;
}
buf = t.readLine();
}
// comments
else if (buf.contains(QRegExp("^\\s*#"))) {
buf = t.readLine();
} else { // blank line, or garbage
buf = t.readLine();
}
}
+
f.close();
+ } else {
+ // We couldnt find the selected keymap, give them a configure button
+ QImage * btn = new QImage((const char ** )kb_config_xpm);
+ setKey(1, 0x1030, 0, 2, btn);
}
}
+
// Keys::setKey {{{2
void Keys::setKey(const int row, const int qcode, const ushort unicode,
const int width, QImage *pix) {
Key * key;
key = new Key;
key->qcode = qcode;
key->unicode = unicode;
key->width = width;
// share key->pressed between same keys
bool found = 0;
for (int i = 1; i <= 5; i++) {
for (unsigned int j = 0; j < keys[i].count(); j++)
if (keys[i].at(j)->qcode == qcode && keys[i].at(j)->unicode == unicode) {
key->pressed = keys[i].at(j)->pressed;
found = 1;
}
}
if (!found) {
key->pressed = new bool;