summaryrefslogtreecommitdiff
authorzecke <zecke>2003-10-07 13:04:51 (UTC)
committer zecke <zecke>2003-10-07 13:04:51 (UTC)
commite125e425d7c25b32527726c416b347902294bfdf (patch) (unidiff)
tree8c0b8e09b121745cebb54a088c9ea3141a1a99e8
parent2ffa87f9e7f7f5c3db3f18880aa1040e870b2ba7 (diff)
downloadopie-e125e425d7c25b32527726c416b347902294bfdf.zip
opie-e125e425d7c25b32527726c416b347902294bfdf.tar.gz
opie-e125e425d7c25b32527726c416b347902294bfdf.tar.bz2
Include custom.h as well
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--x11/libqpe-x11/qpe/qpeapplication.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/x11/libqpe-x11/qpe/qpeapplication.cpp b/x11/libqpe-x11/qpe/qpeapplication.cpp
index 0a98481..0fce355 100644
--- a/x11/libqpe-x11/qpe/qpeapplication.cpp
+++ b/x11/libqpe-x11/qpe/qpeapplication.cpp
@@ -1,213 +1,214 @@
1#define QTOPIA_INTERNAL_LANGLIST 1#define QTOPIA_INTERNAL_LANGLIST
2 2
3#include <stdio.h> 3#include <stdio.h>
4#include <stdlib.h> 4#include <stdlib.h>
5#include <unistd.h> 5#include <unistd.h>
6#include <sys/file.h> 6#include <sys/file.h>
7 7
8 8
9#include <qdir.h> 9#include <qdir.h>
10#include <qdialog.h> 10#include <qdialog.h>
11#include <qdragobject.h> 11#include <qdragobject.h>
12#include <qevent.h> 12#include <qevent.h>
13#include <qlabel.h> 13#include <qlabel.h>
14#include <qlist.h> 14#include <qlist.h>
15#include <qtextstream.h> 15#include <qtextstream.h>
16#include <qtextcodec.h> 16#include <qtextcodec.h>
17#include <qpalette.h> 17#include <qpalette.h>
18#include <qptrdict.h> 18#include <qptrdict.h>
19#include <qregexp.h> 19#include <qregexp.h>
20#include <qtimer.h> 20#include <qtimer.h>
21 21
22#include <qpe/custom.h>
22#include <qpe/alarmserver.h> 23#include <qpe/alarmserver.h>
23#include <qpe/applnk.h> 24#include <qpe/applnk.h>
24#include <qpe/qpemenubar.h> 25#include <qpe/qpemenubar.h>
25#include <qpe/textcodecinterface.h> 26#include <qpe/textcodecinterface.h>
26#include <qpe/imagecodecinterface.h> 27#include <qpe/imagecodecinterface.h>
27#include <qpe/qlibrary.h> 28#include <qpe/qlibrary.h>
28#include <qpe/qpestyle.h> 29#include <qpe/qpestyle.h>
29#include <qpe/styleinterface.h> 30#include <qpe/styleinterface.h>
30#include <qpe/global.h> 31#include <qpe/global.h>
31#include <qpe/resource.h> 32#include <qpe/resource.h>
32#include <qpe/config.h> 33#include <qpe/config.h>
33#include <qpe/network.h> 34#include <qpe/network.h>
34 35
35#include <qpe/qpeapplication.h> 36#include <qpe/qpeapplication.h>
36#include <qpe/timestring.h> 37#include <qpe/timestring.h>
37#include <qpe/qcopenvelope_qws.h> 38#include <qpe/qcopenvelope_qws.h>
38 39
39 40
40#include <X11/Xlib.h> 41#include <X11/Xlib.h>
41#include <X11/Xutil.h> 42#include <X11/Xutil.h>
42 43
43const int XKeyPress = KeyPress; 44const int XKeyPress = KeyPress;
44const int XKeyRelease = KeyRelease; 45const int XKeyRelease = KeyRelease;
45#undef KeyPress 46#undef KeyPress
46#undef KeyRelease 47#undef KeyRelease
47 48
48namespace { 49namespace {
49 struct QCopRec{ 50 struct QCopRec{
50 QCopRec( const QCString& ch, const QCString& msg, const QByteArray& ar ) 51 QCopRec( const QCString& ch, const QCString& msg, const QByteArray& ar )
51 : channel(ch), message(msg), data(ar) { 52 : channel(ch), message(msg), data(ar) {
52 53
53 } 54 }
54 QCString channel; 55 QCString channel;
55 QCString message; 56 QCString message;
56 QByteArray data; 57 QByteArray data;
57 }; 58 };
58}; 59};
59 60
60 61
61class QPEApplication::Private { 62class QPEApplication::Private {
62public: 63public:
63 Private(); 64 Private();
64 ~Private(); 65 ~Private();
65 void enqueueQCop( const QCString& ch, const QCString& msg, 66 void enqueueQCop( const QCString& ch, const QCString& msg,
66 const QByteArray& ); 67 const QByteArray& );
67 void sendQCopQ(); 68 void sendQCopQ();
68 static void show_mx(QWidget* mw, bool nomaximize ); 69 static void show_mx(QWidget* mw, bool nomaximize );
69 void show( QWidget* mw, bool nomax ); 70 void show( QWidget* mw, bool nomax );
70 void loadTextCodecs(); 71 void loadTextCodecs();
71 void loadImageCodecs(); 72 void loadImageCodecs();
72 73
73 int kbgrabber; 74 int kbgrabber;
74 int presstimer; 75 int presstimer;
75 76
76 bool rightpressed : 1; 77 bool rightpressed : 1;
77 bool kbregrab : 1; 78 bool kbregrab : 1;
78 bool notbusysent : 1; 79 bool notbusysent : 1;
79 bool preloaded : 1; 80 bool preloaded : 1;
80 bool forceshow : 1; 81 bool forceshow : 1;
81 bool nomaximize : 1; 82 bool nomaximize : 1;
82 bool keep_running : 1; 83 bool keep_running : 1;
83 84
84 QWidget* presswidget; 85 QWidget* presswidget;
85 QPoint presspos; 86 QPoint presspos;
86 QWidget* qpe_main_widget; 87 QWidget* qpe_main_widget;
87 QString appName; 88 QString appName;
88 QString styleName; 89 QString styleName;
89 QString decorationName; 90 QString decorationName;
90 Atom wm_delete_window; 91 Atom wm_delete_window;
91 Atom wm_take_focus; 92 Atom wm_take_focus;
92 Atom wm_context_help; 93 Atom wm_context_help;
93 Atom wm_context_accept; 94 Atom wm_context_accept;
94 Atom wm_protocols; 95 Atom wm_protocols;
95 96
96private: 97private:
97 QList<QCopRec> qcopq; 98 QList<QCopRec> qcopq;
98}; 99};
99QPEApplication::Private::~Private() { 100QPEApplication::Private::~Private() {
100} 101}
101QPEApplication::Private::Private() 102QPEApplication::Private::Private()
102 : kbgrabber(0 ), presstimer(0 ), rightpressed( FALSE ), kbregrab( FALSE ), notbusysent( FALSE ), 103 : kbgrabber(0 ), presstimer(0 ), rightpressed( FALSE ), kbregrab( FALSE ), notbusysent( FALSE ),
103 preloaded( FALSE ), forceshow( FALSE ), nomaximize( FALSE ), keep_running( TRUE ), 104 preloaded( FALSE ), forceshow( FALSE ), nomaximize( FALSE ), keep_running( TRUE ),
104 presswidget( 0 ), qpe_main_widget(0 ) { 105 presswidget( 0 ), qpe_main_widget(0 ) {
105 106
106 qcopq.setAutoDelete( TRUE ); 107 qcopq.setAutoDelete( TRUE );
107} 108}
108void QPEApplication::Private::enqueueQCop( const QCString& chan, const QCString& msg, 109void QPEApplication::Private::enqueueQCop( const QCString& chan, const QCString& msg,
109 const QByteArray& ar ) { 110 const QByteArray& ar ) {
110 qcopq.append( new QCopRec(chan, msg, ar ) ); 111 qcopq.append( new QCopRec(chan, msg, ar ) );
111} 112}
112void QPEApplication::Private::sendQCopQ() { 113void QPEApplication::Private::sendQCopQ() {
113 QCopRec* r; 114 QCopRec* r;
114 for ( r = qcopq.first(); r; r = qcopq.next() ) { 115 for ( r = qcopq.first(); r; r = qcopq.next() ) {
115 QCopChannel::sendLocally( r->channel, r->message, r->data ); 116 QCopChannel::sendLocally( r->channel, r->message, r->data );
116 } 117 }
117 qcopq.clear(); 118 qcopq.clear();
118} 119}
119void QPEApplication::Private::show_mx(QWidget* mw, bool nomaximize ) { 120void QPEApplication::Private::show_mx(QWidget* mw, bool nomaximize ) {
120 if (mw->layout() && mw->inherits("QDialog") ) { 121 if (mw->layout() && mw->inherits("QDialog") ) {
121 QPEApplication::showDialog( (QDialog*)mw, nomaximize ); 122 QPEApplication::showDialog( (QDialog*)mw, nomaximize );
122 }else { 123 }else {
123 if (!nomaximize ) 124 if (!nomaximize )
124 mw->showMaximized(); 125 mw->showMaximized();
125 else 126 else
126 mw->show(); 127 mw->show();
127 } 128 }
128} 129}
129void QPEApplication::Private::show( QWidget* mw, bool nomax ) { 130void QPEApplication::Private::show( QWidget* mw, bool nomax ) {
130 nomaximize = nomax; 131 nomaximize = nomax;
131 qpe_main_widget = mw; 132 qpe_main_widget = mw;
132 133
133 sendQCopQ(); 134 sendQCopQ();
134 135
135 if ( preloaded ) { 136 if ( preloaded ) {
136 if (forceshow ) 137 if (forceshow )
137 show_mx(mw, nomax ); 138 show_mx(mw, nomax );
138 }else if ( keep_running ) 139 }else if ( keep_running )
139 show_mx( mw, nomax ); 140 show_mx( mw, nomax );
140} 141}
141void QPEApplication::Private::loadTextCodecs() { 142void QPEApplication::Private::loadTextCodecs() {
142 QString path = QPEApplication::qpeDir() + "/plugins/textcodecs"; 143 QString path = QPEApplication::qpeDir() + "/plugins/textcodecs";
143 QDir dir( path, "lib*.so" ); 144 QDir dir( path, "lib*.so" );
144 QStringList list = dir.entryList(); 145 QStringList list = dir.entryList();
145 QStringList::Iterator it; 146 QStringList::Iterator it;
146 for ( it = list.begin(); it != list.end(); ++it ) { 147 for ( it = list.begin(); it != list.end(); ++it ) {
147 TextCodecInterface *iface = 0; 148 TextCodecInterface *iface = 0;
148 QLibrary *lib = new QLibrary( path + "/" + *it ); 149 QLibrary *lib = new QLibrary( path + "/" + *it );
149 if ( lib->queryInterface( IID_QtopiaTextCodec, (QUnknownInterface**)&iface ) == QS_OK && iface ) { 150 if ( lib->queryInterface( IID_QtopiaTextCodec, (QUnknownInterface**)&iface ) == QS_OK && iface ) {
150 QValueList<int> mibs = iface->mibEnums(); 151 QValueList<int> mibs = iface->mibEnums();
151 for (QValueList<int>::ConstIterator i = mibs.begin(); i != mibs.end(); ++i) { 152 for (QValueList<int>::ConstIterator i = mibs.begin(); i != mibs.end(); ++i) {
152 (void)iface->createForMib(*i); 153 (void)iface->createForMib(*i);
153 // ### it exists now; need to remember if we can delete it 154 // ### it exists now; need to remember if we can delete it
154 } 155 }
155 } 156 }
156 else { 157 else {
157 lib->unload(); 158 lib->unload();
158 delete lib; 159 delete lib;
159 } 160 }
160 } 161 }
161} 162}
162void QPEApplication::Private::loadImageCodecs() { 163void QPEApplication::Private::loadImageCodecs() {
163 QString path = QPEApplication::qpeDir() + "/plugins/imagecodecs"; 164 QString path = QPEApplication::qpeDir() + "/plugins/imagecodecs";
164 QDir dir( path, "lib*.so" ); 165 QDir dir( path, "lib*.so" );
165 QStringList list = dir.entryList(); 166 QStringList list = dir.entryList();
166 QStringList::Iterator it; 167 QStringList::Iterator it;
167 for ( it = list.begin(); it != list.end(); ++it ) { 168 for ( it = list.begin(); it != list.end(); ++it ) {
168 ImageCodecInterface *iface = 0; 169 ImageCodecInterface *iface = 0;
169 QLibrary *lib = new QLibrary( path + "/" + *it ); 170 QLibrary *lib = new QLibrary( path + "/" + *it );
170 if ( lib->queryInterface( IID_QtopiaImageCodec, (QUnknownInterface**)&iface ) == QS_OK && iface ) { 171 if ( lib->queryInterface( IID_QtopiaImageCodec, (QUnknownInterface**)&iface ) == QS_OK && iface ) {
171 QStringList formats = iface->keys(); 172 QStringList formats = iface->keys();
172 for (QStringList::ConstIterator i = formats.begin(); i != formats.end(); ++i) { 173 for (QStringList::ConstIterator i = formats.begin(); i != formats.end(); ++i) {
173 (void)iface->installIOHandler(*i); 174 (void)iface->installIOHandler(*i);
174 // ### it exists now; need to remember if we can delete it 175 // ### it exists now; need to remember if we can delete it
175 } 176 }
176 } 177 }
177 else { 178 else {
178 lib->unload(); 179 lib->unload();
179 delete lib; 180 delete lib;
180 } 181 }
181 } 182 }
182} 183}
183 184
184// The Help System hook 185// The Help System hook
185namespace { 186namespace {
186 class ResourceMimeFactory : public QMimeSourceFactory 187 class ResourceMimeFactory : public QMimeSourceFactory
187 { 188 {
188 public: 189 public:
189 ResourceMimeFactory(); 190 ResourceMimeFactory();
190 ~ResourceMimeFactory(); 191 ~ResourceMimeFactory();
191 const QMimeSource* data( const QString& abs_name )const; 192 const QMimeSource* data( const QString& abs_name )const;
192 }; 193 };
193 ResourceMimeFactory::ResourceMimeFactory() 194 ResourceMimeFactory::ResourceMimeFactory()
194 { 195 {
195 setFilePath( Global::helpPath() ); 196 setFilePath( Global::helpPath() );
196 setExtensionType( "html", "text/html;charset=UTF-8" ); 197 setExtensionType( "html", "text/html;charset=UTF-8" );
197 } 198 }
198 ResourceMimeFactory::~ResourceMimeFactory() { 199 ResourceMimeFactory::~ResourceMimeFactory() {
199 } 200 }
200 201
201 const QMimeSource* ResourceMimeFactory::data( const QString& abs_name ) const 202 const QMimeSource* ResourceMimeFactory::data( const QString& abs_name ) const
202 { 203 {
203 const QMimeSource * r = QMimeSourceFactory::data( abs_name ); 204 const QMimeSource * r = QMimeSourceFactory::data( abs_name );
204 if ( !r ) { 205 if ( !r ) {
205 int sl = abs_name.length(); 206 int sl = abs_name.length();
206 do { 207 do {
207 sl = abs_name.findRev( '/', sl - 1 ); 208 sl = abs_name.findRev( '/', sl - 1 );
208 QString name = sl >= 0 ? abs_name.mid( sl + 1 ) : abs_name; 209 QString name = sl >= 0 ? abs_name.mid( sl + 1 ) : abs_name;
209 int dot = name.findRev( '.' ); 210 int dot = name.findRev( '.' );
210 if ( dot >= 0 ) 211 if ( dot >= 0 )
211 name = name.left( dot ); 212 name = name.left( dot );
212 QImage img = Resource::loadImage( name ); 213 QImage img = Resource::loadImage( name );
213 if ( !img.isNull() ) 214 if ( !img.isNull() )