-rw-r--r-- | library/fileselector.h | 5 | ||||
-rw-r--r-- | library/library.pro | 3 | ||||
-rw-r--r-- | library/qcom.h | 3 | ||||
-rw-r--r-- | library/qpeapplication.cpp | 80 | ||||
-rw-r--r-- | library/qpeapplication.h | 58 | ||||
-rw-r--r-- | library/qpedecoration_qws.cpp | 3 | ||||
-rw-r--r-- | library/qpeglobal.h | 41 | ||||
-rw-r--r-- | library/qpemenubar.h | 4 | ||||
-rw-r--r-- | library/qpetoolbar.h | 3 | ||||
-rw-r--r-- | library/widget_showing.cpp | 74 |
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 | |||
@@ -1,115 +1,116 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
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 | #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 | ||
31 | class QPopupMenu; | 32 | class QPopupMenu; |
32 | class QPushButton; | 33 | class QPushButton; |
33 | class FileSelectorView; | 34 | class FileSelectorView; |
34 | 35 | ||
35 | class FileSelectorItem : public QListViewItem | 36 | class FileSelectorItem : public QListViewItem |
36 | { | 37 | { |
37 | public: | 38 | public: |
38 | FileSelectorItem( QListView *parent, const DocLnk& f ); | 39 | FileSelectorItem( QListView *parent, const DocLnk& f ); |
39 | ~FileSelectorItem(); | 40 | ~FileSelectorItem(); |
40 | 41 | ||
41 | DocLnk file() const { return fl; } | 42 | DocLnk file() const { return fl; } |
42 | 43 | ||
43 | private: | 44 | private: |
44 | DocLnk fl; | 45 | DocLnk fl; |
45 | }; | 46 | }; |
46 | 47 | ||
47 | class FileSelectorPrivate; | 48 | class FileSelectorPrivate; |
48 | class FileSelector : public QVBox | 49 | class FileSelector : public QVBox |
49 | { | 50 | { |
50 | Q_OBJECT | 51 | Q_OBJECT |
51 | 52 | ||
52 | public: | 53 | public: |
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); |
69 | delete rp; | 70 | delete rp; |
70 | return r; | 71 | return r; |
71 | } | 72 | } |
72 | 73 | ||
73 | QValueList<DocLnk> fileList() const | 74 | QValueList<DocLnk> fileList() const |
74 | { | 75 | { |
75 | ((FileSelector*)this)->fileCount(); // ensure all loaded when this is extended | 76 | ((FileSelector*)this)->fileCount(); // ensure all loaded when this is extended |
76 | 77 | ||
77 | QValueList<DocLnk> list; | 78 | QValueList<DocLnk> list; |
78 | FileSelectorItem *item = (FileSelectorItem *)((QListView*)view)->firstChild(); | 79 | FileSelectorItem *item = (FileSelectorItem *)((QListView*)view)->firstChild(); |
79 | while (item) { | 80 | while (item) { |
80 | list.append(item->file()); | 81 | list.append(item->file()); |
81 | item = (FileSelectorItem *)item->nextSibling(); | 82 | item = (FileSelectorItem *)item->nextSibling(); |
82 | } | 83 | } |
83 | 84 | ||
84 | return list; | 85 | return list; |
85 | } | 86 | } |
86 | 87 | ||
87 | signals: | 88 | signals: |
88 | void fileSelected( const DocLnk & ); | 89 | void fileSelected( const DocLnk & ); |
89 | void newSelected( const DocLnk & ); | 90 | void newSelected( const DocLnk & ); |
90 | void closeMe(); | 91 | void closeMe(); |
91 | 92 | ||
92 | private slots: | 93 | private slots: |
93 | void createNew(); | 94 | void createNew(); |
94 | void fileClicked( int, QListViewItem *, const QPoint &, int ); | 95 | void fileClicked( int, QListViewItem *, const QPoint &, int ); |
95 | // pressed to get 'right down' | 96 | // pressed to get 'right down' |
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 | ||
102 | private: | 103 | private: |
103 | void updateView(); | 104 | void updateView(); |
104 | void updateWhatsThis(); | 105 | void updateWhatsThis(); |
105 | 106 | ||
106 | private: | 107 | private: |
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 | |||
@@ -1,144 +1,145 @@ | |||
1 | TEMPLATE= lib | 1 | TEMPLATE= lib |
2 | #CONFIG += qt warn_on release | 2 | #CONFIG += qt warn_on release |
3 | CONFIG += qt warn_on debug | 3 | CONFIG += qt warn_on debug |
4 | HEADERS= calendar.h \ | 4 | HEADERS= calendar.h \ |
5 | global.h \ | 5 | global.h \ |
6 | resource.h \ | 6 | resource.h \ |
7 | xmlreader.h \ | 7 | xmlreader.h \ |
8 | mimetype.h \ | 8 | mimetype.h \ |
9 | menubutton.h \ | 9 | menubutton.h \ |
10 | network.h \ | 10 | network.h \ |
11 | networkinterface.h \ | 11 | networkinterface.h \ |
12 | filemanager.h \ | 12 | filemanager.h \ |
13 | fontmanager.h \ | 13 | fontmanager.h \ |
14 | qdawg.h \ | 14 | qdawg.h \ |
15 | datebookmonth.h \ | 15 | datebookmonth.h \ |
16 | fileselector.h \ | 16 | fileselector.h \ |
17 | fileselector_p.h \ | 17 | fileselector_p.h \ |
18 | imageedit.h \ | 18 | imageedit.h \ |
19 | qcopenvelope_qws.h \ | 19 | qcopenvelope_qws.h \ |
20 | qpedecoration_qws.h \ | 20 | qpedecoration_qws.h \ |
21 | qpeapplication.h \ | 21 | qpeapplication.h \ |
22 | qpestyle.h \ | 22 | qpestyle.h \ |
23 | qpedialog.h \ | 23 | qpedialog.h \ |
24 | lightstyle.h \ | 24 | lightstyle.h \ |
25 | config.h \ | 25 | config.h \ |
26 | applnk.h \ | 26 | applnk.h \ |
27 | sound.h \ | 27 | sound.h \ |
28 | tzselect.h \ | 28 | tzselect.h \ |
29 | qmath.h \ | 29 | qmath.h \ |
30 | datebookdb.h \ | 30 | datebookdb.h \ |
31 | alarmserver.h \ | 31 | alarmserver.h \ |
32 | process.h \ | 32 | process.h \ |
33 | password.h \ | 33 | password.h \ |
34 | timestring.h \ | 34 | timestring.h \ |
35 | fontfactoryinterface.h \ | 35 | fontfactoryinterface.h \ |
36 | fontdatabase.h \ | 36 | fontdatabase.h \ |
37 | power.h \ | 37 | power.h \ |
38 | storage.h \ | 38 | storage.h \ |
39 | qpemessagebox.h \ | 39 | qpemessagebox.h \ |
40 | timeconversion.h \ | 40 | timeconversion.h \ |
41 | qpedebug.h \ | 41 | qpedebug.h \ |
42 | qpemenubar.h \ | 42 | qpemenubar.h \ |
43 | qpetoolbar.h \ | 43 | qpetoolbar.h \ |
44 | backend/categories.h \ | 44 | backend/categories.h \ |
45 | stringutil.h \ | 45 | stringutil.h \ |
46 | backend/palmtoprecord.h \ | 46 | backend/palmtoprecord.h \ |
47 | backend/task.h \ | 47 | backend/task.h \ |
48 | backend/event.h \ | 48 | backend/event.h \ |
49 | backend/contact.h\ | 49 | backend/contact.h\ |
50 | categorymenu.h \ | 50 | categorymenu.h \ |
51 | categoryedit_p.h \ | 51 | categoryedit_p.h \ |
52 | categoryselect.h \ | 52 | categoryselect.h \ |
53 | categorywidget.h \ | 53 | categorywidget.h \ |
54 | ir.h \ | 54 | ir.h \ |
55 | backend/vobject_p.h \ | 55 | backend/vobject_p.h \ |
56 | findwidget_p.h \ | 56 | findwidget_p.h \ |
57 | finddialog.h \ | 57 | finddialog.h \ |
58 | lnkproperties.h \ | 58 | lnkproperties.h \ |
59 | windowdecorationinterface.h \ | 59 | windowdecorationinterface.h \ |
60 | textcodecinterface.h \ | 60 | textcodecinterface.h \ |
61 | imagecodecinterface.h \ | 61 | imagecodecinterface.h \ |
62 | qt_override_p.h \ | 62 | qt_override_p.h \ |
63 | qpeglobal.h | 63 | qpeglobal.h |
64 | 64 | ||
65 | SOURCES= calendar.cpp \ | 65 | SOURCES= calendar.cpp \ |
66 | global.cpp \ | 66 | global.cpp \ |
67 | xmlreader.cpp \ | 67 | xmlreader.cpp \ |
68 | mimetype.cpp \ | 68 | mimetype.cpp \ |
69 | menubutton.cpp \ | 69 | menubutton.cpp \ |
70 | network.cpp \ | 70 | network.cpp \ |
71 | networkinterface.cpp \ | 71 | networkinterface.cpp \ |
72 | filemanager.cpp \ | 72 | filemanager.cpp \ |
73 | fontmanager.cpp \ | 73 | fontmanager.cpp \ |
74 | qdawg.cpp \ | 74 | qdawg.cpp \ |
75 | datebookmonth.cpp \ | 75 | datebookmonth.cpp \ |
76 | fileselector.cpp \ | 76 | fileselector.cpp \ |
77 | imageedit.cpp \ | 77 | imageedit.cpp \ |
78 | resource.cpp \ | 78 | resource.cpp \ |
79 | qpedecoration_qws.cpp \ | 79 | qpedecoration_qws.cpp \ |
80 | qcopenvelope_qws.cpp \ | 80 | qcopenvelope_qws.cpp \ |
81 | qpeapplication.cpp \ | 81 | qpeapplication.cpp \ |
82 | qpestyle.cpp \ | 82 | qpestyle.cpp \ |
83 | qpedialog.cpp \ | 83 | qpedialog.cpp \ |
84 | lightstyle.cpp \ | 84 | lightstyle.cpp \ |
85 | config.cpp \ | 85 | config.cpp \ |
86 | applnk.cpp \ | 86 | applnk.cpp \ |
87 | sound.cpp \ | 87 | sound.cpp \ |
88 | tzselect.cpp \ | 88 | tzselect.cpp \ |
89 | qmath.c \ | 89 | qmath.c \ |
90 | datebookdb.cpp \ | 90 | datebookdb.cpp \ |
91 | alarmserver.cpp \ | 91 | alarmserver.cpp \ |
92 | password.cpp \ | 92 | password.cpp \ |
93 | process.cpp \ | 93 | process.cpp \ |
94 | process_unix.cpp \ | 94 | process_unix.cpp \ |
95 | timestring.cpp \ | 95 | timestring.cpp \ |
96 | fontdatabase.cpp \ | 96 | fontdatabase.cpp \ |
97 | power.cpp \ | 97 | power.cpp \ |
98 | storage.cpp \ | 98 | storage.cpp \ |
99 | qpemessagebox.cpp \ | 99 | qpemessagebox.cpp \ |
100 | backend/timeconversion.cpp \ | 100 | backend/timeconversion.cpp \ |
101 | qpedebug.cpp \ | 101 | qpedebug.cpp \ |
102 | qpemenubar.cpp \ | 102 | qpemenubar.cpp \ |
103 | qpetoolbar.cpp \ | 103 | qpetoolbar.cpp \ |
104 | backend/categories.cpp \ | 104 | backend/categories.cpp \ |
105 | backend/stringutil.cpp \ | 105 | backend/stringutil.cpp \ |
106 | backend/palmtoprecord.cpp \ | 106 | backend/palmtoprecord.cpp \ |
107 | backend/task.cpp \ | 107 | backend/task.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 |
125 | HEADERS += quuid.h qcom.h qlibrary.h qlibrary_p.h | 126 | HEADERS += quuid.h qcom.h qlibrary.h qlibrary_p.h |
126 | SOURCES += quuid.cpp qlibrary.cpp qlibrary_unix.cpp | 127 | SOURCES += quuid.cpp qlibrary.cpp qlibrary_unix.cpp |
127 | INCLUDEPATH += $(OPIEDIR)/include backend | 128 | INCLUDEPATH += $(OPIEDIR)/include backend |
128 | LIBS += -ldl -lcrypt -lm | 129 | LIBS += -ldl -lcrypt -lm |
129 | INTERFACES = passwordbase_p.ui categoryeditbase_p.ui findwidgetbase_p.ui lnkpropertiesbase_p.ui | 130 | INTERFACES = 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 |
133 | 134 | ||
134 | include ( $(OPIEDIR)/include.pro ) | 135 | include ( $(OPIEDIR)/include.pro ) |
135 | 136 | ||
136 | contains( CONFIG, no-override ){ | 137 | contains( CONFIG, no-override ){ |
137 | DEFINES += OPIE_NO_OVERRIDE_QT | 138 | DEFINES += OPIE_NO_OVERRIDE_QT |
138 | } | 139 | } |
139 | 140 | ||
140 | contains( CONFIG, LIBQPE_WITHROHFEEDBACK ){ | 141 | contains( CONFIG, LIBQPE_WITHROHFEEDBACK ){ |
141 | DEFINES += OPIE_WITHROHFEEDBACK | 142 | DEFINES += OPIE_WITHROHFEEDBACK |
142 | SOURCES += backend/rohfeedback.cpp | 143 | SOURCES += backend/rohfeedback.cpp |
143 | HEADERS += backend/rohfeedback.h | 144 | HEADERS += backend/rohfeedback.h |
144 | } | 145 | } |
diff --git a/library/qcom.h b/library/qcom.h index 9972d8f..5703800 100644 --- a/library/qcom.h +++ b/library/qcom.h | |||
@@ -1,171 +1,172 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
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 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} |
41 | #ifndef IID_QUnknown | 42 | #ifndef IID_QUnknown |
42 | #define IID_QUnknown QUuid(0x1d8518cd, 0xe8f5, 0x4366, 0x99, 0xe8, 0x87, 0x9f, 0xd7, 0xe4, 0x82, 0xde) | 43 | #define IID_QUnknown QUuid(0x1d8518cd, 0xe8f5, 0x4366, 0x99, 0xe8, 0x87, 0x9f, 0xd7, 0xe4, 0x82, 0xde) |
43 | #endif | 44 | #endif |
44 | 45 | ||
45 | struct Q_EXPORT QUnknownInterface | 46 | struct Q_EXPORT QUnknownInterface |
46 | { | 47 | { |
47 | virtual QRESULT queryInterface( const QUuid&, QUnknownInterface** ) = 0; | 48 | virtual QRESULT queryInterface( const QUuid&, QUnknownInterface** ) = 0; |
48 | virtual ulong addRef() = 0; | 49 | virtual ulong addRef() = 0; |
49 | virtual ulong release() = 0; | 50 | virtual ulong release() = 0; |
50 | }; | 51 | }; |
51 | 52 | ||
52 | // {D16111D4-E1E7-4C47-8599-24483DAE2E07} | 53 | // {D16111D4-E1E7-4C47-8599-24483DAE2E07} |
53 | #ifndef IID_QLibrary | 54 | #ifndef IID_QLibrary |
54 | #define IID_QLibrary QUuid( 0xd16111d4, 0xe1e7, 0x4c47, 0x85, 0x99, 0x24, 0x48, 0x3d, 0xae, 0x2e, 0x07) | 55 | #define IID_QLibrary QUuid( 0xd16111d4, 0xe1e7, 0x4c47, 0x85, 0x99, 0x24, 0x48, 0x3d, 0xae, 0x2e, 0x07) |
55 | #endif | 56 | #endif |
56 | 57 | ||
57 | struct Q_EXPORT QLibraryInterface : public QUnknownInterface | 58 | struct Q_EXPORT QLibraryInterface : public QUnknownInterface |
58 | { | 59 | { |
59 | virtual bool init() = 0; | 60 | virtual bool init() = 0; |
60 | virtual void cleanup() = 0; | 61 | virtual void cleanup() = 0; |
61 | virtual bool canUnload() const = 0; | 62 | virtual bool canUnload() const = 0; |
62 | }; | 63 | }; |
63 | 64 | ||
64 | #define Q_CREATE_INSTANCE( IMPLEMENTATION ) \ | 65 | #define Q_CREATE_INSTANCE( IMPLEMENTATION ) \ |
65 | IMPLEMENTATION *i = new IMPLEMENTATION; \ | 66 | IMPLEMENTATION *i = new IMPLEMENTATION; \ |
66 | QUnknownInterface* iface = 0; \ | 67 | QUnknownInterface* iface = 0; \ |
67 | i->queryInterface( IID_QUnknown, &iface ); \ | 68 | i->queryInterface( IID_QUnknown, &iface ); \ |
68 | return iface; | 69 | return iface; |
69 | 70 | ||
70 | template <class T> | 71 | template <class T> |
71 | class QInterfacePtr | 72 | class QInterfacePtr |
72 | { | 73 | { |
73 | public: | 74 | public: |
74 | QInterfacePtr():iface(0){} | 75 | QInterfacePtr():iface(0){} |
75 | 76 | ||
76 | QInterfacePtr( T* i) { | 77 | QInterfacePtr( T* i) { |
77 | if ( (iface = i) ) | 78 | if ( (iface = i) ) |
78 | iface->addRef(); | 79 | iface->addRef(); |
79 | } | 80 | } |
80 | 81 | ||
81 | QInterfacePtr(const QInterfacePtr<T> &p) { | 82 | QInterfacePtr(const QInterfacePtr<T> &p) { |
82 | if ( (iface = p.iface) ) | 83 | if ( (iface = p.iface) ) |
83 | iface->addRef(); | 84 | iface->addRef(); |
84 | } | 85 | } |
85 | 86 | ||
86 | ~QInterfacePtr() { | 87 | ~QInterfacePtr() { |
87 | if ( iface ) | 88 | if ( iface ) |
88 | iface->release(); | 89 | iface->release(); |
89 | } | 90 | } |
90 | 91 | ||
91 | QInterfacePtr<T> &operator=(const QInterfacePtr<T> &p) { | 92 | QInterfacePtr<T> &operator=(const QInterfacePtr<T> &p) { |
92 | if ( iface != p.iface ) { | 93 | if ( iface != p.iface ) { |
93 | if ( iface ) | 94 | if ( iface ) |
94 | iface->release(); | 95 | iface->release(); |
95 | if ( (iface = p.iface) ) | 96 | if ( (iface = p.iface) ) |
96 | iface->addRef(); | 97 | iface->addRef(); |
97 | } | 98 | } |
98 | return *this; | 99 | return *this; |
99 | } | 100 | } |
100 | 101 | ||
101 | QInterfacePtr<T> &operator=(T* i) { | 102 | QInterfacePtr<T> &operator=(T* i) { |
102 | if (iface != i ) { | 103 | if (iface != i ) { |
103 | if ( iface ) | 104 | if ( iface ) |
104 | iface->release(); | 105 | iface->release(); |
105 | if ( (iface = i) ) | 106 | if ( (iface = i) ) |
106 | iface->addRef(); | 107 | iface->addRef(); |
107 | } | 108 | } |
108 | return *this; | 109 | return *this; |
109 | } | 110 | } |
110 | 111 | ||
111 | bool operator==( const QInterfacePtr<T> &p ) const { return iface == p.iface; } | 112 | bool operator==( const QInterfacePtr<T> &p ) const { return iface == p.iface; } |
112 | 113 | ||
113 | bool operator!= ( const QInterfacePtr<T>& p ) const { return !( *this == p ); } | 114 | bool operator!= ( const QInterfacePtr<T>& p ) const { return !( *this == p ); } |
114 | 115 | ||
115 | bool isNull() const { return !iface; } | 116 | bool isNull() const { return !iface; } |
116 | 117 | ||
117 | T* operator->() const { return iface; } | 118 | T* operator->() const { return iface; } |
118 | 119 | ||
119 | T& operator*() const { return *iface; } | 120 | T& operator*() const { return *iface; } |
120 | 121 | ||
121 | operator T*() const { return iface; } | 122 | operator T*() const { return iface; } |
122 | 123 | ||
123 | QUnknownInterface** operator &() const { | 124 | QUnknownInterface** operator &() const { |
124 | if( iface ) | 125 | if( iface ) |
125 | iface->release(); | 126 | iface->release(); |
126 | return (QUnknownInterface**)&iface; | 127 | return (QUnknownInterface**)&iface; |
127 | } | 128 | } |
128 | 129 | ||
129 | T** operator &() { | 130 | T** operator &() { |
130 | if ( iface ) | 131 | if ( iface ) |
131 | iface->release(); | 132 | iface->release(); |
132 | return &iface; | 133 | return &iface; |
133 | } | 134 | } |
134 | 135 | ||
135 | private: | 136 | private: |
136 | T* iface; | 137 | T* iface; |
137 | }; | 138 | }; |
138 | 139 | ||
139 | 140 | ||
140 | // internal class that wraps an initialized ulong | 141 | // internal class that wraps an initialized ulong |
141 | struct Q_EXPORT QtULong | 142 | 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 \ |
157 | private: \ | 158 | private: \ |
158 | QtULong qtrefcount; \ | 159 | QtULong qtrefcount; \ |
159 | public: \ | 160 | public: \ |
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 | ||
165 | struct Q_EXPORT QUnknownInterface | 166 | struct Q_EXPORT QUnknownInterface |
166 | { | 167 | { |
167 | }; | 168 | }; |
168 | 169 | ||
169 | #endif // QT_NO_COMPONENT | 170 | #endif // QT_NO_COMPONENT |
170 | 171 | ||
171 | #endif // QCOM_H | 172 | #endif // QCOM_H |
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp index 4adfc8f..43a9be5 100644 --- a/library/qpeapplication.cpp +++ b/library/qpeapplication.cpp | |||
@@ -1,505 +1,505 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
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 | #define QTOPIA_INTERNAL_LANGLIST | 20 | #define QTOPIA_INTERNAL_LANGLIST |
21 | #include <stdlib.h> | 21 | #include <stdlib.h> |
22 | #include <unistd.h> | 22 | #include <unistd.h> |
23 | #ifndef Q_OS_MACX | 23 | #ifndef Q_OS_MACX |
24 | #include <linux/limits.h> // needed for some toolchains (PATH_MAX) | 24 | #include <linux/limits.h> // needed for some toolchains (PATH_MAX) |
25 | #endif | 25 | #endif |
26 | #include <qfile.h> | 26 | #include <qfile.h> |
27 | #include <qqueue.h> | 27 | #include <qqueue.h> |
28 | #ifdef Q_WS_QWS | 28 | #ifdef Q_WS_QWS |
29 | #ifndef QT_NO_COP | 29 | #ifndef QT_NO_COP |
30 | #if QT_VERSION <= 231 | 30 | #if QT_VERSION <= 231 |
31 | #define private public | 31 | #define private public |
32 | #define sendLocally processEvent | 32 | #define sendLocally processEvent |
33 | #include "qcopenvelope_qws.h" | 33 | #include "qcopenvelope_qws.h" |
34 | #undef private | 34 | #undef private |
35 | #else | 35 | #else |
36 | #include "qcopenvelope_qws.h" | 36 | #include "qcopenvelope_qws.h" |
37 | #endif | 37 | #endif |
38 | #endif | 38 | #endif |
39 | #include <qwindowsystem_qws.h> | 39 | #include <qwindowsystem_qws.h> |
40 | #endif | 40 | #endif |
41 | #include <qtextstream.h> | 41 | #include <qtextstream.h> |
42 | #include <qpalette.h> | 42 | #include <qpalette.h> |
43 | #include <qbuffer.h> | 43 | #include <qbuffer.h> |
44 | #include <qptrdict.h> | 44 | #include <qptrdict.h> |
45 | #include <qregexp.h> | 45 | #include <qregexp.h> |
46 | #include <qdir.h> | 46 | #include <qdir.h> |
47 | #include <qlabel.h> | 47 | #include <qlabel.h> |
48 | #include <qdialog.h> | 48 | #include <qdialog.h> |
49 | #include <qdragobject.h> | 49 | #include <qdragobject.h> |
50 | #include <qtextcodec.h> | 50 | #include <qtextcodec.h> |
51 | #include <qevent.h> | 51 | #include <qevent.h> |
52 | #include <qtooltip.h> | 52 | #include <qtooltip.h> |
53 | #include <qsignal.h> | 53 | #include <qsignal.h> |
54 | #include <qmainwindow.h> | 54 | #include <qmainwindow.h> |
55 | #include <qwidgetlist.h> | 55 | #include <qwidgetlist.h> |
56 | #include <qpixmapcache.h> | 56 | #include <qpixmapcache.h> |
57 | 57 | ||
58 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 58 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
59 | #define QTOPIA_INTERNAL_INITAPP | 59 | #define QTOPIA_INTERNAL_INITAPP |
60 | #include "qpeapplication.h" | 60 | #include "qpeapplication.h" |
61 | #include "qpestyle.h" | 61 | #include "qpestyle.h" |
62 | #include "styleinterface.h" | 62 | #include "styleinterface.h" |
63 | #if QT_VERSION >= 300 | 63 | #if QT_VERSION >= 300 |
64 | #include <qstylefactory.h> | 64 | #include <qstylefactory.h> |
65 | #else | 65 | #else |
66 | #include <qplatinumstyle.h> | 66 | #include <qplatinumstyle.h> |
67 | #include <qwindowsstyle.h> | 67 | #include <qwindowsstyle.h> |
68 | #include <qmotifstyle.h> | 68 | #include <qmotifstyle.h> |
69 | #include <qmotifplusstyle.h> | 69 | #include <qmotifplusstyle.h> |
70 | #include "lightstyle.h" | 70 | #include "lightstyle.h" |
71 | 71 | ||
72 | #include <qpe/qlibrary.h> | 72 | #include <qpe/qlibrary.h> |
73 | #endif | 73 | #endif |
74 | #include "global.h" | 74 | #include "global.h" |
75 | #include "resource.h" | 75 | #include "resource.h" |
76 | #if QT_VERSION <= 230 && defined(QT_NO_CODECS) | 76 | #if QT_VERSION <= 230 && defined(QT_NO_CODECS) |
77 | #include "qutfcodec.h" | 77 | #include "qutfcodec.h" |
78 | #endif | 78 | #endif |
79 | #include "config.h" | 79 | #include "config.h" |
80 | #include "network.h" | 80 | #include "network.h" |
81 | #ifdef QWS | 81 | #ifdef QWS |
82 | #include "fontmanager.h" | 82 | #include "fontmanager.h" |
83 | #include "fontdatabase.h" | 83 | #include "fontdatabase.h" |
84 | #endif | 84 | #endif |
85 | 85 | ||
86 | #include "alarmserver.h" | 86 | #include "alarmserver.h" |
87 | #include "applnk.h" | 87 | #include "applnk.h" |
88 | #include "qpemenubar.h" | 88 | #include "qpemenubar.h" |
89 | #include "textcodecinterface.h" | 89 | #include "textcodecinterface.h" |
90 | #include "imagecodecinterface.h" | 90 | #include "imagecodecinterface.h" |
91 | #include <qtopia/qpeglobal.h> | 91 | #include <qtopia/qpeglobal.h> |
92 | 92 | ||
93 | #include <unistd.h> | 93 | #include <unistd.h> |
94 | #include <sys/file.h> | 94 | #include <sys/file.h> |
95 | #include <sys/ioctl.h> | 95 | #include <sys/ioctl.h> |
96 | #ifndef QT_NO_SOUND | 96 | #ifndef QT_NO_SOUND |
97 | #include <sys/soundcard.h> | 97 | #include <sys/soundcard.h> |
98 | #endif | 98 | #endif |
99 | #include "qt_override_p.h" | 99 | #include "qt_override_p.h" |
100 | 100 | ||
101 | #include <backend/rohfeedback.h> | 101 | #include <backend/rohfeedback.h> |
102 | 102 | ||
103 | 103 | ||
104 | static bool useBigPixmaps = 0; | 104 | static bool useBigPixmaps = 0; |
105 | 105 | ||
106 | class HackWidget : public QWidget | 106 | class HackWidget : public QWidget |
107 | { | 107 | { |
108 | public: | 108 | public: |
109 | bool needsOk() | 109 | bool needsOk() |
110 | { return (getWState() & WState_Reserved1 ); } | 110 | { return (getWState() & WState_Reserved1 ); } |
111 | 111 | ||
112 | QRect normalGeometry() | 112 | QRect normalGeometry() |
113 | { return topData()->normalGeometry; }; | 113 | { return topData()->normalGeometry; }; |
114 | }; | 114 | }; |
115 | 115 | ||
116 | class QPEApplicationData | 116 | class QPEApplicationData |
117 | { | 117 | { |
118 | public: | 118 | public: |
119 | QPEApplicationData ( ) : | 119 | QPEApplicationData ( ) : |
120 | presstimer( 0 ), presswidget( 0 ), rightpressed( false ), kbgrabbed( false ), | 120 | presstimer( 0 ), presswidget( 0 ), rightpressed( false ), kbgrabbed( false ), |
121 | notbusysent( false ), preloaded( false ), forceshow( false ), nomaximize( false ), | 121 | notbusysent( false ), preloaded( false ), forceshow( false ), nomaximize( false ), |
122 | keep_running( true ), qcopQok( false ), | 122 | keep_running( true ), qcopQok( false ), |
123 | fontFamily( "Vera" ), fontSize( 10 ), smallIconSize( 14 ), | 123 | fontFamily( "Vera" ), fontSize( 10 ), smallIconSize( 14 ), |
124 | bigIconSize( 32 ), qpe_main_widget( 0 ) | 124 | bigIconSize( 32 ), qpe_main_widget( 0 ) |
125 | { | 125 | { |
126 | Config cfg( "qpe" ); | 126 | Config cfg( "qpe" ); |
127 | cfg.setGroup( "Appearance" ); | 127 | cfg.setGroup( "Appearance" ); |
128 | useBigPixmaps = cfg.readBoolEntry( "useBigPixmaps", false ); | 128 | useBigPixmaps = cfg.readBoolEntry( "useBigPixmaps", false ); |
129 | fontFamily = cfg.readEntry( "FontFamily", "Vera" ); | 129 | fontFamily = cfg.readEntry( "FontFamily", "Vera" ); |
130 | fontSize = cfg.readNumEntry( "FontSize", 10 ); | 130 | fontSize = cfg.readNumEntry( "FontSize", 10 ); |
131 | smallIconSize = cfg.readNumEntry( "SmallIconSize", 14 ); | 131 | smallIconSize = cfg.readNumEntry( "SmallIconSize", 14 ); |
132 | bigIconSize = cfg.readNumEntry( "BigIconSize", 32 ); | 132 | bigIconSize = cfg.readNumEntry( "BigIconSize", 32 ); |
133 | #ifdef OPIE_WITHROHFEEDBACK | 133 | #ifdef OPIE_WITHROHFEEDBACK |
134 | RoH = 0; | 134 | RoH = 0; |
135 | #endif | 135 | #endif |
136 | } | 136 | } |
137 | 137 | ||
138 | int presstimer; | 138 | int presstimer; |
139 | QWidget* presswidget; | 139 | QWidget* presswidget; |
140 | QPoint presspos; | 140 | QPoint presspos; |
141 | #ifdef OPIE_WITHROHFEEDBACK | 141 | #ifdef OPIE_WITHROHFEEDBACK |
142 | Opie::Internal::RoHFeedback *RoH; | 142 | Opie::Internal::RoHFeedback *RoH; |
143 | #endif | 143 | #endif |
144 | 144 | ||
145 | bool rightpressed : 1; | 145 | bool rightpressed : 1; |
146 | bool kbgrabbed : 1; | 146 | bool kbgrabbed : 1; |
147 | bool notbusysent : 1; | 147 | bool notbusysent : 1; |
148 | bool preloaded : 1; | 148 | bool preloaded : 1; |
149 | bool forceshow : 1; | 149 | bool forceshow : 1; |
150 | bool nomaximize : 1; | 150 | bool nomaximize : 1; |
151 | bool keep_running : 1; | 151 | bool keep_running : 1; |
152 | bool qcopQok : 1; | 152 | bool qcopQok : 1; |
153 | 153 | ||
154 | QCString fontFamily; | 154 | QCString fontFamily; |
155 | int fontSize; | 155 | int fontSize; |
156 | int smallIconSize; | 156 | int smallIconSize; |
157 | int bigIconSize; | 157 | int bigIconSize; |
158 | 158 | ||
159 | QString appName; | 159 | QString appName; |
160 | struct QCopRec | 160 | struct QCopRec |
161 | { | 161 | { |
162 | QCopRec( const QCString &ch, const QCString &msg, | 162 | QCopRec( const QCString &ch, const QCString &msg, |
163 | const QByteArray &d ) : | 163 | const QByteArray &d ) : |
164 | channel( ch ), message( msg ), data( d ) | 164 | channel( ch ), message( msg ), data( d ) |
165 | { } | 165 | { } |
166 | 166 | ||
167 | QCString channel; | 167 | QCString channel; |
168 | QCString message; | 168 | QCString message; |
169 | QByteArray data; | 169 | QByteArray data; |
170 | }; | 170 | }; |
171 | QWidget* qpe_main_widget; | 171 | QWidget* qpe_main_widget; |
172 | QGuardedPtr<QWidget> lastraised; | 172 | QGuardedPtr<QWidget> lastraised; |
173 | QQueue<QCopRec> qcopq; | 173 | QQueue<QCopRec> qcopq; |
174 | QString styleName; | 174 | QString styleName; |
175 | QString decorationName; | 175 | QString decorationName; |
176 | 176 | ||
177 | void enqueueQCop( const QCString &ch, const QCString &msg, | 177 | void enqueueQCop( const QCString &ch, const QCString &msg, |
178 | const QByteArray &data ) | 178 | const QByteArray &data ) |
179 | { | 179 | { |
180 | qcopq.enqueue( new QCopRec( ch, msg, data ) ); | 180 | qcopq.enqueue( new QCopRec( ch, msg, data ) ); |
181 | } | 181 | } |
182 | void sendQCopQ() | 182 | void sendQCopQ() |
183 | { | 183 | { |
184 | if (!qcopQok ) | 184 | if (!qcopQok ) |
185 | return; | 185 | return; |
186 | 186 | ||
187 | QCopRec * r; | 187 | QCopRec * r; |
188 | 188 | ||
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 ); |
262 | QStringList l = QStringList::split(",", str); | 262 | QStringList l = QStringList::split(",", str); |
263 | 263 | ||
264 | if ( l.count() == 5) { | 264 | if ( l.count() == 5) { |
265 | p.setX( l[0].toInt() ); | 265 | p.setX( l[0].toInt() ); |
266 | p.setY( l[1].toInt() ); | 266 | p.setY( l[1].toInt() ); |
267 | 267 | ||
268 | s.setWidth( l[2].toInt() ); | 268 | s.setWidth( l[2].toInt() ); |
269 | s.setHeight( l[3].toInt() ); | 269 | s.setHeight( l[3].toInt() ); |
270 | 270 | ||
271 | maximized = l[4].toInt(); | 271 | maximized = l[4].toInt(); |
272 | 272 | ||
273 | return TRUE; | 273 | return TRUE; |
274 | } | 274 | } |
275 | 275 | ||
276 | return FALSE; | 276 | return FALSE; |
277 | } | 277 | } |
278 | 278 | ||
279 | 279 | ||
280 | static bool validate_widget_size(const QWidget *w, QPoint &p, QSize &s) | 280 | static bool validate_widget_size(const QWidget *w, QPoint &p, QSize &s) |
281 | { | 281 | { |
282 | #ifndef Q_WS_QWS | 282 | #ifndef Q_WS_QWS |
283 | QRect qt_maxWindowRect = qApp->desktop()->geometry(); | 283 | QRect qt_maxWindowRect = qApp->desktop()->geometry(); |
284 | #endif | 284 | #endif |
285 | int maxX = qt_maxWindowRect.width(); | 285 | int maxX = qt_maxWindowRect.width(); |
286 | int maxY = qt_maxWindowRect.height(); | 286 | int maxY = qt_maxWindowRect.height(); |
287 | int wWidth = s.width() + ( w->frameGeometry().width() - w->geometry().width() ); | 287 | int wWidth = s.width() + ( w->frameGeometry().width() - w->geometry().width() ); |
288 | int wHeight = s.height() + ( w->frameGeometry().height() - w->geometry().height() ); | 288 | int wHeight = s.height() + ( w->frameGeometry().height() - w->geometry().height() ); |
289 | 289 | ||
290 | // total window size is not allowed to be larger than desktop window size | 290 | // total window size is not allowed to be larger than desktop window size |
291 | if ( ( wWidth >= maxX ) && ( wHeight >= maxY ) ) | 291 | if ( ( wWidth >= maxX ) && ( wHeight >= maxY ) ) |
292 | return FALSE; | 292 | return FALSE; |
293 | 293 | ||
294 | if ( wWidth > maxX ) { | 294 | if ( wWidth > maxX ) { |
295 | s.setWidth( maxX - (w->frameGeometry().width() - w->geometry().width() ) ); | 295 | s.setWidth( maxX - (w->frameGeometry().width() - w->geometry().width() ) ); |
296 | wWidth = maxX; | 296 | wWidth = maxX; |
297 | } | 297 | } |
298 | 298 | ||
299 | if ( wHeight > maxY ) { | 299 | if ( wHeight > maxY ) { |
300 | s.setHeight( maxY - (w->frameGeometry().height() - w->geometry().height() ) ); | 300 | s.setHeight( maxY - (w->frameGeometry().height() - w->geometry().height() ) ); |
301 | wHeight = maxY; | 301 | wHeight = maxY; |
302 | } | 302 | } |
303 | 303 | ||
304 | // any smaller than this and the maximize/close/help buttons will be overlapping | 304 | // any smaller than this and the maximize/close/help buttons will be overlapping |
305 | if ( wWidth < 80 || wHeight < 60 ) | 305 | if ( wWidth < 80 || wHeight < 60 ) |
306 | return FALSE; | 306 | return FALSE; |
307 | 307 | ||
308 | if ( p.x() < 0 ) | 308 | if ( p.x() < 0 ) |
309 | p.setX(0); | 309 | p.setX(0); |
310 | if ( p.y() < 0 ) | 310 | if ( p.y() < 0 ) |
311 | p.setY(0); | 311 | p.setY(0); |
312 | 312 | ||
313 | if ( p.x() + wWidth > maxX ) | 313 | if ( p.x() + wWidth > maxX ) |
314 | p.setX( maxX - wWidth ); | 314 | p.setX( maxX - wWidth ); |
315 | if ( p.y() + wHeight > maxY ) | 315 | if ( p.y() + wHeight > maxY ) |
316 | p.setY( maxY - wHeight ); | 316 | p.setY( maxY - wHeight ); |
317 | 317 | ||
318 | return TRUE; | 318 | return TRUE; |
319 | } | 319 | } |
320 | 320 | ||
321 | static void store_widget_rect(QWidget *w, QString &app) | 321 | static void store_widget_rect(QWidget *w, QString &app) |
322 | { | 322 | { |
323 | // 350 is the trigger in qwsdefaultdecoration for providing a resize button | 323 | // 350 is the trigger in qwsdefaultdecoration for providing a resize button |
324 | if ( qApp->desktop()->width() <= 350 ) | 324 | if ( qApp->desktop()->width() <= 350 ) |
325 | return; | 325 | return; |
326 | // we use these to map the offset of geometry and pos. ( we can only use normalGeometry to | 326 | // we use these to map the offset of geometry and pos. ( we can only use normalGeometry to |
327 | // get the non-maximized version, so we have to do it the hard way ) | 327 | // get the non-maximized version, so we have to do it the hard way ) |
328 | int offsetX = w->x() - w->geometry().left(); | 328 | int offsetX = w->x() - w->geometry().left(); |
329 | int offsetY = w->y() - w->geometry().top(); | 329 | int offsetY = w->y() - w->geometry().top(); |
330 | 330 | ||
331 | QRect r; | 331 | QRect r; |
332 | if ( w->isMaximized() ) | 332 | if ( w->isMaximized() ) |
333 | r = ( (HackWidget *) w)->normalGeometry(); | 333 | r = ( (HackWidget *) w)->normalGeometry(); |
334 | else | 334 | else |
335 | r = w->geometry(); | 335 | r = w->geometry(); |
336 | 336 | ||
337 | // Stores the window placement as pos(), size() (due to the offset mapping) | 337 | // Stores the window placement as pos(), size() (due to the offset mapping) |
338 | Config cfg( "qpe" ); | 338 | Config cfg( "qpe" ); |
339 | cfg.setGroup("ApplicationPositions"); | 339 | cfg.setGroup("ApplicationPositions"); |
340 | QString s; | 340 | QString s; |
341 | s.sprintf("%d,%d,%d,%d,%d", r.left() + offsetX, r.top() + offsetY, r.width(), r.height(), w->isMaximized() ); | 341 | s.sprintf("%d,%d,%d,%d,%d", r.left() + offsetX, r.top() + offsetY, r.width(), r.height(), w->isMaximized() ); |
342 | cfg.writeEntry( app, s ); | 342 | cfg.writeEntry( app, s ); |
343 | } | 343 | } |
344 | 344 | ||
345 | static bool setWidgetCaptionFromAppName( QWidget* /*mw*/, const QString& /*appName*/, const QString& /*appsPath*/ ) | 345 | static bool setWidgetCaptionFromAppName( QWidget* /*mw*/, const QString& /*appName*/, const QString& /*appsPath*/ ) |
346 | { | 346 | { |
347 | /* | 347 | /* |
348 | // This works but disable it for now until it is safe to apply | 348 | // This works but disable it for now until it is safe to apply |
349 | // What is does is scan the .desktop files of all the apps for | 349 | // What is does is scan the .desktop files of all the apps for |
350 | // the applnk that has the corresponding argv[0] as this program | 350 | // the applnk that has the corresponding argv[0] as this program |
351 | // then it uses the name stored in the .desktop file as the caption | 351 | // then it uses the name stored in the .desktop file as the caption |
352 | // for the main widget. This saves duplicating translations for | 352 | // for the main widget. This saves duplicating translations for |
353 | // the app name in the program and in the .desktop files. | 353 | // the app name in the program and in the .desktop files. |
354 | 354 | ||
355 | AppLnkSet apps( appsPath ); | 355 | AppLnkSet apps( appsPath ); |
356 | 356 | ||
357 | QList<AppLnk> appsList = apps.children(); | 357 | QList<AppLnk> appsList = apps.children(); |
358 | for ( QListIterator<AppLnk> it(appsList); it.current(); ++it ) { | 358 | for ( QListIterator<AppLnk> it(appsList); it.current(); ++it ) { |
359 | if ( (*it)->exec() == appName ) { | 359 | if ( (*it)->exec() == appName ) { |
360 | mw->setCaption( (*it)->name() ); | 360 | mw->setCaption( (*it)->name() ); |
361 | return TRUE; | 361 | return TRUE; |
362 | } | 362 | } |
363 | } | 363 | } |
364 | */ | 364 | */ |
365 | return FALSE; | 365 | return FALSE; |
366 | } | 366 | } |
367 | 367 | ||
368 | 368 | ||
369 | void show(QWidget* mw, bool nomax) | 369 | void show(QWidget* mw, bool nomax) |
370 | { | 370 | { |
371 | setWidgetCaptionFromAppName( mw, appName, QPEApplication::qpeDir() + "apps" ); | 371 | setWidgetCaptionFromAppName( mw, appName, QPEApplication::qpeDir() + "apps" ); |
372 | nomaximize = nomax; | 372 | nomaximize = nomax; |
373 | qpe_main_widget = mw; | 373 | qpe_main_widget = mw; |
374 | qcopQok = TRUE; | 374 | qcopQok = TRUE; |
375 | #ifndef QT_NO_COP | 375 | #ifndef QT_NO_COP |
376 | 376 | ||
377 | sendQCopQ(); | 377 | sendQCopQ(); |
378 | #endif | 378 | #endif |
379 | 379 | ||
380 | if ( preloaded ) { | 380 | if ( preloaded ) { |
381 | if (forceshow) | 381 | if (forceshow) |
382 | show_mx(mw, nomax, appName); | 382 | show_mx(mw, nomax, appName); |
383 | } | 383 | } |
384 | else if ( keep_running ) { | 384 | else if ( keep_running ) { |
385 | show_mx(mw, nomax, appName); | 385 | show_mx(mw, nomax, appName); |
386 | } | 386 | } |
387 | } | 387 | } |
388 | 388 | ||
389 | void loadTextCodecs() | 389 | void loadTextCodecs() |
390 | { | 390 | { |
391 | QString path = QPEApplication::qpeDir() + "plugins/textcodecs"; | 391 | QString path = QPEApplication::qpeDir() + "plugins/textcodecs"; |
392 | #ifdef Q_OS_MACX | 392 | #ifdef Q_OS_MACX |
393 | QDir dir( path, "lib*.dylib" ); | 393 | QDir dir( path, "lib*.dylib" ); |
394 | #else | 394 | #else |
395 | QDir dir( path, "lib*.so" ); | 395 | QDir dir( path, "lib*.so" ); |
396 | #endif | 396 | #endif |
397 | QStringList list; | 397 | QStringList list; |
398 | if ( dir. exists ( )) | 398 | if ( dir. exists ( )) |
399 | list = dir.entryList(); | 399 | list = dir.entryList(); |
400 | QStringList::Iterator it; | 400 | QStringList::Iterator it; |
401 | for ( it = list.begin(); it != list.end(); ++it ) { | 401 | for ( it = list.begin(); it != list.end(); ++it ) { |
402 | TextCodecInterface *iface = 0; | 402 | TextCodecInterface *iface = 0; |
403 | QLibrary *lib = new QLibrary( path + "/" + *it ); | 403 | QLibrary *lib = new QLibrary( path + "/" + *it ); |
404 | if ( lib->queryInterface( IID_QtopiaTextCodec, (QUnknownInterface**)&iface ) == QS_OK && iface ) { | 404 | if ( lib->queryInterface( IID_QtopiaTextCodec, (QUnknownInterface**)&iface ) == QS_OK && iface ) { |
405 | QValueList<int> mibs = iface->mibEnums(); | 405 | QValueList<int> mibs = iface->mibEnums(); |
406 | for (QValueList<int>::ConstIterator i = mibs.begin(); i != mibs.end(); ++i) { | 406 | for (QValueList<int>::ConstIterator i = mibs.begin(); i != mibs.end(); ++i) { |
407 | (void)iface->createForMib(*i); | 407 | (void)iface->createForMib(*i); |
408 | // ### it exists now; need to remember if we can delete it | 408 | // ### it exists now; need to remember if we can delete it |
409 | } | 409 | } |
410 | } | 410 | } |
411 | else { | 411 | else { |
412 | lib->unload(); | 412 | lib->unload(); |
413 | delete lib; | 413 | delete lib; |
414 | } | 414 | } |
415 | } | 415 | } |
416 | } | 416 | } |
417 | 417 | ||
418 | void loadImageCodecs() | 418 | void loadImageCodecs() |
419 | { | 419 | { |
420 | QString path = QPEApplication::qpeDir() + "plugins/imagecodecs"; | 420 | QString path = QPEApplication::qpeDir() + "plugins/imagecodecs"; |
421 | #ifdef Q_OS_MACX | 421 | #ifdef Q_OS_MACX |
422 | QDir dir( path, "lib*.dylib" ); | 422 | QDir dir( path, "lib*.dylib" ); |
423 | #else | 423 | #else |
424 | QDir dir( path, "lib*.so" ); | 424 | QDir dir( path, "lib*.so" ); |
425 | #endif | 425 | #endif |
426 | QStringList list; | 426 | QStringList list; |
427 | if ( dir. exists ( )) | 427 | if ( dir. exists ( )) |
428 | list = dir.entryList(); | 428 | list = dir.entryList(); |
429 | QStringList::Iterator it; | 429 | QStringList::Iterator it; |
430 | for ( it = list.begin(); it != list.end(); ++it ) { | 430 | for ( it = list.begin(); it != list.end(); ++it ) { |
431 | ImageCodecInterface *iface = 0; | 431 | ImageCodecInterface *iface = 0; |
432 | QLibrary *lib = new QLibrary( path + "/" + *it ); | 432 | QLibrary *lib = new QLibrary( path + "/" + *it ); |
433 | if ( lib->queryInterface( IID_QtopiaImageCodec, (QUnknownInterface**)&iface ) == QS_OK && iface ) { | 433 | if ( lib->queryInterface( IID_QtopiaImageCodec, (QUnknownInterface**)&iface ) == QS_OK && iface ) { |
434 | QStringList formats = iface->keys(); | 434 | QStringList formats = iface->keys(); |
435 | for (QStringList::ConstIterator i = formats.begin(); i != formats.end(); ++i) { | 435 | for (QStringList::ConstIterator i = formats.begin(); i != formats.end(); ++i) { |
436 | (void)iface->installIOHandler(*i); | 436 | (void)iface->installIOHandler(*i); |
437 | // ### it exists now; need to remember if we can delete it | 437 | // ### it exists now; need to remember if we can delete it |
438 | } | 438 | } |
439 | } | 439 | } |
440 | else { | 440 | else { |
441 | lib->unload(); | 441 | lib->unload(); |
442 | delete lib; | 442 | delete lib; |
443 | } | 443 | } |
444 | } | 444 | } |
445 | } | 445 | } |
446 | 446 | ||
447 | }; | 447 | }; |
448 | 448 | ||
449 | class ResourceMimeFactory : public QMimeSourceFactory | 449 | class ResourceMimeFactory : public QMimeSourceFactory |
450 | { | 450 | { |
451 | public: | 451 | public: |
452 | ResourceMimeFactory() : resImage( 0 ) | 452 | ResourceMimeFactory() : resImage( 0 ) |
453 | { | 453 | { |
454 | setFilePath( Global::helpPath() ); | 454 | setFilePath( Global::helpPath() ); |
455 | setExtensionType( "html", "text/html;charset=UTF-8" ); | 455 | setExtensionType( "html", "text/html;charset=UTF-8" ); |
456 | } | 456 | } |
457 | ~ResourceMimeFactory() { | 457 | ~ResourceMimeFactory() { |
458 | delete resImage; | 458 | delete resImage; |
459 | } | 459 | } |
460 | 460 | ||
461 | const QMimeSource* data( const QString& abs_name ) const | 461 | const QMimeSource* data( const QString& abs_name ) const |
462 | { | 462 | { |
463 | const QMimeSource * r = QMimeSourceFactory::data( abs_name ); | 463 | const QMimeSource * r = QMimeSourceFactory::data( abs_name ); |
464 | if ( !r ) { | 464 | if ( !r ) { |
465 | int sl = abs_name.length(); | 465 | int sl = abs_name.length(); |
466 | do { | 466 | do { |
467 | sl = abs_name.findRev( '/', sl - 1 ); | 467 | sl = abs_name.findRev( '/', sl - 1 ); |
468 | QString name = sl >= 0 ? abs_name.mid( sl + 1 ) : abs_name; | 468 | QString name = sl >= 0 ? abs_name.mid( sl + 1 ) : abs_name; |
469 | int dot = name.findRev( '.' ); | 469 | int dot = name.findRev( '.' ); |
470 | if ( dot >= 0 ) | 470 | if ( dot >= 0 ) |
471 | name = name.left( dot ); | 471 | name = name.left( dot ); |
472 | QImage img = Resource::loadImage( name ); | 472 | QImage img = Resource::loadImage( name ); |
473 | if ( !img.isNull() ) { | 473 | if ( !img.isNull() ) { |
474 | delete resImage; | 474 | delete resImage; |
475 | resImage = new QImageDrag( img ); | 475 | resImage = new QImageDrag( img ); |
476 | r = resImage; | 476 | r = resImage; |
477 | } | 477 | } |
478 | } | 478 | } |
479 | while ( !r && sl > 0 ); | 479 | while ( !r && sl > 0 ); |
480 | } | 480 | } |
481 | return r; | 481 | return r; |
482 | } | 482 | } |
483 | private: | 483 | private: |
484 | mutable QImageDrag *resImage; | 484 | mutable QImageDrag *resImage; |
485 | }; | 485 | }; |
486 | 486 | ||
487 | static int& hack(int& i) | 487 | static int& hack(int& i) |
488 | { | 488 | { |
489 | #if QT_VERSION <= 230 && defined(QT_NO_CODECS) | 489 | #if QT_VERSION <= 230 && defined(QT_NO_CODECS) |
490 | // These should be created, but aren't in Qt 2.3.0 | 490 | // These should be created, but aren't in Qt 2.3.0 |
491 | (void)new QUtf8Codec; | 491 | (void)new QUtf8Codec; |
492 | (void)new QUtf16Codec; | 492 | (void)new QUtf16Codec; |
493 | #endif | 493 | #endif |
494 | return i; | 494 | return i; |
495 | } | 495 | } |
496 | 496 | ||
497 | static int muted = 0; | 497 | static int muted = 0; |
498 | static int micMuted = 0; | 498 | static int micMuted = 0; |
499 | 499 | ||
500 | static void setVolume( int t = 0, int percent = -1 ) | 500 | static void setVolume( int t = 0, int percent = -1 ) |
501 | { | 501 | { |
502 | switch ( t ) { | 502 | switch ( t ) { |
503 | case 0: { | 503 | case 0: { |
504 | Config cfg( "qpe" ); | 504 | Config cfg( "qpe" ); |
505 | cfg.setGroup( "Volume" ); | 505 | cfg.setGroup( "Volume" ); |
diff --git a/library/qpeapplication.h b/library/qpeapplication.h index 579fc44..00d3d31 100644 --- a/library/qpeapplication.h +++ b/library/qpeapplication.h | |||
@@ -1,265 +1,231 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
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 | #ifndef __QPE_APPLICATION_H__ | 20 | #ifndef __QPE_APPLICATION_H__ |
21 | #define __QPE_APPLICATION_H__ | 21 | #define __QPE_APPLICATION_H__ |
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 | ||
35 | class QCopChannel; | 36 | class QCopChannel; |
36 | class QPEApplicationData; | 37 | class QPEApplicationData; |
37 | class QWSEvent; | 38 | class QWSEvent; |
38 | class QWSKeyEvent; | 39 | class 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 |
46 | style changes, quits and raises, and in the | 47 | style changes, quits and raises, and in the |
47 | case of \link docwidget.html document-oriented\endlink applications, | 48 | case of \link docwidget.html document-oriented\endlink applications, |
48 | changes the currently displayed document in response to the environment. | 49 | changes the currently displayed document in response to the environment. |
49 | 50 | ||
50 | To create a \link docwidget.html document-oriented\endlink | 51 | To create a \link docwidget.html document-oriented\endlink |
51 | application use showMainDocumentWidget(); to create a | 52 | application use showMainDocumentWidget(); to create a |
52 | non-document-oriented application use showMainWidget(). The | 53 | non-document-oriented application use showMainWidget(). The |
53 | keepRunning() function indicates whether the application will | 54 | keepRunning() function indicates whether the application will |
54 | continue running after it's processed the last \link qcop.html | 55 | continue running after it's processed the last \link qcop.html |
55 | QCop\endlink message. This can be changed using setKeepRunning(). | 56 | QCop\endlink message. This can be changed using setKeepRunning(). |
56 | 57 | ||
57 | A variety of signals are emitted when certain events occur, for | 58 | A variety of signals are emitted when certain events occur, for |
58 | example, timeChanged(), clockChanged(), weekChanged(), | 59 | example, timeChanged(), clockChanged(), weekChanged(), |
59 | dateFormatChanged() and volumeChanged(). If the application receives | 60 | dateFormatChanged() and volumeChanged(). If the application receives |
60 | a \link qcop.html QCop\endlink message on the application's | 61 | a \link qcop.html QCop\endlink message on the application's |
61 | QPE/Application/\e{appname} channel, the appMessage() signal is | 62 | QPE/Application/\e{appname} channel, the appMessage() signal is |
62 | emitted. There are also flush() and reload() signals, which | 63 | emitted. There are also flush() and reload() signals, which |
63 | are emitted when synching begins and ends respectively - upon these | 64 | are emitted when synching begins and ends respectively - upon these |
64 | signals, the application should save and reload any data | 65 | signals, the application should save and reload any data |
65 | files that are involved in synching. Most of these signals will initially | 66 | files that are involved in synching. Most of these signals will initially |
66 | be received and unfiltered through the appMessage() signal. | 67 | be received and unfiltered through the appMessage() signal. |
67 | 68 | ||
68 | This class also provides a set of useful static functions. The | 69 | This class also provides a set of useful static functions. The |
69 | qpeDir() and documentDir() functions return the respective paths. | 70 | qpeDir() and documentDir() functions return the respective paths. |
70 | The grabKeyboard() and ungrabKeyboard() functions are used to | 71 | The grabKeyboard() and ungrabKeyboard() functions are used to |
71 | control whether the application takes control of the device's | 72 | control whether the application takes control of the device's |
72 | physical buttons (e.g. application launch keys). The stylus' mode of | 73 | physical buttons (e.g. application launch keys). The stylus' mode of |
73 | operation is set with setStylusOperation() and retrieved with | 74 | operation is set with setStylusOperation() and retrieved with |
74 | stylusOperation(). There are also setInputMethodHint() and | 75 | stylusOperation(). There are also setInputMethodHint() and |
75 | inputMethodHint() functions. | 76 | inputMethodHint() functions. |
76 | 77 | ||
77 | \ingroup qtopiaemb | 78 | \ingroup qtopiaemb |
78 | */ | 79 | */ |
79 | class QPEApplication : public QApplication | 80 | class QPEApplication : public QApplication |
80 | { | 81 | { |
81 | Q_OBJECT | 82 | Q_OBJECT |
82 | public: | 83 | public: |
83 | QPEApplication( int& argc, char **argv, Type=GuiClient ); | 84 | QPEApplication( int& argc, char **argv, Type=GuiClient ); |
84 | ~QPEApplication(); | 85 | ~QPEApplication(); |
85 | 86 | ||
86 | static QString qpeDir(); | 87 | static QString qpeDir(); |
87 | static QString documentDir(); | 88 | static QString documentDir(); |
88 | void applyStyle(); | 89 | void applyStyle(); |
89 | void reset(); | 90 | void reset(); |
90 | static int defaultRotation(); | 91 | static int defaultRotation(); |
91 | static void setDefaultRotation(int r); | 92 | static void setDefaultRotation(int r); |
92 | static void setCurrentRotation(int r); | 93 | static void setCurrentRotation(int r); |
93 | static void setCurrentMode(int x, int y, int depth ); | 94 | static void setCurrentMode(int x, int y, int depth ); |
94 | static void grabKeyboard(); | 95 | static void grabKeyboard(); |
95 | static void ungrabKeyboard(); | 96 | static void ungrabKeyboard(); |
96 | 97 | ||
97 | enum StylusMode { | 98 | enum StylusMode { |
98 | LeftOnly, | 99 | LeftOnly, |
99 | RightOnHold | 100 | RightOnHold |
100 | // RightOnHoldLeftDelayed, etc. | 101 | // RightOnHoldLeftDelayed, etc. |
101 | }; | 102 | }; |
102 | static void setStylusOperation( QWidget*, StylusMode ); | 103 | static void setStylusOperation( QWidget*, StylusMode ); |
103 | static StylusMode stylusOperation( QWidget* ); | 104 | static StylusMode stylusOperation( QWidget* ); |
104 | 105 | ||
105 | enum InputMethodHint { | 106 | enum InputMethodHint { |
106 | Normal, | 107 | Normal, |
107 | AlwaysOff, | 108 | AlwaysOff, |
108 | AlwaysOn | 109 | AlwaysOn |
109 | }; | 110 | }; |
110 | 111 | ||
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 | ||
138 | signals: | 140 | signals: |
139 | void clientMoused(); | 141 | void clientMoused(); |
140 | void timeChanged(); | 142 | void timeChanged(); |
141 | void clockChanged( bool pm ); | 143 | void clockChanged( bool pm ); |
142 | void micChanged( bool muted ); | 144 | void micChanged( bool muted ); |
143 | void volumeChanged( bool muted ); | 145 | void volumeChanged( bool muted ); |
144 | void appMessage( const QCString& msg, const QByteArray& data); | 146 | void appMessage( const QCString& msg, const QByteArray& data); |
145 | void weekChanged( bool startOnMonday ); | 147 | void weekChanged( bool startOnMonday ); |
146 | void dateFormatChanged( DateFormat ); | 148 | void dateFormatChanged( DateFormat ); |
147 | void flush(); | 149 | void flush(); |
148 | void reload(); | 150 | void reload(); |
149 | /* linkChanged signal */ | 151 | /* linkChanged signal */ |
150 | 152 | ||
151 | private slots: | 153 | private slots: |
152 | void systemMessage( const QCString &msg, const QByteArray &data ); | 154 | void systemMessage( const QCString &msg, const QByteArray &data ); |
153 | void pidMessage( const QCString &msg, const QByteArray &data ); | 155 | void pidMessage( const QCString &msg, const QByteArray &data ); |
154 | void removeSenderFromStylusDict(); | 156 | void removeSenderFromStylusDict(); |
155 | void hideOrQuit(); | 157 | void hideOrQuit(); |
156 | 158 | ||
157 | protected: | 159 | protected: |
158 | bool qwsEventFilter( QWSEvent * ); | 160 | bool qwsEventFilter( QWSEvent * ); |
159 | void internalSetStyle( const QString &style ); | 161 | void internalSetStyle( const QString &style ); |
160 | void prepareForTermination(bool willrestart); | 162 | void prepareForTermination(bool willrestart); |
161 | virtual void restart(); | 163 | virtual void restart(); |
162 | virtual void shutdown(); | 164 | virtual void shutdown(); |
163 | bool eventFilter( QObject *, QEvent * ); | 165 | bool eventFilter( QObject *, QEvent * ); |
164 | void timerEvent( QTimerEvent * ); | 166 | void timerEvent( QTimerEvent * ); |
165 | bool raiseAppropriateWindow(); | 167 | bool raiseAppropriateWindow(); |
166 | virtual void tryQuit(); | 168 | virtual void tryQuit(); |
167 | #ifndef OPIE_NO_ERASE_RECT_HACKFIX | 169 | #ifndef OPIE_NO_ERASE_RECT_HACKFIX |
168 | #if QT_VERSION > 233 | 170 | #if QT_VERSION > 233 |
169 | virtual void polish ( QWidget * ); // this is actually implemented in qt_override.cpp (!) | 171 | virtual void polish ( QWidget * ); // this is actually implemented in qt_override.cpp (!) |
170 | #endif | 172 | #endif |
171 | #endif | 173 | #endif |
172 | private: | 174 | private: |
173 | void mapToDefaultAction( QWSKeyEvent *ke, int defKey ); | 175 | void mapToDefaultAction( QWSKeyEvent *ke, int defKey ); |
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 | ||
186 | inline void QPEApplication::showDialog( QDialog* d, bool nomax ) | ||
187 | { | ||
188 | showWidget( d, nomax ); | ||
189 | } | ||
190 | 188 | ||
191 | inline int QPEApplication::execDialog( QDialog* d, bool nomax ) | ||
192 | { | ||
193 | showDialog( d, nomax ); | ||
194 | return d->exec(); | ||
195 | } | ||
196 | |||
197 | #ifdef Q_WS_QWS | ||
198 | extern Q_EXPORT QRect qt_maxWindowRect; | ||
199 | #endif | ||
200 | |||
201 | inline 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 | ||
231 | enum Transformation { Rot0, Rot90, Rot180, Rot270 }; /* from qgfxtransformed_qws.cpp */ | 190 | enum Transformation { Rot0, Rot90, Rot180, Rot270 }; /* from qgfxtransformed_qws.cpp */ |
232 | 191 | ||
233 | inline int TransToDeg ( Transformation t ) | 192 | inline 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 | ||
239 | inline Transformation DegToTrans ( int d ) | 198 | inline Transformation DegToTrans ( int d ) |
240 | { | 199 | { |
241 | Transformation t = static_cast<Transformation>( d / 90 ); | 200 | Transformation t = static_cast<Transformation>( d / 90 ); |
242 | return t; | 201 | return t; |
243 | } | 202 | } |
244 | 203 | ||
245 | /* | 204 | /* |
246 | * Set current rotation of Opie, and rotation for newly started apps. | 205 | * Set current rotation of Opie, and rotation for newly started apps. |
247 | * Differs from setDefaultRotation in that 1) it rotates currently running apps, | 206 | * Differs from setDefaultRotation in that 1) it rotates currently running apps, |
248 | * and 2) does not set deforient or save orientation to qpe.conf. | 207 | * and 2) does not set deforient or save orientation to qpe.conf. |
249 | */ | 208 | */ |
250 | 209 | ||
251 | inline void QPEApplication::setCurrentRotation( int r ) | 210 | inline void QPEApplication::setCurrentRotation( int r ) |
252 | { | 211 | { |
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 | ||
228 | extern 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 | |||
@@ -1,369 +1,370 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
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 | #ifdef QWS | 20 | #ifdef QWS |
21 | #define QTOPIA_INTERNAL_LANGLIST | 21 | #define QTOPIA_INTERNAL_LANGLIST |
22 | #include <qapplication.h> | 22 | #include <qapplication.h> |
23 | #include <qstyle.h> | 23 | #include <qstyle.h> |
24 | #include <qwidget.h> | 24 | #include <qwidget.h> |
25 | #include <qpainter.h> | 25 | #include <qpainter.h> |
26 | #include <qtimer.h> | 26 | #include <qtimer.h> |
27 | #include <qwhatsthis.h> | 27 | #include <qwhatsthis.h> |
28 | #include <qpopupmenu.h> | 28 | #include <qpopupmenu.h> |
29 | #include "qcopenvelope_qws.h" | 29 | #include "qcopenvelope_qws.h" |
30 | #include "qpedecoration_qws.h" | 30 | #include "qpedecoration_qws.h" |
31 | #include <qdialog.h> | 31 | #include <qdialog.h> |
32 | #include <qdrawutil.h> | 32 | #include <qdrawutil.h> |
33 | #include <qgfx_qws.h> | 33 | #include <qgfx_qws.h> |
34 | #include "qpeapplication.h" | 34 | #include "qpeapplication.h" |
35 | #include "resource.h" | 35 | #include "resource.h" |
36 | #include "global.h" | 36 | #include "global.h" |
37 | #include "qlibrary.h" | 37 | #include "qlibrary.h" |
38 | #include "windowdecorationinterface.h" | 38 | #include "windowdecorationinterface.h" |
39 | #include <qpe/qlibrary.h> | 39 | #include <qpe/qlibrary.h> |
40 | #include <qfile.h> | 40 | #include <qfile.h> |
41 | #include <qsignal.h> | 41 | #include <qsignal.h> |
42 | 42 | ||
43 | #include <stdlib.h> | 43 | #include <stdlib.h> |
44 | 44 | ||
45 | extern Q_EXPORT QRect qt_maxWindowRect; | 45 | extern Q_EXPORT QRect qt_maxWindowRect; |
46 | 46 | ||
47 | #define WHATSTHIS_MODE | 47 | #define WHATSTHIS_MODE |
48 | 48 | ||
49 | #ifndef QT_NO_QWS_QPE_WM_STYLE | 49 | #ifndef QT_NO_QWS_QPE_WM_STYLE |
50 | 50 | ||
51 | #ifndef QT_NO_IMAGEIO_XPM | 51 | #ifndef QT_NO_IMAGEIO_XPM |
52 | 52 | ||
53 | /* XPM */ | 53 | /* XPM */ |
54 | static const char * const qpe_close_xpm[] = { | 54 | static const char * const qpe_close_xpm[] = { |
55 | "16 16 3 1", | 55 | "16 16 3 1", |
56 | " c None", | 56 | " c None", |
57 | ". c #FFFFFF", | 57 | ". c #FFFFFF", |
58 | "+ c #000000", | 58 | "+ c #000000", |
59 | " ", | 59 | " ", |
60 | " ", | 60 | " ", |
61 | " ..... ", | 61 | " ..... ", |
62 | " ..+++++.. ", | 62 | " ..+++++.. ", |
63 | " .+++++++++. ", | 63 | " .+++++++++. ", |
64 | " .+..+++..+. ", | 64 | " .+..+++..+. ", |
65 | " .++...+...++. ", | 65 | " .++...+...++. ", |
66 | " .+++.....+++. ", | 66 | " .+++.....+++. ", |
67 | " .++++...++++. ", | 67 | " .++++...++++. ", |
68 | " .+++.....+++. ", | 68 | " .+++.....+++. ", |
69 | " .++...+...++. ", | 69 | " .++...+...++. ", |
70 | " .+..+++..+. ", | 70 | " .+..+++..+. ", |
71 | " .+++++++++. ", | 71 | " .+++++++++. ", |
72 | " ..+++++.. ", | 72 | " ..+++++.. ", |
73 | " ..... ", | 73 | " ..... ", |
74 | " "}; | 74 | " "}; |
75 | 75 | ||
76 | /* XPM */ | 76 | /* XPM */ |
77 | static const char * const qpe_accept_xpm[] = { | 77 | static const char * const qpe_accept_xpm[] = { |
78 | "16 16 3 1", | 78 | "16 16 3 1", |
79 | " c None", | 79 | " c None", |
80 | ". c #FFFFFF", | 80 | ". c #FFFFFF", |
81 | "+ c #000000", | 81 | "+ c #000000", |
82 | " ", | 82 | " ", |
83 | " ", | 83 | " ", |
84 | " ..... ", | 84 | " ..... ", |
85 | " ..+++++.. ", | 85 | " ..+++++.. ", |
86 | " .+++++++++. ", | 86 | " .+++++++++. ", |
87 | " .+++++++++. ", | 87 | " .+++++++++. ", |
88 | " .+++++++..++. ", | 88 | " .+++++++..++. ", |
89 | " .++.+++...++. ", | 89 | " .++.+++...++. ", |
90 | " .+...+...+++. ", | 90 | " .+...+...+++. ", |
91 | " .+......++++. ", | 91 | " .+......++++. ", |
92 | " .++....+++++. ", | 92 | " .++....+++++. ", |
93 | " .++..+++++. ", | 93 | " .++..+++++. ", |
94 | " .+++++++++. ", | 94 | " .+++++++++. ", |
95 | " ..+++++.. ", | 95 | " ..+++++.. ", |
96 | " ..... ", | 96 | " ..... ", |
97 | " "}; | 97 | " "}; |
98 | 98 | ||
99 | #endif // QT_NO_IMAGEIO_XPM | 99 | #endif // QT_NO_IMAGEIO_XPM |
100 | 100 | ||
101 | class DecorHackWidget : public QWidget | 101 | class DecorHackWidget : public QWidget |
102 | { | 102 | { |
103 | public: | 103 | public: |
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 | ||
111 | static QImage scaleButton( const QImage &img, int height ) | 111 | static 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 | ||
120 | class TLWidget : public QWidget | 121 | class TLWidget : public QWidget |
121 | { | 122 | { |
122 | public: | 123 | public: |
123 | QWSManager *manager() | 124 | QWSManager *manager() |
124 | { | 125 | { |
125 | return topData()->qwsManager; | 126 | return topData()->qwsManager; |
126 | } | 127 | } |
127 | 128 | ||
128 | QTLWExtra *topExtra() | 129 | QTLWExtra *topExtra() |
129 | { | 130 | { |
130 | return topData(); | 131 | return topData(); |
131 | } | 132 | } |
132 | 133 | ||
133 | void setWState( uint s ) { QWidget::setWState( s ); } | 134 | void setWState( uint s ) { QWidget::setWState( s ); } |
134 | void clearWState( uint s ) { QWidget::clearWState( s ); } | 135 | void clearWState( uint s ) { QWidget::clearWState( s ); } |
135 | }; | 136 | }; |
136 | 137 | ||
137 | 138 | ||
138 | QPEManager::QPEManager( QPEDecoration *d, QObject *parent ) | 139 | QPEManager::QPEManager( QPEDecoration *d, QObject *parent ) |
139 | : QObject( parent ), decoration( d ), helpState(0), inWhatsThis(FALSE) | 140 | : QObject( parent ), decoration( d ), helpState(0), inWhatsThis(FALSE) |
140 | { | 141 | { |
141 | wtTimer = new QTimer( this ); | 142 | wtTimer = new QTimer( this ); |
142 | connect( wtTimer, SIGNAL(timeout()), this, SLOT(whatsThisTimeout()) ); | 143 | connect( wtTimer, SIGNAL(timeout()), this, SLOT(whatsThisTimeout()) ); |
143 | } | 144 | } |
144 | 145 | ||
145 | 146 | ||
146 | void QPEManager::updateActive() | 147 | void QPEManager::updateActive() |
147 | { | 148 | { |
148 | QWidget *newActive = qApp->activeWindow(); | 149 | QWidget *newActive = qApp->activeWindow(); |
149 | if ( newActive && (QWidget*)active == newActive ) | 150 | if ( newActive && (QWidget*)active == newActive ) |
150 | return; | 151 | return; |
151 | 152 | ||
152 | if ( active && (!newActive || ((TLWidget *)newActive)->manager()) ) { | 153 | if ( active && (!newActive || ((TLWidget *)newActive)->manager()) ) { |
153 | ((TLWidget *)(QWidget*)active)->manager()->removeEventFilter( this ); | 154 | ((TLWidget *)(QWidget*)active)->manager()->removeEventFilter( this ); |
154 | } | 155 | } |
155 | 156 | ||
156 | if ( newActive && ((TLWidget *)newActive)->manager() ) { | 157 | if ( newActive && ((TLWidget *)newActive)->manager() ) { |
157 | active = newActive; | 158 | active = newActive; |
158 | ((TLWidget *)(QWidget*)active)->manager()->installEventFilter( this ); | 159 | ((TLWidget *)(QWidget*)active)->manager()->installEventFilter( this ); |
159 | } else if ( !newActive ) { | 160 | } else if ( !newActive ) { |
160 | active = 0; | 161 | active = 0; |
161 | } | 162 | } |
162 | } | 163 | } |
163 | 164 | ||
164 | int QPEManager::pointInQpeRegion( QWidget *w, const QPoint &p ) | 165 | int QPEManager::pointInQpeRegion( QWidget *w, const QPoint &p ) |
165 | { | 166 | { |
166 | QRect rect(w->geometry()); | 167 | QRect rect(w->geometry()); |
167 | 168 | ||
168 | if ( decoration->region( w, rect, | 169 | if ( decoration->region( w, rect, |
169 | (QWSDecoration::Region)QPEDecoration::Help ).contains(p) ) | 170 | (QWSDecoration::Region)QPEDecoration::Help ).contains(p) ) |
170 | return QPEDecoration::Help; | 171 | return QPEDecoration::Help; |
171 | 172 | ||
172 | for (int i = QWSDecoration::LastRegion; i >= QWSDecoration::Title; i--) { | 173 | for (int i = QWSDecoration::LastRegion; i >= QWSDecoration::Title; i--) { |
173 | if (decoration->region(w, rect, (QWSDecoration::Region)i).contains(p)) | 174 | if (decoration->region(w, rect, (QWSDecoration::Region)i).contains(p)) |
174 | return (QWSDecoration::Region)i; | 175 | return (QWSDecoration::Region)i; |
175 | } | 176 | } |
176 | 177 | ||
177 | return QWSDecoration::None; | 178 | return QWSDecoration::None; |
178 | } | 179 | } |
179 | 180 | ||
180 | bool QPEManager::eventFilter( QObject *o, QEvent *e ) | 181 | bool QPEManager::eventFilter( QObject *o, QEvent *e ) |
181 | { | 182 | { |
182 | QWSManager *mgr = (QWSManager *)o; | 183 | QWSManager *mgr = (QWSManager *)o; |
183 | QWidget *w = mgr->widget(); | 184 | QWidget *w = mgr->widget(); |
184 | switch ( e->type() ) { | 185 | switch ( e->type() ) { |
185 | case QEvent::MouseButtonPress: | 186 | case QEvent::MouseButtonPress: |
186 | { | 187 | { |
187 | pressTime = QTime::currentTime(); | 188 | pressTime = QTime::currentTime(); |
188 | QPoint p = ((QMouseEvent*)e)->globalPos(); | 189 | QPoint p = ((QMouseEvent*)e)->globalPos(); |
189 | int inRegion = pointInQpeRegion( w, p ); | 190 | int inRegion = pointInQpeRegion( w, p ); |
190 | #ifdef WHATSTHIS_MODE | 191 | #ifdef WHATSTHIS_MODE |
191 | if ( !w->geometry().contains(p) && QWhatsThis::inWhatsThisMode() ) { | 192 | if ( !w->geometry().contains(p) && QWhatsThis::inWhatsThisMode() ) { |
192 | QString text; | 193 | QString text; |
193 | switch ( inRegion ) { | 194 | switch ( inRegion ) { |
194 | case QWSDecoration::Close: | 195 | case QWSDecoration::Close: |
195 | if ( ((DecorHackWidget*)w)->needsOk() ) | 196 | if ( ((DecorHackWidget*)w)->needsOk() ) |
196 | text = tr("Click to close this window, discarding changes."); | 197 | text = tr("Click to close this window, discarding changes."); |
197 | else | 198 | else |
198 | text = tr("Click to close this window."); | 199 | text = tr("Click to close this window."); |
199 | break; | 200 | break; |
200 | case QWSDecoration::Minimize: | 201 | case QWSDecoration::Minimize: |
201 | text = tr("Click to close this window and apply changes."); | 202 | text = tr("Click to close this window and apply changes."); |
202 | break; | 203 | break; |
203 | case QWSDecoration::Maximize: | 204 | case QWSDecoration::Maximize: |
204 | if ( w->isMaximized() ) | 205 | if ( w->isMaximized() ) |
205 | text = tr("Click to make this window movable."); | 206 | text = tr("Click to make this window movable."); |
206 | else | 207 | else |
207 | text = tr("Click to make this window use all available screen area."); | 208 | text = tr("Click to make this window use all available screen area."); |
208 | break; | 209 | break; |
209 | default: | 210 | default: |
210 | break; | 211 | break; |
211 | } | 212 | } |
212 | QWhatsThis::leaveWhatsThisMode( text ); | 213 | QWhatsThis::leaveWhatsThisMode( text ); |
213 | whatsThisTimeout(); | 214 | whatsThisTimeout(); |
214 | helpState = 0; | 215 | helpState = 0; |
215 | return true; | 216 | return true; |
216 | } | 217 | } |
217 | #endif | 218 | #endif |
218 | if ( inRegion == QPEDecoration::Help ) { | 219 | if ( inRegion == QPEDecoration::Help ) { |
219 | #ifdef WHATSTHIS_MODE | 220 | #ifdef WHATSTHIS_MODE |
220 | wtTimer->start( 400, TRUE ); | 221 | wtTimer->start( 400, TRUE ); |
221 | #endif | 222 | #endif |
222 | helpState = QWSButton::Clicked|QWSButton::MouseOver; | 223 | helpState = QWSButton::Clicked|QWSButton::MouseOver; |
223 | drawButton( w, QPEDecoration::Help, helpState ); | 224 | drawButton( w, QPEDecoration::Help, helpState ); |
224 | return true; | 225 | return true; |
225 | } | 226 | } |
226 | } | 227 | } |
227 | break; | 228 | break; |
228 | case QEvent::MouseButtonRelease: | 229 | case QEvent::MouseButtonRelease: |
229 | if ( helpState & QWSButton::Clicked ) { | 230 | if ( helpState & QWSButton::Clicked ) { |
230 | wtTimer->stop(); | 231 | wtTimer->stop(); |
231 | helpState = 0; | 232 | helpState = 0; |
232 | drawButton( w, QPEDecoration::Help, helpState ); | 233 | drawButton( w, QPEDecoration::Help, helpState ); |
233 | QPoint p = ((QMouseEvent*)e)->globalPos(); | 234 | QPoint p = ((QMouseEvent*)e)->globalPos(); |
234 | if ( pointInQpeRegion( w, p ) == QPEDecoration::Help ) { | 235 | if ( pointInQpeRegion( w, p ) == QPEDecoration::Help ) { |
235 | decoration->help( w ); | 236 | decoration->help( w ); |
236 | } | 237 | } |
237 | return true; | 238 | return true; |
238 | } | 239 | } |
239 | break; | 240 | break; |
240 | case QEvent::MouseMove: | 241 | case QEvent::MouseMove: |
241 | if ( helpState & QWSButton::Clicked ) { | 242 | if ( helpState & QWSButton::Clicked ) { |
242 | int oldState = helpState; | 243 | int oldState = helpState; |
243 | QPoint p = ((QMouseEvent*)e)->globalPos(); | 244 | QPoint p = ((QMouseEvent*)e)->globalPos(); |
244 | if ( pointInQpeRegion( w, p ) == QPEDecoration::Help ) { | 245 | if ( pointInQpeRegion( w, p ) == QPEDecoration::Help ) { |
245 | helpState = QWSButton::Clicked|QWSButton::MouseOver; | 246 | helpState = QWSButton::Clicked|QWSButton::MouseOver; |
246 | } else { | 247 | } else { |
247 | helpState = 0; | 248 | helpState = 0; |
248 | } | 249 | } |
249 | if ( helpState != oldState ) | 250 | if ( helpState != oldState ) |
250 | drawButton( w, QPEDecoration::Help, helpState ); | 251 | drawButton( w, QPEDecoration::Help, helpState ); |
251 | } | 252 | } |
252 | break; | 253 | break; |
253 | default: | 254 | default: |
254 | break; | 255 | break; |
255 | } | 256 | } |
256 | return QObject::eventFilter( o, e ); | 257 | return QObject::eventFilter( o, e ); |
257 | } | 258 | } |
258 | 259 | ||
259 | void QPEManager::drawButton( QWidget *w, QPEDecoration::QPERegion r, int state ) | 260 | void QPEManager::drawButton( QWidget *w, QPEDecoration::QPERegion r, int state ) |
260 | { | 261 | { |
261 | QPainter painter(w); | 262 | QPainter painter(w); |
262 | QRegion rgn = ((TLWidget *)w)->topExtra()->decor_allocated_region; | 263 | QRegion rgn = ((TLWidget *)w)->topExtra()->decor_allocated_region; |
263 | painter.internalGfx()->setWidgetDeviceRegion( rgn ); | 264 | painter.internalGfx()->setWidgetDeviceRegion( rgn ); |
264 | painter.setClipRegion(decoration->region(w, w->rect(),QWSDecoration::All)); | 265 | painter.setClipRegion(decoration->region(w, w->rect(),QWSDecoration::All)); |
265 | decoration->paintButton( &painter, w, (QWSDecoration::Region)r, state ); | 266 | decoration->paintButton( &painter, w, (QWSDecoration::Region)r, state ); |
266 | } | 267 | } |
267 | 268 | ||
268 | void QPEManager::drawTitle( QWidget *w ) | 269 | void QPEManager::drawTitle( QWidget *w ) |
269 | { | 270 | { |
270 | QPainter painter(w); | 271 | QPainter painter(w); |
271 | QRegion rgn = ((TLWidget *)w)->topExtra()->decor_allocated_region; | 272 | QRegion rgn = ((TLWidget *)w)->topExtra()->decor_allocated_region; |
272 | painter.internalGfx()->setWidgetDeviceRegion( rgn ); | 273 | painter.internalGfx()->setWidgetDeviceRegion( rgn ); |
273 | painter.setClipRegion(decoration->region(w, w->rect(),QWSDecoration::All)); | 274 | painter.setClipRegion(decoration->region(w, w->rect(),QWSDecoration::All)); |
274 | decoration->paint( &painter, w ); | 275 | decoration->paint( &painter, w ); |
275 | decoration->paintButton(&painter, w, QWSDecoration::Menu, 0); | 276 | decoration->paintButton(&painter, w, QWSDecoration::Menu, 0); |
276 | decoration->paintButton(&painter, w, QWSDecoration::Close, 0); | 277 | decoration->paintButton(&painter, w, QWSDecoration::Close, 0); |
277 | decoration->paintButton(&painter, w, QWSDecoration::Minimize, 0); | 278 | decoration->paintButton(&painter, w, QWSDecoration::Minimize, 0); |
278 | decoration->paintButton(&painter, w, QWSDecoration::Maximize, 0); | 279 | decoration->paintButton(&painter, w, QWSDecoration::Maximize, 0); |
279 | } | 280 | } |
280 | 281 | ||
281 | void QPEManager::whatsThisTimeout() | 282 | void QPEManager::whatsThisTimeout() |
282 | { | 283 | { |
283 | if ( !QWhatsThis::inWhatsThisMode() ) { | 284 | if ( !QWhatsThis::inWhatsThisMode() ) { |
284 | if ( inWhatsThis ) { | 285 | if ( inWhatsThis ) { |
285 | if ( whatsThis ) { | 286 | if ( whatsThis ) { |
286 | QWidget *w = whatsThis; | 287 | QWidget *w = whatsThis; |
287 | whatsThis = 0; | 288 | whatsThis = 0; |
288 | drawTitle( w ); | 289 | drawTitle( w ); |
289 | } | 290 | } |
290 | wtTimer->stop(); | 291 | wtTimer->stop(); |
291 | } else { | 292 | } else { |
292 | QWhatsThis::enterWhatsThisMode(); | 293 | QWhatsThis::enterWhatsThisMode(); |
293 | helpState = 0; | 294 | helpState = 0; |
294 | updateActive(); | 295 | updateActive(); |
295 | if ( active ) { | 296 | if ( active ) { |
296 | whatsThis = active; | 297 | whatsThis = active; |
297 | drawTitle( active ); | 298 | drawTitle( active ); |
298 | // check periodically to see if we've left whats this mode | 299 | // check periodically to see if we've left whats this mode |
299 | wtTimer->start( 250 ); | 300 | wtTimer->start( 250 ); |
300 | } | 301 | } |
301 | } | 302 | } |
302 | inWhatsThis = !inWhatsThis; | 303 | inWhatsThis = !inWhatsThis; |
303 | } | 304 | } |
304 | } | 305 | } |
305 | 306 | ||
306 | //=========================================================================== | 307 | //=========================================================================== |
307 | 308 | ||
308 | static QImage *okImage( int th ) | 309 | static QImage *okImage( int th ) |
309 | { | 310 | { |
310 | static QImage *i = 0; | 311 | static QImage *i = 0; |
311 | if ( !i || i->height() != th ) { | 312 | if ( !i || i->height() != th ) { |
312 | delete i; | 313 | delete i; |
313 | i = new QImage(scaleButton(Resource::loadImage("OKButton"),th)); | 314 | i = new QImage(scaleButton(Resource::loadImage("OKButton"),th)); |
314 | } | 315 | } |
315 | return i; | 316 | return i; |
316 | } | 317 | } |
317 | 318 | ||
318 | static QImage *closeImage( int th ) | 319 | static QImage *closeImage( int th ) |
319 | { | 320 | { |
320 | static QImage *i = 0; | 321 | static QImage *i = 0; |
321 | if ( !i || i->height() != th ) { | 322 | if ( !i || i->height() != th ) { |
322 | delete i; | 323 | delete i; |
323 | i = new QImage(scaleButton(Resource::loadImage("CloseButton"),th)); | 324 | i = new QImage(scaleButton(Resource::loadImage("CloseButton"),th)); |
324 | } | 325 | } |
325 | return i; | 326 | return i; |
326 | } | 327 | } |
327 | 328 | ||
328 | static QImage *helpImage( int th ) | 329 | static QImage *helpImage( int th ) |
329 | { | 330 | { |
330 | static QImage *i = 0; | 331 | static QImage *i = 0; |
331 | if ( !i || i->height() != th ) { | 332 | if ( !i || i->height() != th ) { |
332 | delete i; | 333 | delete i; |
333 | i = new QImage(scaleButton(Resource::loadImage("HelpButton"),th)); | 334 | i = new QImage(scaleButton(Resource::loadImage("HelpButton"),th)); |
334 | } | 335 | } |
335 | return i; | 336 | return i; |
336 | } | 337 | } |
337 | 338 | ||
338 | static QImage *maximizeImage( int th ) | 339 | static QImage *maximizeImage( int th ) |
339 | { | 340 | { |
340 | static QImage *i = 0; | 341 | static QImage *i = 0; |
341 | if ( !i || i->height() != th ) { | 342 | if ( !i || i->height() != th ) { |
342 | delete i; | 343 | delete i; |
343 | i = new QImage(scaleButton(Resource::loadImage("MaximizeButton"),th)); | 344 | i = new QImage(scaleButton(Resource::loadImage("MaximizeButton"),th)); |
344 | } | 345 | } |
345 | return i; | 346 | return i; |
346 | } | 347 | } |
347 | 348 | ||
348 | int WindowDecorationInterface::metric( Metric m, const WindowData *wd ) const | 349 | int WindowDecorationInterface::metric( Metric m, const WindowData *wd ) const |
349 | { | 350 | { |
350 | switch ( m ) { | 351 | switch ( m ) { |
351 | case TitleHeight: | 352 | case TitleHeight: |
352 | if ( QApplication::desktop()->height() > 320 ) | 353 | if ( QApplication::desktop()->height() > 320 ) |
353 | return 19; | 354 | return 19; |
354 | else | 355 | else |
355 | return 15; | 356 | return 15; |
356 | case LeftBorder: | 357 | case LeftBorder: |
357 | case RightBorder: | 358 | case RightBorder: |
358 | case TopBorder: | 359 | case TopBorder: |
359 | case BottomBorder: | 360 | case BottomBorder: |
360 | return 4; | 361 | return 4; |
361 | case OKWidth: | 362 | case OKWidth: |
362 | return okImage(metric(TitleHeight,wd))->width(); | 363 | return okImage(metric(TitleHeight,wd))->width(); |
363 | case CloseWidth: | 364 | case CloseWidth: |
364 | return closeImage(metric(TitleHeight,wd))->width(); | 365 | return closeImage(metric(TitleHeight,wd))->width(); |
365 | case HelpWidth: | 366 | case HelpWidth: |
366 | return helpImage(metric(TitleHeight,wd))->width(); | 367 | return helpImage(metric(TitleHeight,wd))->width(); |
367 | case MaximizeWidth: | 368 | case MaximizeWidth: |
368 | return maximizeImage(metric(TitleHeight,wd))->width(); | 369 | return maximizeImage(metric(TitleHeight,wd))->width(); |
369 | case CornerGrabSize: | 370 | case CornerGrabSize: |
diff --git a/library/qpeglobal.h b/library/qpeglobal.h index 96ce3a6..a84e435 100644 --- a/library/qpeglobal.h +++ b/library/qpeglobal.h | |||
@@ -1,55 +1,88 @@ | |||
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 |
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 20 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
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 | |||
@@ -1,85 +1,87 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
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 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 | |||
28 | class QPEMenuToolFocusManager : public QObject | 30 | class QPEMenuToolFocusManager : public QObject |
29 | { | 31 | { |
30 | Q_OBJECT | 32 | Q_OBJECT |
31 | public: | 33 | public: |
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 | ||
40 | static QPEMenuToolFocusManager *manager(); | 42 | static QPEMenuToolFocusManager *manager(); |
41 | static void initialize(); | 43 | static void initialize(); |
42 | 44 | ||
43 | protected: | 45 | protected: |
44 | void setFocus( QWidget *w, bool next=TRUE ); | 46 | void setFocus( QWidget *w, bool next=TRUE ); |
45 | bool eventFilter( QObject *object, QEvent *event ); | 47 | bool eventFilter( QObject *object, QEvent *event ); |
46 | 48 | ||
47 | private slots: | 49 | private slots: |
48 | void deactivate(); | 50 | void deactivate(); |
49 | 51 | ||
50 | private: | 52 | private: |
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 | ||
57 | private: // Sharp ROM compatibility | 59 | private: // Sharp ROM compatibility |
58 | void setMenukeyEnabled ( bool b ); | 60 | void setMenukeyEnabled ( bool b ); |
59 | }; | 61 | }; |
60 | 62 | ||
61 | 63 | ||
62 | class QPEMenuBar : public QMenuBar | 64 | class QPE_DEPRECATED QPEMenuBar : public QMenuBar |
63 | { | 65 | { |
64 | Q_OBJECT | 66 | Q_OBJECT |
65 | public: | 67 | public: |
66 | QPEMenuBar( QWidget *parent=0, const char* name=0 ); | 68 | QPEMenuBar( QWidget *parent=0, const char* name=0 ); |
67 | ~QPEMenuBar(); | 69 | ~QPEMenuBar(); |
68 | 70 | ||
69 | protected: | 71 | protected: |
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 |
75 | */ | 77 | */ |
76 | void activateItem( int index ); | 78 | void activateItem( int index ); |
77 | void goodbye(); | 79 | void goodbye(); |
78 | 80 | ||
79 | // This is a special "lineo" add-on for the Sharp ROM | 81 | // This is a special "lineo" add-on for the Sharp ROM |
80 | // nobody knows, what it does, though ... | 82 | // nobody knows, what it does, though ... |
81 | int getOldFocus ( ); | 83 | int getOldFocus ( ); |
82 | }; | 84 | }; |
83 | 85 | ||
84 | #endif | 86 | #endif |
85 | 87 | ||
diff --git a/library/qpetoolbar.h b/library/qpetoolbar.h index 53d21c0..c894ec9 100644 --- a/library/qpetoolbar.h +++ b/library/qpetoolbar.h | |||
@@ -1,39 +1,40 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2001 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2001 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
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 | ||
26 | class QMainWindow; | 27 | class QMainWindow; |
27 | 28 | ||
28 | class QPEToolBar : public QToolBar | 29 | class QPE_DEPRECATED QPEToolBar : public QToolBar |
29 | { | 30 | { |
30 | Q_OBJECT | 31 | Q_OBJECT |
31 | public: | 32 | public: |
32 | QPEToolBar( QMainWindow *parent = 0, const char *name = 0 ); | 33 | QPEToolBar( QMainWindow *parent = 0, const char *name = 0 ); |
33 | 34 | ||
34 | protected: | 35 | protected: |
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 | ||
35 | extern Q_EXPORT QRect qt_maxWindowRect; | ||
36 | #endif | ||
37 | |||
38 | void QPEApplication::showDialog( QDialog* d, bool nomax ) | ||
39 | { | ||
40 | showWidget( d, nomax ); | ||
41 | } | ||
42 | |||
43 | int QPEApplication::execDialog( QDialog* d, bool nomax ) | ||
44 | { | ||
45 | showDialog( d, nomax ); | ||
46 | return d->exec(); | ||
47 | } | ||
48 | |||
49 | void 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 | } | ||