summaryrefslogtreecommitdiff
path: root/noncore/applets/zkbapplet/keyzcfg/zkbcfg.cpp
Side-by-side diff
Diffstat (limited to 'noncore/applets/zkbapplet/keyzcfg/zkbcfg.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/applets/zkbapplet/keyzcfg/zkbcfg.cpp19
1 files changed, 14 insertions, 5 deletions
diff --git a/noncore/applets/zkbapplet/keyzcfg/zkbcfg.cpp b/noncore/applets/zkbapplet/keyzcfg/zkbcfg.cpp
index 24bd897..6f3b9bf 100644
--- a/noncore/applets/zkbapplet/keyzcfg/zkbcfg.cpp
+++ b/noncore/applets/zkbapplet/keyzcfg/zkbcfg.cpp
@@ -2,6 +2,7 @@
/* OPIE */
#include <opie2/odebug.h>
+#include <opie2/oapplication.h>
using namespace Opie::Core;
/* QT */
@@ -16,16 +17,23 @@ ZkbConfig::~ZkbConfig() {
bool ZkbConfig::load(const QString& file, Keymap& keymap, const QString& prefix) {
bool ret;
- QFile f(path+"/"+file);
- QFileInfo fi(f);
+ QFile *f = new QFile(path+"/"+file);
+ QFileInfo fi(*f);
- odebug << "start loading file=" << file.utf8() << "\n" << oendl;
+ /* Try */
+ if ( !fi.exists() && !path.contains( QPEApplication::qpeDir()) ) {
+ delete f;
+ f = new QFile( QPEApplication::qpeDir() + "share/zkb/" + file );
+ fi = QFileInfo( *f );
+ }
+
+ odebug << "start loading file=" << file << "\n" << oendl;
if (includedFiles.find(fi.absFilePath()) != includedFiles.end()) {
return false;
}
includedFiles.insert(fi.absFilePath(), 1);
- QXmlInputSource is(f);
+ QXmlInputSource is(*f);
QXmlSimpleReader reader;
ZkbHandler h(*this, keymap, prefix);
@@ -34,7 +42,8 @@ bool ZkbConfig::load(const QString& file, Keymap& keymap, const QString& prefix)
ret = reader.parse(is);
includedFiles.remove(fi.absFilePath());
- odebug << "end loading file=" << file.utf8() << ": status=" << err.utf8() << oendl;
+ odebug << "end loading file=" << file << ": status=" << err << oendl;
+ delete f;
return ret;
}