summaryrefslogtreecommitdiff
authorzecke <zecke>2004-12-20 22:11:44 (UTC)
committer zecke <zecke>2004-12-20 22:11:44 (UTC)
commita50334dddaa542fd63726a639e852c30036f53a0 (patch) (unidiff)
tree30d0a41308f752c72d2c685fab60e2bd7c650bec
parent29e93ce47f7a52ded8956811d50b93e754caa3a6 (diff)
downloadopie-a50334dddaa542fd63726a639e852c30036f53a0.zip
opie-a50334dddaa542fd63726a639e852c30036f53a0.tar.gz
opie-a50334dddaa542fd63726a639e852c30036f53a0.tar.bz2
Restore Files:
-QWSDecoration scaling fixes by mickeyl -Readd macros for DEPRECATED and VISIBILITY -Move out showWidget and execDialog to widget_sowing.cpp -QPE_EXPORT_SYMBOL for Q_EXPORT_INTERFACE -Deprecated for FileSelector, QPEMenubar and Toolbar
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--library/fileselector.h5
-rw-r--r--library/library.pro3
-rw-r--r--library/qcom.h3
-rw-r--r--library/qpeapplication.cpp80
-rw-r--r--library/qpeapplication.h58
-rw-r--r--library/qpedecoration_qws.cpp3
-rw-r--r--library/qpeglobal.h41
-rw-r--r--library/qpemenubar.h4
-rw-r--r--library/qpetoolbar.h3
-rw-r--r--library/widget_showing.cpp74
10 files changed, 177 insertions, 97 deletions
diff --git a/library/fileselector.h b/library/fileselector.h
index e3ae891..f1738db 100644
--- a/library/fileselector.h
+++ b/library/fileselector.h
@@ -16,24 +16,25 @@
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#ifndef FILESELECTOR_H 20#ifndef FILESELECTOR_H
21#define FILESELECTOR_H 21#define FILESELECTOR_H
22 22
23#include <qhbox.h> 23#include <qhbox.h>
24#include <qvbox.h> 24#include <qvbox.h>
25#include <qtoolbutton.h> 25#include <qtoolbutton.h>
26#include <qlistview.h> 26#include <qlistview.h>
27 27
28#include "qpeglobal.h"
28#include "filemanager.h" 29#include "filemanager.h"
29#include "applnk.h" 30#include "applnk.h"
30 31
31class QPopupMenu; 32class QPopupMenu;
32class QPushButton; 33class QPushButton;
33class FileSelectorView; 34class FileSelectorView;
34 35
35class FileSelectorItem : public QListViewItem 36class FileSelectorItem : public QListViewItem
36{ 37{
37public: 38public:
38 FileSelectorItem( QListView *parent, const DocLnk& f ); 39 FileSelectorItem( QListView *parent, const DocLnk& f );
39 ~FileSelectorItem(); 40 ~FileSelectorItem();
@@ -44,25 +45,25 @@ private:
44 DocLnk fl; 45 DocLnk fl;
45}; 46};
46 47
47class FileSelectorPrivate; 48class FileSelectorPrivate;
48class FileSelector : public QVBox 49class FileSelector : public QVBox
49{ 50{
50 Q_OBJECT 51 Q_OBJECT
51 52
52public: 53public:
53 FileSelector( const QString &mimefilter, QWidget *parent, const char *name=0, bool newVisible = TRUE, bool closeVisible = TRUE ); 54 FileSelector( const QString &mimefilter, QWidget *parent, const char *name=0, bool newVisible = TRUE, bool closeVisible = TRUE );
54 ~FileSelector(); 55 ~FileSelector();
55 void setNewVisible( bool b ); 56 void setNewVisible( bool b );
56 void setCloseVisible( bool b ); 57 void setCloseVisible( bool b ) QPE_DEPRECATED;
57 void setTypeComboVisible( bool b = TRUE ); 58 void setTypeComboVisible( bool b = TRUE );
58 void setCategorySelectVisible( bool b = TRUE ); 59 void setCategorySelectVisible( bool b = TRUE );
59 void reread(); 60 void reread();
60 int fileCount(); 61 int fileCount();
61 DocLnk selectedDocument() const 62 DocLnk selectedDocument() const
62 { 63 {
63 const DocLnk* rp = ((FileSelector*)this)->selected(); 64 const DocLnk* rp = ((FileSelector*)this)->selected();
64 if (!rp) { 65 if (!rp) {
65 DocLnk r; 66 DocLnk r;
66 return r; 67 return r;
67 } 68 }
68 DocLnk r(*rp); 69 DocLnk r(*rp);
@@ -96,20 +97,20 @@ private slots:
96 void filePressed( int, QListViewItem *, const QPoint &, int ); 97 void filePressed( int, QListViewItem *, const QPoint &, int );
97 void fileClicked( QListViewItem *); 98 void fileClicked( QListViewItem *);
98 void typeSelected( const QString &type ); 99 void typeSelected( const QString &type );
99 void catSelected( int ); 100 void catSelected( int );
100 void cardMessage( const QCString &, const QByteArray &); 101 void cardMessage( const QCString &, const QByteArray &);
101 102
102private: 103private:
103 void updateView(); 104 void updateView();
104 void updateWhatsThis(); 105 void updateWhatsThis();
105 106
106private: 107private:
107 // RESOLVE please -zecke@handhelds.org 108 // RESOLVE please -zecke@handhelds.org
108 const DocLnk *selected(); // use selectedDocument() luckily no compiler is putting the access into the symbol name 109 const DocLnk *selected() QPE_DEPRECATED; // use selectedDocument() luckily no compiler is putting the access into the symbol name
109 FileSelectorView *view; 110 FileSelectorView *view;
110 QString filter; 111 QString filter;
111 QToolButton *buttonNew, *buttonClose; 112 QToolButton *buttonNew, *buttonClose;
112 FileSelectorPrivate *d; 113 FileSelectorPrivate *d;
113}; 114};
114 115
115#endif 116#endif
diff --git a/library/library.pro b/library/library.pro
index cdc1dab..45e69bc 100644
--- a/library/library.pro
+++ b/library/library.pro
@@ -108,25 +108,26 @@ SOURCES = calendar.cpp \
108 backend/event.cpp \ 108 backend/event.cpp \
109 backend/contact.cpp \ 109 backend/contact.cpp \
110 categorymenu.cpp \ 110 categorymenu.cpp \
111 categoryedit_p.cpp \ 111 categoryedit_p.cpp \
112 categoryselect.cpp \ 112 categoryselect.cpp \
113 categorywidget.cpp \ 113 categorywidget.cpp \
114 ir.cpp \ 114 ir.cpp \
115 backend/vcc_yacc.cpp \ 115 backend/vcc_yacc.cpp \
116 backend/vobject.cpp \ 116 backend/vobject.cpp \
117 findwidget_p.cpp \ 117 findwidget_p.cpp \
118 finddialog.cpp \ 118 finddialog.cpp \
119 lnkproperties.cpp \ 119 lnkproperties.cpp \
120 qt_override.cpp 120 qt_override.cpp \
121 widget_showing.cpp
121 122
122 123
123 124
124# Qt 3 compatibility 125# Qt 3 compatibility
125HEADERS += quuid.h qcom.h qlibrary.h qlibrary_p.h 126HEADERS += quuid.h qcom.h qlibrary.h qlibrary_p.h
126SOURCES += quuid.cpp qlibrary.cpp qlibrary_unix.cpp 127SOURCES += quuid.cpp qlibrary.cpp qlibrary_unix.cpp
127INCLUDEPATH += $(OPIEDIR)/include backend 128INCLUDEPATH += $(OPIEDIR)/include backend
128 LIBS += -ldl -lcrypt -lm 129 LIBS += -ldl -lcrypt -lm
129INTERFACES = passwordbase_p.ui categoryeditbase_p.ui findwidgetbase_p.ui lnkpropertiesbase_p.ui 130INTERFACES = passwordbase_p.ui categoryeditbase_p.ui findwidgetbase_p.ui lnkpropertiesbase_p.ui
130 TARGET = qpe 131 TARGET = qpe
131 DESTDIR = $(OPIEDIR)/lib$(PROJMAK) 132 DESTDIR = $(OPIEDIR)/lib$(PROJMAK)
132 VERSION = 1.5.0.1 133 VERSION = 1.5.0.1
diff --git a/library/qcom.h b/library/qcom.h
index 9972d8f..5703800 100644
--- a/library/qcom.h
+++ b/library/qcom.h
@@ -17,24 +17,25 @@
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#ifndef QCOM_H 21#ifndef QCOM_H
22#define QCOM_H 22#define QCOM_H
23 23
24#include <qstringlist.h> 24#include <qstringlist.h>
25 25
26#ifndef QT_NO_COMPONENT 26#ifndef QT_NO_COMPONENT
27 27
28#include <qpe/quuid.h> 28#include <qpe/quuid.h>
29#include <qpe/qpeglobal.h>
29 30
30#define QRESULT unsigned long 31#define QRESULT unsigned long
31#define QS_OK (QRESULT)0x00000000 32#define QS_OK (QRESULT)0x00000000
32#define QS_FALSE (QRESULT)0x00000001 33#define QS_FALSE (QRESULT)0x00000001
33 34
34#define QE_NOTIMPL (QRESULT)0x80000001 35#define QE_NOTIMPL (QRESULT)0x80000001
35#define QE_OUTOFMEMORY (QRESULT)0x80000002 36#define QE_OUTOFMEMORY (QRESULT)0x80000002
36#define QE_INVALIDARG (QRESULT)0x80000003 37#define QE_INVALIDARG (QRESULT)0x80000003
37#define QE_NOINTERFACE (QRESULT)0x80000004 38#define QE_NOINTERFACE (QRESULT)0x80000004
38#define QE_NOCOMPONENT (QRESULT)0x80000005 39#define QE_NOCOMPONENT (QRESULT)0x80000005
39 40
40// {1D8518CD-E8F5-4366-99E8-879FD7E482DE} 41// {1D8518CD-E8F5-4366-99E8-879FD7E482DE}
@@ -142,25 +143,25 @@ struct Q_EXPORT QtULong
142{ 143{
143 QtULong() : ref( 0 ) { } 144 QtULong() : ref( 0 ) { }
144 operator unsigned long () const { return ref; } 145 operator unsigned long () const { return ref; }
145 unsigned long& operator++() { return ++ref; } 146 unsigned long& operator++() { return ++ref; }
146 unsigned long operator++( int ) { return ref++; } 147 unsigned long operator++( int ) { return ref++; }
147 unsigned long& operator--() { return --ref; } 148 unsigned long& operator--() { return --ref; }
148 unsigned long operator--( int ) { return ref--; } 149 unsigned long operator--( int ) { return ref--; }
149 150
150 unsigned long ref; 151 unsigned long ref;
151}; 152};
152 153
153#define Q_EXPORT_INTERFACE() \ 154#define Q_EXPORT_INTERFACE() \
154 extern "C" QUnknownInterface* ucm_instantiate() 155 extern "C" QUnknownInterface* ucm_instantiate QPE_EXPORT_SYMBOL ()
155 156
156#define Q_REFCOUNT \ 157#define Q_REFCOUNT \
157private: \ 158private: \
158 QtULong qtrefcount; \ 159 QtULong qtrefcount; \
159public: \ 160public: \
160 ulong addRef() {return qtrefcount++;} \ 161 ulong addRef() {return qtrefcount++;} \
161 ulong release() {if(!--qtrefcount){delete this;return 0;}return qtrefcount;} 162 ulong release() {if(!--qtrefcount){delete this;return 0;}return qtrefcount;}
162 163
163#else // QT_NO_COMPONENT 164#else // QT_NO_COMPONENT
164 165
165struct Q_EXPORT QUnknownInterface 166struct Q_EXPORT QUnknownInterface
166{ 167{
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp
index 4adfc8f..43a9be5 100644
--- a/library/qpeapplication.cpp
+++ b/library/qpeapplication.cpp
@@ -189,73 +189,73 @@ public:
189 while((r=qcopq.dequeue())) { 189 while((r=qcopq.dequeue())) {
190 // remove from queue before sending... 190 // remove from queue before sending...
191 // event loop can come around again before getting 191 // event loop can come around again before getting
192 // back from sendLocally 192 // back from sendLocally
193#ifndef QT_NO_COP 193#ifndef QT_NO_COP
194 QCopChannel::sendLocally( r->channel, r->message, r->data ); 194 QCopChannel::sendLocally( r->channel, r->message, r->data );
195#endif 195#endif
196 196
197 delete r; 197 delete r;
198 } 198 }
199 } 199 }
200 200
201 static void show_mx(QWidget* mw, bool nomaximize, QString &strName) 201 static void show_mx(QWidget* mw, bool nomaximize, QString &strName) {
202 { 202 if ( mw->inherits("QMainWindow") || mw->isA("QMainWindow") )
203 if ( mw->inherits("QMainWindow") || mw->isA("QMainWindow") ) 203 {
204 { 204 ( ( QMainWindow* ) mw )->setUsesBigPixmaps( useBigPixmaps );
205 ( ( QMainWindow* ) mw )->setUsesBigPixmaps( useBigPixmaps ); 205 }
206 }
207 QPoint p; 206 QPoint p;
208 QSize s; 207 QSize s;
209 bool max; 208 bool max;
210 if ( mw->isVisible() ) {
211 if ( read_widget_rect(strName, max, p, s) && validate_widget_size(mw, p, s) ) {
212 mw->resize(s);
213 mw->move(p);
214 }
215 mw->raise();
216 } else {
217 209
218 if ( mw->layout() && mw->inherits("QDialog") ) { 210 if ( mw->isVisible() ) {
219 if ( read_widget_rect(strName, max, p, s) && validate_widget_size(mw, p, s) ) { 211 if ( read_widget_rect(strName, max, p, s) && validate_widget_size(mw, p, s) ) {
220 mw->resize(s); 212 mw->resize(s);
221 mw->move(p); 213 mw->move(p);
214 }
215 mw->raise();
216 } else {
222 217
223 if ( max && !nomaximize ) { 218 if ( mw->layout() && mw->inherits("QDialog") ) {
224 mw->showMaximized(); 219 if ( read_widget_rect(strName, max, p, s) && validate_widget_size(mw, p, s) ) {
225 } else { 220 mw->resize(s);
226 mw->show(); 221 mw->move(p);
222
223 if ( max && !nomaximize ) {
224 mw->showMaximized();
225 } else {
226 mw->show();
227 }
228 } else {
229 QPEApplication::showDialog((QDialog*)mw,nomaximize);
227 } 230 }
228 } else { 231 } else {
229 QPEApplication::showDialog((QDialog*)mw,nomaximize); 232 if ( read_widget_rect(strName, max, p, s) && validate_widget_size(mw, p, s) ) {
230 } 233 mw->resize(s);
231 } else { 234 mw->move(p);
232 if ( read_widget_rect(strName, max, p, s) && validate_widget_size(mw, p, s) ) { 235 } else { //no stored rectangle, make an estimation
233 mw->resize(s); 236 int x = (qApp->desktop()->width()-mw->frameGeometry().width())/2;
234 mw->move(p); 237 int y = (qApp->desktop()->height()-mw->frameGeometry().height())/2;
235 } else { //no stored rectangle, make an estimation 238 mw->move( QMAX(x,0), QMAX(y,0) );
236 int x = (qApp->desktop()->width()-mw->frameGeometry().width())/2;
237 int y = (qApp->desktop()->height()-mw->frameGeometry().height())/2;
238 mw->move( QMAX(x,0), QMAX(y,0) );
239#ifdef Q_WS_QWS 239#ifdef Q_WS_QWS
240 if ( !nomaximize ) 240 if ( !nomaximize )
241 mw->showMaximized(); 241 mw->showMaximized();
242#endif 242#endif
243 }
244 if ( max && !nomaximize )
245 mw->showMaximized();
246 else
247 mw->show();
248 }
243 } 249 }
244 if ( max && !nomaximize )
245 mw->showMaximized();
246 else
247 mw->show();
248 }
249 }
250 } 250 }
251 251
252 static bool read_widget_rect(const QString &app, bool &maximized, QPoint &p, QSize &s) 252 static bool read_widget_rect(const QString &app, bool &maximized, QPoint &p, QSize &s)
253 { 253 {
254 maximized = TRUE; 254 maximized = TRUE;
255 // 350 is the trigger in qwsdefaultdecoration for providing a resize button 255 // 350 is the trigger in qwsdefaultdecoration for providing a resize button
256 if ( qApp->desktop()->width() <= 350 ) 256 if ( qApp->desktop()->width() <= 350 )
257 return FALSE; 257 return FALSE;
258 258
259 Config cfg( "qpe" ); 259 Config cfg( "qpe" );
260 cfg.setGroup("ApplicationPositions"); 260 cfg.setGroup("ApplicationPositions");
261 QString str = cfg.readEntry( app, QString::null ); 261 QString str = cfg.readEntry( app, QString::null );
diff --git a/library/qpeapplication.h b/library/qpeapplication.h
index 579fc44..00d3d31 100644
--- a/library/qpeapplication.h
+++ b/library/qpeapplication.h
@@ -22,24 +22,25 @@
22 22
23#include <stdlib.h> // for setenv() 23#include <stdlib.h> // for setenv()
24 24
25#include <qglobal.h> 25#include <qglobal.h>
26#include <qapplication.h> 26#include <qapplication.h>
27#include <qdialog.h> 27#include <qdialog.h>
28#include <qwsdisplay_qws.h> 28#include <qwsdisplay_qws.h>
29#if defined(_WS_QWS_) && !defined(Q_WS_QWS) 29#if defined(_WS_QWS_) && !defined(Q_WS_QWS)
30#define Q_WS_QWS 30#define Q_WS_QWS
31#endif 31#endif
32#include "qpedecoration_qws.h" 32#include "qpedecoration_qws.h"
33#include "timestring.h" 33#include "timestring.h"
34#include "qpeglobal.h"
34 35
35class QCopChannel; 36class QCopChannel;
36class QPEApplicationData; 37class QPEApplicationData;
37class QWSEvent; 38class QWSEvent;
38class QWSKeyEvent; 39class QWSKeyEvent;
39 40
40/** 41/**
41 \brief The QPEApplication class implements various system services 42 \brief The QPEApplication class implements various system services
42 that are available to all Qtopia applications. 43 that are available to all Qtopia applications.
43 44
44 Simply by using QPEApplication instead of QApplication, a standard Qt 45 Simply by using QPEApplication instead of QApplication, a standard Qt
45 application becomes a Qtopia application. It automatically follows 46 application becomes a Qtopia application. It automatically follows
@@ -111,27 +112,28 @@ public:
111 enum screenSaverHint { 112 enum screenSaverHint {
112 Disable = 0, 113 Disable = 0,
113 DisableLightOff = 1, 114 DisableLightOff = 1,
114 DisableSuspend = 2, 115 DisableSuspend = 2,
115 Enable = 100 116 Enable = 100
116 }; 117 };
117 118
118 static void setInputMethodHint( QWidget *, InputMethodHint ); 119 static void setInputMethodHint( QWidget *, InputMethodHint );
119 static InputMethodHint inputMethodHint( QWidget * ); 120 static InputMethodHint inputMethodHint( QWidget * );
120 121
121 void showMainWidget( QWidget*, bool nomax=FALSE ); 122 void showMainWidget( QWidget*, bool nomax=FALSE );
122 void showMainDocumentWidget( QWidget*, bool nomax=FALSE ); 123 void showMainDocumentWidget( QWidget*, bool nomax=FALSE );
123 static void showDialog( QDialog*, bool nomax=FALSE ); 124
124 static int execDialog( QDialog*, bool nomax=FALSE ); 125 static void showDialog( QDialog*, bool nomax=FALSE ) QPE_WEAK_SYMBOL;
125 static void showWidget( QWidget*, bool nomax=FALSE ); 126 static int execDialog ( QDialog*, bool nomax=FALSE ) QPE_WEAK_SYMBOL;
127 static void showWidget( QWidget*, bool nomax=FALSE ) QPE_WEAK_SYMBOL;
126 /* Merge setTempScreenSaverMode */ 128 /* Merge setTempScreenSaverMode */
127#ifdef QTOPIA_INTERNAL_INITAPP 129#ifdef QTOPIA_INTERNAL_INITAPP
128 void initApp( int argv, char **argv ); 130 void initApp( int argv, char **argv );
129#endif 131#endif
130 132
131 static void setKeepRunning(); 133 static void setKeepRunning();
132 bool keepRunning() const; 134 bool keepRunning() const;
133 135
134 bool keyboardGrabbed() const; 136 bool keyboardGrabbed() const;
135 137
136 int exec(); 138 int exec();
137 139
@@ -174,68 +176,25 @@ private:
174 void processQCopFile(); 176 void processQCopFile();
175 177
176#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 178#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
177 QCopChannel *sysChannel; 179 QCopChannel *sysChannel;
178 QCopChannel *pidChannel; 180 QCopChannel *pidChannel;
179#endif 181#endif
180 QPEApplicationData *d; 182 QPEApplicationData *d;
181 183
182 bool reserved_sh; 184 bool reserved_sh;
183 185
184}; 186};
185 187
186inline void QPEApplication::showDialog( QDialog* d, bool nomax )
187{
188 showWidget( d, nomax );
189}
190 188
191inline int QPEApplication::execDialog( QDialog* d, bool nomax )
192{
193 showDialog( d, nomax );
194 return d->exec();
195}
196
197#ifdef Q_WS_QWS
198extern Q_EXPORT QRect qt_maxWindowRect;
199#endif
200
201inline void QPEApplication::showWidget( QWidget* wg, bool nomax )
202{
203 if ( wg->isVisible() )
204 wg->show();
205 else
206 {
207 if ( !nomax
208 && ( qApp->desktop()->width() <= 320 ) )
209 {
210 wg->showMaximized();
211 } else {
212 #ifdef Q_WS_QWS
213 QSize desk = QSize( qApp->desktop()->width(), qApp->desktop()->height() );
214 #else
215 QSize desk = QSize( qt_maxWindowRect.width(), qt_maxWindowRect.height() );
216 #endif
217
218 QSize sh = wg->sizeHint();
219 int w = QMAX( sh.width(), wg->width() );
220 int h = QMAX( sh.height(), wg->height() );
221 // desktop widget-frame taskbar
222 w = QMIN( w, ( desk.width() - ( wg->frameGeometry().width() - wg->geometry().width() ) - 25 ) );
223 h = QMIN( h, ( desk.height() - ( wg->frameGeometry().height() - wg->geometry().height() ) - 25 ) );
224
225 wg->resize( w, h );
226 wg->show();
227 }
228 }
229}
230 189
231enum Transformation { Rot0, Rot90, Rot180, Rot270 }; /* from qgfxtransformed_qws.cpp */ 190enum Transformation { Rot0, Rot90, Rot180, Rot270 }; /* from qgfxtransformed_qws.cpp */
232 191
233inline int TransToDeg ( Transformation t ) 192inline int TransToDeg ( Transformation t )
234{ 193{
235 int d = static_cast<int>( t ); 194 int d = static_cast<int>( t );
236 return d * 90; 195 return d * 90;
237} 196}
238 197
239inline Transformation DegToTrans ( int d ) 198inline Transformation DegToTrans ( int d )
240{ 199{
241 Transformation t = static_cast<Transformation>( d / 90 ); 200 Transformation t = static_cast<Transformation>( d / 90 );
@@ -253,13 +212,20 @@ inline void QPEApplication::setCurrentRotation( int r )
253 // setTransformation has been introduced in Qt/Embedded 2.3.4 snapshots 212 // setTransformation has been introduced in Qt/Embedded 2.3.4 snapshots
254 // for compatibility with the SharpROM use fallback to setDefaultTransformation() 213 // for compatibility with the SharpROM use fallback to setDefaultTransformation()
255#if QT_VERSION > 233 214#if QT_VERSION > 233
256 Transformation e = DegToTrans( r ); 215 Transformation e = DegToTrans( r );
257 ::setenv( "QWS_DISPLAY", QString( "Transformed:Rot%1:0" ).arg( r ).latin1(), 1 ); 216 ::setenv( "QWS_DISPLAY", QString( "Transformed:Rot%1:0" ).arg( r ).latin1(), 1 );
258 qApp->desktop()->qwsDisplay()->setTransformation( e ); 217 qApp->desktop()->qwsDisplay()->setTransformation( e );
259#else 218#else
260 setDefaultRotation( r ); 219 setDefaultRotation( r );
261#endif 220#endif
262} 221}
263 222
264 223
224/*
225 * -remove me
226 */
227#ifdef Q_WS_QWS
228extern Q_EXPORT QRect qt_maxWindowRect;
229#endif
230
265#endif 231#endif
diff --git a/library/qpedecoration_qws.cpp b/library/qpedecoration_qws.cpp
index 8b02de6..fa38180 100644
--- a/library/qpedecoration_qws.cpp
+++ b/library/qpedecoration_qws.cpp
@@ -101,25 +101,26 @@ static const char * const qpe_accept_xpm[] = {
101class DecorHackWidget : public QWidget 101class DecorHackWidget : public QWidget
102{ 102{
103public: 103public:
104 bool needsOk() { 104 bool needsOk() {
105 return (getWState() & WState_Reserved1 ) || 105 return (getWState() & WState_Reserved1 ) ||
106 (inherits("QDialog") && !inherits("QMessageBox") 106 (inherits("QDialog") && !inherits("QMessageBox")
107 && !inherits("QWizard") ); 107 && !inherits("QWizard") );
108 } 108 }
109}; 109};
110 110
111static QImage scaleButton( const QImage &img, int height ) 111static QImage scaleButton( const QImage &img, int height )
112{ 112{
113 if ( img.height() != 0 && img.height() != height ) { 113 //ML: We don't want to scale if the difference is less than 4 pixels to prevent blurring
114 if ( img.height() != 0 && ::abs( img.height()-height ) > 4 ) {
114 return img.smoothScale( img.width()*height/img.height(), height ); 115 return img.smoothScale( img.width()*height/img.height(), height );
115 } else { 116 } else {
116 return img; 117 return img;
117 } 118 }
118} 119}
119 120
120class TLWidget : public QWidget 121class TLWidget : public QWidget
121{ 122{
122public: 123public:
123 QWSManager *manager() 124 QWSManager *manager()
124 { 125 {
125 return topData()->qwsManager; 126 return topData()->qwsManager;
diff --git a/library/qpeglobal.h b/library/qpeglobal.h
index 96ce3a6..a84e435 100644
--- a/library/qpeglobal.h
+++ b/library/qpeglobal.h
@@ -1,15 +1,19 @@
1/* 1/*
2               =. This file is part of the OPIE Project 2 This file is part of the OPIE Project
3             .=l. Copyright (c) 2002,2003,2004 Holger Hans Peter Freyther <freyther@handhelds.org> 3 Copyright (c) 2002,2003,2004 Holger Hans Peter Freyther <freyther@handhelds.org>
4 Copyright (c) 2002,2003,2004 Stefan Eilers <eilers@handhelds.org>
5
6               =.
7             .=l.
4           .>+-= 8           .>+-=
5 _;:,     .>    :=|. This library is free software; you can 9 _;:,     .>    :=|. This library is free software; you can
6.> <`_,   >  .   <= redistribute it and/or modify it under 10.> <`_,   >  .   <= redistribute it and/or modify it under
7:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 11:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
8.="- .-=="i,     .._ License as published by the Free Software 12.="- .-=="i,     .._ License as published by the Free Software
9 - .   .-<_>     .<> Foundation; either version 2 of the License, 13 - .   .-<_>     .<> Foundation; either version 2 of the License,
10     ._= =}       : or (at your option) any later version. 14     ._= =}       : or (at your option) any later version.
11    .%`+i>       _;_. 15    .%`+i>       _;_.
12    .i_,=:_.      -<s. This library is distributed in the hope that 16    .i_,=:_.      -<s. This library is distributed in the hope that
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 17     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
14    : ..    .:,     . . . without even the implied warranty of 18    : ..    .:,     . . . without even the implied warranty of
15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 19    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
@@ -17,39 +21,68 @@
17..}^=.=       =       ; Library General Public License for more 21..}^=.=       =       ; Library General Public License for more
18++=   -.     .`     .: details. 22++=   -.     .`     .: details.
19 :     =  ...= . :.=- 23 :     =  ...= . :.=-
20 -.   .:....=;==+<; You should have received a copy of the GNU 24 -.   .:....=;==+<; You should have received a copy of the GNU
21  -_. . .   )=.  = Library General Public License along with 25  -_. . .   )=.  = Library General Public License along with
22    --        :-=` this library; see the file COPYING.LIB. 26    --        :-=` this library; see the file COPYING.LIB.
23 If not, write to the Free Software Foundation, 27 If not, write to the Free Software Foundation,
24 Inc., 59 Temple Place - Suite 330, 28 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 29 Boston, MA 02111-1307, USA.
26 30
27*/ 31*/
28 32
29#ifndef QPE_GLOBAL_H 33#ifndef QPE_GLOBAL_DEFINES_H
30#define QPE_GLOBAL_H 34#define QPE_GLOBAL_DEFINES_H
31 35
32/** 36/**
33 * Defines for used compiler attributes 37 * Defines for used compiler attributes
34 * 38 *
35 */ 39 */
40
41/*
42 * commons
43 */
44#define QPE_DEPRECATED
45
46
36#if defined(Q_OS_MACX) 47#if defined(Q_OS_MACX)
37#define QPE_WEAK_SYMBOL __attribute__((weak_import)) 48#define QPE_WEAK_SYMBOL __attribute__((weak_import))
38#define QPE_SYMBOL_USED 49#define QPE_SYMBOL_USED
39#define QPE_SYMBOL_UNUSED 50#define QPE_SYMBOL_UNUSED
51#define QPE_EXPORT_SYMBOL
40 52
41#elif defined(_OS_UNIX_) 53#elif defined(_OS_UNIX_)
42#define QPE_WEAK_SYMBOL __attribute__((weak)) 54#define QPE_WEAK_SYMBOL __attribute__((weak))
43#define QPE_SYMBOL_USED __attribute__((used)) 55#define QPE_SYMBOL_USED __attribute__((used))
44#define QPE_SYMBOL_UNUSED __attribute__((unused)) 56#define QPE_SYMBOL_UNUSED __attribute__((unused))
57#define QPE_EXPORT_SYMBOL
58
59
60/*
61 * mark method as deprecated
62 */
63#if __GNUC__ - 0 > 3 || (__GNUC__ - 0 == 3 && __GNUC_MINOR__ - 0 >= 2)
64 /* gcc >= 3.2 */
65#undef QPE_DEPRECATED
66#define QPE_DEPRECATED __attribute__((deprecated))
67#endif
68
69/*
70 * Defined if Compiler supports attributes
71 */
72#ifdef GCC_SUPPORTS_VISIBILITY
73#undef QPE_EXPORT_SYMBOL
74#define QPE_EXPORT_SYMBOL __attribute__((visibility("default")))
75#endif
76
45 77
46 78
47#else // defined(Q_OS_WIN32) 79#else // defined(Q_OS_WIN32)
48#define QPE_WEAK_SYMBOL 80#define QPE_WEAK_SYMBOL
49#define QPE_SYMBOL_USED 81#define QPE_SYMBOL_USED
50#define QPE_SYMBOL_UNUSED 82#define QPE_SYMBOL_UNUSED
83#define QPE_EXPORT_SYMBOL
51#endif 84#endif
52 85
53 86
54 87
55#endif 88#endif
diff --git a/library/qpemenubar.h b/library/qpemenubar.h
index 66d0c85..64bf39c 100644
--- a/library/qpemenubar.h
+++ b/library/qpemenubar.h
@@ -16,24 +16,26 @@
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#ifndef QPEMENUBAR_H 21#ifndef QPEMENUBAR_H
22#define QPEMENUBAR_H 22#define QPEMENUBAR_H
23 23
24#include <qmenubar.h> 24#include <qmenubar.h>
25#include <qguardedptr.h> 25#include <qguardedptr.h>
26#include <qvaluelist.h> 26#include <qvaluelist.h>
27 27
28#include <qtopia/qpeglobal.h>
29
28class QPEMenuToolFocusManager : public QObject 30class QPEMenuToolFocusManager : public QObject
29{ 31{
30 Q_OBJECT 32 Q_OBJECT
31public: 33public:
32 QPEMenuToolFocusManager(); 34 QPEMenuToolFocusManager();
33 35
34 void addWidget( QWidget *w ); 36 void addWidget( QWidget *w );
35 void removeWidget( QWidget *w ); 37 void removeWidget( QWidget *w );
36 void setActive( bool a ); 38 void setActive( bool a );
37 bool isActive() const; 39 bool isActive() const;
38 void moveFocus( bool next ); 40 void moveFocus( bool next );
39 41
@@ -50,25 +52,25 @@ private slots:
50private: 52private:
51 typedef QGuardedPtr<QWidget> GuardedWidget; 53 typedef QGuardedPtr<QWidget> GuardedWidget;
52 QValueList<GuardedWidget> list; 54 QValueList<GuardedWidget> list;
53 GuardedWidget inFocus; 55 GuardedWidget inFocus;
54 GuardedWidget oldFocus; 56 GuardedWidget oldFocus;
55 static QPEMenuToolFocusManager *me; 57 static QPEMenuToolFocusManager *me;
56 58
57private: // Sharp ROM compatibility 59private: // Sharp ROM compatibility
58 void setMenukeyEnabled ( bool b ); 60 void setMenukeyEnabled ( bool b );
59}; 61};
60 62
61 63
62class QPEMenuBar : public QMenuBar 64class QPE_DEPRECATED QPEMenuBar : public QMenuBar
63{ 65{
64 Q_OBJECT 66 Q_OBJECT
65public: 67public:
66 QPEMenuBar( QWidget *parent=0, const char* name=0 ); 68 QPEMenuBar( QWidget *parent=0, const char* name=0 );
67 ~QPEMenuBar(); 69 ~QPEMenuBar();
68 70
69protected: 71protected:
70 virtual void keyPressEvent( QKeyEvent *e ); 72 virtual void keyPressEvent( QKeyEvent *e );
71 73
72 /* Patch from Mickey 74 /* Patch from Mickey
73 * Sharp Qtopia1.5 seems to have these functions 75 * Sharp Qtopia1.5 seems to have these functions
74 * TO BE RESOLVED - zecke 76 * TO BE RESOLVED - zecke
diff --git a/library/qpetoolbar.h b/library/qpetoolbar.h
index 53d21c0..c894ec9 100644
--- a/library/qpetoolbar.h
+++ b/library/qpetoolbar.h
@@ -13,27 +13,28 @@
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#ifndef QPETOOLBAR_H 21#ifndef QPETOOLBAR_H
22#define QPETOOLBAR_H 22#define QPETOOLBAR_H
23 23
24#include <qtoolbar.h> 24#include <qtoolbar.h>
25#include <qtopia/qpeglobal.h>
25 26
26class QMainWindow; 27class QMainWindow;
27 28
28class QPEToolBar : public QToolBar 29class QPE_DEPRECATED QPEToolBar : public QToolBar
29{ 30{
30 Q_OBJECT 31 Q_OBJECT
31public: 32public:
32 QPEToolBar( QMainWindow *parent = 0, const char *name = 0 ); 33 QPEToolBar( QMainWindow *parent = 0, const char *name = 0 );
33 34
34protected: 35protected:
35 virtual void childEvent( QChildEvent *e ); 36 virtual void childEvent( QChildEvent *e );
36}; 37};
37 38
38#endif 39#endif
39 40
diff --git a/library/widget_showing.cpp b/library/widget_showing.cpp
new file mode 100644
index 0000000..43ece64
--- a/dev/null
+++ b/library/widget_showing.cpp
@@ -0,0 +1,74 @@
1/*
2 This file is part of the OPIE Project
3 Copyright (c) 2004 Andreas Richter <ar@handhelds.org>
4 Copyright (c) 2004 Holger Hans Peter Freyther <freyther@handhelds.org>
5               =.
6             .=l.
7           .>+-=
8 _;:,     .>    :=|. This library is free software; you can
9.> <`_,   >  .   <= redistribute it and/or modify it under
10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11.="- .-=="i,     .._ License as published by the Free Software
12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13     ._= =}       : or (at your option) any later version.
14    .%`+i>       _;_.
15    .i_,=:_.      -<s. This library is distributed in the hope that
16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17    : ..    .:,     . . . without even the implied warranty of
18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20..}^=.=       =       ; Library General Public License for more
21++=   -.     .`     .: details.
22 :     =  ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330,
28 Boston, MA 02111-1307, USA.
29
30*/
31
32#include <qtopia/qpeapplication.h>
33
34#ifdef Q_WS_QWS
35extern Q_EXPORT QRect qt_maxWindowRect;
36#endif
37
38void QPEApplication::showDialog( QDialog* d, bool nomax )
39{
40 showWidget( d, nomax );
41}
42
43int QPEApplication::execDialog( QDialog* d, bool nomax )
44{
45 showDialog( d, nomax );
46 return d->exec();
47}
48
49void QPEApplication::showWidget( QWidget* wg, bool nomax ) {
50 if ( wg->isVisible() ) {
51 wg->show();
52 return;
53 }
54
55 if ( !nomax
56 && ( qApp->desktop()->width() <= 320 ) ){
57 wg->showMaximized();
58 } else {
59#ifdef Q_WS_QWS
60 QSize desk = QSize( qApp->desktop()->width(), qApp->desktop()->height() );
61#else
62 QSize desk = QSize( qt_maxWindowRect.width(), qt_maxWindowRect.height() );
63#endif
64
65 QSize sh = wg->sizeHint();
66 int w = QMAX( sh.width(), wg->width() );
67 int h = QMAX( sh.height(), wg->height() );
68// desktop widget-frame taskbar
69 w = QMIN( w, ( desk.width() - ( wg->frameGeometry().width() - wg->geometry().width() ) - 25 ) );
70 h = QMIN( h, ( desk.height() - ( wg->frameGeometry().height() - wg->geometry().height() ) - 25 ) );
71 wg->resize( w, h );
72 wg->show();
73 }
74}