summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--library/fileselector.h2
-rw-r--r--library/qpedecoration_qws.cpp3
2 files changed, 2 insertions, 3 deletions
diff --git a/library/fileselector.h b/library/fileselector.h
index ef57626..f1c9eb1 100644
--- a/library/fileselector.h
+++ b/library/fileselector.h
@@ -1,113 +1,113 @@
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 "filemanager.h" 28#include "filemanager.h"
29#include "applnk.h" 29#include "applnk.h"
30 30
31class QPopupMenu; 31class QPopupMenu;
32class QPushButton; 32class QPushButton;
33class FileSelectorView; 33class FileSelectorView;
34 34
35class FileSelectorItem : public QListViewItem 35class FileSelectorItem : public QListViewItem
36{ 36{
37public: 37public:
38 FileSelectorItem( QListView *parent, const DocLnk& f ); 38 FileSelectorItem( QListView *parent, const DocLnk& f );
39 ~FileSelectorItem(); 39 ~FileSelectorItem();
40 40
41 DocLnk file() const { return fl; } 41 DocLnk file() const { return fl; }
42 42
43private: 43private:
44 DocLnk fl; 44 DocLnk fl;
45}; 45};
46 46
47class FileSelectorPrivate; 47class FileSelectorPrivate;
48class FileSelector : public QVBox 48class FileSelector : public QVBox
49{ 49{
50 Q_OBJECT 50 Q_OBJECT
51 51
52public: 52public:
53 FileSelector( const QString &mimefilter, QWidget *parent, const char *name=0, bool newVisible = TRUE, bool closeVisible = TRUE ); 53 FileSelector( const QString &mimefilter, QWidget *parent, const char *name=0, bool newVisible = TRUE, bool closeVisible = TRUE );
54 ~FileSelector(); 54 ~FileSelector();
55 void setNewVisible( bool b ); 55 void setNewVisible( bool b );
56 void setCloseVisible( bool b ); 56 void setCloseVisible( bool b );
57 void reread(); 57 void reread();
58 int fileCount(); 58 int fileCount();
59 DocLnk selectedDocument() const 59 DocLnk selectedDocument() const
60 { 60 {
61 const DocLnk* rp = ((FileSelector*)this)->selected(); 61 const DocLnk* rp = ((FileSelector*)this)->selected();
62 if (!rp) { 62 if (!rp) {
63 DocLnk r; 63 DocLnk r;
64 return r; 64 return r;
65 } 65 }
66 DocLnk r(*rp); 66 DocLnk r(*rp);
67 delete rp; 67 delete rp;
68 return r; 68 return r;
69 } 69 }
70 70
71 QValueList<DocLnk> fileList() const 71 QValueList<DocLnk> fileList() const
72 { 72 {
73 ((FileSelector*)this)->fileCount(); // ensure all loaded when this is extended 73 ((FileSelector*)this)->fileCount(); // ensure all loaded when this is extended
74 74
75 QValueList<DocLnk> list; 75 QValueList<DocLnk> list;
76 FileSelectorItem *item = (FileSelectorItem *)((QListView*)view)->firstChild(); 76 FileSelectorItem *item = (FileSelectorItem *)((QListView*)view)->firstChild();
77 while (item) { 77 while (item) {
78 list.append(item->file()); 78 list.append(item->file());
79 item = (FileSelectorItem *)item->nextSibling(); 79 item = (FileSelectorItem *)item->nextSibling();
80 } 80 }
81 81
82 return list; 82 return list;
83 } 83 }
84 84
85signals: 85signals:
86 void fileSelected( const DocLnk & ); 86 void fileSelected( const DocLnk & );
87 void newSelected( const DocLnk & ); 87 void newSelected( const DocLnk & );
88 void closeMe(); 88 void closeMe();
89 89
90private slots: 90private slots:
91 void createNew(); 91 void createNew();
92 void fileClicked( int, QListViewItem *, const QPoint &, int ); 92 void fileClicked( int, QListViewItem *, const QPoint &, int );
93 // pressed to get 'right down' 93 // pressed to get 'right down'
94 void filePressed( int, QListViewItem *, const QPoint &, int ); 94 void filePressed( int, QListViewItem *, const QPoint &, int );
95 void fileClicked( QListViewItem *); 95 void fileClicked( QListViewItem *);
96 void typeSelected( const QString &type ); 96 void typeSelected( const QString &type );
97 void catSelected( int ); 97 void catSelected( int );
98 void cardMessage( const QCString &, const QByteArray &); 98 void cardMessage( const QCString &, const QByteArray &);
99 99
100private: 100private:
101 void updateView(); 101 void updateView();
102 void updateWhatsThis(); 102 void updateWhatsThis();
103 103
104private: 104private:
105 // RESOLVE please -zecke@handhelds.org 105 // RESOLVE please -zecke@handhelds.org
106 const DocLnk *selected(); // use selectedDocument() that's no luckily no compiler is putting the access into the symbol name 106 const DocLnk *selected(); // use selectedDocument() luckily no compiler is putting the access into the symbol name
107 FileSelectorView *view; 107 FileSelectorView *view;
108 QString filter; 108 QString filter;
109 QToolButton *buttonNew, *buttonClose; 109 QToolButton *buttonNew, *buttonClose;
110 FileSelectorPrivate *d; 110 FileSelectorPrivate *d;
111}; 111};
112 112
113#endif 113#endif
diff --git a/library/qpedecoration_qws.cpp b/library/qpedecoration_qws.cpp
index c2eb751..708dd23 100644
--- a/library/qpedecoration_qws.cpp
+++ b/library/qpedecoration_qws.cpp
@@ -1,239 +1,238 @@
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 "qcopenvelope_qws.h" 28#include "qcopenvelope_qws.h"
29#include "qpedecoration_qws.h" 29#include "qpedecoration_qws.h"
30#include <qdialog.h> 30#include <qdialog.h>
31#include <qdrawutil.h> 31#include <qdrawutil.h>
32#include <qgfx_qws.h> 32#include <qgfx_qws.h>
33#include "qpeapplication.h" 33#include "qpeapplication.h"
34#include "resource.h" 34#include "resource.h"
35#include "global.h" 35#include "global.h"
36#include "qlibrary.h" 36#include "qlibrary.h"
37#include "windowdecorationinterface.h" 37#include "windowdecorationinterface.h"
38#include <qfile.h> 38#include <qfile.h>
39#include <qsignal.h> 39#include <qsignal.h>
40 40
41#include <stdlib.h> 41#include <stdlib.h>
42 42
43extern QRect qt_maxWindowRect; 43extern QRect qt_maxWindowRect;
44 44
45#define WHATSTHIS_MODE 45#define WHATSTHIS_MODE
46 46
47#ifndef QT_NO_QWS_QPE_WM_STYLE 47#ifndef QT_NO_QWS_QPE_WM_STYLE
48 48
49#ifndef QT_NO_IMAGEIO_XPM 49#ifndef QT_NO_IMAGEIO_XPM
50 50
51/* XPM */ 51/* XPM */
52static const char * const qpe_close_xpm[] = { 52static const char * const qpe_close_xpm[] = {
53"16 16 3 1", 53"16 16 3 1",
54" c None", 54" c None",
55". c #FFFFFF", 55". c #FFFFFF",
56"+ c #000000", 56"+ c #000000",
57" ", 57" ",
58" ", 58" ",
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/* XPM */ 74/* XPM */
75static const char * const qpe_accept_xpm[] = { 75static const char * const qpe_accept_xpm[] = {
76"16 16 3 1", 76"16 16 3 1",
77" c None", 77" c None",
78". c #FFFFFF", 78". c #FFFFFF",
79"+ c #000000", 79"+ c #000000",
80" ", 80" ",
81" ", 81" ",
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#endif // QT_NO_IMAGEIO_XPM 97#endif // QT_NO_IMAGEIO_XPM
98 98
99class HackWidget : public QWidget 99class HackWidget : public QWidget
100{ 100{
101public: 101public:
102 bool needsOk() { 102 bool needsOk() {
103 return (getWState() & WState_Reserved1 ) || 103 return (getWState() & WState_Reserved1 ) ||
104 (inherits( "QDialog" ) && !inherits( "QMessageBox" ) ); 104 (inherits( "QDialog" ) && !inherits( "QMessageBox" ) );
105 } 105 }
106}; 106};
107 107
108static QImage scaleButton( const QImage &img, int height ) 108static QImage scaleButton( const QImage &img, int height )
109{ 109{
110 qWarning("Height %d %d", height, img.height() ); 110 if ( img.height() != 0 && img.height() != height ) {
111 if ( img.height()!=0 && img.height() != height ) {
112 return img.smoothScale( img.width()*height/img.height(), height ); 111 return img.smoothScale( img.width()*height/img.height(), height );
113 } else { 112 } else {
114 return img; 113 return img;
115 } 114 }
116} 115}
117 116
118class TLWidget : public QWidget 117class TLWidget : public QWidget
119{ 118{
120public: 119public:
121 QWSManager *manager() 120 QWSManager *manager()
122 { 121 {
123 return topData()->qwsManager; 122 return topData()->qwsManager;
124 } 123 }
125 124
126 QTLWExtra *topExtra() 125 QTLWExtra *topExtra()
127 { 126 {
128 return topData(); 127 return topData();
129 } 128 }
130 129
131 void setWState( uint s ) { QWidget::setWState( s ); } 130 void setWState( uint s ) { QWidget::setWState( s ); }
132 void clearWState( uint s ) { QWidget::clearWState( s ); } 131 void clearWState( uint s ) { QWidget::clearWState( s ); }
133}; 132};
134 133
135 134
136QPEManager::QPEManager( QPEDecoration *d, QObject *parent ) 135QPEManager::QPEManager( QPEDecoration *d, QObject *parent )
137 : QObject( parent ), decoration( d ), helpState(0), inWhatsThis(FALSE) 136 : QObject( parent ), decoration( d ), helpState(0), inWhatsThis(FALSE)
138{ 137{
139 wtTimer = new QTimer( this ); 138 wtTimer = new QTimer( this );
140 connect( wtTimer, SIGNAL(timeout()), this, SLOT(whatsThisTimeout()) ); 139 connect( wtTimer, SIGNAL(timeout()), this, SLOT(whatsThisTimeout()) );
141} 140}
142 141
143 142
144void QPEManager::updateActive() 143void QPEManager::updateActive()
145{ 144{
146 QWidget *newActive = qApp->activeWindow(); 145 QWidget *newActive = qApp->activeWindow();
147 if ( newActive && (QWidget*)active == newActive ) 146 if ( newActive && (QWidget*)active == newActive )
148 return; 147 return;
149 148
150 if ( active && (!newActive || ((TLWidget *)newActive)->manager()) ) { 149 if ( active && (!newActive || ((TLWidget *)newActive)->manager()) ) {
151 ((TLWidget *)(QWidget*)active)->manager()->removeEventFilter( this ); 150 ((TLWidget *)(QWidget*)active)->manager()->removeEventFilter( this );
152 } 151 }
153 152
154 if ( newActive && ((TLWidget *)newActive)->manager() ) { 153 if ( newActive && ((TLWidget *)newActive)->manager() ) {
155 active = newActive; 154 active = newActive;
156 ((TLWidget *)(QWidget*)active)->manager()->installEventFilter( this ); 155 ((TLWidget *)(QWidget*)active)->manager()->installEventFilter( this );
157 } else if ( !newActive ) { 156 } else if ( !newActive ) {
158 active = 0; 157 active = 0;
159 } 158 }
160} 159}
161 160
162int QPEManager::pointInQpeRegion( QWidget *w, const QPoint &p ) 161int QPEManager::pointInQpeRegion( QWidget *w, const QPoint &p )
163{ 162{
164 QRect rect(w->geometry()); 163 QRect rect(w->geometry());
165 164
166 if ( decoration->region( w, rect, 165 if ( decoration->region( w, rect,
167 (QWSDecoration::Region)QPEDecoration::Help ).contains(p) ) 166 (QWSDecoration::Region)QPEDecoration::Help ).contains(p) )
168 return QPEDecoration::Help; 167 return QPEDecoration::Help;
169 168
170 for (int i = QWSDecoration::LastRegion; i >= QWSDecoration::Title; i--) { 169 for (int i = QWSDecoration::LastRegion; i >= QWSDecoration::Title; i--) {
171 if (decoration->region(w, rect, (QWSDecoration::Region)i).contains(p)) 170 if (decoration->region(w, rect, (QWSDecoration::Region)i).contains(p))
172 return (QWSDecoration::Region)i; 171 return (QWSDecoration::Region)i;
173 } 172 }
174 173
175 return QWSDecoration::None; 174 return QWSDecoration::None;
176} 175}
177 176
178bool QPEManager::eventFilter( QObject *o, QEvent *e ) 177bool QPEManager::eventFilter( QObject *o, QEvent *e )
179{ 178{
180 QWSManager *mgr = (QWSManager *)o; 179 QWSManager *mgr = (QWSManager *)o;
181 QWidget *w = mgr->widget(); 180 QWidget *w = mgr->widget();
182 switch ( e->type() ) { 181 switch ( e->type() ) {
183 case QEvent::MouseButtonPress: 182 case QEvent::MouseButtonPress:
184 { 183 {
185 pressTime = QTime::currentTime(); 184 pressTime = QTime::currentTime();
186 QPoint p = ((QMouseEvent*)e)->globalPos(); 185 QPoint p = ((QMouseEvent*)e)->globalPos();
187 int inRegion = pointInQpeRegion( w, p ); 186 int inRegion = pointInQpeRegion( w, p );
188#ifdef WHATSTHIS_MODE 187#ifdef WHATSTHIS_MODE
189 if ( !w->geometry().contains(p) && QWhatsThis::inWhatsThisMode() ) { 188 if ( !w->geometry().contains(p) && QWhatsThis::inWhatsThisMode() ) {
190 QString text; 189 QString text;
191 switch ( inRegion ) { 190 switch ( inRegion ) {
192 case QWSDecoration::Close: 191 case QWSDecoration::Close:
193 if ( ((HackWidget*)w)->needsOk() ) 192 if ( ((HackWidget*)w)->needsOk() )
194 text = tr("Click to close this window, discarding changes."); 193 text = tr("Click to close this window, discarding changes.");
195 else 194 else
196 text = tr("Click to close this window."); 195 text = tr("Click to close this window.");
197 break; 196 break;
198 case QWSDecoration::Minimize: 197 case QWSDecoration::Minimize:
199 text = tr("Click to close this window and apply changes."); 198 text = tr("Click to close this window and apply changes.");
200 break; 199 break;
201 case QWSDecoration::Maximize: 200 case QWSDecoration::Maximize:
202 if ( w->isMaximized() ) 201 if ( w->isMaximized() )
203 text = tr("Click to make this window moveable."); 202 text = tr("Click to make this window moveable.");
204 else 203 else
205 text = tr("Click to make this window use all available screen area."); 204 text = tr("Click to make this window use all available screen area.");
206 break; 205 break;
207 default: 206 default:
208 break; 207 break;
209 } 208 }
210 QWhatsThis::leaveWhatsThisMode( text ); 209 QWhatsThis::leaveWhatsThisMode( text );
211 whatsThisTimeout(); 210 whatsThisTimeout();
212 helpState = 0; 211 helpState = 0;
213 return true; 212 return true;
214 } 213 }
215#endif 214#endif
216 if ( inRegion == QPEDecoration::Help ) { 215 if ( inRegion == QPEDecoration::Help ) {
217#ifdef WHATSTHIS_MODE 216#ifdef WHATSTHIS_MODE
218 wtTimer->start( 400, TRUE ); 217 wtTimer->start( 400, TRUE );
219#endif 218#endif
220 helpState = QWSButton::Clicked|QWSButton::MouseOver; 219 helpState = QWSButton::Clicked|QWSButton::MouseOver;
221 drawButton( w, QPEDecoration::Help, helpState ); 220 drawButton( w, QPEDecoration::Help, helpState );
222 return true; 221 return true;
223 } 222 }
224 } 223 }
225 break; 224 break;
226 case QEvent::MouseButtonRelease: 225 case QEvent::MouseButtonRelease:
227 if ( helpState & QWSButton::Clicked ) { 226 if ( helpState & QWSButton::Clicked ) {
228 wtTimer->stop(); 227 wtTimer->stop();
229 helpState = 0; 228 helpState = 0;
230 drawButton( w, QPEDecoration::Help, helpState ); 229 drawButton( w, QPEDecoration::Help, helpState );
231 QPoint p = ((QMouseEvent*)e)->globalPos(); 230 QPoint p = ((QMouseEvent*)e)->globalPos();
232 if ( pointInQpeRegion( w, p ) == QPEDecoration::Help ) { 231 if ( pointInQpeRegion( w, p ) == QPEDecoration::Help ) {
233 decoration->help( w ); 232 decoration->help( w );
234 } 233 }
235 return true; 234 return true;
236 } 235 }
237 break; 236 break;
238 case QEvent::MouseMove: 237 case QEvent::MouseMove:
239 if ( helpState & QWSButton::Clicked ) { 238 if ( helpState & QWSButton::Clicked ) {