summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (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) :
loadKeyboardColors();
keys = new Keys();
repeatTimer = new QTimer( this );
connect( repeatTimer, SIGNAL(timeout()), this, SLOT(repeat()) );
}
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?
}
/* KeyboardPicks::initialize {{{1 */
void KeyboardPicks::initialise()
{
setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed));
mode = 0;
dc = new KeyboardConfig(this);
configs.append(dc);
}
/* KeyboardPicks::sizeHint {{{1 */
QSize KeyboardPicks::sizeHint() const
{
@@ -1300,48 +1300,51 @@ ushort Keyboard::constoe(const ushort c) {
}
}
// Keys::Keys {{{1
Keys::Keys() {
Config *config = new Config ("multikey");
config->setGroup( "keymaps" );
QString map = config->readEntry( "current" );
delete config;
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);
if (f.open(IO_ReadOnly)) {
QTextStream t(&f);
int row;
int qcode;
ushort unicode;
int width;
QString buf;
QString comment;
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()
QWidget *KeyboardImpl::inputMethod( QWidget *parent, Qt::WFlags f )
{
if ( !input )
input = new Keyboard( parent, "Keyboard", f );
return input;
}
void KeyboardImpl::resetState()
{
if ( input )
input->resetState();
}
QPixmap *KeyboardImpl::icon()
{
if ( !icn )
icn = new QPixmap( (const char **)kb_xpm );
return icn;
}
QString KeyboardImpl::name()
{
return qApp->translate( "InputMethods", "Multikey" );
-// return qApp->translate( "InputMethods", "Opti" );
}
void KeyboardImpl::onKeyPress( QObject *receiver, const char *slot )
{
if ( input )
QObject::connect( input, SIGNAL(key(ushort,ushort,ushort,bool,bool)), receiver, slot );
}
#ifndef QT_NO_COMPONENT
QRESULT KeyboardImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface )
{
*iface = 0;
if ( uuid == IID_QUnknown )
*iface = this;
else if ( uuid == IID_InputMethod )
*iface = this;
if ( *iface )
(*iface)->addRef();
return QS_OK;
}
Q_EXPORT_INTERFACE()
{