author | zecke <zecke> | 2004-12-20 22:17:40 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-12-20 22:17:40 (UTC) |
commit | b15930cd03acafd9770bca26f3388817f1a4dcbf (patch) (side-by-side diff) | |
tree | 7f86e31793c1bacb0882e7abb88a3847333f5c4a | |
parent | a50334dddaa542fd63726a639e852c30036f53a0 (diff) | |
download | opie-b15930cd03acafd9770bca26f3388817f1a4dcbf.zip opie-b15930cd03acafd9770bca26f3388817f1a4dcbf.tar.gz opie-b15930cd03acafd9770bca26f3388817f1a4dcbf.tar.bz2 |
-Fix for 1483
"ZKB should keep user settings in $HOME/Settings instead of $OPIEDIR/share/zkb"
Now by default it loads and saves to $HOME/Applications/zkb but falls
back to $OPIEDIR/share/zkb to find the included files
-rw-r--r-- | noncore/applets/zkbapplet/applet/zkbwidget.cpp | 10 | ||||
-rw-r--r-- | noncore/applets/zkbapplet/applet/zkbwidget.h | 2 | ||||
-rw-r--r-- | noncore/applets/zkbapplet/keyzcfg/cfgdlg.cpp | 2 | ||||
-rw-r--r-- | noncore/applets/zkbapplet/keyzcfg/main.cpp | 4 | ||||
-rw-r--r-- | noncore/applets/zkbapplet/keyzcfg/zkbcfg.cpp | 19 |
5 files changed, 19 insertions, 18 deletions
diff --git a/noncore/applets/zkbapplet/applet/zkbwidget.cpp b/noncore/applets/zkbapplet/applet/zkbwidget.cpp index 13729ea..55c08b3 100644 --- a/noncore/applets/zkbapplet/applet/zkbwidget.cpp +++ b/noncore/applets/zkbapplet/applet/zkbwidget.cpp @@ -30,9 +30,7 @@ ZkbWidget::ZkbWidget(QWidget* parent) ZkbWidget::~ZkbWidget() { - if (keymap != 0) { delete keymap; keymap = 0; } -} int ZkbWidget::position() @@ -42,11 +40,9 @@ int ZkbWidget::position() bool ZkbWidget::loadKeymap() { - ZkbConfig c(QPEApplication::qpeDir()+"share/zkb"); + ZkbConfig c(Global::applicationFileName("zkb", QString::null) ); QFontMetrics fm(font()); - if (keymap != 0) { delete keymap; keymap = 0; - } Keymap* km = new Keymap(); @@ -99,8 +95,4 @@ bool ZkbWidget::loadKeymap() { } -QSize ZkbWidget::sizeHint() const { - return QSize(AppLnk::smallIconSize(),AppLnk::smallIconSize()); -} - void ZkbWidget::stateChanged(const QString& s) { // odebug << "stateChanged: " << s.utf8() << "\n" << oendl; diff --git a/noncore/applets/zkbapplet/applet/zkbwidget.h b/noncore/applets/zkbapplet/applet/zkbwidget.h index 9bce85a..13906c0 100644 --- a/noncore/applets/zkbapplet/applet/zkbwidget.h +++ b/noncore/applets/zkbapplet/applet/zkbwidget.h @@ -18,6 +18,4 @@ public: static int position(); - QSize sizeHint() const; - protected: QLabel* label; diff --git a/noncore/applets/zkbapplet/keyzcfg/cfgdlg.cpp b/noncore/applets/zkbapplet/keyzcfg/cfgdlg.cpp index 4190a9e..6f24ea0 100644 --- a/noncore/applets/zkbapplet/keyzcfg/cfgdlg.cpp +++ b/noncore/applets/zkbapplet/keyzcfg/cfgdlg.cpp @@ -125,5 +125,5 @@ void CfgDlg::accept() { CfgParser p; - p.save(QPEApplication::qpeDir()+"share/zkb/zkb.xml", *cfile); + p.save(Global::applicationFileName("zkb", "zkb.xml" ), *cfile); QCopEnvelope("QPE/zkb", "reload()"); diff --git a/noncore/applets/zkbapplet/keyzcfg/main.cpp b/noncore/applets/zkbapplet/keyzcfg/main.cpp index afd0f6a..d7926f0 100644 --- a/noncore/applets/zkbapplet/keyzcfg/main.cpp +++ b/noncore/applets/zkbapplet/keyzcfg/main.cpp @@ -1,4 +1,6 @@ #include <stdio.h> #include <qpe/qpeapplication.h> +#include <qpe/global.h> + #include <qlayout.h> #include <qmainwindow.h> @@ -10,5 +12,5 @@ int main( int argc, char **argv ) { CfgFile cfile; CfgParser cp; - cp.load(QPEApplication::qpeDir()+"share/zkb/zkb.xml", cfile); + cp.load(Global::applicationFileName("zkb", "zkb.xml"), cfile); 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 @@ -3,4 +3,5 @@ /* OPIE */ #include <opie2/odebug.h> +#include <opie2/oapplication.h> using namespace Opie::Core; @@ -17,8 +18,15 @@ 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; @@ -26,5 +34,5 @@ bool ZkbConfig::load(const QString& file, Keymap& keymap, const QString& prefix) includedFiles.insert(fi.absFilePath(), 1); - QXmlInputSource is(f); + QXmlInputSource is(*f); QXmlSimpleReader reader; ZkbHandler h(*this, keymap, prefix); @@ -35,5 +43,6 @@ bool ZkbConfig::load(const QString& file, Keymap& keymap, const QString& prefix) 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; } |