summaryrefslogtreecommitdiff
path: root/library
authorzecke <zecke>2004-12-20 22:11:44 (UTC)
committer zecke <zecke>2004-12-20 22:11:44 (UTC)
commita50334dddaa542fd63726a639e852c30036f53a0 (patch) (unidiff)
tree30d0a41308f752c72d2c685fab60e2bd7c650bec /library
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 (limited to 'library') (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
@@ -22,12 +22,13 @@
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;
@@ -50,13 +51,13 @@ class FileSelector : public QVBox
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 {
@@ -102,13 +103,13 @@ private slots:
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
diff --git a/library/library.pro b/library/library.pro
index cdc1dab..45e69bc 100644
--- a/library/library.pro
+++ b/library/library.pro
@@ -114,13 +114,14 @@ SOURCES = calendar.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
diff --git a/library/qcom.h b/library/qcom.h
index 9972d8f..5703800 100644
--- a/library/qcom.h
+++ b/library/qcom.h
@@ -23,12 +23,13 @@
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
@@ -148,13 +149,13 @@ struct Q_EXPORT QtULong
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++;} \
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp
index 4adfc8f..43a9be5 100644
--- a/library/qpeapplication.cpp
+++ b/library/qpeapplication.cpp
@@ -195,61 +195,61 @@ public:
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
diff --git a/library/qpeapplication.h b/library/qpeapplication.h
index 579fc44..00d3d31 100644
--- a/library/qpeapplication.h
+++ b/library/qpeapplication.h
@@ -28,12 +28,13 @@
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
@@ -117,15 +118,16 @@ public:
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();
@@ -180,56 +182,13 @@ private:
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 );
@@ -259,7 +218,14 @@ inline void QPEApplication::setCurrentRotation( int r )
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
@@ -107,13 +107,14 @@ public:
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
diff --git a/library/qpeglobal.h b/library/qpeglobal.h
index 96ce3a6..a84e435 100644
--- a/library/qpeglobal.h
+++ b/library/qpeglobal.h
@@ -1,9 +1,13 @@
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,
@@ -23,33 +27,62 @@
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
@@ -22,12 +22,14 @@
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
@@ -56,13 +58,13 @@ private:
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
diff --git a/library/qpetoolbar.h b/library/qpetoolbar.h
index 53d21c0..c894ec9 100644
--- a/library/qpetoolbar.h
+++ b/library/qpetoolbar.h
@@ -19,16 +19,17 @@
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:
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}