author | zecke <zecke> | 2004-10-16 22:50:23 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-10-16 22:50:23 (UTC) |
commit | 5fb6ed213aa8b4b1101082671f57db45d7b10d01 (patch) (unidiff) | |
tree | a38ed0cd40d0e3960226e724c52864b64f44d000 /inputmethods/dasher | |
parent | 79c4778d1dc6050975fceeee7aab0ac0c28462ca (diff) | |
download | opie-5fb6ed213aa8b4b1101082671f57db45d7b10d01.zip opie-5fb6ed213aa8b4b1101082671f57db45d7b10d01.tar.gz opie-5fb6ed213aa8b4b1101082671f57db45d7b10d01.tar.bz2 |
-Remove hardcoding of "/opt/QtPalmtop/" and use QPEApplication::qpeDir instead
In future we need a OpieStandardDir with locateFile, locateUserSetting
and such
-rw-r--r-- | inputmethods/dasher/QtDasherPlugin.cc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/inputmethods/dasher/QtDasherPlugin.cc b/inputmethods/dasher/QtDasherPlugin.cc index 50d4539..91167c2 100644 --- a/inputmethods/dasher/QtDasherPlugin.cc +++ b/inputmethods/dasher/QtDasherPlugin.cc | |||
@@ -1,79 +1,81 @@ | |||
1 | #include "QtDasherPlugin.h" | 1 | #include "QtDasherPlugin.h" |
2 | 2 | ||
3 | #include <qpe/global.h> | 3 | #include <qpe/global.h> |
4 | #include <qpe/qpeapplication.h> | ||
4 | 5 | ||
5 | #include <qpainter.h> | 6 | #include <qpainter.h> |
6 | #include <qlist.h> | 7 | #include <qlist.h> |
7 | #include <qbitmap.h> | 8 | #include <qbitmap.h> |
8 | #include <qlayout.h> | 9 | #include <qlayout.h> |
9 | #include <qvbox.h> | 10 | #include <qvbox.h> |
10 | #include <qdialog.h> | 11 | #include <qdialog.h> |
12 | #include <qfile.h> | ||
11 | #include <qscrollview.h> | 13 | #include <qscrollview.h> |
12 | #include <qpopupmenu.h> | 14 | #include <qpopupmenu.h> |
13 | #include <qhbuttongroup.h> | 15 | #include <qhbuttongroup.h> |
14 | #include <qpushbutton.h> | 16 | #include <qpushbutton.h> |
15 | #include <qmessagebox.h> | 17 | #include <qmessagebox.h> |
16 | #include <qwindowsystem_qws.h> | 18 | #include <qwindowsystem_qws.h> |
17 | 19 | ||
18 | QtDasherPlugin::QtDasherPlugin(QWidget* parent, const char* name, WFlags f) : QFrame(parent,name,f) | 20 | QtDasherPlugin::QtDasherPlugin(QWidget* parent, const char* name, WFlags f) : QFrame(parent,name,f) |
19 | { | 21 | { |
20 | (new QHBoxLayout(this))->setAutoAdd(TRUE); | 22 | (new QHBoxLayout(this))->setAutoAdd(TRUE); |
21 | interface = new CDasherInterface; | 23 | interface = new CDasherInterface; |
22 | interface->SetSystemLocation("/opt/QtPalmtop/share/dasher/"); | 24 | interface->SetSystemLocation( QFile::encodeName(QPEApplication::qpeDir()+"share/dasher/").data() ); |
23 | interface->Unpause(0); | 25 | interface->Unpause(0); |
24 | interface->Start(); | 26 | interface->Start(); |
25 | d = new QtDasherScreen(240,100,interface,this,this); | 27 | d = new QtDasherScreen(240,100,interface,this,this); |
26 | interface->ChangeMaxBitRate(2.5); | 28 | interface->ChangeMaxBitRate(2.5); |
27 | d->show(); | 29 | d->show(); |
28 | utf8_codec = new QUtf8Codec; | 30 | utf8_codec = new QUtf8Codec; |
29 | } | 31 | } |
30 | 32 | ||
31 | QSize QtDasherPlugin::sizeHint() const | 33 | QSize QtDasherPlugin::sizeHint() const |
32 | { | 34 | { |
33 | return QSize(240,100); | 35 | return QSize(240,100); |
34 | } | 36 | } |
35 | 37 | ||
36 | QtDasherPlugin::~QtDasherPlugin() | 38 | QtDasherPlugin::~QtDasherPlugin() |
37 | { | 39 | { |
38 | delete interface; | 40 | delete interface; |
39 | } | 41 | } |
40 | 42 | ||
41 | void QtDasherPlugin::resetState() | 43 | void QtDasherPlugin::resetState() |
42 | { | 44 | { |
43 | flushcount=0; | 45 | flushcount=0; |
44 | interface->Start(); | 46 | interface->Start(); |
45 | interface->Redraw(); | 47 | interface->Redraw(); |
46 | } | 48 | } |
47 | 49 | ||
48 | void QtDasherPlugin::unflush() | 50 | void QtDasherPlugin::unflush() |
49 | { | 51 | { |
50 | if (flushcount==0) | 52 | if (flushcount==0) |
51 | return; | 53 | return; |
52 | for (; flushcount>0; flushcount--) { | 54 | for (; flushcount>0; flushcount--) { |
53 | deletetext(); | 55 | deletetext(); |
54 | } | 56 | } |
55 | } | 57 | } |
56 | 58 | ||
57 | void QtDasherPlugin::output(int Symbol) | 59 | void QtDasherPlugin::output(int Symbol) |
58 | { | 60 | { |
59 | std::string label = interface->GetEditText(Symbol); | 61 | std::string label = interface->GetEditText(Symbol); |
60 | QString unicodestring = utf8_codec->toUnicode(label.c_str()); | 62 | QString unicodestring = utf8_codec->toUnicode(label.c_str()); |
61 | for (int i=0; i<int(unicodestring.length()); i++) { | 63 | for (int i=0; i<int(unicodestring.length()); i++) { |
62 | emit key( unicodestring[i].unicode(), 0, 0, true, false ); | 64 | emit key( unicodestring[i].unicode(), 0, 0, true, false ); |
63 | emit key( unicodestring[i].unicode(), 0, 0, false, false ); | 65 | emit key( unicodestring[i].unicode(), 0, 0, false, false ); |
64 | } | 66 | } |
65 | } | 67 | } |
66 | 68 | ||
67 | void QtDasherPlugin::deletetext() | 69 | void QtDasherPlugin::deletetext() |
68 | { | 70 | { |
69 | emit key( 0, Qt::Key_Backspace, 0, true, false); | 71 | emit key( 0, Qt::Key_Backspace, 0, true, false); |
70 | emit key( 0, Qt::Key_Backspace, 0, false, false); | 72 | emit key( 0, Qt::Key_Backspace, 0, false, false); |
71 | } | 73 | } |
72 | 74 | ||
73 | void QtDasherPlugin::flush(int Symbol) | 75 | void QtDasherPlugin::flush(int Symbol) |
74 | { | 76 | { |
75 | if (Symbol==0) | 77 | if (Symbol==0) |
76 | return; | 78 | return; |
77 | output(Symbol); | 79 | output(Symbol); |
78 | flushcount++; | 80 | flushcount++; |
79 | } | 81 | } |