summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/embeddedkonsole/TEWidget.cpp2
-rw-r--r--core/apps/textedit/textedit.cpp2
-rw-r--r--core/opie-login/loginwindowimpl.cpp4
-rw-r--r--freetype/fontfactoryttf_qws.h2
-rw-r--r--libopie2/opieui/oseparator.cpp2
-rw-r--r--libopie2/qt3/opieui/oeditlistbox.h2
-rw-r--r--libopie2/qt3/opieui/ojanuswidget.cpp2
-rw-r--r--library/lightstyle.cpp10
-rw-r--r--library/lightstyle.h2
-rw-r--r--library/qpeapplication.cpp4
-rw-r--r--library/qpestyle.cpp4
-rw-r--r--library/qpestyle.h2
-rw-r--r--noncore/apps/opie-console/TEWidget.cpp2
-rw-r--r--noncore/apps/tinykate/libkate/qt3back/qregexp3.cpp4
-rw-r--r--noncore/apps/tinykate/libkate/qt3back/qregexp3.h4
-rw-r--r--noncore/apps/zsafe/shadedlistitem.cpp2
-rw-r--r--noncore/net/wellenreiter/gui/configwindow.cpp6
-rw-r--r--noncore/settings/appearance2/appearance.cpp4
-rw-r--r--noncore/settings/doctab/doctab.cpp2
-rw-r--r--noncore/settings/language/language.cpp2
-rw-r--r--noncore/settings/networksettings/interfaces/module.h2
-rw-r--r--noncore/settings/networksettings/mainwindow/addconnectionimp.cpp2
-rw-r--r--noncore/settings/networksettings/mainwindow/mainwindowimp.cpp2
-rw-r--r--noncore/unsupported/qpdf/QOutputDev.cpp2
-rw-r--r--scripts/kconfig/qconf.cc16
-rw-r--r--scripts/kconfig/qconf.h2
26 files changed, 45 insertions, 45 deletions
diff --git a/core/apps/embeddedkonsole/TEWidget.cpp b/core/apps/embeddedkonsole/TEWidget.cpp
index 5171bf1..bee58e7 100644
--- a/core/apps/embeddedkonsole/TEWidget.cpp
+++ b/core/apps/embeddedkonsole/TEWidget.cpp
@@ -128,257 +128,257 @@ static const ColorEntry base_color_table[TABLE_COLORS] =
128 Code 0 1 2 3 4 5 6 7 128 Code 0 1 2 3 4 5 6 7
129 ----------- ------- ------- ------- ------- ------- ------- ------- ------- 129 ----------- ------- ------- ------- ------- ------- ------- ------- -------
130 ANSI (bgr) Black Red Green Yellow Blue Magenta Cyan White 130 ANSI (bgr) Black Red Green Yellow Blue Magenta Cyan White
131 IBMPC (rgb) Black Blue Green Cyan Red Magenta Yellow White 131 IBMPC (rgb) Black Blue Green Cyan Red Magenta Yellow White
132*/ 132*/
133 133
134QColor TEWidget::getDefaultBackColor() 134QColor TEWidget::getDefaultBackColor()
135{ 135{
136 return color_table[DEFAULT_BACK_COLOR].color; 136 return color_table[DEFAULT_BACK_COLOR].color;
137} 137}
138 138
139const ColorEntry* TEWidget::getColorTable() const 139const ColorEntry* TEWidget::getColorTable() const
140{ 140{
141 return color_table; 141 return color_table;
142} 142}
143 143
144const ColorEntry* TEWidget::getdefaultColorTable() const 144const ColorEntry* TEWidget::getdefaultColorTable() const
145{ 145{
146 return base_color_table; 146 return base_color_table;
147} 147}
148 148
149 149
150const QPixmap *TEWidget::backgroundPixmap() 150const QPixmap *TEWidget::backgroundPixmap()
151{ 151{
152 static QPixmap *bg = new QPixmap("~/qpim/main/pics/faded_bg.xpm"); 152 static QPixmap *bg = new QPixmap("~/qpim/main/pics/faded_bg.xpm");
153 const QPixmap *pm = bg; 153 const QPixmap *pm = bg;
154 return pm; 154 return pm;
155} 155}
156 156
157void TEWidget::setColorTable(const ColorEntry table[]) 157void TEWidget::setColorTable(const ColorEntry table[])
158{ 158{
159 for (int i = 0; i < TABLE_COLORS; i++) color_table[i] = table[i]; 159 for (int i = 0; i < TABLE_COLORS; i++) color_table[i] = table[i];
160 160
161 const QPixmap* pm = backgroundPixmap(); 161 const QPixmap* pm = backgroundPixmap();
162 if (!pm) setBackgroundColor(color_table[DEFAULT_BACK_COLOR].color); 162 if (!pm) setBackgroundColor(color_table[DEFAULT_BACK_COLOR].color);
163 update(); 163 update();
164} 164}
165 165
166//FIXME: add backgroundPixmapChanged. 166//FIXME: add backgroundPixmapChanged.
167 167
168/* ------------------------------------------------------------------------- */ 168/* ------------------------------------------------------------------------- */
169/* */ 169/* */
170/* Font */ 170/* Font */
171/* */ 171/* */
172/* ------------------------------------------------------------------------- */ 172/* ------------------------------------------------------------------------- */
173 173
174/* 174/*
175 The VT100 has 32 special graphical characters. The usual vt100 extended 175 The VT100 has 32 special graphical characters. The usual vt100 extended
176 xterm fonts have these at 0x00..0x1f. 176 xterm fonts have these at 0x00..0x1f.
177 177
178 QT's iso mapping leaves 0x00..0x7f without any changes. But the graphicals 178 QT's iso mapping leaves 0x00..0x7f without any changes. But the graphicals
179 come in here as proper unicode characters. 179 come in here as proper unicode characters.
180 180
181 We treat non-iso10646 fonts as VT100 extended and do the requiered mapping 181 We treat non-iso10646 fonts as VT100 extended and do the requiered mapping
182 from unicode to 0x00..0x1f. The remaining translation is then left to the 182 from unicode to 0x00..0x1f. The remaining translation is then left to the
183 QCodec. 183 QCodec.
184*/ 184*/
185 185
186// assert for i in [0..31] : vt100extended(vt100_graphics[i]) == i. 186// assert for i in [0..31] : vt100extended(vt100_graphics[i]) == i.
187 187
188unsigned short vt100_graphics[32] = 188unsigned short vt100_graphics[32] =
189{ // 0/8 1/9 2/10 3/11 4/12 5/13 6/14 7/15 189{ // 0/8 1/9 2/10 3/11 4/12 5/13 6/14 7/15
190 0x0020, 0x25C6, 0x2592, 0x2409, 0x240c, 0x240d, 0x240a, 0x00b0, 190 0x0020, 0x25C6, 0x2592, 0x2409, 0x240c, 0x240d, 0x240a, 0x00b0,
191 0x00b1, 0x2424, 0x240b, 0x2518, 0x2510, 0x250c, 0x2514, 0x253c, 191 0x00b1, 0x2424, 0x240b, 0x2518, 0x2510, 0x250c, 0x2514, 0x253c,
192 0xF800, 0xF801, 0x2500, 0xF803, 0xF804, 0x251c, 0x2524, 0x2534, 192 0xF800, 0xF801, 0x2500, 0xF803, 0xF804, 0x251c, 0x2524, 0x2534,
193 0x252c, 0x2502, 0x2264, 0x2265, 0x03C0, 0x2260, 0x00A3, 0x00b7 193 0x252c, 0x2502, 0x2264, 0x2265, 0x03C0, 0x2260, 0x00A3, 0x00b7
194}; 194};
195 195
196static QChar vt100extended(QChar c) 196static QChar vt100extended(QChar c)
197{ 197{
198 switch (c.unicode()) 198 switch (c.unicode())
199 { 199 {
200 case 0x25c6 : return 1; 200 case 0x25c6 : return 1;
201 case 0x2592 : return 2; 201 case 0x2592 : return 2;
202 case 0x2409 : return 3; 202 case 0x2409 : return 3;
203 case 0x240c : return 4; 203 case 0x240c : return 4;
204 case 0x240d : return 5; 204 case 0x240d : return 5;
205 case 0x240a : return 6; 205 case 0x240a : return 6;
206 case 0x00b0 : return 7; 206 case 0x00b0 : return 7;
207 case 0x00b1 : return 8; 207 case 0x00b1 : return 8;
208 case 0x2424 : return 9; 208 case 0x2424 : return 9;
209 case 0x240b : return 10; 209 case 0x240b : return 10;
210 case 0x2518 : return 11; 210 case 0x2518 : return 11;
211 case 0x2510 : return 12; 211 case 0x2510 : return 12;
212 case 0x250c : return 13; 212 case 0x250c : return 13;
213 case 0x2514 : return 14; 213 case 0x2514 : return 14;
214 case 0x253c : return 15; 214 case 0x253c : return 15;
215 case 0xf800 : return 16; 215 case 0xf800 : return 16;
216 case 0xf801 : return 17; 216 case 0xf801 : return 17;
217 case 0x2500 : return 18; 217 case 0x2500 : return 18;
218 case 0xf803 : return 19; 218 case 0xf803 : return 19;
219 case 0xf804 : return 20; 219 case 0xf804 : return 20;
220 case 0x251c : return 21; 220 case 0x251c : return 21;
221 case 0x2524 : return 22; 221 case 0x2524 : return 22;
222 case 0x2534 : return 23; 222 case 0x2534 : return 23;
223 case 0x252c : return 24; 223 case 0x252c : return 24;
224 case 0x2502 : return 25; 224 case 0x2502 : return 25;
225 case 0x2264 : return 26; 225 case 0x2264 : return 26;
226 case 0x2265 : return 27; 226 case 0x2265 : return 27;
227 case 0x03c0 : return 28; 227 case 0x03c0 : return 28;
228 case 0x2260 : return 29; 228 case 0x2260 : return 29;
229 case 0x00a3 : return 30; 229 case 0x00a3 : return 30;
230 case 0x00b7 : return 31; 230 case 0x00b7 : return 31;
231 } 231 }
232 return c; 232 return c;
233} 233}
234 234
235static QChar identicalMap(QChar c) 235static QChar identicalMap(QChar c)
236{ 236{
237 return c; 237 return c;
238} 238}
239 239
240void TEWidget::fontChange(const QFont &) 240void TEWidget::fontChange(const QFont &)
241{ 241{
242 QFontMetrics fm(font()); 242 QFontMetrics fm(font());
243 font_h = fm.height(); 243 font_h = fm.height();
244 // font_w = fm.maxWidth(); 244 // font_w = fm.maxWidth();
245 font_w = fm.width("m"); 245 font_w = fm.width("m");
246 font_a = fm.ascent(); 246 font_a = fm.ascent();
247 printf("font h=%d max_width=%d width_m=%d assent=%d\n", font_h, 247 printf("font h=%d max_width=%d width_m=%d assent=%d\n", font_h,
248 fm.maxWidth(), font_w, font_a); 248 fm.maxWidth(), font_w, font_a);
249 249
250 //printf("font_h: %d\n",font_h); 250 //printf("font_h: %d\n",font_h);
251 //printf("font_w: %d\n",font_w); 251 //printf("font_w: %d\n",font_w);
252 //printf("font_a: %d\n",font_a); 252 //printf("font_a: %d\n",font_a);
253 //printf("charset: %s\n",QFont::encodingName(font().charSet()).ascii()); 253 //printf("charset: %s\n",QFont::encodingName(font().charSet()).ascii());
254 //printf("rawname: %s\n",font().rawName().ascii()); 254 //printf("rawname: %s\n",font().rawName().ascii());
255 fontMap = 255 fontMap =
256#if QT_VERSION < 300 256#if QT_VERSION < 0x030000
257 strcmp(QFont::encodingName(font().charSet()).ascii(),"iso10646") 257 strcmp(QFont::encodingName(font().charSet()).ascii(),"iso10646")
258 ? vt100extended 258 ? vt100extended
259 : 259 :
260#endif 260#endif
261 identicalMap; 261 identicalMap;
262 propagateSize(); 262 propagateSize();
263 update(); 263 update();
264} 264}
265 265
266void TEWidget::setVTFont(const QFont& f) 266void TEWidget::setVTFont(const QFont& f)
267{ 267{
268 QFrame::setFont(f); 268 QFrame::setFont(f);
269} 269}
270 270
271QFont TEWidget::getVTFont() { 271QFont TEWidget::getVTFont() {
272 return font(); 272 return font();
273} 273}
274 274
275void TEWidget::setFont(const QFont &) 275void TEWidget::setFont(const QFont &)
276{ 276{
277 // ignore font change request if not coming from konsole itself 277 // ignore font change request if not coming from konsole itself
278} 278}
279 279
280/* ------------------------------------------------------------------------- */ 280/* ------------------------------------------------------------------------- */
281/* */ 281/* */
282/* Constructor / Destructor */ 282/* Constructor / Destructor */
283/* */ 283/* */
284/* ------------------------------------------------------------------------- */ 284/* ------------------------------------------------------------------------- */
285 285
286TEWidget::TEWidget(QWidget *parent, const char *name) : QFrame(parent,name) 286TEWidget::TEWidget(QWidget *parent, const char *name) : QFrame(parent,name)
287{ 287{
288#ifndef QT_NO_CLIPBOARD 288#ifndef QT_NO_CLIPBOARD
289 cb = QApplication::clipboard(); 289 cb = QApplication::clipboard();
290 QObject::connect( (QObject*)cb, SIGNAL(dataChanged()), 290 QObject::connect( (QObject*)cb, SIGNAL(dataChanged()),
291 this, SLOT(onClearSelection()) ); 291 this, SLOT(onClearSelection()) );
292#endif 292#endif
293 293
294 scrollbar = new QScrollBar(this); 294 scrollbar = new QScrollBar(this);
295 scrollbar->setCursor( arrowCursor ); 295 scrollbar->setCursor( arrowCursor );
296 connect(scrollbar, SIGNAL(valueChanged(int)), this, SLOT(scrollChanged(int))); 296 connect(scrollbar, SIGNAL(valueChanged(int)), this, SLOT(scrollChanged(int)));
297 297
298 hScrollbar = new QScrollBar(this); 298 hScrollbar = new QScrollBar(this);
299 hScrollbar->setCursor( arrowCursor ); 299 hScrollbar->setCursor( arrowCursor );
300 hScrollbar->setOrientation(QScrollBar::Horizontal); 300 hScrollbar->setOrientation(QScrollBar::Horizontal);
301 // hScrollbar->setMaximumHeight(16); 301 // hScrollbar->setMaximumHeight(16);
302 302
303 connect( hScrollbar, SIGNAL(valueChanged(int)), this, SLOT( hScrollChanged(int))); 303 connect( hScrollbar, SIGNAL(valueChanged(int)), this, SLOT( hScrollChanged(int)));
304 304
305 Config cfg( "Konsole" ); 305 Config cfg( "Konsole" );
306 cfg.setGroup("ScrollBar"); 306 cfg.setGroup("ScrollBar");
307 switch( cfg.readNumEntry("Position",2)){ 307 switch( cfg.readNumEntry("Position",2)){
308 case 0: 308 case 0:
309 scrollLoc = SCRNONE; 309 scrollLoc = SCRNONE;
310 break; 310 break;
311 case 1: 311 case 1:
312 scrollLoc = SCRLEFT; 312 scrollLoc = SCRLEFT;
313 break; 313 break;
314 case 2: 314 case 2:
315 scrollLoc = SCRRIGHT; 315 scrollLoc = SCRRIGHT;
316 break; 316 break;
317 }; 317 };
318 318
319 useHorzScroll=cfg.readBoolEntry("HorzScroll",0); 319 useHorzScroll=cfg.readBoolEntry("HorzScroll",0);
320 320
321 blinkT = new QTimer(this); 321 blinkT = new QTimer(this);
322 connect(blinkT, SIGNAL(timeout()), this, SLOT(blinkEvent())); 322 connect(blinkT, SIGNAL(timeout()), this, SLOT(blinkEvent()));
323 // blinking = FALSE; 323 // blinking = FALSE;
324 blinking = TRUE; 324 blinking = TRUE;
325 325
326 resizing = FALSE; 326 resizing = FALSE;
327 actSel = 0; 327 actSel = 0;
328 image = 0; 328 image = 0;
329 lines = 1; 329 lines = 1;
330 columns = 1; 330 columns = 1;
331 font_w = 1; 331 font_w = 1;
332 font_h = 1; 332 font_h = 1;
333 font_a = 1; 333 font_a = 1;
334 word_selection_mode = FALSE; 334 word_selection_mode = FALSE;
335 hposition = 0; 335 hposition = 0;
336 vcolumns = 0; 336 vcolumns = 0;
337 useBeep = true; 337 useBeep = true;
338 338
339 setMouseMarks(TRUE); 339 setMouseMarks(TRUE);
340 setVTFont( QFont("fixed") ); 340 setVTFont( QFont("fixed") );
341 setColorTable(base_color_table); // init color table 341 setColorTable(base_color_table); // init color table
342 342
343 qApp->installEventFilter( this ); //FIXME: see below 343 qApp->installEventFilter( this ); //FIXME: see below
344// KCursor::setAutoHideCursor( this, true ); 344// KCursor::setAutoHideCursor( this, true );
345 345
346 // Init DnD //////////////////////////////////////////////////////////////// 346 // Init DnD ////////////////////////////////////////////////////////////////
347 currentSession = NULL; 347 currentSession = NULL;
348// setAcceptDrops(true); // attempt 348// setAcceptDrops(true); // attempt
349// m_drop = new QPopupMenu(this); 349// m_drop = new QPopupMenu(this);
350// m_drop->insertItem( QString("Paste"), 0); 350// m_drop->insertItem( QString("Paste"), 0);
351// m_drop->insertItem( QString("cd"), 1); 351// m_drop->insertItem( QString("cd"), 1);
352// connect(m_drop, SIGNAL(activated(int)), SLOT(drop_menu_activated(int))); 352// connect(m_drop, SIGNAL(activated(int)), SLOT(drop_menu_activated(int)));
353 353
354 // we need focus so that the auto-hide cursor feature works 354 // we need focus so that the auto-hide cursor feature works
355 setFocus(); 355 setFocus();
356 setFocusPolicy( WheelFocus ); 356 setFocusPolicy( WheelFocus );
357} 357}
358 358
359//FIXME: make proper destructor 359//FIXME: make proper destructor
360// Here's a start (David) 360// Here's a start (David)
361TEWidget::~TEWidget() 361TEWidget::~TEWidget()
362{ 362{
363 qApp->removeEventFilter( this ); 363 qApp->removeEventFilter( this );
364 if (image) free(image); 364 if (image) free(image);
365} 365}
366 366
367/* ------------------------------------------------------------------------- */ 367/* ------------------------------------------------------------------------- */
368/* */ 368/* */
369/* Display Operations */ 369/* Display Operations */
370/* */ 370/* */
371/* ------------------------------------------------------------------------- */ 371/* ------------------------------------------------------------------------- */
372 372
373/*! 373/*!
374 attributed string draw primitive 374 attributed string draw primitive
375*/ 375*/
376 376
377void TEWidget::drawAttrStr(QPainter &paint, QRect rect, 377void TEWidget::drawAttrStr(QPainter &paint, QRect rect,
378 QString& str, ca attr, BOOL pm, BOOL clear) 378 QString& str, ca attr, BOOL pm, BOOL clear)
379{ 379{
380 if (pm && color_table[attr.b].transparent) 380 if (pm && color_table[attr.b].transparent)
381 { 381 {
382 paint.setBackgroundMode( TransparentMode ); 382 paint.setBackgroundMode( TransparentMode );
383 if (clear) erase(rect); 383 if (clear) erase(rect);
384 } 384 }
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp
index cabeb20..c7273c5 100644
--- a/core/apps/textedit/textedit.cpp
+++ b/core/apps/textedit/textedit.cpp
@@ -1,176 +1,176 @@
1/********************************************************************** 1/**********************************************************************
2// textedit.cpp 2// textedit.cpp
3** Copyright (C) 2000 Trolltech AS. All rights reserved. 3** Copyright (C) 2000 Trolltech AS. All rights reserved.
4** 4**
5** This file is part of Opie Environment. 5** This file is part of Opie Environment.
6** 6**
7** This file may be distributed and/or modified under the terms of the 7** This file may be distributed and/or modified under the terms of the
8** GNU General Public License version 2 as published by the Free Software 8** GNU General Public License version 2 as published by the Free Software
9** Foundation and appearing in the file LICENSE.GPL included in the 9** Foundation and appearing in the file LICENSE.GPL included in the
10** packaging of this file. 10** packaging of this file.
11** 11**
12**********************************************************************/ 12**********************************************************************/
13// changes added by L. J. Potter Sun 02-17-2002 21:31:31 13// changes added by L. J. Potter Sun 02-17-2002 21:31:31
14 14
15#include "textedit.h" 15#include "textedit.h"
16#include "filePermissions.h" 16#include "filePermissions.h"
17 17
18/* OPIE */ 18/* OPIE */
19#include <opie2/odebug.h> 19#include <opie2/odebug.h>
20#include <opie2/ofileselector.h> 20#include <opie2/ofileselector.h>
21#include <opie2/ofiledialog.h> 21#include <opie2/ofiledialog.h>
22#include <opie2/ofontselector.h> 22#include <opie2/ofontselector.h>
23#include <qpe/resource.h> 23#include <qpe/resource.h>
24#include <qpe/config.h> 24#include <qpe/config.h>
25#include <qpe/qpeapplication.h> 25#include <qpe/qpeapplication.h>
26 26
27 27
28/* QT */ 28/* QT */
29#include <qmenubar.h> 29#include <qmenubar.h>
30#include <qtoolbar.h> 30#include <qtoolbar.h>
31#include <qtextstream.h> 31#include <qtextstream.h>
32#include <qclipboard.h> 32#include <qclipboard.h>
33#include <qaction.h> 33#include <qaction.h>
34#include <qlineedit.h> 34#include <qlineedit.h>
35#include <qmessagebox.h> 35#include <qmessagebox.h>
36#include <qlayout.h> 36#include <qlayout.h>
37#include <qtimer.h> 37#include <qtimer.h>
38#include <qdir.h> 38#include <qdir.h>
39 39
40/* STD */ 40/* STD */
41#include <unistd.h> 41#include <unistd.h>
42#include <sys/stat.h> 42#include <sys/stat.h>
43#include <stdlib.h> //getenv 43#include <stdlib.h> //getenv
44 44
45using namespace Opie::Core; 45using namespace Opie::Core;
46using namespace Opie::Ui; 46using namespace Opie::Ui;
47 47
48#if QT_VERSION < 300 48#if QT_VERSION < 0x030000
49class QpeEditor : public QMultiLineEdit 49class QpeEditor : public QMultiLineEdit
50{ 50{
51 51
52public: 52public:
53 QpeEditor( QWidget *parent, const char * name = 0 ) 53 QpeEditor( QWidget *parent, const char * name = 0 )
54 : QMultiLineEdit( parent, name ) { 54 : QMultiLineEdit( parent, name ) {
55 clearTableFlags(); 55 clearTableFlags();
56 setTableFlags( Tbl_vScrollBar | Tbl_autoHScrollBar ); 56 setTableFlags( Tbl_vScrollBar | Tbl_autoHScrollBar );
57} 57}
58 58
59 void find( const QString &txt, bool caseSensitive, 59 void find( const QString &txt, bool caseSensitive,
60 bool backwards ); 60 bool backwards );
61protected: 61protected:
62 bool markIt; 62 bool markIt;
63 int line1, line2, col1, col2; 63 int line1, line2, col1, col2;
64 void mousePressEvent( QMouseEvent * ); 64 void mousePressEvent( QMouseEvent * );
65 void mouseReleaseEvent( QMouseEvent * ); 65 void mouseReleaseEvent( QMouseEvent * );
66 66
67//public slots: 67//public slots:
68 /* 68 /*
69signals: 69signals:
70 void notFound(); 70 void notFound();
71 void searchWrapped(); 71 void searchWrapped();
72 */ 72 */
73 73
74private: 74private:
75 75
76}; 76};
77 77
78void QpeEditor::mousePressEvent( QMouseEvent *e ) { 78void QpeEditor::mousePressEvent( QMouseEvent *e ) {
79 switch(e->button()) { 79 switch(e->button()) {
80 case RightButton: 80 case RightButton:
81 { //rediculous workaround for qt popup menu 81 { //rediculous workaround for qt popup menu
82 //and the hold right click mechanism 82 //and the hold right click mechanism
83 this->setSelection( line1, col1, line2, col2); 83 this->setSelection( line1, col1, line2, col2);
84 QMultiLineEdit::mousePressEvent( e ); 84 QMultiLineEdit::mousePressEvent( e );
85 markIt = false; 85 markIt = false;
86 } 86 }
87 break; 87 break;
88 default: 88 default:
89 { 89 {
90 if(!markIt) { 90 if(!markIt) {
91 int line, col; 91 int line, col;
92 this->getCursorPosition(&line, &col); 92 this->getCursorPosition(&line, &col);
93 line1=line2=line; 93 line1=line2=line;
94 col1=col2=col; 94 col1=col2=col;
95 } 95 }
96 QMultiLineEdit::mousePressEvent( e ); 96 QMultiLineEdit::mousePressEvent( e );
97 } 97 }
98 break; 98 break;
99 }; 99 };
100} 100}
101 101
102void QpeEditor::mouseReleaseEvent( QMouseEvent * ) { 102void QpeEditor::mouseReleaseEvent( QMouseEvent * ) {
103 if(this->hasMarkedText()) { 103 if(this->hasMarkedText()) {
104 markIt = true; 104 markIt = true;
105 this->getMarkedRegion( &line1, &col1, &line2, & col2 ); 105 this->getMarkedRegion( &line1, &col1, &line2, & col2 );
106 } else { 106 } else {
107 markIt = false; 107 markIt = false;
108 } 108 }
109} 109}
110 110
111void QpeEditor::find ( const QString &txt, bool caseSensitive, 111void QpeEditor::find ( const QString &txt, bool caseSensitive,
112 bool backwards ) 112 bool backwards )
113{ 113{
114 static bool wrap = false; 114 static bool wrap = false;
115 int line, col; 115 int line, col;
116 if ( wrap ) { 116 if ( wrap ) {
117 if ( !backwards ) 117 if ( !backwards )
118 line = col = 0; 118 line = col = 0;
119 wrap = false; 119 wrap = false;
120 // emit searchWrapped(); 120 // emit searchWrapped();
121 } else { 121 } else {
122 getCursorPosition( &line, &col ); 122 getCursorPosition( &line, &col );
123 } 123 }
124 //ignore backwards for now.... 124 //ignore backwards for now....
125 if ( !backwards ) { 125 if ( !backwards ) {
126 for ( ; ; ) { 126 for ( ; ; ) {
127 if ( line >= numLines() ) { 127 if ( line >= numLines() ) {
128 wrap = true; 128 wrap = true;
129 //emit notFound(); 129 //emit notFound();
130 break; 130 break;
131 } 131 }
132 int findCol = getString( line )->find( txt, col, caseSensitive ); 132 int findCol = getString( line )->find( txt, col, caseSensitive );
133 if ( findCol >= 0 ) { 133 if ( findCol >= 0 ) {
134 setCursorPosition( line, findCol, false ); 134 setCursorPosition( line, findCol, false );
135 col = findCol + txt.length(); 135 col = findCol + txt.length();
136 setCursorPosition( line, col, true ); 136 setCursorPosition( line, col, true );
137 137
138 //found = true; 138 //found = true;
139 break; 139 break;
140 } 140 }
141 line++; 141 line++;
142 col = 0; 142 col = 0;
143 } 143 }
144 } 144 }
145} 145}
146 146
147 147
148#else 148#else
149 149
150#error "Must make a QpeEditor that inherits QTextEdit" 150#error "Must make a QpeEditor that inherits QTextEdit"
151 151
152#endif 152#endif
153 153
154 154
155static const int nfontsizes = 6; 155static const int nfontsizes = 6;
156static const int fontsize[nfontsizes] = {8,10,12,14,18,24}; 156static const int fontsize[nfontsizes] = {8,10,12,14,18,24};
157 157
158TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f ) 158TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f )
159 : QMainWindow( parent, name, f ), bFromDocView( false ) 159 : QMainWindow( parent, name, f ), bFromDocView( false )
160{ 160{
161 doc = 0; 161 doc = 0;
162 edited=false; 162 edited=false;
163 fromSetDocument=false; 163 fromSetDocument=false;
164 164
165 setToolBarsMovable( false ); 165 setToolBarsMovable( false );
166 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); 166 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
167 167
168 channel = new QCopChannel( "QPE/Application/textedit", this ); 168 channel = new QCopChannel( "QPE/Application/textedit", this );
169 connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), 169 connect( channel, SIGNAL(received(const QCString&,const QByteArray&)),
170 this, SLOT(receive(const QCString&,const QByteArray&)) ); 170 this, SLOT(receive(const QCString&,const QByteArray&)) );
171 171
172 setIcon( Resource::loadPixmap( "TextEditor" ) ); 172 setIcon( Resource::loadPixmap( "TextEditor" ) );
173 173
174 QToolBar *bar = new QToolBar( this ); 174 QToolBar *bar = new QToolBar( this );
175 bar->setHorizontalStretchable( true ); 175 bar->setHorizontalStretchable( true );
176 menu = bar; 176 menu = bar;
diff --git a/core/opie-login/loginwindowimpl.cpp b/core/opie-login/loginwindowimpl.cpp
index 73c2cbe..ac24894 100644
--- a/core/opie-login/loginwindowimpl.cpp
+++ b/core/opie-login/loginwindowimpl.cpp
@@ -1,262 +1,262 @@
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 Robert Griebl <sandman@handhelds.org> 3             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org>
4           .>+-= 4           .>+-=
5 _;:,     .>    :=|. This file is free software; you can 5 _;:,     .>    :=|. This file is free software; you can
6.> <`_,   >  .   <= redistribute it and/or modify it under 6.> <`_,   >  .   <= redistribute it and/or modify it under
7:`=1 )Y*s>-.--   : the terms of the GNU General Public 7:`=1 )Y*s>-.--   : the terms of the GNU General Public
8.="- .-=="i,     .._ License as published by the Free Software 8.="- .-=="i,     .._ License as published by the Free Software
9 - .   .-<_>     .<> Foundation; either version 2 of the License, 9 - .   .-<_>     .<> Foundation; either version 2 of the License,
10     ._= =}       : or (at your option) any later version. 10     ._= =}       : or (at your option) any later version.
11    .%`+i>       _;_. 11    .%`+i>       _;_.
12    .i_,=:_.      -<s. This file is distributed in the hope that 12    .i_,=:_.      -<s. This file is distributed in the hope that
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
14    : ..    .:,     . . . without even the implied warranty of 14    : ..    .:,     . . . without even the implied warranty of
15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General 16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
17..}^=.=       =       ; Public License for more details. 17..}^=.=       =       ; Public License for more details.
18++=   -.     .`     .: 18++=   -.     .`     .:
19 :     =  ...= . :.=- You should have received a copy of the GNU 19 :     =  ...= . :.=- You should have received a copy of the GNU
20 -.   .:....=;==+<; General Public License along with this file; 20 -.   .:....=;==+<; General Public License along with this file;
21  -_. . .   )=.  = see the file COPYING. If not, write to the 21  -_. . .   )=.  = see the file COPYING. If not, write to the
22    --        :-=` Free Software Foundation, Inc., 22    --        :-=` Free Software Foundation, Inc.,
23 59 Temple Place - Suite 330, 23 59 Temple Place - Suite 330,
24 Boston, MA 02111-1307, USA. 24 Boston, MA 02111-1307, USA.
25 25
26*/ 26*/
27#include <qpe/version.h> 27#include <qpe/version.h>
28#include <qpushbutton.h> 28#include <qpushbutton.h>
29#include <qlayout.h> 29#include <qlayout.h>
30#include <qlineedit.h> 30#include <qlineedit.h>
31#include <qtimer.h> 31#include <qtimer.h>
32#include <qcombobox.h> 32#include <qcombobox.h>
33#include <qlabel.h> 33#include <qlabel.h>
34#include <qpopupmenu.h> 34#include <qpopupmenu.h>
35#include <qmessagebox.h> 35#include <qmessagebox.h>
36#if QT_VERSION < 300 36#if QT_VERSION < 0x030000
37#include <qgfx_qws.h> 37#include <qgfx_qws.h>
38#endif 38#endif
39#include <qwindowsystem_qws.h> 39#include <qwindowsystem_qws.h>
40 40
41#include <qpe/resource.h> 41#include <qpe/resource.h>
42#include <qpe/qcopenvelope_qws.h> 42#include <qpe/qcopenvelope_qws.h>
43#include <qpe/config.h> 43#include <qpe/config.h>
44 44
45#include <opie2/odevice.h> 45#include <opie2/odevice.h>
46 46
47#include <stdio.h> 47#include <stdio.h>
48#include <stdlib.h> 48#include <stdlib.h>
49 49
50#include "passworddialogimpl.h" 50#include "passworddialogimpl.h"
51#include "loginwindowimpl.h" 51#include "loginwindowimpl.h"
52#include "loginapplication.h" 52#include "loginapplication.h"
53#include "inputmethods.h" 53#include "inputmethods.h"
54 54
55using namespace Opie::Core; 55using namespace Opie::Core;
56 56
57 57
58LoginWindowImpl::LoginWindowImpl ( ) : LoginWindow ( 0, "LOGIN-WINDOW", WStyle_Customize | WStyle_NoBorder | WDestructiveClose ) 58LoginWindowImpl::LoginWindowImpl ( ) : LoginWindow ( 0, "LOGIN-WINDOW", WStyle_Customize | WStyle_NoBorder | WDestructiveClose )
59{ 59{
60 QPopupMenu *pop = new QPopupMenu ( this ); 60 QPopupMenu *pop = new QPopupMenu ( this );
61 pop-> insertItem ( tr( "Restart" ), this, SLOT( restart())); 61 pop-> insertItem ( tr( "Restart" ), this, SLOT( restart()));
62 pop-> insertItem ( tr( "Quit" ), this, SLOT( quit())); 62 pop-> insertItem ( tr( "Quit" ), this, SLOT( quit()));
63 m_menu-> setPopup ( pop ); 63 m_menu-> setPopup ( pop );
64 64
65 QCopChannel *channel = new QCopChannel ( "QPE/TaskBar", this ); 65 QCopChannel *channel = new QCopChannel ( "QPE/TaskBar", this );
66 connect ( channel, SIGNAL( received(const QCString&,const QByteArray&)), this, SLOT( receive(const QCString&,const QByteArray&))); 66 connect ( channel, SIGNAL( received(const QCString&,const QByteArray&)), this, SLOT( receive(const QCString&,const QByteArray&)));
67 67
68 QHBoxLayout *lay = new QHBoxLayout ( m_taskbar, 4, 4 ); 68 QHBoxLayout *lay = new QHBoxLayout ( m_taskbar, 4, 4 );
69 m_input = new InputMethods ( m_taskbar ); 69 m_input = new InputMethods ( m_taskbar );
70 connect ( m_input, SIGNAL( inputToggled(bool)), this, SLOT( calcMaxWindowRect())); 70 connect ( m_input, SIGNAL( inputToggled(bool)), this, SLOT( calcMaxWindowRect()));
71 lay-> addWidget ( m_input ); 71 lay-> addWidget ( m_input );
72 lay-> addStretch ( 10 ); 72 lay-> addStretch ( 10 );
73 73
74 setActiveWindow ( ); 74 setActiveWindow ( );
75 m_password-> setFocus ( ); 75 m_password-> setFocus ( );
76 76
77 m_user-> insertStringList ( lApp-> allUsers ( )); 77 m_user-> insertStringList ( lApp-> allUsers ( ));
78 78
79 //there is no point in displaying the IM for a zaurus 79 //there is no point in displaying the IM for a zaurus
80 if (ODevice::inst ( )-> series ( ) != Model_Zaurus){ 80 if (ODevice::inst ( )-> series ( ) != Model_Zaurus){
81 QTimer::singleShot ( 0, this, SLOT( showIM())); 81 QTimer::singleShot ( 0, this, SLOT( showIM()));
82 } 82 }
83 83
84 QString opiedir = ::getenv ( "OPIEDIR" ); 84 QString opiedir = ::getenv ( "OPIEDIR" );
85 QPixmap bgpix ( opiedir + "/pics/launcher/opie-background.jpg" ); 85 QPixmap bgpix ( opiedir + "/pics/launcher/opie-background.jpg" );
86 86
87 if ( !bgpix. isNull ( )) { 87 if ( !bgpix. isNull ( )) {
88 setBackgroundPixmap ( bgpix ); 88 setBackgroundPixmap ( bgpix );
89 m_caption-> setBackgroundPixmap ( bgpix); 89 m_caption-> setBackgroundPixmap ( bgpix);
90 TextLabel1-> setBackgroundPixmap ( bgpix); 90 TextLabel1-> setBackgroundPixmap ( bgpix);
91 TextLabel2-> setBackgroundPixmap ( bgpix); 91 TextLabel2-> setBackgroundPixmap ( bgpix);
92 } 92 }
93 93
94 //m_caption-> setText ( tr("<center>Welcome to OPIE %1</center><center>& %2 %3</center>"). arg(QPE_VERSION). arg ( ODevice::inst ( )-> systemString ( )). arg ( ODevice::inst ( )-> systemVersionString ( ))); 94 //m_caption-> setText ( tr("<center>Welcome to OPIE %1</center><center>& %2 %3</center>"). arg(QPE_VERSION). arg ( ODevice::inst ( )-> systemString ( )). arg ( ODevice::inst ( )-> systemVersionString ( )));
95 95
96 Config cfg ( "opie-login" ); 96 Config cfg ( "opie-login" );
97 cfg. setGroup ( "General" ); 97 cfg. setGroup ( "General" );
98 QString last = cfg. readEntry ( "LastLogin" ); 98 QString last = cfg. readEntry ( "LastLogin" );
99 99
100 if ( !last. isEmpty ( )) 100 if ( !last. isEmpty ( ))
101 m_user-> setEditText ( last ); 101 m_user-> setEditText ( last );
102 102
103 calcMaxWindowRect ( ); 103 calcMaxWindowRect ( );
104 104
105 if ( PasswordDialogImpl::needDialog() ) 105 if ( PasswordDialogImpl::needDialog() )
106 QTimer::singleShot(10, this, SLOT(showPasswordDialog()) ); 106 QTimer::singleShot(10, this, SLOT(showPasswordDialog()) );
107 107
108 108
109} 109}
110 110
111LoginWindowImpl::~LoginWindowImpl ( ) 111LoginWindowImpl::~LoginWindowImpl ( )
112{ 112{
113} 113}
114 114
115 115
116void LoginWindowImpl::receive ( const QCString &msg, const QByteArray &data ) 116void LoginWindowImpl::receive ( const QCString &msg, const QByteArray &data )
117{ 117{
118 QDataStream stream ( data, IO_ReadOnly ); 118 QDataStream stream ( data, IO_ReadOnly );
119 119
120 if ( msg == "hideInputMethod()" ) 120 if ( msg == "hideInputMethod()" )
121 m_input-> hideInputMethod ( ); 121 m_input-> hideInputMethod ( );
122 else if ( msg == "showInputMethod()" ) 122 else if ( msg == "showInputMethod()" )
123 m_input-> showInputMethod ( ); 123 m_input-> showInputMethod ( );
124 else if ( msg == "reloadInputMethods()" ) 124 else if ( msg == "reloadInputMethods()" )
125 m_input-> loadInputMethods ( ); 125 m_input-> loadInputMethods ( );
126} 126}
127 127
128void LoginWindowImpl::calcMaxWindowRect ( ) 128void LoginWindowImpl::calcMaxWindowRect ( )
129{ 129{
130#ifdef Q_WS_QWS 130#ifdef Q_WS_QWS
131 QRect wr; 131 QRect wr;
132 int displayWidth = qApp-> desktop ( )-> width ( ); 132 int displayWidth = qApp-> desktop ( )-> width ( );
133 QRect ir = m_input-> inputRect ( ); 133 QRect ir = m_input-> inputRect ( );
134 if ( ir.isValid() ) 134 if ( ir.isValid() )
135 wr.setCoords( 0, 0, displayWidth-1, ir.top()-1 ); 135 wr.setCoords( 0, 0, displayWidth-1, ir.top()-1 );
136 else 136 else
137 wr.setCoords( 0, 0, displayWidth-1, m_taskbar->y()-1 ); 137 wr.setCoords( 0, 0, displayWidth-1, m_taskbar->y()-1 );
138 138
139#if QT_VERSION < 300 139#if QT_VERSION < 0x030000
140 wr = qt_screen-> mapToDevice ( wr, QSize ( qt_screen-> width ( ), qt_screen-> height ( ))); 140 wr = qt_screen-> mapToDevice ( wr, QSize ( qt_screen-> width ( ), qt_screen-> height ( )));
141#endif 141#endif
142 142
143 QWSServer::setMaxWindowRect( wr ); 143 QWSServer::setMaxWindowRect( wr );
144#endif 144#endif
145} 145}
146 146
147 147
148void LoginWindowImpl::keyPressEvent ( QKeyEvent *e ) 148void LoginWindowImpl::keyPressEvent ( QKeyEvent *e )
149{ 149{
150 switch ( e-> key ( )) { 150 switch ( e-> key ( )) {
151 case HardKey_Suspend: suspend ( ); 151 case HardKey_Suspend: suspend ( );
152 break; 152 break;
153 case HardKey_Backlight: backlight ( ); 153 case HardKey_Backlight: backlight ( );
154 break; 154 break;
155 default: e-> ignore ( ); 155 default: e-> ignore ( );
156 break; 156 break;
157 } 157 }
158 LoginWindow::keyPressEvent ( e ); 158 LoginWindow::keyPressEvent ( e );
159} 159}
160 160
161 161
162void LoginWindowImpl::toggleEchoMode ( bool t ) 162void LoginWindowImpl::toggleEchoMode ( bool t )
163{ 163{
164 m_password-> setEchoMode ( t ? QLineEdit::Normal : QLineEdit::Password ); 164 m_password-> setEchoMode ( t ? QLineEdit::Normal : QLineEdit::Password );
165} 165}
166 166
167void LoginWindowImpl::showIM ( ) 167void LoginWindowImpl::showIM ( )
168{ 168{
169 m_input-> showInputMethod ( ); 169 m_input-> showInputMethod ( );
170} 170}
171 171
172void LoginWindowImpl::restart ( ) 172void LoginWindowImpl::restart ( )
173{ 173{
174 qApp-> quit ( ); 174 qApp-> quit ( );
175} 175}
176 176
177void LoginWindowImpl::quit ( ) 177void LoginWindowImpl::quit ( )
178{ 178{
179 lApp-> quitToConsole ( ); 179 lApp-> quitToConsole ( );
180} 180}
181 181
182void LoginWindowImpl::suspend ( ) 182void LoginWindowImpl::suspend ( )
183{ 183{
184 ODevice::inst ( )-> suspend ( ); 184 ODevice::inst ( )-> suspend ( );
185 185
186 QCopEnvelope e("QPE/System", "setBacklight(int)"); 186 QCopEnvelope e("QPE/System", "setBacklight(int)");
187 e << -3; // Force on 187 e << -3; // Force on
188} 188}
189 189
190void LoginWindowImpl::backlight ( ) 190void LoginWindowImpl::backlight ( )
191{ 191{
192 QCopEnvelope e("QPE/System", "setBacklight(int)"); 192 QCopEnvelope e("QPE/System", "setBacklight(int)");
193 e << -2; // toggle 193 e << -2; // toggle
194} 194}
195 195
196class WaitLogo : public QLabel { 196class WaitLogo : public QLabel {
197public: 197public:
198 WaitLogo ( ) : QLabel ( 0, "wait hack!", WStyle_Customize | WStyle_NoBorder | WStyle_Tool ) 198 WaitLogo ( ) : QLabel ( 0, "wait hack!", WStyle_Customize | WStyle_NoBorder | WStyle_Tool )
199 { 199 {
200 QImage img = Resource::loadImage ( "launcher/new_wait" ); 200 QImage img = Resource::loadImage ( "launcher/new_wait" );
201 QPixmap pix; 201 QPixmap pix;
202 pix. convertFromImage ( img ); 202 pix. convertFromImage ( img );
203 setPixmap ( pix ); 203 setPixmap ( pix );
204 setAlignment ( AlignCenter ); 204 setAlignment ( AlignCenter );
205 move ( 0, 0 ); 205 move ( 0, 0 );
206 resize ( qApp-> desktop ( )-> width ( ), qApp-> desktop ( )-> height ( )); 206 resize ( qApp-> desktop ( )-> width ( ), qApp-> desktop ( )-> height ( ));
207 207
208 m_visible = false; 208 m_visible = false;
209 show ( ); 209 show ( );
210 } 210 }
211 211
212 virtual void showEvent ( QShowEvent *e ) 212 virtual void showEvent ( QShowEvent *e )
213 { 213 {
214 QLabel::showEvent ( e ); 214 QLabel::showEvent ( e );
215 m_visible = true; 215 m_visible = true;
216 } 216 }
217 217
218 virtual void paintEvent ( QPaintEvent *e ) 218 virtual void paintEvent ( QPaintEvent *e )
219 { 219 {
220 QLabel::paintEvent ( e ); 220 QLabel::paintEvent ( e );
221 if ( m_visible ) 221 if ( m_visible )
222 qApp-> quit ( ); 222 qApp-> quit ( );
223 } 223 }
224 224
225private: 225private:
226 bool m_visible; 226 bool m_visible;
227}; 227};
228 228
229void LoginWindowImpl::login ( ) 229void LoginWindowImpl::login ( )
230{ 230{
231 const char *user = ::strdup ( m_user-> currentText ( ). local8Bit ( )); 231 const char *user = ::strdup ( m_user-> currentText ( ). local8Bit ( ));
232 const char *pass = ::strdup ( m_password-> text ( ). local8Bit ( )); 232 const char *pass = ::strdup ( m_password-> text ( ). local8Bit ( ));
233 233
234 if ( !user || !user [0] ) 234 if ( !user || !user [0] )
235 return; 235 return;
236 if ( !pass ) 236 if ( !pass )
237 pass = ""; 237 pass = "";
238 238
239 if ( lApp-> checkPassword ( user, pass )) { 239 if ( lApp-> checkPassword ( user, pass )) {
240 Config cfg ( "opie-login" ); 240 Config cfg ( "opie-login" );
241 cfg. setGroup ( "General" ); 241 cfg. setGroup ( "General" );
242 cfg. writeEntry ( "LastLogin", user ); 242 cfg. writeEntry ( "LastLogin", user );
243 cfg. write ( ); 243 cfg. write ( );
244 244
245 lApp-> setLoginAs ( user ); 245 lApp-> setLoginAs ( user );
246 246
247 // Draw a big wait icon, the image can be altered in later revisions 247 // Draw a big wait icon, the image can be altered in later revisions
248 m_input-> hideInputMethod ( ); 248 m_input-> hideInputMethod ( );
249 new WaitLogo ( ); 249 new WaitLogo ( );
250 // WaitLogo::showEvent() calls qApp-> quit() 250 // WaitLogo::showEvent() calls qApp-> quit()
251 } 251 }
252 else { 252 else {
253 QMessageBox::warning ( this, tr( "Wrong password" ), tr( "The given password is incorrect." )); 253 QMessageBox::warning ( this, tr( "Wrong password" ), tr( "The given password is incorrect." ));
254 m_password-> clear ( ); 254 m_password-> clear ( );
255 } 255 }
256} 256}
257 257
258void LoginWindowImpl::showPasswordDialog() { 258void LoginWindowImpl::showPasswordDialog() {
259 PasswordDialogImpl dia( this ); 259 PasswordDialogImpl dia( this );
260 dia.showMaximized(); 260 dia.showMaximized();
261 dia.exec(); 261 dia.exec();
262} 262}
diff --git a/freetype/fontfactoryttf_qws.h b/freetype/fontfactoryttf_qws.h
index 208ab61..ff0fcfc 100644
--- a/freetype/fontfactoryttf_qws.h
+++ b/freetype/fontfactoryttf_qws.h
@@ -1,63 +1,63 @@
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 21
22#ifndef FONTFACTORY_FT_H 22#ifndef FONTFACTORY_FT_H
23#define FONTFACTORY_FT_H 23#define FONTFACTORY_FT_H
24 24
25#include <qfontmanager_qws.h> 25#include <qfontmanager_qws.h>
26#if QT_VERSION >= 300 26#if QT_VERSION >= 0x030000
27# include <private/qfontdata_p.h> 27# include <private/qfontdata_p.h>
28#else 28#else
29# include "qfontdata_p.h" 29# include "qfontdata_p.h"
30#endif 30#endif
31 31
32 32
33#ifdef QT_NO_FREETYPE 33#ifdef QT_NO_FREETYPE
34 34
35extern "C" { 35extern "C" {
36#include <freetype/freetype.h> 36#include <freetype/freetype.h>
37} 37}
38 38
39// ascent, descent, width(ch), width(string), maxwidth? 39// ascent, descent, width(ch), width(string), maxwidth?
40// leftbearing, rightbearing, minleftbearing,minrightbearing 40// leftbearing, rightbearing, minleftbearing,minrightbearing
41// leading 41// leading
42 42
43class QFontFactoryFT : public QFontFactory { 43class QFontFactoryFT : public QFontFactory {
44 44
45public: 45public:
46 46
47 QFontFactoryFT(); 47 QFontFactoryFT();
48 virtual ~QFontFactoryFT(); 48 virtual ~QFontFactoryFT();
49 49
50 QRenderedFont * get(const QFontDef &,QDiskFont *); 50 QRenderedFont * get(const QFontDef &,QDiskFont *);
51 virtual void load(QDiskFont *) const; 51 virtual void load(QDiskFont *) const;
52 virtual QString name(); 52 virtual QString name();
53 53
54private: 54private:
55 55
56 friend class QRenderedFontFT; 56 friend class QRenderedFontFT;
57 FT_Library library; 57 FT_Library library;
58}; 58};
59 59
60#endif // QT_NO_FREETYPE 60#endif // QT_NO_FREETYPE
61 61
62#endif // QFONTFACTORY_FT_H 62#endif // QFONTFACTORY_FT_H
63 63
diff --git a/libopie2/opieui/oseparator.cpp b/libopie2/opieui/oseparator.cpp
index bbc4381..177368b 100644
--- a/libopie2/opieui/oseparator.cpp
+++ b/libopie2/opieui/oseparator.cpp
@@ -1,129 +1,129 @@
1/* 1/*
2                 This file is part of the Opie Project 2                 This file is part of the Opie Project
3              Copyright (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> 3              Copyright (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de>
4 Copyright (C) 1997 Michael Roth <mroth@wirlweb.de> 4 Copyright (C) 1997 Michael Roth <mroth@wirlweb.de>
5 =. 5 =.
6 .=l. 6 .=l.
7           .>+-= 7           .>+-=
8 _;:,     .>    :=|. This program is free software; you can 8 _;:,     .>    :=|. This program is free software; you can
9.> <`_,   >  .   <= redistribute it and/or modify it under 9.> <`_,   >  .   <= redistribute it and/or modify it under
10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11.="- .-=="i,     .._ License as published by the Free Software 11.="- .-=="i,     .._ License as published by the Free Software
12 - .   .-<_>     .<> Foundation; either version 2 of the License, 12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13     ._= =}       : or (at your option) any later version. 13     ._= =}       : or (at your option) any later version.
14    .%`+i>       _;_. 14    .%`+i>       _;_.
15    .i_,=:_.      -<s. This program is distributed in the hope that 15    .i_,=:_.      -<s. This program is distributed in the hope that
16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17    : ..    .:,     . . . without even the implied warranty of 17    : ..    .:,     . . . without even the implied warranty of
18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20..}^=.=       =       ; Library General Public License for more 20..}^=.=       =       ; Library General Public License for more
21++=   -.     .`     .: details. 21++=   -.     .`     .: details.
22 :     =  ...= . :.=- 22 :     =  ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU 23 -.   .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with 24  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB. 25    --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation, 26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330, 27 Inc., 59 Temple Place - Suite 330,
28 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
29 29
30*/ 30*/
31 31
32/* OPIE */ 32/* OPIE */
33 33
34#include <opie2/odebug.h> 34#include <opie2/odebug.h>
35#include <opie2/oseparator.h> 35#include <opie2/oseparator.h>
36 36
37/* QT */ 37/* QT */
38 38
39using namespace Opie::Core; 39using namespace Opie::Core;
40using namespace Opie::Ui; 40using namespace Opie::Ui;
41 41
42OSeparator::OSeparator(QWidget* parent, const char* name, WFlags f) 42OSeparator::OSeparator(QWidget* parent, const char* name, WFlags f)
43 : QFrame(parent, name, f) 43 : QFrame(parent, name, f)
44{ 44{
45 setLineWidth(1); 45 setLineWidth(1);
46 setMidLineWidth(0); 46 setMidLineWidth(0);
47 setOrientation( HLine ); 47 setOrientation( HLine );
48} 48}
49 49
50 50
51 51
52OSeparator::OSeparator(int orientation, QWidget* parent, const char* name, WFlags f) 52OSeparator::OSeparator(int orientation, QWidget* parent, const char* name, WFlags f)
53 : QFrame(parent, name, f) 53 : QFrame(parent, name, f)
54{ 54{
55 setLineWidth(1); 55 setLineWidth(1);
56 setMidLineWidth(0); 56 setMidLineWidth(0);
57 setOrientation( orientation ); 57 setOrientation( orientation );
58} 58}
59 59
60 60
61 61
62void OSeparator::setOrientation(int orientation) 62void OSeparator::setOrientation(int orientation)
63{ 63{
64 switch(orientation) 64 switch(orientation)
65 { 65 {
66 case Vertical: 66 case Vertical:
67 case VLine: 67 case VLine:
68 setFrameStyle( QFrame::VLine | QFrame::Sunken ); 68 setFrameStyle( QFrame::VLine | QFrame::Sunken );
69 setMinimumSize(2, 0); 69 setMinimumSize(2, 0);
70 break; 70 break;
71 71
72 default: 72 default:
73 owarn << "OSeparator::setOrientation(): invalid orientation, using default orientation HLine" << oendl; 73 owarn << "OSeparator::setOrientation(): invalid orientation, using default orientation HLine" << oendl;
74 74
75 case Horizontal: 75 case Horizontal:
76 case HLine: 76 case HLine:
77 setFrameStyle( QFrame::HLine | QFrame::Sunken ); 77 setFrameStyle( QFrame::HLine | QFrame::Sunken );
78 setMinimumSize(0, 2); 78 setMinimumSize(0, 2);
79 break; 79 break;
80 } 80 }
81} 81}
82 82
83 83
84 84
85int OSeparator::orientation() const 85int OSeparator::orientation() const
86{ 86{
87 if ( frameStyle() & VLine ) 87 if ( frameStyle() & VLine )
88 return VLine; 88 return VLine;
89 89
90 if ( frameStyle() & HLine ) 90 if ( frameStyle() & HLine )
91 return HLine; 91 return HLine;
92 92
93 return 0; 93 return 0;
94} 94}
95 95
96void OSeparator::drawFrame(QPainter *p) 96void OSeparator::drawFrame(QPainter *p)
97{ 97{
98 QPointp1, p2; 98 QPointp1, p2;
99 QRectr = frameRect(); 99 QRectr = frameRect();
100 const QColorGroup & g = colorGroup(); 100 const QColorGroup & g = colorGroup();
101 101
102 if ( frameStyle() & HLine ) { 102 if ( frameStyle() & HLine ) {
103 p1 = QPoint( r.x(), r.height()/2 ); 103 p1 = QPoint( r.x(), r.height()/2 );
104 p2 = QPoint( r.x()+r.width(), p1.y() ); 104 p2 = QPoint( r.x()+r.width(), p1.y() );
105 } 105 }
106 else { 106 else {
107 p1 = QPoint( r.x()+r.width()/2, 0 ); 107 p1 = QPoint( r.x()+r.width()/2, 0 );
108 p2 = QPoint( p1.x(), r.height() ); 108 p2 = QPoint( p1.x(), r.height() );
109 } 109 }
110 110
111#if QT_VERSION < 300 111#if QT_VERSION < 0x030000
112 style().drawSeparator( p, p1.x(), p1.y(), p2.x(), p2.y(), g, true, 1, midLineWidth() ); 112 style().drawSeparator( p, p1.x(), p1.y(), p2.x(), p2.y(), g, true, 1, midLineWidth() );
113#else 113#else
114 QStyleOption opt( lineWidth(), midLineWidth() ); 114 QStyleOption opt( lineWidth(), midLineWidth() );
115 style().drawPrimitive( QStyle::PE_Separator, p, QRect( p1, p2 ), g, QStyle::Style_Sunken, opt ); 115 style().drawPrimitive( QStyle::PE_Separator, p, QRect( p1, p2 ), g, QStyle::Style_Sunken, opt );
116#endif 116#endif
117} 117}
118 118
119 119
120QSize OSeparator::sizeHint() const 120QSize OSeparator::sizeHint() const
121{ 121{
122 if ( frameStyle() & VLine ) 122 if ( frameStyle() & VLine )
123 return QSize(2, 0); 123 return QSize(2, 0);
124 124
125 if ( frameStyle() & HLine ) 125 if ( frameStyle() & HLine )
126 return QSize(0, 2); 126 return QSize(0, 2);
127 127
128 return QSize(-1, -1); 128 return QSize(-1, -1);
129} 129}
diff --git a/libopie2/qt3/opieui/oeditlistbox.h b/libopie2/qt3/opieui/oeditlistbox.h
index 63fab11..c9c207d 100644
--- a/libopie2/qt3/opieui/oeditlistbox.h
+++ b/libopie2/qt3/opieui/oeditlistbox.h
@@ -1,158 +1,158 @@
1/* This file is part of the KDE libraries 1/* This file is part of the KDE libraries
2 Copyright (C) 2000 David Faure <faure@kde.org>, Alexander Neundorf <neundorf@kde.org> 2 Copyright (C) 2000 David Faure <faure@kde.org>, Alexander Neundorf <neundorf@kde.org>
3 3
4 This library is free software; you can redistribute it and/or 4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public 5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either 6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version. 7 version 2 of the License, or (at your option) any later version.
8 8
9 This library is distributed in the hope that it will be useful, 9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of 10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details. 12 Library General Public License for more details.
13 13
14 You should have received a copy of the GNU Library General Public License 14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to 15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 16 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, USA. 17 Boston, MA 02111-1307, USA.
18*/ 18*/
19 19
20#ifndef OEDITLISTBOX_H 20#ifndef OEDITLISTBOX_H
21#define OEDITLISTBOX_H 21#define OEDITLISTBOX_H
22 22
23#include <qgroupbox.h> 23#include <qgroupbox.h>
24#include <qlistbox.h> 24#include <qlistbox.h>
25 25
26class OLineEdit; 26class OLineEdit;
27class OComboBox; 27class OComboBox;
28class QPushButton; 28class QPushButton;
29 29
30#if QT_VERSION < 300 30#if QT_VERSION < 0x030000
31 enum StringComparisonMode { 31 enum StringComparisonMode {
32 CaseSensitive = 0x00001, // 0 0001 32 CaseSensitive = 0x00001, // 0 0001
33 BeginsWith = 0x00002, // 0 0010 33 BeginsWith = 0x00002, // 0 0010
34 EndsWith = 0x00004, // 0 0100 34 EndsWith = 0x00004, // 0 0100
35 Contains = 0x00008, // 0 1000 35 Contains = 0x00008, // 0 1000
36 ExactMatch = 0x00010 // 1 0000 36 ExactMatch = 0x00010 // 1 0000
37 }; 37 };
38#endif 38#endif
39 39
40class OEditListBoxPrivate; 40class OEditListBoxPrivate;
41/** 41/**
42 * An editable listbox 42 * An editable listbox
43 * 43 *
44 * This class provides a editable listbox ;-), this means 44 * This class provides a editable listbox ;-), this means
45 * a listbox which is accompanied by a line edit to enter new 45 * a listbox which is accompanied by a line edit to enter new
46 * items into the listbox and pushbuttons to add and remove 46 * items into the listbox and pushbuttons to add and remove
47 * items from the listbox and two buttons to move items up and down. 47 * items from the listbox and two buttons to move items up and down.
48 */ 48 */
49class OEditListBox : public QGroupBox 49class OEditListBox : public QGroupBox
50{ 50{
51 Q_OBJECT 51 Q_OBJECT
52 52
53public: 53public:
54 /// @since 3.1 54 /// @since 3.1
55 class CustomEditor 55 class CustomEditor
56 { 56 {
57 public: 57 public:
58 CustomEditor() 58 CustomEditor()
59 : m_representationWidget( 0L ), 59 : m_representationWidget( 0L ),
60 m_lineEdit( 0L ) {} 60 m_lineEdit( 0L ) {}
61 CustomEditor( QWidget *repWidget, OLineEdit *edit ) 61 CustomEditor( QWidget *repWidget, OLineEdit *edit )
62 : m_representationWidget( repWidget ), 62 : m_representationWidget( repWidget ),
63 m_lineEdit( edit ) {} 63 m_lineEdit( edit ) {}
64 CustomEditor( OComboBox *combo ); 64 CustomEditor( OComboBox *combo );
65 65
66 void setRepresentationWidget( QWidget *repWidget ) { 66 void setRepresentationWidget( QWidget *repWidget ) {
67 m_representationWidget = repWidget; 67 m_representationWidget = repWidget;
68 } 68 }
69 void setLineEdit( OLineEdit *edit ) { 69 void setLineEdit( OLineEdit *edit ) {
70 m_lineEdit = edit; 70 m_lineEdit = edit;
71 } 71 }
72 72
73 virtual QWidget *representationWidget() const { 73 virtual QWidget *representationWidget() const {
74 return m_representationWidget; 74 return m_representationWidget;
75 } 75 }
76 virtual OLineEdit *lineEdit() const { 76 virtual OLineEdit *lineEdit() const {
77 return m_lineEdit; 77 return m_lineEdit;
78 } 78 }
79 79
80 protected: 80 protected:
81 QWidget *m_representationWidget; 81 QWidget *m_representationWidget;
82 OLineEdit *m_lineEdit; 82 OLineEdit *m_lineEdit;
83 }; 83 };
84 84
85 public: 85 public:
86 86
87 /** 87 /**
88 * Enumeration of the buttons, the listbox offers. Specify them in the 88 * Enumeration of the buttons, the listbox offers. Specify them in the
89 * constructor in the buttons parameter. 89 * constructor in the buttons parameter.
90 */ 90 */
91 enum Button { Add = 1, Remove = 2, UpDown = 4, All = Add|Remove|UpDown }; 91 enum Button { Add = 1, Remove = 2, UpDown = 4, All = Add|Remove|UpDown };
92 92
93 /** 93 /**
94 * Create an editable listbox. 94 * Create an editable listbox.
95 * 95 *
96 * If @p checkAtEntering is true, after every character you type 96 * If @p checkAtEntering is true, after every character you type
97 * in the line edit OEditListBox will enable or disable 97 * in the line edit OEditListBox will enable or disable
98 * the Add-button, depending whether the current content of the 98 * the Add-button, depending whether the current content of the
99 * line edit is already in the listbox. Maybe this can become a 99 * line edit is already in the listbox. Maybe this can become a
100 * performance hit with large lists on slow machines. 100 * performance hit with large lists on slow machines.
101 * If @p checkAtEntering is false, 101 * If @p checkAtEntering is false,
102 * it will be checked if you press the Add-button. It is not 102 * it will be checked if you press the Add-button. It is not
103 * possible to enter items twice into the listbox. 103 * possible to enter items twice into the listbox.
104 */ 104 */
105 OEditListBox(QWidget *parent = 0, const char *name = 0, 105 OEditListBox(QWidget *parent = 0, const char *name = 0,
106 bool checkAtEntering=false, int buttons = All ); 106 bool checkAtEntering=false, int buttons = All );
107 /** 107 /**
108 * Create an editable listbox. 108 * Create an editable listbox.
109 * 109 *
110 * The same as the other constructor, additionally it takes 110 * The same as the other constructor, additionally it takes
111 * @title, which will be the title of the frame around the listbox. 111 * @title, which will be the title of the frame around the listbox.
112 */ 112 */
113 OEditListBox(const QString& title, QWidget *parent = 0, 113 OEditListBox(const QString& title, QWidget *parent = 0,
114 const char *name = 0, bool checkAtEntering=false, 114 const char *name = 0, bool checkAtEntering=false,
115 int buttons = All ); 115 int buttons = All );
116 116
117 /** 117 /**
118 * Another constructor, which allows to use a custom editing widget 118 * Another constructor, which allows to use a custom editing widget
119 * instead of the standard OLineEdit widget. E.g. you can use a 119 * instead of the standard OLineEdit widget. E.g. you can use a
120 * @ref OURLRequester or a @ref OComboBox as input widget. The custom 120 * @ref OURLRequester or a @ref OComboBox as input widget. The custom
121 * editor must consist of a lineedit and optionally another widget that 121 * editor must consist of a lineedit and optionally another widget that
122 * is used as representation. A OComboBox or a OURLRequester have a 122 * is used as representation. A OComboBox or a OURLRequester have a
123 * OLineEdit as child-widget for example, so the OComboBox is used as 123 * OLineEdit as child-widget for example, so the OComboBox is used as
124 * the representation widget. 124 * the representation widget.
125 * 125 *
126 * @see OURLRequester::customEditor() 126 * @see OURLRequester::customEditor()
127 * @since 3.1 127 * @since 3.1
128 */ 128 */
129 OEditListBox( const QString& title, 129 OEditListBox( const QString& title,
130 const CustomEditor &customEditor, 130 const CustomEditor &customEditor,
131 QWidget *parent = 0, const char *name = 0, 131 QWidget *parent = 0, const char *name = 0,
132 bool checkAtEntering = false, int buttons = All ); 132 bool checkAtEntering = false, int buttons = All );
133 133
134 virtual ~OEditListBox(); 134 virtual ~OEditListBox();
135 135
136 /** 136 /**
137 * Return a pointer to the embedded QListBox. 137 * Return a pointer to the embedded QListBox.
138 */ 138 */
139 QListBox* listBox() const { return m_listBox; } 139 QListBox* listBox() const { return m_listBox; }
140 /** 140 /**
141 * Return a pointer to the embedded QLineEdit. 141 * Return a pointer to the embedded QLineEdit.
142 */ 142 */
143 OLineEdit* lineEdit() const { return m_lineEdit; } 143 OLineEdit* lineEdit() const { return m_lineEdit; }
144 /** 144 /**
145 * Return a pointer to the Add button 145 * Return a pointer to the Add button
146 */ 146 */
147 QPushButton* addButton() const { return servNewButton; } 147 QPushButton* addButton() const { return servNewButton; }
148 /** 148 /**
149 * Return a pointer to the Remove button 149 * Return a pointer to the Remove button
150 */ 150 */
151 QPushButton* removeButton() const { return servRemoveButton; } 151 QPushButton* removeButton() const { return servRemoveButton; }
152 /** 152 /**
153 * Return a pointer to the Up button 153 * Return a pointer to the Up button
154 */ 154 */
155 QPushButton* upButton() const { return servUpButton; } 155 QPushButton* upButton() const { return servUpButton; }
156 /** 156 /**
157 * Return a pointer to the Down button 157 * Return a pointer to the Down button
158 */ 158 */
diff --git a/libopie2/qt3/opieui/ojanuswidget.cpp b/libopie2/qt3/opieui/ojanuswidget.cpp
index 063e393..8bdbc03 100644
--- a/libopie2/qt3/opieui/ojanuswidget.cpp
+++ b/libopie2/qt3/opieui/ojanuswidget.cpp
@@ -647,257 +647,257 @@ bool OJanusWidget::showPage( QWidget *w )
647 647
648 return( true ); 648 return( true );
649} 649}
650 650
651 651
652int OJanusWidget::activePageIndex() const 652int OJanusWidget::activePageIndex() const
653{ 653{
654 if( mFace == TreeList) { 654 if( mFace == TreeList) {
655 QListViewItem *node = mTreeList->selectedItem(); 655 QListViewItem *node = mTreeList->selectedItem();
656 if( node == 0 ) { return -1; } 656 if( node == 0 ) { return -1; }
657 QWidget *stackItem = mTreeListToPageStack[node]; 657 QWidget *stackItem = mTreeListToPageStack[node];
658 return mPageList->findRef(stackItem); 658 return mPageList->findRef(stackItem);
659 } 659 }
660 else if (mFace == IconList) { 660 else if (mFace == IconList) {
661 QListBoxItem *node = mIconList->item( mIconList->currentItem() ); 661 QListBoxItem *node = mIconList->item( mIconList->currentItem() );
662 if( node == 0 ) { return( false ); } 662 if( node == 0 ) { return( false ); }
663 QWidget *stackItem = mIconListToPageStack[node]; 663 QWidget *stackItem = mIconListToPageStack[node];
664 return mPageList->findRef(stackItem); 664 return mPageList->findRef(stackItem);
665 } 665 }
666 else if( mFace == Tabbed ) { 666 else if( mFace == Tabbed ) {
667 QWidget *widget = mTabControl->currentPage(); 667 QWidget *widget = mTabControl->currentPage();
668 return( widget == 0 ? -1 : mPageList->findRef( widget ) ); 668 return( widget == 0 ? -1 : mPageList->findRef( widget ) );
669 } 669 }
670 else { 670 else {
671 return( -1 ); 671 return( -1 );
672 } 672 }
673} 673}
674 674
675 675
676int OJanusWidget::pageIndex( QWidget *widget ) const 676int OJanusWidget::pageIndex( QWidget *widget ) const
677{ 677{
678 if( widget == 0 ) 678 if( widget == 0 )
679 { 679 {
680 return( -1 ); 680 return( -1 );
681 } 681 }
682 else if( mFace == TreeList || mFace == IconList ) 682 else if( mFace == TreeList || mFace == IconList )
683 { 683 {
684 return( mPageList->findRef( widget ) ); 684 return( mPageList->findRef( widget ) );
685 } 685 }
686 else if( mFace == Tabbed ) 686 else if( mFace == Tabbed )
687 { 687 {
688 // 688 //
689 // The user gets the real page widget with addVBoxPage(), addHBoxPage() 689 // The user gets the real page widget with addVBoxPage(), addHBoxPage()
690 // and addGridPage() but not with addPage() which returns a child of 690 // and addGridPage() but not with addPage() which returns a child of
691 // the toplevel page. addPage() returns a QFrame so I check for that. 691 // the toplevel page. addPage() returns a QFrame so I check for that.
692 // 692 //
693 if( widget->isA("QFrame") ) 693 if( widget->isA("QFrame") )
694 { 694 {
695 return( mPageList->findRef( widget->parentWidget() ) ); 695 return( mPageList->findRef( widget->parentWidget() ) );
696 } 696 }
697 else 697 else
698 { 698 {
699 return( mPageList->findRef( widget ) ); 699 return( mPageList->findRef( widget ) );
700 } 700 }
701 } 701 }
702 else 702 else
703 { 703 {
704 return( -1 ); 704 return( -1 );
705 } 705 }
706} 706}
707 707
708void OJanusWidget::slotFontChanged() 708void OJanusWidget::slotFontChanged()
709{ 709{
710#ifdef FIXME 710#ifdef FIXME
711 711
712 if ( mTitleLabel != 0 ) 712 if ( mTitleLabel != 0 )
713 { 713 {
714 mTitleLabel->setFont( KGlobalSettings::generalFont() ); 714 mTitleLabel->setFont( KGlobalSettings::generalFont() );
715 QFont titleFont( mTitleLabel->font() ); 715 QFont titleFont( mTitleLabel->font() );
716 titleFont.setBold( true ); 716 titleFont.setBold( true );
717 mTitleLabel->setFont( titleFont ); 717 mTitleLabel->setFont( titleFont );
718 } 718 }
719#endif 719#endif
720 720
721 if( mFace == IconList ) 721 if( mFace == IconList )
722 { 722 {
723 QFont listFont( mIconList->font() ); 723 QFont listFont( mIconList->font() );
724 listFont.setBold( true ); 724 listFont.setBold( true );
725 mIconList->setFont( listFont ); 725 mIconList->setFont( listFont );
726 mIconList->invalidateHeight(); 726 mIconList->invalidateHeight();
727 mIconList->invalidateWidth(); 727 mIconList->invalidateWidth();
728 } 728 }
729} 729}
730 730
731// makes the treelist behave like the list of kcontrol 731// makes the treelist behave like the list of kcontrol
732void OJanusWidget::slotItemClicked(QListViewItem *it) 732void OJanusWidget::slotItemClicked(QListViewItem *it)
733{ 733{
734 if(it && (it->childCount()>0)) 734 if(it && (it->childCount()>0))
735 it->setOpen(!it->isOpen()); 735 it->setOpen(!it->isOpen());
736} 736}
737 737
738void OJanusWidget::setFocus() 738void OJanusWidget::setFocus()
739{ 739{
740 if( mValid == false ) { return; } 740 if( mValid == false ) { return; }
741 if( mFace == TreeList ) 741 if( mFace == TreeList )
742 { 742 {
743 mTreeList->setFocus(); 743 mTreeList->setFocus();
744 } 744 }
745 if( mFace == IconList ) 745 if( mFace == IconList )
746 { 746 {
747 mIconList->setFocus(); 747 mIconList->setFocus();
748 } 748 }
749 else if( mFace == Tabbed ) 749 else if( mFace == Tabbed )
750 { 750 {
751 mTabControl->setFocus(); 751 mTabControl->setFocus();
752 } 752 }
753 else if( mFace == Swallow ) 753 else if( mFace == Swallow )
754 { 754 {
755 mSwallowPage->setFocus(); 755 mSwallowPage->setFocus();
756 } 756 }
757 else if( mFace == Plain ) 757 else if( mFace == Plain )
758 { 758 {
759 mPlainPage->setFocus(); 759 mPlainPage->setFocus();
760 } 760 }
761} 761}
762 762
763 763
764QSize OJanusWidget::minimumSizeHint() const 764QSize OJanusWidget::minimumSizeHint() const
765{ 765{
766 if( mFace == TreeList || mFace == IconList ) 766 if( mFace == TreeList || mFace == IconList )
767 { 767 {
768 QSize s1( ODialog::spacingHint(), ODialog::spacingHint()*2 ); 768 QSize s1( ODialog::spacingHint(), ODialog::spacingHint()*2 );
769 QSize s2(0,0); 769 QSize s2(0,0);
770 QSize s3(0,0); 770 QSize s3(0,0);
771 QSize s4( mPageStack->sizeHint() ); 771 QSize s4( mPageStack->sizeHint() );
772 772
773 if( mFace == TreeList ) 773 if( mFace == TreeList )
774 { 774 {
775#if QT_VERSION < 300 775#if QT_VERSION < 0x030000
776 s1.rwidth() += style().splitterWidth(); 776 s1.rwidth() += style().splitterWidth();
777#else 777#else
778 s1.rwidth() += style().pixelMetric( QStyle::PM_SplitterWidth ); 778 s1.rwidth() += style().pixelMetric( QStyle::PM_SplitterWidth );
779#endif 779#endif
780 s2 = mTreeList->minimumSize(); 780 s2 = mTreeList->minimumSize();
781 } 781 }
782 else 782 else
783 { 783 {
784 mIconList->updateMinimumHeight(); 784 mIconList->updateMinimumHeight();
785 mIconList->updateWidth(); 785 mIconList->updateWidth();
786 s2 = mIconList->minimumSize(); 786 s2 = mIconList->minimumSize();
787 } 787 }
788 788
789 if( mTitleLabel->isVisible() == true ) 789 if( mTitleLabel->isVisible() == true )
790 { 790 {
791 s3 += mTitleLabel->sizeHint(); 791 s3 += mTitleLabel->sizeHint();
792 s3.rheight() += mTitleSep->minimumSize().height(); 792 s3.rheight() += mTitleSep->minimumSize().height();
793 } 793 }
794 794
795 // 795 //
796 // Select the tallest item. It has only effect in IconList mode 796 // Select the tallest item. It has only effect in IconList mode
797 // 797 //
798 int h1 = s1.rheight() + s3.rheight() + s4.height(); 798 int h1 = s1.rheight() + s3.rheight() + s4.height();
799 int h2 = QMAX( h1, s2.rheight() ); 799 int h2 = QMAX( h1, s2.rheight() );
800 800
801 return( QSize( s1.width()+s2.width()+QMAX(s3.width(),s4.width()), h2 ) ); 801 return( QSize( s1.width()+s2.width()+QMAX(s3.width(),s4.width()), h2 ) );
802 } 802 }
803 else if( mFace == Tabbed ) 803 else if( mFace == Tabbed )
804 { 804 {
805 return( mTabControl->sizeHint() ); 805 return( mTabControl->sizeHint() );
806 } 806 }
807 else if( mFace == Swallow ) 807 else if( mFace == Swallow )
808 { 808 {
809 return( mSwallowPage->minimumSize() ); 809 return( mSwallowPage->minimumSize() );
810 } 810 }
811 else if( mFace == Plain ) 811 else if( mFace == Plain )
812 { 812 {
813 return( mPlainPage->sizeHint() ); 813 return( mPlainPage->sizeHint() );
814 } 814 }
815 else 815 else
816 { 816 {
817 return( QSize( 100, 100 ) ); // Should never happen though. 817 return( QSize( 100, 100 ) ); // Should never happen though.
818 } 818 }
819 819
820} 820}
821 821
822 822
823QSize OJanusWidget::sizeHint() const 823QSize OJanusWidget::sizeHint() const
824{ 824{
825 return( minimumSizeHint() ); 825 return( minimumSizeHint() );
826} 826}
827 827
828 828
829void OJanusWidget::setTreeListAutoResize( bool state ) 829void OJanusWidget::setTreeListAutoResize( bool state )
830{ 830{
831 if( mFace == TreeList ) 831 if( mFace == TreeList )
832 { 832 {
833 mTreeListResizeMode = state == false ? 833 mTreeListResizeMode = state == false ?
834 QSplitter::KeepSize : QSplitter::Stretch; 834 QSplitter::KeepSize : QSplitter::Stretch;
835 QSplitter *splitter = (QSplitter*)(mTreeList->parentWidget()); 835 QSplitter *splitter = (QSplitter*)(mTreeList->parentWidget());
836 splitter->setResizeMode( mTreeList, mTreeListResizeMode ); 836 splitter->setResizeMode( mTreeList, mTreeListResizeMode );
837 } 837 }
838} 838}
839 839
840 840
841void OJanusWidget::setIconListAllVisible( bool state ) 841void OJanusWidget::setIconListAllVisible( bool state )
842{ 842{
843 if( mFace == IconList ) 843 if( mFace == IconList )
844 { 844 {
845 mIconList->setShowAll( state ); 845 mIconList->setShowAll( state );
846 } 846 }
847} 847}
848 848
849void OJanusWidget::setShowIconsInTreeList( bool state ) 849void OJanusWidget::setShowIconsInTreeList( bool state )
850{ 850{
851 mShowIconsInTreeList = state; 851 mShowIconsInTreeList = state;
852} 852}
853 853
854void OJanusWidget::setRootIsDecorated( bool state ) 854void OJanusWidget::setRootIsDecorated( bool state )
855{ 855{
856 if( mFace == TreeList ) { 856 if( mFace == TreeList ) {
857 mTreeList->setRootIsDecorated(state); 857 mTreeList->setRootIsDecorated(state);
858 } 858 }
859} 859}
860 860
861void OJanusWidget::unfoldTreeList( bool persist ) 861void OJanusWidget::unfoldTreeList( bool persist )
862{ 862{
863 if( mFace == TreeList ) 863 if( mFace == TreeList )
864 { 864 {
865 if( persist ) 865 if( persist )
866 connect( mTreeList, SIGNAL( collapsed(QListViewItem*) ), this, SLOT( slotReopen(QListViewItem*) ) ); 866 connect( mTreeList, SIGNAL( collapsed(QListViewItem*) ), this, SLOT( slotReopen(QListViewItem*) ) );
867 else 867 else
868 disconnect( mTreeList, SIGNAL( collapsed(QListViewItem*) ), this, SLOT( slotReopen(QListViewItem*) ) ); 868 disconnect( mTreeList, SIGNAL( collapsed(QListViewItem*) ), this, SLOT( slotReopen(QListViewItem*) ) );
869 869
870 for( QListViewItem * item = mTreeList->firstChild(); item; item = item->itemBelow() ) 870 for( QListViewItem * item = mTreeList->firstChild(); item; item = item->itemBelow() )
871 item->setOpen( true ); 871 item->setOpen( true );
872 } 872 }
873} 873}
874 874
875void OJanusWidget::showEvent( QShowEvent * ) 875void OJanusWidget::showEvent( QShowEvent * )
876{ 876{
877 if( mFace == TreeList ) 877 if( mFace == TreeList )
878 { 878 {
879 QSplitter *splitter = (QSplitter*)(mTreeList->parentWidget()); 879 QSplitter *splitter = (QSplitter*)(mTreeList->parentWidget());
880 splitter->setResizeMode( mTreeList, mTreeListResizeMode ); 880 splitter->setResizeMode( mTreeList, mTreeListResizeMode );
881 } 881 }
882} 882}
883 883
884 884
885// 885//
886// 2000-13-02 Espen Sand 886// 2000-13-02 Espen Sand
887// It should be obvious that this eventfilter must only be 887// It should be obvious that this eventfilter must only be
888// be installed on the vertical scrollbar of the mIconList. 888// be installed on the vertical scrollbar of the mIconList.
889// 889//
890bool OJanusWidget::eventFilter( QObject *o, QEvent *e ) 890bool OJanusWidget::eventFilter( QObject *o, QEvent *e )
891{ 891{
892 if( e->type() == QEvent::Show ) 892 if( e->type() == QEvent::Show )
893 { 893 {
894 IconListItem *item = (IconListItem*)mIconList->item(0); 894 IconListItem *item = (IconListItem*)mIconList->item(0);
895 if( item != 0 ) 895 if( item != 0 )
896 { 896 {
897 int lw = item->width( mIconList ); 897 int lw = item->width( mIconList );
898 int sw = mIconList->verticalScrollBar()->sizeHint().width(); 898 int sw = mIconList->verticalScrollBar()->sizeHint().width();
899 mIconList->setFixedWidth( lw+sw+mIconList->frameWidth()*2 ); 899 mIconList->setFixedWidth( lw+sw+mIconList->frameWidth()*2 );
900 } 900 }
901 } 901 }
902 else if( e->type() == QEvent::Hide ) 902 else if( e->type() == QEvent::Hide )
903 { 903 {
diff --git a/library/lightstyle.cpp b/library/lightstyle.cpp
index f18bdca..3bd1623 100644
--- a/library/lightstyle.cpp
+++ b/library/lightstyle.cpp
@@ -1,562 +1,562 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 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#include "lightstyle.h" 20#include "lightstyle.h"
21 21
22#if QT_VERSION < 300 22#if QT_VERSION < 0x030000
23 23
24#define INCLUDE_MENUITEM_DEF 24#define INCLUDE_MENUITEM_DEF
25#include "qmenubar.h" 25#include "qmenubar.h"
26#include "qapplication.h" 26#include "qapplication.h"
27#include "qpainter.h" 27#include "qpainter.h"
28#include "qpalette.h" 28#include "qpalette.h"
29#include "qframe.h" 29#include "qframe.h"
30#include "qpushbutton.h" 30#include "qpushbutton.h"
31#include "qdrawutil.h" 31#include "qdrawutil.h"
32#include "qscrollbar.h" 32#include "qscrollbar.h"
33#include "qtabbar.h" 33#include "qtabbar.h"
34#include "qguardedptr.h" 34#include "qguardedptr.h"
35#include "qlayout.h" 35#include "qlayout.h"
36#include "qlineedit.h" 36#include "qlineedit.h"
37 37
38 38
39class LightStylePrivate 39class LightStylePrivate
40{ 40{
41public: 41public:
42 LightStylePrivate() 42 LightStylePrivate()
43 : hoverWidget(0), ref(1), savePalette(0) 43 : hoverWidget(0), ref(1), savePalette(0)
44 { 44 {
45 } 45 }
46 46
47 QGuardedPtr<QWidget> hoverWidget; 47 QGuardedPtr<QWidget> hoverWidget;
48 QPalette oldPalette, hoverPalette; 48 QPalette oldPalette, hoverPalette;
49 int ref; 49 int ref;
50 QPoint mousePos; 50 QPoint mousePos;
51 QPalette *savePalette; 51 QPalette *savePalette;
52}; 52};
53 53
54 54
55static LightStylePrivate *singleton = 0; 55static LightStylePrivate *singleton = 0;
56 56
57 57
58LightStyle::LightStyle() 58LightStyle::LightStyle()
59 : QWindowsStyle() 59 : QWindowsStyle()
60{ 60{
61 if (! singleton) { 61 if (! singleton) {
62 singleton = new LightStylePrivate; 62 singleton = new LightStylePrivate;
63 63
64 QPalette pal = QApplication::palette(); 64 QPalette pal = QApplication::palette();
65 singleton->oldPalette = pal; 65 singleton->oldPalette = pal;
66 66
67 QColor bg = pal.color(QPalette::Active, QColorGroup::Background); 67 QColor bg = pal.color(QPalette::Active, QColorGroup::Background);
68 QColor prelight; 68 QColor prelight;
69 69
70 if ( (bg.red() + bg.green() + bg.blue()) / 3 > 128) 70 if ( (bg.red() + bg.green() + bg.blue()) / 3 > 128)
71 prelight = pal.color(QPalette::Active, 71 prelight = pal.color(QPalette::Active,
72 QColorGroup::Background).light(110); 72 QColorGroup::Background).light(110);
73 else 73 else
74 prelight = pal.color(QPalette::Active, 74 prelight = pal.color(QPalette::Active,
75 QColorGroup::Background).light(120); 75 QColorGroup::Background).light(120);
76 76
77 QColorGroup active2(pal.color(QPalette::Active, 77 QColorGroup active2(pal.color(QPalette::Active,
78 QColorGroup::Foreground), // foreground 78 QColorGroup::Foreground), // foreground
79 prelight, // button 79 prelight, // button
80 prelight.light(), // light 80 prelight.light(), // light
81 prelight.dark(), // dark 81 prelight.dark(), // dark
82 prelight.dark(120), // mid 82 prelight.dark(120), // mid
83 pal.color(QPalette::Active, 83 pal.color(QPalette::Active,
84 QColorGroup::Text), // text 84 QColorGroup::Text), // text
85 pal.color(QPalette::Active, 85 pal.color(QPalette::Active,
86 QColorGroup::BrightText), // bright text 86 QColorGroup::BrightText), // bright text
87 pal.color(QPalette::Active, 87 pal.color(QPalette::Active,
88 QColorGroup::Base), // base 88 QColorGroup::Base), // base
89 bg); // background 89 bg); // background
90 active2.setColor(QColorGroup::Highlight, 90 active2.setColor(QColorGroup::Highlight,
91 pal.color(QPalette::Active, QColorGroup::Highlight)); 91 pal.color(QPalette::Active, QColorGroup::Highlight));
92 92
93 singleton->hoverPalette = pal; 93 singleton->hoverPalette = pal;
94 singleton->hoverPalette.setActive(active2); 94 singleton->hoverPalette.setActive(active2);
95 singleton->hoverPalette.setInactive(active2); 95 singleton->hoverPalette.setInactive(active2);
96 } else 96 } else
97 singleton->ref++; 97 singleton->ref++;
98} 98}
99 99
100 100
101LightStyle::~LightStyle() 101LightStyle::~LightStyle()
102{ 102{
103 if (singleton && singleton->ref-- <= 0) { 103 if (singleton && singleton->ref-- <= 0) {
104 delete singleton; 104 delete singleton;
105 singleton = 0; 105 singleton = 0;
106 } 106 }
107} 107}
108 108
109 109
110QSize LightStyle::scrollBarExtent() const 110QSize LightStyle::scrollBarExtent() const
111{ 111{
112 return QSize(12 + defaultFrameWidth(), 12 + defaultFrameWidth()); 112 return QSize(12 + defaultFrameWidth(), 12 + defaultFrameWidth());
113} 113}
114 114
115 115
116int LightStyle::buttonDefaultIndicatorWidth() const 116int LightStyle::buttonDefaultIndicatorWidth() const
117{ 117{
118 return 2; 118 return 2;
119} 119}
120 120
121 121
122int LightStyle::sliderThickness() const 122int LightStyle::sliderThickness() const
123{ 123{
124 return 16; 124 return 16;
125} 125}
126 126
127int LightStyle::sliderLength() const 127int LightStyle::sliderLength() const
128{ 128{
129 return 13; 129 return 13;
130} 130}
131 131
132 132
133int LightStyle::buttonMargin() const 133int LightStyle::buttonMargin() const
134{ 134{
135 return 4; 135 return 4;
136} 136}
137 137
138 138
139QSize LightStyle::exclusiveIndicatorSize() const 139QSize LightStyle::exclusiveIndicatorSize() const
140{ 140{
141 return QSize(13, 13); 141 return QSize(13, 13);
142} 142}
143 143
144 144
145int LightStyle::defaultFrameWidth() const 145int LightStyle::defaultFrameWidth() const
146{ 146{
147 return 2; 147 return 2;
148} 148}
149 149
150 150
151QSize LightStyle::indicatorSize() const 151QSize LightStyle::indicatorSize() const
152{ 152{
153 return QSize(13, 13); 153 return QSize(13, 13);
154} 154}
155 155
156 156
157void LightStyle::polish(QWidget *widget) 157void LightStyle::polish(QWidget *widget)
158{ 158{
159 if (widget->inherits("QPushButton")) 159 if (widget->inherits("QPushButton"))
160 widget->installEventFilter(this); 160 widget->installEventFilter(this);
161 161
162#if QT_VERSION >= 300 162#if QT_VERSION >= 0x030000
163 if (widget->inherits("QLineEdit")) { 163 if (widget->inherits("QLineEdit")) {
164 QLineEdit *lineedit = (QLineEdit *) widget; 164 QLineEdit *lineedit = (QLineEdit *) widget;
165 lineedit->setFrameShape(QFrame::StyledPanel); 165 lineedit->setFrameShape(QFrame::StyledPanel);
166 lineedit->setLineWidth(2); 166 lineedit->setLineWidth(2);
167 } 167 }
168#endif 168#endif
169 169
170 QWindowsStyle::polish(widget); 170 QWindowsStyle::polish(widget);
171} 171}
172 172
173 173
174void LightStyle::unPolish(QWidget *widget) 174void LightStyle::unPolish(QWidget *widget)
175{ 175{
176 if (widget->inherits("QPushButton")) 176 if (widget->inherits("QPushButton"))
177 widget->removeEventFilter(this); 177 widget->removeEventFilter(this);
178 178
179#if QT_VERSION >= 300 179#if QT_VERSION >= 0x030000
180 if (widget->inherits("QLineEdit")) { 180 if (widget->inherits("QLineEdit")) {
181 QLineEdit *lineedit = (QLineEdit *) widget; 181 QLineEdit *lineedit = (QLineEdit *) widget;
182 lineedit->setLineWidth(1); 182 lineedit->setLineWidth(1);
183 lineedit->setFrameShape(QFrame::WinPanel); 183 lineedit->setFrameShape(QFrame::WinPanel);
184 } 184 }
185#endif 185#endif
186 186
187 QWindowsStyle::unPolish(widget); 187 QWindowsStyle::unPolish(widget);
188} 188}
189 189
190 190
191void LightStyle::polish(QApplication *app) 191void LightStyle::polish(QApplication *app)
192{ 192{
193 QPalette pal = app->palette(); 193 QPalette pal = app->palette();
194 194
195 QColorGroup active(pal.color(QPalette::Active, 195 QColorGroup active(pal.color(QPalette::Active,
196 QColorGroup::Foreground), // foreground 196 QColorGroup::Foreground), // foreground
197 pal.color(QPalette::Active, 197 pal.color(QPalette::Active,
198 QColorGroup::Button), // button 198 QColorGroup::Button), // button
199 pal.color(QPalette::Active, 199 pal.color(QPalette::Active,
200 QColorGroup::Background).light(), // light 200 QColorGroup::Background).light(), // light
201 pal.color(QPalette::Active, 201 pal.color(QPalette::Active,
202 QColorGroup::Background).dark(175), // dark 202 QColorGroup::Background).dark(175), // dark
203 pal.color(QPalette::Active, 203 pal.color(QPalette::Active,
204 QColorGroup::Background).dark(110), // mid 204 QColorGroup::Background).dark(110), // mid
205 pal.color(QPalette::Active, 205 pal.color(QPalette::Active,
206 QColorGroup::Text), // text 206 QColorGroup::Text), // text
207 pal.color(QPalette::Active, 207 pal.color(QPalette::Active,
208 QColorGroup::BrightText), // bright text 208 QColorGroup::BrightText), // bright text
209 pal.color(QPalette::Active, 209 pal.color(QPalette::Active,
210 QColorGroup::Base), // base 210 QColorGroup::Base), // base
211 pal.color(QPalette::Active, 211 pal.color(QPalette::Active,
212 QColorGroup::Background)), // background 212 QColorGroup::Background)), // background
213 213
214 214
215 disabled(pal.color(QPalette::Disabled, 215 disabled(pal.color(QPalette::Disabled,
216 QColorGroup::Foreground), // foreground 216 QColorGroup::Foreground), // foreground
217 pal.color(QPalette::Disabled, 217 pal.color(QPalette::Disabled,
218 QColorGroup::Button), // button 218 QColorGroup::Button), // button
219 pal.color(QPalette::Disabled, 219 pal.color(QPalette::Disabled,
220 QColorGroup::Background).light(), // light 220 QColorGroup::Background).light(), // light
221 pal.color(QPalette::Disabled, 221 pal.color(QPalette::Disabled,
222 QColorGroup::Background).dark(), // dark 222 QColorGroup::Background).dark(), // dark
223 pal.color(QPalette::Disabled, 223 pal.color(QPalette::Disabled,
224 QColorGroup::Background).dark(110), // mid 224 QColorGroup::Background).dark(110), // mid
225 pal.color(QPalette::Disabled, 225 pal.color(QPalette::Disabled,
226 QColorGroup::Text), // text 226 QColorGroup::Text), // text
227 pal.color(QPalette::Disabled, 227 pal.color(QPalette::Disabled,
228 QColorGroup::BrightText), // bright text 228 QColorGroup::BrightText), // bright text
229 pal.color(QPalette::Disabled, 229 pal.color(QPalette::Disabled,
230 QColorGroup::Base), // base 230 QColorGroup::Base), // base
231 pal.color(QPalette::Disabled, 231 pal.color(QPalette::Disabled,
232 QColorGroup::Background)); // background 232 QColorGroup::Background)); // background
233 233
234 active.setColor(QColorGroup::Highlight, 234 active.setColor(QColorGroup::Highlight,
235 pal.color(QPalette::Active, QColorGroup::Highlight)); 235 pal.color(QPalette::Active, QColorGroup::Highlight));
236 disabled.setColor(QColorGroup::Highlight, 236 disabled.setColor(QColorGroup::Highlight,
237 pal.color(QPalette::Disabled, QColorGroup::Highlight)); 237 pal.color(QPalette::Disabled, QColorGroup::Highlight));
238 238
239 active.setColor(QColorGroup::HighlightedText, 239 active.setColor(QColorGroup::HighlightedText,
240 pal.color(QPalette::Active, QColorGroup::HighlightedText)); 240 pal.color(QPalette::Active, QColorGroup::HighlightedText));
241 disabled.setColor(QColorGroup::HighlightedText, 241 disabled.setColor(QColorGroup::HighlightedText,
242 pal.color(QPalette::Disabled, QColorGroup::HighlightedText)); 242 pal.color(QPalette::Disabled, QColorGroup::HighlightedText));
243 243
244 pal.setActive(active); 244 pal.setActive(active);
245 pal.setInactive(active); 245 pal.setInactive(active);
246 pal.setDisabled(disabled); 246 pal.setDisabled(disabled);
247 247
248 singleton->oldPalette = pal; 248 singleton->oldPalette = pal;
249 249
250 QColor bg = pal.color(QPalette::Active, QColorGroup::Background); 250 QColor bg = pal.color(QPalette::Active, QColorGroup::Background);
251 QColor prelight; 251 QColor prelight;
252 252
253 if ( (bg.red() + bg.green() + bg.blue()) / 3 > 128) 253 if ( (bg.red() + bg.green() + bg.blue()) / 3 > 128)
254 prelight = pal.color(QPalette::Active, 254 prelight = pal.color(QPalette::Active,
255 QColorGroup::Background).light(110); 255 QColorGroup::Background).light(110);
256 else 256 else
257 prelight = pal.color(QPalette::Active, 257 prelight = pal.color(QPalette::Active,
258 QColorGroup::Background).light(120); 258 QColorGroup::Background).light(120);
259 259
260 QColorGroup active2(pal.color(QPalette::Active, 260 QColorGroup active2(pal.color(QPalette::Active,
261 QColorGroup::Foreground), // foreground 261 QColorGroup::Foreground), // foreground
262 prelight, // button 262 prelight, // button
263 prelight.light(), // light 263 prelight.light(), // light
264 prelight.dark(), // dark 264 prelight.dark(), // dark
265 prelight.dark(120), // mid 265 prelight.dark(120), // mid
266 pal.color(QPalette::Active, 266 pal.color(QPalette::Active,
267 QColorGroup::Text), // text 267 QColorGroup::Text), // text
268 pal.color(QPalette::Active, 268 pal.color(QPalette::Active,
269 QColorGroup::BrightText), // bright text 269 QColorGroup::BrightText), // bright text
270 pal.color(QPalette::Active, 270 pal.color(QPalette::Active,
271 QColorGroup::Base), // base 271 QColorGroup::Base), // base
272 bg); // background 272 bg); // background
273 active2.setColor(QColorGroup::Highlight, 273 active2.setColor(QColorGroup::Highlight,
274 pal.color(QPalette::Active, QColorGroup::Highlight)); 274 pal.color(QPalette::Active, QColorGroup::Highlight));
275 275
276 singleton->hoverPalette = pal; 276 singleton->hoverPalette = pal;
277 singleton->hoverPalette.setActive(active2); 277 singleton->hoverPalette.setActive(active2);
278 singleton->hoverPalette.setInactive(active2); 278 singleton->hoverPalette.setInactive(active2);
279 279
280 app->setPalette(pal); 280 app->setPalette(pal);
281} 281}
282 282
283 283
284void LightStyle::unPolish(QApplication *app) 284void LightStyle::unPolish(QApplication *app)
285{ 285{
286 app->setPalette(singleton->oldPalette); 286 app->setPalette(singleton->oldPalette);
287} 287}
288 288
289 289
290void LightStyle::polishPopupMenu(QPopupMenu *menu) 290void LightStyle::polishPopupMenu(QPopupMenu *menu)
291{ 291{
292 menu->setMouseTracking(TRUE); 292 menu->setMouseTracking(TRUE);
293} 293}
294 294
295 295
296void LightStyle::drawPushButton(QPushButton *button, QPainter *p) 296void LightStyle::drawPushButton(QPushButton *button, QPainter *p)
297{ 297{
298 int x1, y1, x2, y2; 298 int x1, y1, x2, y2;
299 button->rect().coords(&x1, &y1, &x2, &y2); 299 button->rect().coords(&x1, &y1, &x2, &y2);
300 300
301 if (button->isDefault()) { 301 if (button->isDefault()) {
302 p->save(); 302 p->save();
303 p->setPen(button->palette().active().color(QColorGroup::Highlight)); 303 p->setPen(button->palette().active().color(QColorGroup::Highlight));
304 p->setBrush(button->palette().active().brush(QColorGroup::Highlight)); 304 p->setBrush(button->palette().active().brush(QColorGroup::Highlight));
305 p->drawRoundRect(x1, y1, x2 - x1 + 1, y2 - y1 + 1, 15, 15); 305 p->drawRoundRect(x1, y1, x2 - x1 + 1, y2 - y1 + 1, 15, 15);
306 p->restore(); 306 p->restore();
307 } 307 }
308 308
309 if (button->isDefault() || button->autoDefault()) { 309 if (button->isDefault() || button->autoDefault()) {
310 x1 += buttonDefaultIndicatorWidth(); 310 x1 += buttonDefaultIndicatorWidth();
311 y1 += buttonDefaultIndicatorWidth(); 311 y1 += buttonDefaultIndicatorWidth();
312 x2 -= buttonDefaultIndicatorWidth(); 312 x2 -= buttonDefaultIndicatorWidth();
313 y2 -= buttonDefaultIndicatorWidth(); 313 y2 -= buttonDefaultIndicatorWidth();
314 314
315 if (button->isDefault()) { 315 if (button->isDefault()) {
316 QPointArray pa(8); 316 QPointArray pa(8);
317 pa.setPoint(0, x1 + 2, y1 ); 317 pa.setPoint(0, x1 + 2, y1 );
318 pa.setPoint(1, x2 - 1, y1 ); 318 pa.setPoint(1, x2 - 1, y1 );
319 pa.setPoint(2, x2 + 1, y1 + 2); 319 pa.setPoint(2, x2 + 1, y1 + 2);
320 pa.setPoint(3, x2 + 1, y2 - 2); 320 pa.setPoint(3, x2 + 1, y2 - 2);
321 pa.setPoint(4, x2 - 2, y2 + 1); 321 pa.setPoint(4, x2 - 2, y2 + 1);
322 pa.setPoint(5, x1 + 2, y2 + 1); 322 pa.setPoint(5, x1 + 2, y2 + 1);
323 pa.setPoint(6, x1, y2 - 1); 323 pa.setPoint(6, x1, y2 - 1);
324 pa.setPoint(7, x1, y1 + 2); 324 pa.setPoint(7, x1, y1 + 2);
325 QRegion r(pa); 325 QRegion r(pa);
326 p->setClipRegion(r); 326 p->setClipRegion(r);
327 } 327 }
328 } 328 }
329 329
330 QBrush fill; 330 QBrush fill;
331 if (button->isDown() || button->isOn()) 331 if (button->isDown() || button->isOn())
332 fill = button->colorGroup().brush(QColorGroup::Mid); 332 fill = button->colorGroup().brush(QColorGroup::Mid);
333 else 333 else
334 fill = button->colorGroup().brush(QColorGroup::Button); 334 fill = button->colorGroup().brush(QColorGroup::Button);
335 335
336 if ( !button->isFlat() || button->isOn() || button->isDown() ) 336 if ( !button->isFlat() || button->isOn() || button->isDown() )
337 drawButton(p, x1, y1, x2 - x1 + 1, y2 - y1 + 1, 337 drawButton(p, x1, y1, x2 - x1 + 1, y2 - y1 + 1,
338 button->colorGroup(), button->isOn() || button->isDown(), &fill); 338 button->colorGroup(), button->isOn() || button->isDown(), &fill);
339} 339}
340 340
341 341
342void LightStyle::drawButton(QPainter *p, int x, int y, int w, int h, 342void LightStyle::drawButton(QPainter *p, int x, int y, int w, int h,
343 const QColorGroup &g, 343 const QColorGroup &g,
344 bool sunken, const QBrush *fill) 344 bool sunken, const QBrush *fill)
345{ 345{
346 p->save(); 346 p->save();
347 if ( fill ) 347 if ( fill )
348 p->fillRect(x + 2, y + 2, w - 4, h - 4, *fill); 348 p->fillRect(x + 2, y + 2, w - 4, h - 4, *fill);
349 else 349 else
350 p->fillRect(x + 2, y + 2, w - 4, h - 4, 350 p->fillRect(x + 2, y + 2, w - 4, h - 4,
351 QBrush(sunken ? g.mid() : g.button())); 351 QBrush(sunken ? g.mid() : g.button()));
352 352
353 // frame 353 // frame
354 p->setPen(g.dark()); 354 p->setPen(g.dark());
355 p->drawLine(x, y + 2, x, y + h - 3); // left 355 p->drawLine(x, y + 2, x, y + h - 3); // left
356 p->drawLine(x + 2, y, x + w - 3, y); // top 356 p->drawLine(x + 2, y, x + w - 3, y); // top
357 p->drawLine(x + w - 1, y + 2, x + w - 1, y + h - 3); // right 357 p->drawLine(x + w - 1, y + 2, x + w - 1, y + h - 3); // right
358 p->drawLine(x + 2, y + h - 1, x + w - 3, y + h - 1); // bottom 358 p->drawLine(x + 2, y + h - 1, x + w - 3, y + h - 1); // bottom
359 p->drawPoint(x + 1, y + 1); 359 p->drawPoint(x + 1, y + 1);
360 p->drawPoint(x + 1, y + h - 2); 360 p->drawPoint(x + 1, y + h - 2);
361 p->drawPoint(x + w - 2, y + 1); 361 p->drawPoint(x + w - 2, y + 1);
362 p->drawPoint(x + w - 2, y + h - 2); 362 p->drawPoint(x + w - 2, y + h - 2);
363 363
364 // bevel 364 // bevel
365 if (sunken) 365 if (sunken)
366 p->setPen(g.mid()); 366 p->setPen(g.mid());
367 else 367 else
368 p->setPen(g.light()); 368 p->setPen(g.light());
369 369
370 p->drawLine(x + 1, y + 2, x + 1, y + h - 3); // left 370 p->drawLine(x + 1, y + 2, x + 1, y + h - 3); // left
371 p->drawLine(x + 2, y + 1, x + w - 3, y + 1); // top 371 p->drawLine(x + 2, y + 1, x + w - 3, y + 1); // top
372 372
373 if (sunken) 373 if (sunken)
374 p->setPen(g.light()); 374 p->setPen(g.light());
375 else 375 else
376 p->setPen(g.mid()); 376 p->setPen(g.mid());
377 377
378 p->drawLine(x + w - 2, y + 2, x + w - 2, y + h - 3); // right + 1 378 p->drawLine(x + w - 2, y + 2, x + w - 2, y + h - 3); // right + 1
379 p->drawLine(x + 2, y + h - 2, x + w - 3, y + h - 2); // bottom + 1 379 p->drawLine(x + 2, y + h - 2, x + w - 3, y + h - 2); // bottom + 1
380 380
381 p->restore(); 381 p->restore();
382} 382}
383 383
384 384
385void LightStyle::drawBevelButton(QPainter *p, int x, int y, int w, int h, 385void LightStyle::drawBevelButton(QPainter *p, int x, int y, int w, int h,
386 const QColorGroup &g, 386 const QColorGroup &g,
387 bool sunken, const QBrush *fill) 387 bool sunken, const QBrush *fill)
388{ 388{
389 drawButton(p, x, y, w, h, g, sunken, fill); 389 drawButton(p, x, y, w, h, g, sunken, fill);
390} 390}
391 391
392 392
393void LightStyle::getButtonShift(int &x, int &y) const 393void LightStyle::getButtonShift(int &x, int &y) const
394{ 394{
395 x = y = 0; 395 x = y = 0;
396} 396}
397 397
398 398
399void LightStyle::drawComboButton(QPainter *p, int x, int y, int w, int h, 399void LightStyle::drawComboButton(QPainter *p, int x, int y, int w, int h,
400 const QColorGroup &g, bool, 400 const QColorGroup &g, bool,
401 bool editable, bool, 401 bool editable, bool,
402 const QBrush *fill) 402 const QBrush *fill)
403{ 403{
404 drawButton(p, x, y, w, h, g, FALSE, fill); 404 drawButton(p, x, y, w, h, g, FALSE, fill);
405 405
406 if (editable) { 406 if (editable) {
407 QRect r = comboButtonRect(x, y, w, h); 407 QRect r = comboButtonRect(x, y, w, h);
408 qDrawShadePanel(p, r.x() - 1, r.y() - 1, 408 qDrawShadePanel(p, r.x() - 1, r.y() - 1,
409 r.width() + defaultFrameWidth(), 409 r.width() + defaultFrameWidth(),
410 r.height() + defaultFrameWidth(), 410 r.height() + defaultFrameWidth(),
411 g, TRUE); 411 g, TRUE);
412 } 412 }
413 413
414 int indent = ((y + h) / 2) - 3; 414 int indent = ((y + h) / 2) - 3;
415 int xpos = x; 415 int xpos = x;
416 416
417#if QT_VERSION >= 300 417#if QT_VERSION >= 0x030000
418 if( QApplication::reverseLayout() ) 418 if( QApplication::reverseLayout() )
419 xpos += indent; 419 xpos += indent;
420 else 420 else
421#endif 421#endif
422 xpos += w - indent - 5; 422 xpos += w - indent - 5;
423 423
424 drawArrow(p, Qt::DownArrow, TRUE, xpos, indent, 5, 5, g, TRUE, fill); 424 drawArrow(p, Qt::DownArrow, TRUE, xpos, indent, 5, 5, g, TRUE, fill);
425} 425}
426 426
427 427
428QRect LightStyle::comboButtonRect( int x, int y, int w, int h ) const 428QRect LightStyle::comboButtonRect( int x, int y, int w, int h ) const
429{ 429{
430 QRect r(x + 3, y + 3, w - 6, h - 6); 430 QRect r(x + 3, y + 3, w - 6, h - 6);
431 int indent = ((y + h) / 2) - 3; 431 int indent = ((y + h) / 2) - 3;
432 r.setRight(r.right() - indent - 10); 432 r.setRight(r.right() - indent - 10);
433 433
434#if QT_VERSION >= 300 434#if QT_VERSION >= 0x030000
435 if( QApplication::reverseLayout() ) 435 if( QApplication::reverseLayout() )
436 r.moveBy( indent + 10, 0 ); 436 r.moveBy( indent + 10, 0 );
437#endif 437#endif
438 438
439 return r; 439 return r;
440} 440}
441 441
442 442
443QRect LightStyle::comboButtonFocusRect(int x, int y, int w, int h ) const 443QRect LightStyle::comboButtonFocusRect(int x, int y, int w, int h ) const
444{ 444{
445 return comboButtonRect(x, y, w, h); 445 return comboButtonRect(x, y, w, h);
446} 446}
447 447
448 448
449void LightStyle::drawPanel(QPainter *p, int x, int y, int w, int h, 449void LightStyle::drawPanel(QPainter *p, int x, int y, int w, int h,
450 const QColorGroup &g, bool sunken, 450 const QColorGroup &g, bool sunken,
451 int lw, const QBrush *fill) 451 int lw, const QBrush *fill)
452{ 452{
453 if (lw >= 2) { 453 if (lw >= 2) {
454 if ( fill ) 454 if ( fill )
455 p->fillRect(x + 2, y + 2, w - 4, h - 4, *fill); 455 p->fillRect(x + 2, y + 2, w - 4, h - 4, *fill);
456 456
457 QPen oldpen = p->pen(); 457 QPen oldpen = p->pen();
458 458
459 // frame 459 // frame
460 p->setPen(g.dark()); 460 p->setPen(g.dark());
461 p->drawLine(x, y + 2, x, y + h - 3); // left 461 p->drawLine(x, y + 2, x, y + h - 3); // left
462 p->drawLine(x + 2, y, x + w - 3, y); // top 462 p->drawLine(x + 2, y, x + w - 3, y); // top
463 p->drawLine(x + w - 1, y + 2, x + w - 1, y + h - 3); // right 463 p->drawLine(x + w - 1, y + 2, x + w - 1, y + h - 3); // right
464 p->drawLine(x + 2, y + h - 1, x + w - 3, y + h - 1); // bottom 464 p->drawLine(x + 2, y + h - 1, x + w - 3, y + h - 1); // bottom
465 p->drawPoint(x + 1, y + 1); 465 p->drawPoint(x + 1, y + 1);
466 p->drawPoint(x + 1, y + h - 2); 466 p->drawPoint(x + 1, y + h - 2);
467 p->drawPoint(x + w - 2, y + 1); 467 p->drawPoint(x + w - 2, y + 1);
468 p->drawPoint(x + w - 2, y + h - 2); 468 p->drawPoint(x + w - 2, y + h - 2);
469 469
470 // bevel 470 // bevel
471 if (sunken) 471 if (sunken)
472 p->setPen(g.mid()); 472 p->setPen(g.mid());
473 else 473 else
474 p->setPen(g.light()); 474 p->setPen(g.light());
475 475
476 p->drawLine(x + 1, y + 2, x + 1, y + h - 3); // left 476 p->drawLine(x + 1, y + 2, x + 1, y + h - 3); // left
477 p->drawLine(x + 2, y + 1, x + w - 3, y + 1); // top 477 p->drawLine(x + 2, y + 1, x + w - 3, y + 1); // top
478 478
479 if (sunken) 479 if (sunken)
480 p->setPen(g.light()); 480 p->setPen(g.light());
481 else 481 else
482 p->setPen(g.mid()); 482 p->setPen(g.mid());
483 483
484 p->drawLine(x + w - 2, y + 2, x + w - 2, y + h - 3); // right + 1 484 p->drawLine(x + w - 2, y + 2, x + w - 2, y + h - 3); // right + 1
485 p->drawLine(x + 2, y + h - 2, x + w - 3, y + h - 2); // bottom + 1 485 p->drawLine(x + 2, y + h - 2, x + w - 3, y + h - 2); // bottom + 1
486 486
487 // corners 487 // corners
488 p->setPen(g.background()); 488 p->setPen(g.background());
489 p->drawLine(x, y, x + 1, y); 489 p->drawLine(x, y, x + 1, y);
490 p->drawLine(x, y + h - 1, x + 1, y + h - 1); 490 p->drawLine(x, y + h - 1, x + 1, y + h - 1);
491 p->drawLine(x + w - 2, y, x + w - 1, y); 491 p->drawLine(x + w - 2, y, x + w - 1, y);
492 p->drawLine(x + w - 2, y + h - 1, x + w - 1, y + h - 1); 492 p->drawLine(x + w - 2, y + h - 1, x + w - 1, y + h - 1);
493 p->drawPoint(x, y + 1); 493 p->drawPoint(x, y + 1);
494 p->drawPoint(x, y + h - 2); 494 p->drawPoint(x, y + h - 2);
495 p->drawPoint(x + w - 1, y + 1); 495 p->drawPoint(x + w - 1, y + 1);
496 p->drawPoint(x + w - 1, y + h - 2); 496 p->drawPoint(x + w - 1, y + h - 2);
497 497
498 p->setPen(oldpen); 498 p->setPen(oldpen);
499 } else 499 } else
500 qDrawShadePanel(p, x, y, w, h, g, sunken, lw, fill); 500 qDrawShadePanel(p, x, y, w, h, g, sunken, lw, fill);
501} 501}
502 502
503 503
504void LightStyle::drawIndicator(QPainter *p, int x, int y ,int w, int h, 504void LightStyle::drawIndicator(QPainter *p, int x, int y ,int w, int h,
505 const QColorGroup &g, int state, 505 const QColorGroup &g, int state,
506 bool down, bool) 506 bool down, bool)
507{ 507{
508 drawButton(p, x, y, w, h, g, TRUE, 508 drawButton(p, x, y, w, h, g, TRUE,
509 &g.brush(down ? QColorGroup::Mid : QColorGroup::Base)); 509 &g.brush(down ? QColorGroup::Mid : QColorGroup::Base));
510 510
511 p->save(); 511 p->save();
512 512
513 p->setPen(g.foreground()); 513 p->setPen(g.foreground());
514 if (state == QButton::NoChange) { 514 if (state == QButton::NoChange) {
515 p->drawLine(x + 3, y + h / 2, x + w - 4, y + h / 2); 515 p->drawLine(x + 3, y + h / 2, x + w - 4, y + h / 2);
516 p->drawLine(x + 3, y + 1 + h / 2, x + w - 4, y + 1 + h / 2); 516 p->drawLine(x + 3, y + 1 + h / 2, x + w - 4, y + 1 + h / 2);
517 p->drawLine(x + 3, y - 1 + h / 2, x + w - 4, y - 1 + h / 2); 517 p->drawLine(x + 3, y - 1 + h / 2, x + w - 4, y - 1 + h / 2);
518 } else if (state == QButton::On) { 518 } else if (state == QButton::On) {
519 p->drawLine(x + 4, y + 3, x + w - 4, y + h - 5); 519 p->drawLine(x + 4, y + 3, x + w - 4, y + h - 5);
520 p->drawLine(x + 3, y + 3, x + w - 4, y + h - 4); 520 p->drawLine(x + 3, y + 3, x + w - 4, y + h - 4);
521 p->drawLine(x + 3, y + 4, x + w - 5, y + h - 4); 521 p->drawLine(x + 3, y + 4, x + w - 5, y + h - 4);
522 p->drawLine(x + 3, y + h - 5, x + w - 5, y + 3); 522 p->drawLine(x + 3, y + h - 5, x + w - 5, y + 3);
523 p->drawLine(x + 3, y + h - 4, x + w - 4, y + 3); 523 p->drawLine(x + 3, y + h - 4, x + w - 4, y + 3);
524 p->drawLine(x + 4, y + h - 4, x + w - 4, y + 4); 524 p->drawLine(x + 4, y + h - 4, x + w - 4, y + 4);
525 } 525 }
526 526
527 p->restore(); 527 p->restore();
528} 528}
529 529
530 530
531void LightStyle::drawExclusiveIndicator(QPainter *p, int x, int y, int w, int h, 531void LightStyle::drawExclusiveIndicator(QPainter *p, int x, int y, int w, int h,
532 const QColorGroup &g, bool on, 532 const QColorGroup &g, bool on,
533 bool down, bool) 533 bool down, bool)
534{ 534{
535 p->save(); 535 p->save();
536 536
537 p->fillRect(x, y, w, h, g.brush(QColorGroup::Background)); 537 p->fillRect(x, y, w, h, g.brush(QColorGroup::Background));
538 538
539 p->setPen(g.dark()); 539 p->setPen(g.dark());
540 p->drawArc(x, y, w, h, 0, 16*360); 540 p->drawArc(x, y, w, h, 0, 16*360);
541 p->setPen(g.mid()); 541 p->setPen(g.mid());
542 p->drawArc(x + 1, y + 1, w - 2, h - 2, 45*16, 180*16); 542 p->drawArc(x + 1, y + 1, w - 2, h - 2, 45*16, 180*16);
543 p->setPen(g.light()); 543 p->setPen(g.light());
544 p->drawArc(x + 1, y + 1, w - 2, h - 2, 235*16, 180*16); 544 p->drawArc(x + 1, y + 1, w - 2, h - 2, 235*16, 180*16);
545 545
546 p->setPen(down ? g.mid() : g.base()); 546 p->setPen(down ? g.mid() : g.base());
547 p->setBrush(down ? g.mid() : g.base()); 547 p->setBrush(down ? g.mid() : g.base());
548 p->drawEllipse(x + 2, y + 2, w - 4, h - 4); 548 p->drawEllipse(x + 2, y + 2, w - 4, h - 4);
549 549
550 if (on) { 550 if (on) {
551 p->setBrush(g.foreground()); 551 p->setBrush(g.foreground());
552 p->drawEllipse(x + 3, y + 3, w - x - 6, h - y - 6); 552 p->drawEllipse(x + 3, y + 3, w - x - 6, h - y - 6);
553 } 553 }
554 554
555 p->restore(); 555 p->restore();
556} 556}
557 557
558 558
559 559
560#if 1 560#if 1
561//copied from QPE style 561//copied from QPE style
562void LightStyle::drawTab( QPainter *p, const QTabBar *tb, QTab *t, bool selected ) 562void LightStyle::drawTab( QPainter *p, const QTabBar *tb, QTab *t, bool selected )
diff --git a/library/lightstyle.h b/library/lightstyle.h
index c377cc2..0392957 100644
--- a/library/lightstyle.h
+++ b/library/lightstyle.h
@@ -1,120 +1,120 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 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#ifndef LIGHTSTYLE_H 20#ifndef LIGHTSTYLE_H
21#define LIGHTSTYLE_H 21#define LIGHTSTYLE_H
22 22
23 23
24#ifndef QT_H 24#ifndef QT_H
25#include <qstyle.h> 25#include <qstyle.h>
26#include <qwindowsstyle.h> 26#include <qwindowsstyle.h>
27#endif // QT_H 27#endif // QT_H
28 28
29#if QT_VERSION < 300 29#if QT_VERSION < 0x030000
30 30
31#ifdef QT_PLUGIN_STYLE_LIGHT 31#ifdef QT_PLUGIN_STYLE_LIGHT
32# define Q_EXPORT_STYLE_LIGHT 32# define Q_EXPORT_STYLE_LIGHT
33#else 33#else
34# define Q_EXPORT_STYLE_LIGHT Q_EXPORT 34# define Q_EXPORT_STYLE_LIGHT Q_EXPORT
35#endif // QT_PLUGIN_STYLE_LIGHT 35#endif // QT_PLUGIN_STYLE_LIGHT
36 36
37 37
38class Q_EXPORT_STYLE_LIGHT LightStyle : public QWindowsStyle 38class Q_EXPORT_STYLE_LIGHT LightStyle : public QWindowsStyle
39{ 39{
40public: 40public:
41 LightStyle(); 41 LightStyle();
42 virtual ~LightStyle(); 42 virtual ~LightStyle();
43 43
44 void polish(QWidget *widget); 44 void polish(QWidget *widget);
45 void unPolish(QWidget*widget); 45 void unPolish(QWidget*widget);
46 46
47 void polish(QApplication *app); 47 void polish(QApplication *app);
48 void unPolish(QApplication *app); 48 void unPolish(QApplication *app);
49 49
50 void polishPopupMenu(QPopupMenu *menu); 50 void polishPopupMenu(QPopupMenu *menu);
51 51
52 void drawPushButton(QPushButton *button, QPainter *p); 52 void drawPushButton(QPushButton *button, QPainter *p);
53 void drawButton(QPainter *p, int x, int y, int w, int h, 53 void drawButton(QPainter *p, int x, int y, int w, int h,
54 const QColorGroup &g, bool sunken = FALSE, 54 const QColorGroup &g, bool sunken = FALSE,
55 const QBrush *fill = 0); 55 const QBrush *fill = 0);
56 void drawBevelButton(QPainter *p, int x, int y, int w, int h, 56 void drawBevelButton(QPainter *p, int x, int y, int w, int h,
57 const QColorGroup &g, bool sunken = FALSE, 57 const QColorGroup &g, bool sunken = FALSE,
58 const QBrush *fill = 0); 58 const QBrush *fill = 0);
59 void getButtonShift(int &x, int &y) const; 59 void getButtonShift(int &x, int &y) const;
60 60
61 void drawComboButton(QPainter *p, int x, int y, int w, int h, 61 void drawComboButton(QPainter *p, int x, int y, int w, int h,
62 const QColorGroup &g, bool sunken = FALSE, 62 const QColorGroup &g, bool sunken = FALSE,
63 bool editable = FALSE, bool = TRUE, 63 bool editable = FALSE, bool = TRUE,
64 const QBrush *fill = 0); 64 const QBrush *fill = 0);
65 QRect comboButtonRect(int x, int y, int w, int h) const; 65 QRect comboButtonRect(int x, int y, int w, int h) const;
66 QRect comboButtonFocusRect(int x, int y, int w, int h) const; 66 QRect comboButtonFocusRect(int x, int y, int w, int h) const;
67 67
68 void drawIndicator(QPainter *p, int x, int y ,int w, int h, 68 void drawIndicator(QPainter *p, int x, int y ,int w, int h,
69 const QColorGroup &g, int state, 69 const QColorGroup &g, int state,
70 bool = FALSE, bool = TRUE); 70 bool = FALSE, bool = TRUE);
71 QSize indicatorSize() const; 71 QSize indicatorSize() const;
72 72
73 void drawExclusiveIndicator(QPainter *p, int x, int y ,int w, int h, 73 void drawExclusiveIndicator(QPainter *p, int x, int y ,int w, int h,
74 const QColorGroup &g, bool on, 74 const QColorGroup &g, bool on,
75 bool = FALSE, bool = TRUE); 75 bool = FALSE, bool = TRUE);
76 QSize exclusiveIndicatorSize() const; 76 QSize exclusiveIndicatorSize() const;
77 77
78 void drawPanel(QPainter * p, int x, int y, int w, int h, 78 void drawPanel(QPainter * p, int x, int y, int w, int h,
79 const QColorGroup &g, bool sunken = FALSE, 79 const QColorGroup &g, bool sunken = FALSE,
80 int = 1, const QBrush * = 0); 80 int = 1, const QBrush * = 0);
81 81
82 void scrollBarMetrics( const QScrollBar *, 82 void scrollBarMetrics( const QScrollBar *,
83 int &, int &, int &, int & ) const; 83 int &, int &, int &, int & ) const;
84 void drawScrollBarControls(QPainter* p, const QScrollBar* sb, 84 void drawScrollBarControls(QPainter* p, const QScrollBar* sb,
85 int sliderStart, uint controls, 85 int sliderStart, uint controls,
86 uint activeControl); 86 uint activeControl);
87 QStyle::ScrollControl scrollBarPointOver(const QScrollBar *, int, const QPoint& p); 87 QStyle::ScrollControl scrollBarPointOver(const QScrollBar *, int, const QPoint& p);
88 88
89 void drawTab(QPainter *p, const QTabBar *tabbar, QTab *tab, bool selected); 89 void drawTab(QPainter *p, const QTabBar *tabbar, QTab *tab, bool selected);
90 90
91 void drawSlider(QPainter *p, int x, int y, int w, int h, 91 void drawSlider(QPainter *p, int x, int y, int w, int h,
92 const QColorGroup &g, Qt::Orientation orientation, 92 const QColorGroup &g, Qt::Orientation orientation,
93 bool, bool); 93 bool, bool);
94 void drawSliderGroove(QPainter *p, int x, int y, int w, int h, 94 void drawSliderGroove(QPainter *p, int x, int y, int w, int h,
95 const QColorGroup& g, QCOORD, 95 const QColorGroup& g, QCOORD,
96 Qt::Orientation ); 96 Qt::Orientation );
97 97
98 void drawToolBarHandle(QPainter *, const QRect &, Qt::Orientation, 98 void drawToolBarHandle(QPainter *, const QRect &, Qt::Orientation,
99 bool, const QColorGroup &, bool = FALSE ); 99 bool, const QColorGroup &, bool = FALSE );
100 100
101 QSize scrollBarExtent() const; 101 QSize scrollBarExtent() const;
102 int buttonDefaultIndicatorWidth() const; 102 int buttonDefaultIndicatorWidth() const;
103 int buttonMargin() const; 103 int buttonMargin() const;
104 int sliderThickness() const; 104 int sliderThickness() const;
105 int sliderLength() const; 105 int sliderLength() const;
106 int defaultFrameWidth() const; 106 int defaultFrameWidth() const;
107 107
108 int extraPopupMenuItemWidth( bool checkable, int maxpmw, QMenuItem*, const QFontMetrics& ); 108 int extraPopupMenuItemWidth( bool checkable, int maxpmw, QMenuItem*, const QFontMetrics& );
109 int popupMenuItemHeight( bool checkable, QMenuItem*, const QFontMetrics& ); 109 int popupMenuItemHeight( bool checkable, QMenuItem*, const QFontMetrics& );
110 void drawPopupMenuItem( QPainter* p, bool checkable, int maxpmw, int tab, QMenuItem* mi, 110 void drawPopupMenuItem( QPainter* p, bool checkable, int maxpmw, int tab, QMenuItem* mi,
111 const QPalette& pal, 111 const QPalette& pal,
112 bool act, bool enabled, int x, int y, int w, int h); 112 bool act, bool enabled, int x, int y, int w, int h);
113 113
114protected: 114protected:
115 bool eventFilter(QObject *, QEvent *); 115 bool eventFilter(QObject *, QEvent *);
116}; 116};
117 117
118#endif 118#endif
119 119
120#endif // LIGHTSTYLE_H 120#endif // LIGHTSTYLE_H
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp
index af00f49..1c5ced3 100644
--- a/library/qpeapplication.cpp
+++ b/library/qpeapplication.cpp
@@ -1,191 +1,191 @@
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 >= 0x030000
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
104static bool useBigPixmaps = 0; 104static bool useBigPixmaps = 0;
105 105
106class HackWidget : public QWidget 106class HackWidget : public QWidget
107{ 107{
108public: 108public:
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
116class QPEApplicationData 116class QPEApplicationData
117{ 117{
118public: 118public:
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
@@ -1718,257 +1718,257 @@ void QPEApplication::pidMessage( const QCString& msg, const QByteArray& data)
1718 else if ( msg == "enablePreload()" ) { 1718 else if ( msg == "enablePreload()" ) {
1719 if (d->qpe_main_widget) 1719 if (d->qpe_main_widget)
1720 d->preloaded = TRUE; 1720 d->preloaded = TRUE;
1721 d->keep_running = TRUE; 1721 d->keep_running = TRUE;
1722 /* so next quit won't quit */ 1722 /* so next quit won't quit */
1723 } 1723 }
1724 else if ( msg == "raise()" ) { 1724 else if ( msg == "raise()" ) {
1725 d->keep_running = TRUE; 1725 d->keep_running = TRUE;
1726 d->notbusysent = FALSE; 1726 d->notbusysent = FALSE;
1727 raiseAppropriateWindow(); 1727 raiseAppropriateWindow();
1728 // Tell the system we're still chugging along... 1728 // Tell the system we're still chugging along...
1729 QCopEnvelope e("QPE/System", "appRaised(QString)"); 1729 QCopEnvelope e("QPE/System", "appRaised(QString)");
1730 e << d->appName; 1730 e << d->appName;
1731 } 1731 }
1732 else if ( msg == "flush()" ) { 1732 else if ( msg == "flush()" ) {
1733 emit flush(); 1733 emit flush();
1734 // we need to tell the desktop 1734 // we need to tell the desktop
1735 QCopEnvelope e( "QPE/Desktop", "flushDone(QString)" ); 1735 QCopEnvelope e( "QPE/Desktop", "flushDone(QString)" );
1736 e << d->appName; 1736 e << d->appName;
1737 } 1737 }
1738 else if ( msg == "reload()" ) { 1738 else if ( msg == "reload()" ) {
1739 emit reload(); 1739 emit reload();
1740 } 1740 }
1741 else if ( msg == "setDocument(QString)" ) { 1741 else if ( msg == "setDocument(QString)" ) {
1742 d->keep_running = TRUE; 1742 d->keep_running = TRUE;
1743 QDataStream stream( data, IO_ReadOnly ); 1743 QDataStream stream( data, IO_ReadOnly );
1744 QString doc; 1744 QString doc;
1745 stream >> doc; 1745 stream >> doc;
1746 QWidget *mw = mainWidget(); 1746 QWidget *mw = mainWidget();
1747 if ( !mw ) 1747 if ( !mw )
1748 mw = d->qpe_main_widget; 1748 mw = d->qpe_main_widget;
1749 if ( mw ) 1749 if ( mw )
1750 Global::setDocument( mw, doc ); 1750 Global::setDocument( mw, doc );
1751 1751
1752 } else if ( msg == "QPEProcessQCop()" ) { 1752 } else if ( msg == "QPEProcessQCop()" ) {
1753 processQCopFile(); 1753 processQCopFile();
1754 d->sendQCopQ(); 1754 d->sendQCopQ();
1755 }else 1755 }else
1756 { 1756 {
1757 bool p = d->keep_running; 1757 bool p = d->keep_running;
1758 d->keep_running = FALSE; 1758 d->keep_running = FALSE;
1759 emit appMessage( msg, data); 1759 emit appMessage( msg, data);
1760 if ( d->keep_running ) { 1760 if ( d->keep_running ) {
1761 d->notbusysent = FALSE; 1761 d->notbusysent = FALSE;
1762 raiseAppropriateWindow(); 1762 raiseAppropriateWindow();
1763 if ( !p ) { 1763 if ( !p ) {
1764 // Tell the system we're still chugging along... 1764 // Tell the system we're still chugging along...
1765#ifndef QT_NO_COP 1765#ifndef QT_NO_COP
1766 QCopEnvelope e("QPE/System", "appRaised(QString)"); 1766 QCopEnvelope e("QPE/System", "appRaised(QString)");
1767 e << d->appName; 1767 e << d->appName;
1768#endif 1768#endif
1769 } 1769 }
1770 } 1770 }
1771 if ( p ) 1771 if ( p )
1772 d->keep_running = p; 1772 d->keep_running = p;
1773 } 1773 }
1774#endif 1774#endif
1775} 1775}
1776 1776
1777 1777
1778/*! 1778/*!
1779 Sets widget \a mw as the mainWidget() and shows it. For small windows, 1779 Sets widget \a mw as the mainWidget() and shows it. For small windows,
1780 consider passing TRUE for \a nomaximize rather than the default FALSE. 1780 consider passing TRUE for \a nomaximize rather than the default FALSE.
1781 1781
1782 \sa showMainDocumentWidget() 1782 \sa showMainDocumentWidget()
1783*/ 1783*/
1784void QPEApplication::showMainWidget( QWidget* mw, bool nomaximize ) 1784void QPEApplication::showMainWidget( QWidget* mw, bool nomaximize )
1785{ 1785{
1786// setMainWidget(mw); this breaks FastLoading because lastWindowClose() would quit 1786// setMainWidget(mw); this breaks FastLoading because lastWindowClose() would quit
1787 d->show(mw, nomaximize ); 1787 d->show(mw, nomaximize );
1788} 1788}
1789 1789
1790/*! 1790/*!
1791 Sets widget \a mw as the mainWidget() and shows it. For small windows, 1791 Sets widget \a mw as the mainWidget() and shows it. For small windows,
1792 consider passing TRUE for \a nomaximize rather than the default FALSE. 1792 consider passing TRUE for \a nomaximize rather than the default FALSE.
1793 1793
1794 This calls designates the application as 1794 This calls designates the application as
1795 a \link docwidget.html document-oriented\endlink application. 1795 a \link docwidget.html document-oriented\endlink application.
1796 1796
1797 The \a mw widget \e must have this slot: setDocument(const QString&). 1797 The \a mw widget \e must have this slot: setDocument(const QString&).
1798 1798
1799 \sa showMainWidget() 1799 \sa showMainWidget()
1800*/ 1800*/
1801void QPEApplication::showMainDocumentWidget( QWidget* mw, bool nomaximize ) 1801void QPEApplication::showMainDocumentWidget( QWidget* mw, bool nomaximize )
1802{ 1802{
1803 if ( mw && argc() == 2 ) 1803 if ( mw && argc() == 2 )
1804 Global::setDocument( mw, QString::fromUtf8(argv()[1]) ); 1804 Global::setDocument( mw, QString::fromUtf8(argv()[1]) );
1805 1805
1806 1806
1807// setMainWidget(mw); see above 1807// setMainWidget(mw); see above
1808 d->show(mw, nomaximize ); 1808 d->show(mw, nomaximize );
1809} 1809}
1810 1810
1811 1811
1812/*! 1812/*!
1813 If an application is started via a \link qcop.html QCop\endlink 1813 If an application is started via a \link qcop.html QCop\endlink
1814 message, the application will process the \link qcop.html 1814 message, the application will process the \link qcop.html
1815 QCop\endlink message and then quit. If the application calls this 1815 QCop\endlink message and then quit. If the application calls this
1816 function while processing a \link qcop.html QCop\endlink message, 1816 function while processing a \link qcop.html QCop\endlink message,
1817 after processing its outstanding \link qcop.html QCop\endlink 1817 after processing its outstanding \link qcop.html QCop\endlink
1818 messages the application will start 'properly' and show itself. 1818 messages the application will start 'properly' and show itself.
1819 1819
1820 \sa keepRunning() 1820 \sa keepRunning()
1821*/ 1821*/
1822void QPEApplication::setKeepRunning() 1822void QPEApplication::setKeepRunning()
1823{ 1823{
1824 if ( qApp && qApp->inherits( "QPEApplication" ) ) { 1824 if ( qApp && qApp->inherits( "QPEApplication" ) ) {
1825 QPEApplication * qpeApp = ( QPEApplication* ) qApp; 1825 QPEApplication * qpeApp = ( QPEApplication* ) qApp;
1826 qpeApp->d->keep_running = TRUE; 1826 qpeApp->d->keep_running = TRUE;
1827 } 1827 }
1828} 1828}
1829 1829
1830/*! 1830/*!
1831 Returns TRUE if the application will quit after processing the 1831 Returns TRUE if the application will quit after processing the
1832 current list of qcop messages; otherwise returns FALSE. 1832 current list of qcop messages; otherwise returns FALSE.
1833 1833
1834 \sa setKeepRunning() 1834 \sa setKeepRunning()
1835*/ 1835*/
1836bool QPEApplication::keepRunning() const 1836bool QPEApplication::keepRunning() const
1837{ 1837{
1838 return d->keep_running; 1838 return d->keep_running;
1839} 1839}
1840 1840
1841/*! 1841/*!
1842 \internal 1842 \internal
1843*/ 1843*/
1844void QPEApplication::internalSetStyle( const QString &style ) 1844void QPEApplication::internalSetStyle( const QString &style )
1845{ 1845{
1846#if QT_VERSION >= 300 1846#if QT_VERSION >= 0x030000
1847 if ( style == "QPE" ) { 1847 if ( style == "QPE" ) {
1848 setStyle( new QPEStyle ); 1848 setStyle( new QPEStyle );
1849 } 1849 }
1850 else { 1850 else {
1851 QStyle *s = QStyleFactory::create( style ); 1851 QStyle *s = QStyleFactory::create( style );
1852 if ( s ) 1852 if ( s )
1853 setStyle( s ); 1853 setStyle( s );
1854 } 1854 }
1855#else 1855#else
1856 if ( style == "Windows" ) { 1856 if ( style == "Windows" ) {
1857 setStyle( new QWindowsStyle ); 1857 setStyle( new QWindowsStyle );
1858 } 1858 }
1859 else if ( style == "QPE" ) { 1859 else if ( style == "QPE" ) {
1860 setStyle( new QPEStyle ); 1860 setStyle( new QPEStyle );
1861 } 1861 }
1862 else if ( style == "Light" ) { 1862 else if ( style == "Light" ) {
1863 setStyle( new LightStyle ); 1863 setStyle( new LightStyle );
1864 } 1864 }
1865#ifndef QT_NO_STYLE_PLATINUM 1865#ifndef QT_NO_STYLE_PLATINUM
1866 else if ( style == "Platinum" ) { 1866 else if ( style == "Platinum" ) {
1867 setStyle( new QPlatinumStyle ); 1867 setStyle( new QPlatinumStyle );
1868 } 1868 }
1869#endif 1869#endif
1870#ifndef QT_NO_STYLE_MOTIF 1870#ifndef QT_NO_STYLE_MOTIF
1871 else if ( style == "Motif" ) { 1871 else if ( style == "Motif" ) {
1872 setStyle( new QMotifStyle ); 1872 setStyle( new QMotifStyle );
1873 } 1873 }
1874#endif 1874#endif
1875#ifndef QT_NO_STYLE_MOTIFPLUS 1875#ifndef QT_NO_STYLE_MOTIFPLUS
1876 else if ( style == "MotifPlus" ) { 1876 else if ( style == "MotifPlus" ) {
1877 setStyle( new QMotifPlusStyle ); 1877 setStyle( new QMotifPlusStyle );
1878 } 1878 }
1879#endif 1879#endif
1880 1880
1881 else { 1881 else {
1882 QStyle *sty = 0; 1882 QStyle *sty = 0;
1883 QString path = QPEApplication::qpeDir ( ) + "plugins/styles/"; 1883 QString path = QPEApplication::qpeDir ( ) + "plugins/styles/";
1884 1884
1885#ifdef Q_OS_MACX 1885#ifdef Q_OS_MACX
1886 if ( style. find ( ".dylib" ) > 0 ) 1886 if ( style. find ( ".dylib" ) > 0 )
1887 path += style; 1887 path += style;
1888 else 1888 else
1889 path = path + "lib" + style. lower ( ) + ".dylib"; // compatibility 1889 path = path + "lib" + style. lower ( ) + ".dylib"; // compatibility
1890#else 1890#else
1891 if ( style. find ( ".so" ) > 0 ) 1891 if ( style. find ( ".so" ) > 0 )
1892 path += style; 1892 path += style;
1893 else 1893 else
1894 path = path + "lib" + style. lower ( ) + ".so"; // compatibility 1894 path = path + "lib" + style. lower ( ) + ".so"; // compatibility
1895#endif 1895#endif
1896 static QLibrary *lastlib = 0; 1896 static QLibrary *lastlib = 0;
1897 static StyleInterface *lastiface = 0; 1897 static StyleInterface *lastiface = 0;
1898 1898
1899 QLibrary *lib = new QLibrary ( path ); 1899 QLibrary *lib = new QLibrary ( path );
1900 StyleInterface *iface = 0; 1900 StyleInterface *iface = 0;
1901 1901
1902 if (( lib-> queryInterface ( IID_Style, ( QUnknownInterface ** ) &iface ) == QS_OK ) && iface ) 1902 if (( lib-> queryInterface ( IID_Style, ( QUnknownInterface ** ) &iface ) == QS_OK ) && iface )
1903 sty = iface-> style ( ); 1903 sty = iface-> style ( );
1904 1904
1905 if ( sty ) { 1905 if ( sty ) {
1906 setStyle ( sty ); 1906 setStyle ( sty );
1907 1907
1908 if ( lastiface ) 1908 if ( lastiface )
1909 lastiface-> release ( ); 1909 lastiface-> release ( );
1910 lastiface = iface; 1910 lastiface = iface;
1911 1911
1912 if ( lastlib ) { 1912 if ( lastlib ) {
1913 lastlib-> unload ( ); 1913 lastlib-> unload ( );
1914 delete lastlib; 1914 delete lastlib;
1915 } 1915 }
1916 lastlib = lib; 1916 lastlib = lib;
1917 } 1917 }
1918 else { 1918 else {
1919 if ( iface ) 1919 if ( iface )
1920 iface-> release ( ); 1920 iface-> release ( );
1921 delete lib; 1921 delete lib;
1922 1922
1923 setStyle ( new LightStyle ( )); 1923 setStyle ( new LightStyle ( ));
1924 } 1924 }
1925 } 1925 }
1926#endif 1926#endif
1927} 1927}
1928 1928
1929/*! 1929/*!
1930 \internal 1930 \internal
1931*/ 1931*/
1932void QPEApplication::prepareForTermination( bool willrestart ) 1932void QPEApplication::prepareForTermination( bool willrestart )
1933{ 1933{
1934 if ( willrestart ) { 1934 if ( willrestart ) {
1935 QLabel *lblWait = new QLabel( tr( "Please wait..." ), 0, "wait hack", QWidget::WStyle_Customize | 1935 QLabel *lblWait = new QLabel( tr( "Please wait..." ), 0, "wait hack", QWidget::WStyle_Customize |
1936 QWidget::WStyle_NoBorder | QWidget::WStyle_Tool ); 1936 QWidget::WStyle_NoBorder | QWidget::WStyle_Tool );
1937 lblWait->setAlignment( QWidget::AlignCenter ); 1937 lblWait->setAlignment( QWidget::AlignCenter );
1938 lblWait->show(); 1938 lblWait->show();
1939 lblWait->showMaximized(); 1939 lblWait->showMaximized();
1940 } 1940 }
1941 { QCopEnvelope envelope( "QPE/System", "forceQuit()" ); 1941 { QCopEnvelope envelope( "QPE/System", "forceQuit()" );
1942 } 1942 }
1943 processEvents(); // ensure the message goes out. 1943 processEvents(); // ensure the message goes out.
1944} 1944}
1945 1945
1946/*! 1946/*!
1947 \internal 1947 \internal
1948*/ 1948*/
1949void QPEApplication::shutdown() 1949void QPEApplication::shutdown()
1950{ 1950{
1951 // Implement in server's QPEApplication subclass 1951 // Implement in server's QPEApplication subclass
1952} 1952}
1953 1953
1954/*! 1954/*!
1955 \internal 1955 \internal
1956*/ 1956*/
1957void QPEApplication::restart() 1957void QPEApplication::restart()
1958{ 1958{
1959 // Implement in server's QPEApplication subclass 1959 // Implement in server's QPEApplication subclass
1960} 1960}
1961 1961
1962static QPtrDict<void>* stylusDict = 0; 1962static QPtrDict<void>* stylusDict = 0;
1963static void createDict() 1963static void createDict()
1964{ 1964{
1965 if ( !stylusDict ) 1965 if ( !stylusDict )
1966 stylusDict = new QPtrDict<void>; 1966 stylusDict = new QPtrDict<void>;
1967} 1967}
1968 1968
1969/*! 1969/*!
1970 Returns the current StylusMode for widget \a w. 1970 Returns the current StylusMode for widget \a w.
1971 1971
1972 \sa setStylusOperation() StylusMode 1972 \sa setStylusOperation() StylusMode
1973*/ 1973*/
1974QPEApplication::StylusMode QPEApplication::stylusOperation( QWidget* w ) 1974QPEApplication::StylusMode QPEApplication::stylusOperation( QWidget* w )
diff --git a/library/qpestyle.cpp b/library/qpestyle.cpp
index b61ada4..0566f6b 100644
--- a/library/qpestyle.cpp
+++ b/library/qpestyle.cpp
@@ -1,154 +1,154 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 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#include "qpestyle.h" 21#include "qpestyle.h"
22 22
23 23
24#define QCOORDARRLEN(x) sizeof(x)/(sizeof(QCOORD)*2) 24#define QCOORDARRLEN(x) sizeof(x)/(sizeof(QCOORD)*2)
25 25
26#if QT_VERSION >= 300 26#if QT_VERSION >= 0x030000
27 27
28#include <qdrawutil.h> 28#include <qdrawutil.h>
29#include <qcombobox.h> 29#include <qcombobox.h>
30#include <qtabbar.h> 30#include <qtabbar.h>
31 31
32QPEStyle::QPEStyle() 32QPEStyle::QPEStyle()
33{ 33{
34} 34}
35 35
36QPEStyle::~QPEStyle() 36QPEStyle::~QPEStyle()
37{ 37{
38} 38}
39 39
40void QPEStyle::drawPrimitive( PrimitiveElement pe, QPainter *p, const QRect &r, 40void QPEStyle::drawPrimitive( PrimitiveElement pe, QPainter *p, const QRect &r,
41 const QColorGroup &cg, SFlags flags, const QStyleOption &data) const 41 const QColorGroup &cg, SFlags flags, const QStyleOption &data) const
42{ 42{
43 switch ( pe ) { 43 switch ( pe ) {
44 case PE_ButtonTool: 44 case PE_ButtonTool:
45 { 45 {
46 QColorGroup mycg = cg; 46 QColorGroup mycg = cg;
47 if ( flags & Style_On ) { 47 if ( flags & Style_On ) {
48 QBrush fill( cg.mid(), Dense4Pattern ); 48 QBrush fill( cg.mid(), Dense4Pattern );
49 mycg.setBrush( QColorGroup::Button, fill ); 49 mycg.setBrush( QColorGroup::Button, fill );
50 } 50 }
51 drawPrimitive( PE_ButtonBevel, p, r, mycg, flags, data ); 51 drawPrimitive( PE_ButtonBevel, p, r, mycg, flags, data );
52 break; 52 break;
53 } 53 }
54 case PE_ButtonCommand: 54 case PE_ButtonCommand:
55 case PE_ButtonDefault: 55 case PE_ButtonDefault:
56 case PE_ButtonBevel: 56 case PE_ButtonBevel:
57 case PE_HeaderSection: 57 case PE_HeaderSection:
58 { 58 {
59 QPen oldPen = p->pen(); 59 QPen oldPen = p->pen();
60 p->fillRect( r.x()+1, r.y()+1, r.width()-2, r.height()-2, cg.brush(QColorGroup::Button) ); 60 p->fillRect( r.x()+1, r.y()+1, r.width()-2, r.height()-2, cg.brush(QColorGroup::Button) );
61 61
62 int x2 = r.right(); 62 int x2 = r.right();
63 int y2 = r.bottom(); 63 int y2 = r.bottom();
64 64
65 if ( flags & (Style_Sunken | Style_Down | Style_On) ) 65 if ( flags & (Style_Sunken | Style_Down | Style_On) )
66 p->setPen( cg.dark() ); 66 p->setPen( cg.dark() );
67 else 67 else
68 p->setPen( cg.light() ); 68 p->setPen( cg.light() );
69 p->drawLine( r.x(), r.y()+1, r.x(), y2-1 ); 69 p->drawLine( r.x(), r.y()+1, r.x(), y2-1 );
70 p->drawLine( r.x()+1, r.y(), x2-1, r.y() ); 70 p->drawLine( r.x()+1, r.y(), x2-1, r.y() );
71 71
72 if ( flags & (Style_Sunken | Style_Down | Style_On) ) 72 if ( flags & (Style_Sunken | Style_Down | Style_On) )
73 p->setPen( cg.light() ); 73 p->setPen( cg.light() );
74 else 74 else
75 p->setPen( cg.dark() ); 75 p->setPen( cg.dark() );
76 p->drawLine( x2, r.y()+1, x2, y2-1 ); 76 p->drawLine( x2, r.y()+1, x2, y2-1 );
77 p->drawLine( r.x()+1, y2, x2-1, y2 ); 77 p->drawLine( r.x()+1, y2, x2-1, y2 );
78 p->setPen( oldPen ); 78 p->setPen( oldPen );
79 break; 79 break;
80 } 80 }
81 case PE_FocusRect: 81 case PE_FocusRect:
82 break; 82 break;
83 case PE_Indicator: 83 case PE_Indicator:
84 { 84 {
85 QColorGroup mycg( cg ); 85 QColorGroup mycg( cg );
86 QBrush fill; 86 QBrush fill;
87 if ( flags & Style_Down ) 87 if ( flags & Style_Down )
88 fill = cg.brush( QColorGroup::Button ); 88 fill = cg.brush( QColorGroup::Button );
89 else 89 else
90 fill = cg.brush( (flags&Style_Enabled) ? QColorGroup::Base : QColorGroup::Background ); 90 fill = cg.brush( (flags&Style_Enabled) ? QColorGroup::Base : QColorGroup::Background );
91 mycg.setBrush( QColorGroup::Button, fill ); 91 mycg.setBrush( QColorGroup::Button, fill );
92 if ( flags&Style_Enabled ) 92 if ( flags&Style_Enabled )
93 flags |= Style_Sunken; 93 flags |= Style_Sunken;
94 drawPrimitive( PE_ButtonBevel, p, r, mycg, flags ); 94 drawPrimitive( PE_ButtonBevel, p, r, mycg, flags );
95 if ( flags & Style_On ) { 95 if ( flags & Style_On ) {
96 QPointArray a( 7*2 ); 96 QPointArray a( 7*2 );
97 int i, xx, yy; 97 int i, xx, yy;
98 xx = r.x()+3; 98 xx = r.x()+3;
99 yy = r.y()+5; 99 yy = r.y()+5;
100 for ( i=0; i<3; i++ ) { 100 for ( i=0; i<3; i++ ) {
101 a.setPoint( 2*i, xx, yy ); 101 a.setPoint( 2*i, xx, yy );
102 a.setPoint( 2*i+1, xx, yy+2 ); 102 a.setPoint( 2*i+1, xx, yy+2 );
103 xx++; yy++; 103 xx++; yy++;
104 } 104 }
105 yy -= 2; 105 yy -= 2;
106 for ( i=3; i<7; i++ ) { 106 for ( i=3; i<7; i++ ) {
107 a.setPoint( 2*i, xx, yy ); 107 a.setPoint( 2*i, xx, yy );
108 a.setPoint( 2*i+1, xx, yy+2 ); 108 a.setPoint( 2*i+1, xx, yy+2 );
109 xx++; yy--; 109 xx++; yy--;
110 } 110 }
111 if ( flags & Style_NoChange ) { 111 if ( flags & Style_NoChange ) {
112 p->setPen( mycg.dark() ); 112 p->setPen( mycg.dark() );
113 } else { 113 } else {
114 p->setPen( mycg.text() ); 114 p->setPen( mycg.text() );
115 } 115 }
116 p->drawLineSegments( a ); 116 p->drawLineSegments( a );
117 } 117 }
118 break; 118 break;
119 } 119 }
120 case PE_ExclusiveIndicator: 120 case PE_ExclusiveIndicator:
121 { 121 {
122 static const QCOORD pts1[] = { // dark lines 122 static const QCOORD pts1[] = { // dark lines
123 1,9, 1,8, 0,7, 0,4, 1,3, 1,2, 2,1, 3,1, 4,0, 7,0, 8,1, 9,1 }; 123 1,9, 1,8, 0,7, 0,4, 1,3, 1,2, 2,1, 3,1, 4,0, 7,0, 8,1, 9,1 };
124 static const QCOORD pts4[] = { // white lines 124 static const QCOORD pts4[] = { // white lines
125 2,10, 3,10, 4,11, 7,11, 8,10, 9,10, 10,9, 10,8, 11,7, 125 2,10, 3,10, 4,11, 7,11, 8,10, 9,10, 10,9, 10,8, 11,7,
126 11,4, 10,3, 10,2 }; 126 11,4, 10,3, 10,2 };
127 static const QCOORD pts5[] = { // inner fill 127 static const QCOORD pts5[] = { // inner fill
128 4,2, 7,2, 9,4, 9,7, 7,9, 4,9, 2,7, 2,4 }; 128 4,2, 7,2, 9,4, 9,7, 7,9, 4,9, 2,7, 2,4 };
129 129
130 int x, y, w, h; 130 int x, y, w, h;
131 r.rect( &x, &y, &w, &h ); 131 r.rect( &x, &y, &w, &h );
132 p->eraseRect( x, y, w, h ); 132 p->eraseRect( x, y, w, h );
133 QPointArray a( QCOORDARRLEN(pts1), pts1 ); 133 QPointArray a( QCOORDARRLEN(pts1), pts1 );
134 a.translate( x, y ); 134 a.translate( x, y );
135 p->setPen( cg.dark() ); 135 p->setPen( cg.dark() );
136 p->drawPolyline( a ); 136 p->drawPolyline( a );
137 a.setPoints( QCOORDARRLEN(pts4), pts4 ); 137 a.setPoints( QCOORDARRLEN(pts4), pts4 );
138 a.translate( x, y ); 138 a.translate( x, y );
139 p->setPen( cg.light() ); 139 p->setPen( cg.light() );
140 p->drawPolyline( a ); 140 p->drawPolyline( a );
141 a.setPoints( QCOORDARRLEN(pts5), pts5 ); 141 a.setPoints( QCOORDARRLEN(pts5), pts5 );
142 a.translate( x, y ); 142 a.translate( x, y );
143 QColor fillColor = ( flags&Style_Down || !(flags&Style_Enabled) ) ? cg.button() : cg.base(); 143 QColor fillColor = ( flags&Style_Down || !(flags&Style_Enabled) ) ? cg.button() : cg.base();
144 p->setPen( fillColor ); 144 p->setPen( fillColor );
145 p->setBrush( fillColor ) ; 145 p->setBrush( fillColor ) ;
146 p->drawPolygon( a ); 146 p->drawPolygon( a );
147 if ( flags&Style_On ) { 147 if ( flags&Style_On ) {
148 p->setPen( NoPen ); 148 p->setPen( NoPen );
149 p->setBrush( cg.text() ); 149 p->setBrush( cg.text() );
150 p->drawRect( x+5, y+4, 2, 4 ); 150 p->drawRect( x+5, y+4, 2, 4 );
151 p->drawRect( x+4, y+5, 4, 2 ); 151 p->drawRect( x+4, y+5, 4, 2 );
152 } 152 }
153 break; 153 break;
154 } 154 }
@@ -304,257 +304,257 @@ void QPEStyle::drawComplexControl( ComplexControl control, QPainter *p,
304 QStyle::visualRect( querySubControlMetrics( CC_ComboBox, widget, 304 QStyle::visualRect( querySubControlMetrics( CC_ComboBox, widget,
305 SC_ComboBoxArrow ), widget ); 305 SC_ComboBoxArrow ), widget );
306 306
307 if ( subActive == SC_ComboBoxArrow ) { 307 if ( subActive == SC_ComboBoxArrow ) {
308 p->setPen( cg.dark() ); 308 p->setPen( cg.dark() );
309 p->setBrush( cg.brush( QColorGroup::Button ) ); 309 p->setBrush( cg.brush( QColorGroup::Button ) );
310 p->drawRect( ar ); 310 p->drawRect( ar );
311 } 311 }
312 312
313 ar.addCoords( 2, 2, -2, -2 ); 313 ar.addCoords( 2, 2, -2, -2 );
314 if ( widget->isEnabled() ) 314 if ( widget->isEnabled() )
315 flags |= Style_Enabled; 315 flags |= Style_Enabled;
316 316
317 if ( subActive & Style_Sunken ) { 317 if ( subActive & Style_Sunken ) {
318 flags |= Style_Sunken; 318 flags |= Style_Sunken;
319 } 319 }
320 drawPrimitive( PE_ArrowDown, p, ar, cg, flags ); 320 drawPrimitive( PE_ArrowDown, p, ar, cg, flags );
321 } 321 }
322 322
323 if ( sub & SC_ComboBoxEditField ) { 323 if ( sub & SC_ComboBoxEditField ) {
324 const QComboBox * cb = (const QComboBox *) widget; 324 const QComboBox * cb = (const QComboBox *) widget;
325 QRect re = 325 QRect re =
326 QStyle::visualRect( querySubControlMetrics( CC_ComboBox, widget, 326 QStyle::visualRect( querySubControlMetrics( CC_ComboBox, widget,
327 SC_ComboBoxEditField ), widget ); 327 SC_ComboBoxEditField ), widget );
328 if ( cb->hasFocus() && !cb->editable() ) 328 if ( cb->hasFocus() && !cb->editable() )
329 p->fillRect( re.x(), re.y(), re.width(), re.height(), 329 p->fillRect( re.x(), re.y(), re.width(), re.height(),
330 cg.brush( QColorGroup::Highlight ) ); 330 cg.brush( QColorGroup::Highlight ) );
331 331
332 if ( cb->hasFocus() ) { 332 if ( cb->hasFocus() ) {
333 p->setPen( cg.highlightedText() ); 333 p->setPen( cg.highlightedText() );
334 p->setBackgroundColor( cg.highlight() ); 334 p->setBackgroundColor( cg.highlight() );
335 335
336 } else { 336 } else {
337 p->setPen( cg.text() ); 337 p->setPen( cg.text() );
338 p->setBackgroundColor( cg.background() ); 338 p->setBackgroundColor( cg.background() );
339 } 339 }
340 340
341 if ( cb->hasFocus() && !cb->editable() ) { 341 if ( cb->hasFocus() && !cb->editable() ) {
342 QRect re = 342 QRect re =
343 QStyle::visualRect( subRect( SR_ComboBoxFocusRect, cb ), widget ); 343 QStyle::visualRect( subRect( SR_ComboBoxFocusRect, cb ), widget );
344 drawPrimitive( PE_FocusRect, p, re, cg, Style_FocusAtBorder, QStyleOption(cg.highlight())); 344 drawPrimitive( PE_FocusRect, p, re, cg, Style_FocusAtBorder, QStyleOption(cg.highlight()));
345 } 345 }
346 } 346 }
347 break; 347 break;
348 default: 348 default:
349 QWindowsStyle::drawComplexControl( control, p, widget, r, cg, how, 349 QWindowsStyle::drawComplexControl( control, p, widget, r, cg, how,
350 sub, subActive, data ); 350 sub, subActive, data );
351 break; 351 break;
352 } 352 }
353} 353}
354 354
355int QPEStyle::pixelMetric( PixelMetric metric, const QWidget *widget ) const 355int QPEStyle::pixelMetric( PixelMetric metric, const QWidget *widget ) const
356{ 356{
357 int ret; 357 int ret;
358 switch( metric ) { 358 switch( metric ) {
359 case PM_ButtonMargin: 359 case PM_ButtonMargin:
360 ret = 2; 360 ret = 2;
361 break; 361 break;
362 case PM_DefaultFrameWidth: 362 case PM_DefaultFrameWidth:
363 ret = 1; 363 ret = 1;
364 break; 364 break;
365 case PM_ButtonDefaultIndicator: 365 case PM_ButtonDefaultIndicator:
366 ret = 2; 366 ret = 2;
367 break; 367 break;
368 case PM_ButtonShiftHorizontal: 368 case PM_ButtonShiftHorizontal:
369 case PM_ButtonShiftVertical: 369 case PM_ButtonShiftVertical:
370 ret = -1; 370 ret = -1;
371 break; 371 break;
372 case PM_IndicatorWidth: 372 case PM_IndicatorWidth:
373 ret = 15; 373 ret = 15;
374 break; 374 break;
375 case PM_IndicatorHeight: 375 case PM_IndicatorHeight:
376 ret = 13; 376 ret = 13;
377 break; 377 break;
378 case PM_ExclusiveIndicatorHeight: 378 case PM_ExclusiveIndicatorHeight:
379 case PM_ExclusiveIndicatorWidth: 379 case PM_ExclusiveIndicatorWidth:
380 ret = 15; 380 ret = 15;
381 break; 381 break;
382 case PM_ScrollBarExtent: 382 case PM_ScrollBarExtent:
383 ret = 13; 383 ret = 13;
384 break; 384 break;
385 case PM_SliderLength: 385 case PM_SliderLength:
386 ret = 12; 386 ret = 12;
387 break; 387 break;
388 default: 388 default:
389 ret = QWindowsStyle::pixelMetric( metric, widget ); 389 ret = QWindowsStyle::pixelMetric( metric, widget );
390 break; 390 break;
391 } 391 }
392 return ret; 392 return ret;
393} 393}
394 394
395QSize QPEStyle::sizeFromContents( ContentsType contents, const QWidget *widget, 395QSize QPEStyle::sizeFromContents( ContentsType contents, const QWidget *widget,
396 const QSize &contentsSize, const QStyleOption &data) const 396 const QSize &contentsSize, const QStyleOption &data) const
397{ 397{
398 QSize sz(contentsSize); 398 QSize sz(contentsSize);
399 399
400 switch ( contents ) { 400 switch ( contents ) {
401 case CT_PopupMenuItem: 401 case CT_PopupMenuItem:
402 { 402 {
403 if ( !widget || data.isDefault() ) 403 if ( !widget || data.isDefault() )
404 break; 404 break;
405 sz = QWindowsStyle::sizeFromContents( contents, widget, contentsSize, data ); 405 sz = QWindowsStyle::sizeFromContents( contents, widget, contentsSize, data );
406 sz = QSize( sz.width(), sz.height()-2 ); 406 sz = QSize( sz.width(), sz.height()-2 );
407 break; 407 break;
408 } 408 }
409 default: 409 default:
410 sz = QWindowsStyle::sizeFromContents( contents, widget, contentsSize, data ); 410 sz = QWindowsStyle::sizeFromContents( contents, widget, contentsSize, data );
411 break; 411 break;
412 } 412 }
413 413
414 return sz; 414 return sz;
415} 415}
416 416
417#else 417#else
418 418
419#include <qfontmetrics.h> 419#include <qfontmetrics.h>
420#include <qpalette.h> 420#include <qpalette.h>
421#include <qdrawutil.h> 421#include <qdrawutil.h>
422#include <qscrollbar.h> 422#include <qscrollbar.h>
423#include <qbutton.h> 423#include <qbutton.h>
424#include <qframe.h> 424#include <qframe.h>
425#include <qtabbar.h> 425#include <qtabbar.h>
426 426
427#define INCLUDE_MENUITEM_DEF 427#define INCLUDE_MENUITEM_DEF
428#include <qmenudata.h> 428#include <qmenudata.h>
429 429
430QPEStyle::QPEStyle() 430QPEStyle::QPEStyle()
431{ 431{
432#if QT_VERSION < 300 432#if QT_VERSION < 0x030000
433 setButtonMargin(buttonMargin()); 433 setButtonMargin(buttonMargin());
434 setScrollBarExtent(scrollBarExtent().width(),scrollBarExtent().height()); 434 setScrollBarExtent(scrollBarExtent().width(),scrollBarExtent().height());
435#endif 435#endif
436} 436}
437 437
438QPEStyle::~QPEStyle() 438QPEStyle::~QPEStyle()
439{ 439{
440} 440}
441 441
442int QPEStyle::buttonMargin() const 442int QPEStyle::buttonMargin() const
443{ 443{
444 return 2; 444 return 2;
445} 445}
446 446
447QSize QPEStyle::scrollBarExtent() const 447QSize QPEStyle::scrollBarExtent() const
448{ 448{
449 return QSize(13,13); 449 return QSize(13,13);
450} 450}
451 451
452void QPEStyle::polish ( QPalette & ) 452void QPEStyle::polish ( QPalette & )
453{ 453{
454} 454}
455 455
456void QPEStyle::polish( QWidget *w ) 456void QPEStyle::polish( QWidget *w )
457{ 457{
458 if ( w->inherits( "QListBox" ) || 458 if ( w->inherits( "QListBox" ) ||
459 w->inherits( "QListView" ) || 459 w->inherits( "QListView" ) ||
460 w->inherits( "QPopupMenu" ) || 460 w->inherits( "QPopupMenu" ) ||
461 w->inherits( "QSpinBox" ) ) { 461 w->inherits( "QSpinBox" ) ) {
462 QFrame *f = (QFrame *)w; 462 QFrame *f = (QFrame *)w;
463 f->setFrameShape( QFrame::StyledPanel ); 463 f->setFrameShape( QFrame::StyledPanel );
464 f->setLineWidth( 1 ); 464 f->setLineWidth( 1 );
465 } 465 }
466} 466}
467 467
468void QPEStyle::unPolish( QWidget *w ) 468void QPEStyle::unPolish( QWidget *w )
469{ 469{
470 if ( w->inherits( "QListBox" ) || 470 if ( w->inherits( "QListBox" ) ||
471 w->inherits( "QListView" ) || 471 w->inherits( "QListView" ) ||
472 w->inherits( "QPopupMenu" ) || 472 w->inherits( "QPopupMenu" ) ||
473 w->inherits( "QSpinBox" ) ) { 473 w->inherits( "QSpinBox" ) ) {
474 QFrame *f = (QFrame *)w; 474 QFrame *f = (QFrame *)w;
475 f->setFrameShape( QFrame::StyledPanel ); 475 f->setFrameShape( QFrame::StyledPanel );
476 f->setLineWidth( 2 ); 476 f->setLineWidth( 2 );
477 } 477 }
478} 478}
479 479
480int QPEStyle::defaultFrameWidth() const 480int QPEStyle::defaultFrameWidth() const
481{ 481{
482 return 1; 482 return 1;
483} 483}
484 484
485void QPEStyle::drawPanel ( QPainter * p, int x, int y, int w, int h, 485void QPEStyle::drawPanel ( QPainter * p, int x, int y, int w, int h,
486 const QColorGroup &g, bool sunken, int lineWidth, const QBrush * fill ) 486 const QColorGroup &g, bool sunken, int lineWidth, const QBrush * fill )
487{ 487{
488 qDrawShadePanel( p, QRect(x, y, w, h), g, sunken, lineWidth, fill ); 488 qDrawShadePanel( p, QRect(x, y, w, h), g, sunken, lineWidth, fill );
489} 489}
490 490
491void QPEStyle::drawButton( QPainter *p, int x, int y, int w, int h, 491void QPEStyle::drawButton( QPainter *p, int x, int y, int w, int h,
492 const QColorGroup &g, bool sunken, const QBrush* fill ) 492 const QColorGroup &g, bool sunken, const QBrush* fill )
493{ 493{
494 QPen oldPen = p->pen(); 494 QPen oldPen = p->pen();
495 if ( sunken ) 495 if ( sunken )
496 p->setPen( g.dark() ); 496 p->setPen( g.dark() );
497 else 497 else
498 p->setPen( g.light() ); 498 p->setPen( g.light() );
499 499
500 int x2 = x+w-1; 500 int x2 = x+w-1;
501 int y2 = y+h-1; 501 int y2 = y+h-1;
502 502
503 p->drawLine( x, y, x, y2 ); 503 p->drawLine( x, y, x, y2 );
504 p->drawLine( x, y, x2, y ); 504 p->drawLine( x, y, x2, y );
505 505
506 if ( sunken ) 506 if ( sunken )
507 p->setPen( g.light() ); 507 p->setPen( g.light() );
508 else 508 else
509 p->setPen( g.dark() ); 509 p->setPen( g.dark() );
510 510
511 p->drawLine( x2, y, x2, y2 ); 511 p->drawLine( x2, y, x2, y2 );
512 p->drawLine( x, y2, x2, y2 ); 512 p->drawLine( x, y2, x2, y2 );
513 p->setPen( oldPen ); 513 p->setPen( oldPen );
514 514
515 p->fillRect( x+1, y+1, w-2, h-2, fill?(*fill):g.brush(QColorGroup::Button) ); 515 p->fillRect( x+1, y+1, w-2, h-2, fill?(*fill):g.brush(QColorGroup::Button) );
516} 516}
517 517
518void QPEStyle::drawButtonMask ( QPainter * p, int x, int y, int w, int h ) 518void QPEStyle::drawButtonMask ( QPainter * p, int x, int y, int w, int h )
519{ 519{
520 p->fillRect( x, y, w, h, color1 ); 520 p->fillRect( x, y, w, h, color1 );
521} 521}
522 522
523void QPEStyle::drawBevelButton( QPainter *p, int x, int y, int w, int h, 523void QPEStyle::drawBevelButton( QPainter *p, int x, int y, int w, int h,
524 const QColorGroup &g, bool sunken, const QBrush* fill ) 524 const QColorGroup &g, bool sunken, const QBrush* fill )
525{ 525{
526 drawButton( p, x, y, w, h, g, sunken, fill ); 526 drawButton( p, x, y, w, h, g, sunken, fill );
527} 527}
528 528
529QRect QPEStyle::comboButtonRect( int x, int y, int w, int h) 529QRect QPEStyle::comboButtonRect( int x, int y, int w, int h)
530{ 530{
531 return QRect(x+1, y+1, w-2-14, h-2); 531 return QRect(x+1, y+1, w-2-14, h-2);
532} 532}
533 533
534 534
535QRect QPEStyle::comboButtonFocusRect( int x, int y, int w, int h) 535QRect QPEStyle::comboButtonFocusRect( int x, int y, int w, int h)
536{ 536{
537 return QRect(x+2, y+2, w-4-14, h-4); 537 return QRect(x+2, y+2, w-4-14, h-4);
538} 538}
539 539
540void QPEStyle::drawComboButton( QPainter *p, int x, int y, int w, int h, 540void QPEStyle::drawComboButton( QPainter *p, int x, int y, int w, int h,
541 const QColorGroup &g, bool sunken, 541 const QColorGroup &g, bool sunken,
542 bool /*editable*/, 542 bool /*editable*/,
543 bool enabled, 543 bool enabled,
544 const QBrush *fill ) 544 const QBrush *fill )
545{ 545{
546 drawBevelButton( p, x, y, w, h, g, FALSE, fill ); 546 drawBevelButton( p, x, y, w, h, g, FALSE, fill );
547 drawBevelButton( p, x+w-14, y, 14, h, g, sunken, fill ); 547 drawBevelButton( p, x+w-14, y, 14, h, g, sunken, fill );
548 drawArrow( p, QStyle::DownArrow, sunken, 548 drawArrow( p, QStyle::DownArrow, sunken,
549 x+w-14+ 2, y+ 2, 14- 4, h- 4, g, enabled, 549 x+w-14+ 2, y+ 2, 14- 4, h- 4, g, enabled,
550 &g.brush( QColorGroup::Button ) ); 550 &g.brush( QColorGroup::Button ) );
551 551
552} 552}
553 553
554 554
555void QPEStyle::drawExclusiveIndicator ( QPainter * p, int x, int y, int w, 555void QPEStyle::drawExclusiveIndicator ( QPainter * p, int x, int y, int w,
556 int h, const QColorGroup & g, bool on, bool down, bool enabled ) 556 int h, const QColorGroup & g, bool on, bool down, bool enabled )
557{ 557{
558 static const QCOORD pts1[] = { // dark lines 558 static const QCOORD pts1[] = { // dark lines
559 1,9, 1,8, 0,7, 0,4, 1,3, 1,2, 2,1, 3,1, 4,0, 7,0, 8,1, 9,1 }; 559 1,9, 1,8, 0,7, 0,4, 1,3, 1,2, 2,1, 3,1, 4,0, 7,0, 8,1, 9,1 };
560 static const QCOORD pts4[] = { // white lines 560 static const QCOORD pts4[] = { // white lines
diff --git a/library/qpestyle.h b/library/qpestyle.h
index 19ef346..1bde0ff 100644
--- a/library/qpestyle.h
+++ b/library/qpestyle.h
@@ -1,102 +1,102 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 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 QPESTYLE_H 21#ifndef QPESTYLE_H
22#define QPESTYLE_H 22#define QPESTYLE_H
23 23
24#ifndef QT_H 24#ifndef QT_H
25#include "qwindowsstyle.h" 25#include "qwindowsstyle.h"
26#endif // QT_H 26#endif // QT_H
27 27
28#if QT_VERSION >= 300 28#if QT_VERSION >= 0x030000
29 29
30class Q_EXPORT QPEStyle : public QWindowsStyle 30class Q_EXPORT QPEStyle : public QWindowsStyle
31{ 31{
32public: 32public:
33 QPEStyle(); 33 QPEStyle();
34 virtual ~QPEStyle(); 34 virtual ~QPEStyle();
35 35
36 virtual void drawPrimitive( PrimitiveElement pe, QPainter *p, const QRect &r, const QColorGroup &cg, SFlags flags=Style_Default, const QStyleOption & = QStyleOption::Default) const; 36 virtual void drawPrimitive( PrimitiveElement pe, QPainter *p, const QRect &r, const QColorGroup &cg, SFlags flags=Style_Default, const QStyleOption & = QStyleOption::Default) const;
37 virtual void drawControl( ControlElement ce, QPainter *p, const QWidget *widget, const QRect &r, const QColorGroup &cg, SFlags how=Style_Default, const QStyleOption & = QStyleOption::Default) const; 37 virtual void drawControl( ControlElement ce, QPainter *p, const QWidget *widget, const QRect &r, const QColorGroup &cg, SFlags how=Style_Default, const QStyleOption & = QStyleOption::Default) const;
38 virtual void drawComplexControl( ComplexControl control, QPainter *p, const QWidget *widget, const QRect &r, const QColorGroup &cg, SFlags how=Style_Default, SCFlags sub=SC_All, SCFlags subActive=SC_None, const QStyleOption & = QStyleOption::Default) const; 38 virtual void drawComplexControl( ComplexControl control, QPainter *p, const QWidget *widget, const QRect &r, const QColorGroup &cg, SFlags how=Style_Default, SCFlags sub=SC_All, SCFlags subActive=SC_None, const QStyleOption & = QStyleOption::Default) const;
39 virtual int pixelMetric( PixelMetric metric, const QWidget *widget=0 ) const; 39 virtual int pixelMetric( PixelMetric metric, const QWidget *widget=0 ) const;
40 virtual QSize sizeFromContents( ContentsType contents, const QWidget *widget, const QSize &contentsSize, const QStyleOption & = QStyleOption::Default) const; 40 virtual QSize sizeFromContents( ContentsType contents, const QWidget *widget, const QSize &contentsSize, const QStyleOption & = QStyleOption::Default) const;
41}; 41};
42 42
43#else 43#else
44 44
45class Q_EXPORT QPEStyle : public QWindowsStyle 45class Q_EXPORT QPEStyle : public QWindowsStyle
46{ 46{
47public: 47public:
48 QPEStyle(); 48 QPEStyle();
49 virtual ~QPEStyle(); 49 virtual ~QPEStyle();
50 virtual void polish( QPalette &p ); 50 virtual void polish( QPalette &p );
51 virtual void polish( QWidget *w ); 51 virtual void polish( QWidget *w );
52 virtual void unPolish( QWidget *w ); 52 virtual void unPolish( QWidget *w );
53 53
54 int defaultFrameWidth () const; 54 int defaultFrameWidth () const;
55 void drawPanel ( QPainter * p, int x, int y, int w, int h, 55 void drawPanel ( QPainter * p, int x, int y, int w, int h,
56 const QColorGroup &, bool sunken=FALSE, int lineWidth = 1, const QBrush * fill = 0 ); 56 const QColorGroup &, bool sunken=FALSE, int lineWidth = 1, const QBrush * fill = 0 );
57 void drawButton( QPainter *p, int x, int y, int w, int h, 57 void drawButton( QPainter *p, int x, int y, int w, int h,
58 const QColorGroup &g, bool sunken, const QBrush* fill ); 58 const QColorGroup &g, bool sunken, const QBrush* fill );
59 void drawButtonMask ( QPainter * p, int x, int y, int w, int h ); 59 void drawButtonMask ( QPainter * p, int x, int y, int w, int h );
60 void drawBevelButton( QPainter *p, int x, int y, int w, int h, 60 void drawBevelButton( QPainter *p, int x, int y, int w, int h,
61 const QColorGroup &g, bool sunken=FALSE, const QBrush* fill=0 ); 61 const QColorGroup &g, bool sunken=FALSE, const QBrush* fill=0 );
62 QRect comboButtonRect( int x, int y, int w, int h); 62 QRect comboButtonRect( int x, int y, int w, int h);
63 QRect comboButtonFocusRect( int x, int y, int w, int h); 63 QRect comboButtonFocusRect( int x, int y, int w, int h);
64 void drawComboButton( QPainter *p, int x, int y, int w, int h, 64 void drawComboButton( QPainter *p, int x, int y, int w, int h,
65 const QColorGroup &g, bool sunken, bool, bool enabled, 65 const QColorGroup &g, bool sunken, bool, bool enabled,
66 const QBrush *fill ); 66 const QBrush *fill );
67 void drawExclusiveIndicator ( QPainter * p, int x, int y, int w, int h, 67 void drawExclusiveIndicator ( QPainter * p, int x, int y, int w, int h,
68 const QColorGroup & g, bool on, bool down = FALSE, bool enabled = TRUE ); 68 const QColorGroup & g, bool on, bool down = FALSE, bool enabled = TRUE );
69 void drawIndicator ( QPainter * p, int x, int y, int w, int h, 69 void drawIndicator ( QPainter * p, int x, int y, int w, int h,
70 const QColorGroup & g, int state, bool down = FALSE, bool enabled = TRUE ); 70 const QColorGroup & g, int state, bool down = FALSE, bool enabled = TRUE );
71 void scrollBarMetrics( const QScrollBar*, int&, int&, int&, int&); 71 void scrollBarMetrics( const QScrollBar*, int&, int&, int&, int&);
72 void drawScrollBarControls( QPainter*, const QScrollBar*, int sliderStart, uint controls, uint activeControl ); 72 void drawScrollBarControls( QPainter*, const QScrollBar*, int sliderStart, uint controls, uint activeControl );
73 ScrollControl scrollBarPointOver( const QScrollBar* sb, int sliderStart, const QPoint& p ); 73 ScrollControl scrollBarPointOver( const QScrollBar* sb, int sliderStart, const QPoint& p );
74 void drawRiffles( QPainter* p, int x, int y, int w, int h, 74 void drawRiffles( QPainter* p, int x, int y, int w, int h,
75 const QColorGroup &g, bool horizontal ); 75 const QColorGroup &g, bool horizontal );
76 int sliderLength() const; 76 int sliderLength() const;
77 void drawSlider( QPainter *p, int x, int y, int w, int h, 77 void drawSlider( QPainter *p, int x, int y, int w, int h,
78 const QColorGroup &g, Orientation, bool tickAbove, bool tickBelow ); 78 const QColorGroup &g, Orientation, bool tickAbove, bool tickBelow );
79 void drawSliderMask( QPainter *p, int x, int y, int w, int h, 79 void drawSliderMask( QPainter *p, int x, int y, int w, int h,
80 Orientation, bool tickAbove, bool tickBelow ); 80 Orientation, bool tickAbove, bool tickBelow );
81 void drawSliderGrooveMask( QPainter *p, int x, int y, int w, int h, 81 void drawSliderGrooveMask( QPainter *p, int x, int y, int w, int h,
82 const QColorGroup& , QCOORD c, Orientation orient ); 82 const QColorGroup& , QCOORD c, Orientation orient );
83 void drawTab( QPainter *, const QTabBar *, QTab *, bool selected ); 83 void drawTab( QPainter *, const QTabBar *, QTab *, bool selected );
84 int extraPopupMenuItemWidth( bool checkable, int maxpmw, QMenuItem*, const QFontMetrics& ); 84 int extraPopupMenuItemWidth( bool checkable, int maxpmw, QMenuItem*, const QFontMetrics& );
85 int popupMenuItemHeight( bool checkable, QMenuItem*, const QFontMetrics& ); 85 int popupMenuItemHeight( bool checkable, QMenuItem*, const QFontMetrics& );
86 void drawPopupMenuItem( QPainter* p, bool checkable, int maxpmw, int tab, QMenuItem* mi, 86 void drawPopupMenuItem( QPainter* p, bool checkable, int maxpmw, int tab, QMenuItem* mi,
87 const QPalette& pal, 87 const QPalette& pal,
88 bool act, bool enabled, int x, int y, int w, int h); 88 bool act, bool enabled, int x, int y, int w, int h);
89 89
90 int buttonMargin() const; 90 int buttonMargin() const;
91 QSize scrollBarExtent() const; 91 QSize scrollBarExtent() const;
92 92
93 private:// Disabled copy constructor and operator= 93 private:// Disabled copy constructor and operator=
94#if defined(Q_DISABLE_COPY) 94#if defined(Q_DISABLE_COPY)
95 QPEStyle( const QPEStyle & ); 95 QPEStyle( const QPEStyle & );
96 QPEStyle& operator=( const QPEStyle & ); 96 QPEStyle& operator=( const QPEStyle & );
97#endif 97#endif
98}; 98};
99 99
100#endif 100#endif
101 101
102#endif // QPESTYLE_H 102#endif // QPESTYLE_H
diff --git a/noncore/apps/opie-console/TEWidget.cpp b/noncore/apps/opie-console/TEWidget.cpp
index 98c1793..1199e4f 100644
--- a/noncore/apps/opie-console/TEWidget.cpp
+++ b/noncore/apps/opie-console/TEWidget.cpp
@@ -139,257 +139,257 @@ static const ColorEntry base_color_table[TABLE_COLORS] =
139}; 139};
140 140
141/* Note that we use ANSI color order (bgr), while IBMPC color order is (rgb) 141/* Note that we use ANSI color order (bgr), while IBMPC color order is (rgb)
142 142
143 Code 0 1 2 3 4 5 6 7 143 Code 0 1 2 3 4 5 6 7
144 ----------- ------- ------- ------- ------- ------- ------- ------- ------- 144 ----------- ------- ------- ------- ------- ------- ------- ------- -------
145 ANSI (bgr) Black Red Green Yellow Blue Magenta Cyan White 145 ANSI (bgr) Black Red Green Yellow Blue Magenta Cyan White
146 IBMPC (rgb) Black Blue Green Cyan Red Magenta Yellow White 146 IBMPC (rgb) Black Blue Green Cyan Red Magenta Yellow White
147*/ 147*/
148 148
149QColor TEWidget::getDefaultBackColor() 149QColor TEWidget::getDefaultBackColor()
150{ 150{
151 return color_table[DEFAULT_BACK_COLOR].color; 151 return color_table[DEFAULT_BACK_COLOR].color;
152} 152}
153 153
154const ColorEntry* TEWidget::getColorTable() const 154const ColorEntry* TEWidget::getColorTable() const
155{ 155{
156 return color_table; 156 return color_table;
157} 157}
158 158
159const ColorEntry* TEWidget::getdefaultColorTable() const 159const ColorEntry* TEWidget::getdefaultColorTable() const
160{ 160{
161 return base_color_table; 161 return base_color_table;
162} 162}
163 163
164 164
165const QPixmap *TEWidget::backgroundPixmap() 165const QPixmap *TEWidget::backgroundPixmap()
166{ 166{
167 static QPixmap *bg = new QPixmap("~/qpim/main/pics/faded_bg.xpm"); 167 static QPixmap *bg = new QPixmap("~/qpim/main/pics/faded_bg.xpm");
168 const QPixmap *pm = bg; 168 const QPixmap *pm = bg;
169 return pm; 169 return pm;
170} 170}
171 171
172void TEWidget::setColorTable(const ColorEntry table[]) 172void TEWidget::setColorTable(const ColorEntry table[])
173{ 173{
174 for (int i = 0; i < TABLE_COLORS; i++) color_table[i] = table[i]; 174 for (int i = 0; i < TABLE_COLORS; i++) color_table[i] = table[i];
175 175
176 const QPixmap* pm = backgroundPixmap(); 176 const QPixmap* pm = backgroundPixmap();
177 if (!pm) setBackgroundColor(color_table[DEFAULT_BACK_COLOR].color); 177 if (!pm) setBackgroundColor(color_table[DEFAULT_BACK_COLOR].color);
178 update(); 178 update();
179} 179}
180 180
181//FIXME: add backgroundPixmapChanged. 181//FIXME: add backgroundPixmapChanged.
182 182
183/* ------------------------------------------------------------------------- */ 183/* ------------------------------------------------------------------------- */
184/* */ 184/* */
185/* Font */ 185/* Font */
186/* */ 186/* */
187/* ------------------------------------------------------------------------- */ 187/* ------------------------------------------------------------------------- */
188 188
189/* 189/*
190 The VT100 has 32 special graphical characters. The usual vt100 extended 190 The VT100 has 32 special graphical characters. The usual vt100 extended
191 xterm fonts have these at 0x00..0x1f. 191 xterm fonts have these at 0x00..0x1f.
192 192
193 QT's iso mapping leaves 0x00..0x7f without any changes. But the graphicals 193 QT's iso mapping leaves 0x00..0x7f without any changes. But the graphicals
194 come in here as proper unicode characters. 194 come in here as proper unicode characters.
195 195
196 We treat non-iso10646 fonts as VT100 extended and do the requiered mapping 196 We treat non-iso10646 fonts as VT100 extended and do the requiered mapping
197 from unicode to 0x00..0x1f. The remaining translation is then left to the 197 from unicode to 0x00..0x1f. The remaining translation is then left to the
198 QCodec. 198 QCodec.
199*/ 199*/
200 200
201// assert for i in [0..31] : vt100extended(vt100_graphics[i]) == i. 201// assert for i in [0..31] : vt100extended(vt100_graphics[i]) == i.
202 202
203unsigned short vt100_graphics[32] = 203unsigned short vt100_graphics[32] =
204{ // 0/8 1/9 2/10 3/11 4/12 5/13 6/14 7/15 204{ // 0/8 1/9 2/10 3/11 4/12 5/13 6/14 7/15
205 0x0020, 0x25C6, 0x2592, 0x2409, 0x240c, 0x240d, 0x240a, 0x00b0, 205 0x0020, 0x25C6, 0x2592, 0x2409, 0x240c, 0x240d, 0x240a, 0x00b0,
206 0x00b1, 0x2424, 0x240b, 0x2518, 0x2510, 0x250c, 0x2514, 0x253c, 206 0x00b1, 0x2424, 0x240b, 0x2518, 0x2510, 0x250c, 0x2514, 0x253c,
207 0xF800, 0xF801, 0x2500, 0xF803, 0xF804, 0x251c, 0x2524, 0x2534, 207 0xF800, 0xF801, 0x2500, 0xF803, 0xF804, 0x251c, 0x2524, 0x2534,
208 0x252c, 0x2502, 0x2264, 0x2265, 0x03C0, 0x2260, 0x00A3, 0x00b7 208 0x252c, 0x2502, 0x2264, 0x2265, 0x03C0, 0x2260, 0x00A3, 0x00b7
209}; 209};
210 210
211static QChar vt100extended(QChar c) 211static QChar vt100extended(QChar c)
212{ 212{
213 switch (c.unicode()) 213 switch (c.unicode())
214 { 214 {
215 case 0x25c6 : return 1; 215 case 0x25c6 : return 1;
216 case 0x2592 : return 2; 216 case 0x2592 : return 2;
217 case 0x2409 : return 3; 217 case 0x2409 : return 3;
218 case 0x240c : return 4; 218 case 0x240c : return 4;
219 case 0x240d : return 5; 219 case 0x240d : return 5;
220 case 0x240a : return 6; 220 case 0x240a : return 6;
221 case 0x00b0 : return 7; 221 case 0x00b0 : return 7;
222 case 0x00b1 : return 8; 222 case 0x00b1 : return 8;
223 case 0x2424 : return 9; 223 case 0x2424 : return 9;
224 case 0x240b : return 10; 224 case 0x240b : return 10;
225 case 0x2518 : return 11; 225 case 0x2518 : return 11;
226 case 0x2510 : return 12; 226 case 0x2510 : return 12;
227 case 0x250c : return 13; 227 case 0x250c : return 13;
228 case 0x2514 : return 14; 228 case 0x2514 : return 14;
229 case 0x253c : return 15; 229 case 0x253c : return 15;
230 case 0xf800 : return 16; 230 case 0xf800 : return 16;
231 case 0xf801 : return 17; 231 case 0xf801 : return 17;
232 case 0x2500 : return 18; 232 case 0x2500 : return 18;
233 case 0xf803 : return 19; 233 case 0xf803 : return 19;
234 case 0xf804 : return 20; 234 case 0xf804 : return 20;
235 case 0x251c : return 21; 235 case 0x251c : return 21;
236 case 0x2524 : return 22; 236 case 0x2524 : return 22;
237 case 0x2534 : return 23; 237 case 0x2534 : return 23;
238 case 0x252c : return 24; 238 case 0x252c : return 24;
239 case 0x2502 : return 25; 239 case 0x2502 : return 25;
240 case 0x2264 : return 26; 240 case 0x2264 : return 26;
241 case 0x2265 : return 27; 241 case 0x2265 : return 27;
242 case 0x03c0 : return 28; 242 case 0x03c0 : return 28;
243 case 0x2260 : return 29; 243 case 0x2260 : return 29;
244 case 0x00a3 : return 30; 244 case 0x00a3 : return 30;
245 case 0x00b7 : return 31; 245 case 0x00b7 : return 31;
246 } 246 }
247 return c; 247 return c;
248} 248}
249 249
250static QChar identicalMap(QChar c) 250static QChar identicalMap(QChar c)
251{ 251{
252 return c; 252 return c;
253} 253}
254 254
255void TEWidget::fontChange(const QFont &) 255void TEWidget::fontChange(const QFont &)
256{ 256{
257 QFontMetrics fm(font()); 257 QFontMetrics fm(font());
258 font_h = fm.height(); 258 font_h = fm.height();
259 font_w = fm.maxWidth(); 259 font_w = fm.maxWidth();
260 font_a = fm.ascent(); 260 font_a = fm.ascent();
261//printf("font_h: %d\n",font_h); 261//printf("font_h: %d\n",font_h);
262//printf("font_w: %d\n",font_w); 262//printf("font_w: %d\n",font_w);
263//printf("font_a: %d\n",font_a); 263//printf("font_a: %d\n",font_a);
264//printf("charset: %s\n",QFont::encodingName(font().charSet()).ascii()); 264//printf("charset: %s\n",QFont::encodingName(font().charSet()).ascii());
265//printf("rawname: %s\n",font().rawName().ascii()); 265//printf("rawname: %s\n",font().rawName().ascii());
266 fontMap = 266 fontMap =
267#if QT_VERSION < 300 267#if QT_VERSION < 0x030000
268 strcmp(QFont::encodingName(font().charSet()).ascii(),"iso10646") 268 strcmp(QFont::encodingName(font().charSet()).ascii(),"iso10646")
269 ? vt100extended 269 ? vt100extended
270 : 270 :
271#endif 271#endif
272 identicalMap; 272 identicalMap;
273 propagateSize(); 273 propagateSize();
274 update(); 274 update();
275} 275}
276 276
277void TEWidget::setVTFont(const QFont& f) 277void TEWidget::setVTFont(const QFont& f)
278{ 278{
279 QFrame::setFont(f); 279 QFrame::setFont(f);
280} 280}
281 281
282QFont TEWidget::getVTFont() { 282QFont TEWidget::getVTFont() {
283 return font(); 283 return font();
284} 284}
285 285
286void TEWidget::setFont(const QFont &) 286void TEWidget::setFont(const QFont &)
287{ 287{
288 // ignore font change request if not coming from konsole itself 288 // ignore font change request if not coming from konsole itself
289} 289}
290 290
291/* ------------------------------------------------------------------------- */ 291/* ------------------------------------------------------------------------- */
292/* */ 292/* */
293/* Constructor / Destructor */ 293/* Constructor / Destructor */
294/* */ 294/* */
295/* ----------------------------------------------------------------------- */ 295/* ----------------------------------------------------------------------- */
296 296
297 297
298 298
299TEWidget::TEWidget(QWidget *parent, const char *name) : QFrame(parent,name) 299TEWidget::TEWidget(QWidget *parent, const char *name) : QFrame(parent,name)
300{ 300{
301#ifndef QT_NO_CLIPBOARD 301#ifndef QT_NO_CLIPBOARD
302 cb = QApplication::clipboard(); 302 cb = QApplication::clipboard();
303 QObject::connect( (QObject*)cb, SIGNAL(dataChanged()), 303 QObject::connect( (QObject*)cb, SIGNAL(dataChanged()),
304 this, SLOT(onClearSelection()) ); 304 this, SLOT(onClearSelection()) );
305#endif 305#endif
306 306
307 307
308 scrollbar = new QScrollBar( this ); 308 scrollbar = new QScrollBar( this );
309 scrollbar->setCursor( arrowCursor ); 309 scrollbar->setCursor( arrowCursor );
310 connect(scrollbar, SIGNAL(valueChanged(int)), this, SLOT(scrollChanged(int))); 310 connect(scrollbar, SIGNAL(valueChanged(int)), this, SLOT(scrollChanged(int)));
311 311
312 hscrollbar = new QScrollBar( Qt::Horizontal, this ); 312 hscrollbar = new QScrollBar( Qt::Horizontal, this );
313 hscrollbar->setCursor( arrowCursor ); 313 hscrollbar->setCursor( arrowCursor );
314 connect(hscrollbar, SIGNAL(valueChanged(int)), this, SLOT(hscrollChanged(int))); 314 connect(hscrollbar, SIGNAL(valueChanged(int)), this, SLOT(hscrollChanged(int)));
315 315
316 m_cornerButton = new QPushButton( this ); 316 m_cornerButton = new QPushButton( this );
317 m_cornerButton->setPixmap( QPixmap( (const char**)menu_xpm ) ); 317 m_cornerButton->setPixmap( QPixmap( (const char**)menu_xpm ) );
318 m_cornerButton->setMaximumSize( 14, 14 ); 318 m_cornerButton->setMaximumSize( 14, 14 );
319 m_cornerButton->hide(); 319 m_cornerButton->hide();
320 320
321 Config cfg("Konsole"); 321 Config cfg("Konsole");
322 cfg.setGroup("ScrollBar"); 322 cfg.setGroup("ScrollBar");
323 switch( cfg.readNumEntry("Position",2)){ 323 switch( cfg.readNumEntry("Position",2)){
324 case 0: 324 case 0:
325 scrollLoc = SCRNONE; 325 scrollLoc = SCRNONE;
326 break; 326 break;
327 case 1: 327 case 1:
328 scrollLoc = SCRLEFT; 328 scrollLoc = SCRLEFT;
329 break; 329 break;
330 case 2: 330 case 2:
331 scrollLoc = SCRRIGHT; 331 scrollLoc = SCRRIGHT;
332 break; 332 break;
333 }; 333 };
334 334
335 blinkT = new QTimer(this); 335 blinkT = new QTimer(this);
336 connect(blinkT, SIGNAL(timeout()), this, SLOT(blinkEvent())); 336 connect(blinkT, SIGNAL(timeout()), this, SLOT(blinkEvent()));
337 // blinking = FALSE; 337 // blinking = FALSE;
338 blinking = TRUE; 338 blinking = TRUE;
339 339
340 resizing = FALSE; 340 resizing = FALSE;
341 actSel = 0; 341 actSel = 0;
342 image = 0; 342 image = 0;
343 lines = 1; 343 lines = 1;
344 columns = 1; 344 columns = 1;
345 font_w = 1; 345 font_w = 1;
346 font_h = 1; 346 font_h = 1;
347 font_a = 1; 347 font_a = 1;
348 word_selection_mode = FALSE; 348 word_selection_mode = FALSE;
349 vcolumns = 0; 349 vcolumns = 0;
350 hposition = 0; 350 hposition = 0;
351 351
352 setMouseMarks(TRUE); 352 setMouseMarks(TRUE);
353 setVTFont( QFont("fixed") ); 353 setVTFont( QFont("fixed") );
354 setColorTable(base_color_table); // init color table 354 setColorTable(base_color_table); // init color table
355 355
356 qApp->installEventFilter( this ); //FIXME: see below 356 qApp->installEventFilter( this ); //FIXME: see below
357// KCursor::setAutoHideCursor( this, true ); 357// KCursor::setAutoHideCursor( this, true );
358 358
359 // Init DnD //////////////////////////////////////////////////////////////// 359 // Init DnD ////////////////////////////////////////////////////////////////
360 currentSession = NULL; 360 currentSession = NULL;
361// setAcceptDrops(true); // attempt 361// setAcceptDrops(true); // attempt
362// m_drop = new QPopupMenu(this); 362// m_drop = new QPopupMenu(this);
363// m_drop->insertItem( QString("Paste"), 0); 363// m_drop->insertItem( QString("Paste"), 0);
364// m_drop->insertItem( QString("cd"), 1); 364// m_drop->insertItem( QString("cd"), 1);
365// connect(m_drop, SIGNAL(activated(int)), SLOT(drop_menu_activated(int))); 365// connect(m_drop, SIGNAL(activated(int)), SLOT(drop_menu_activated(int)));
366 366
367 // we need focus so that the auto-hide cursor feature works 367 // we need focus so that the auto-hide cursor feature works
368 setFocus(); 368 setFocus();
369 setFocusPolicy( WheelFocus ); 369 setFocusPolicy( WheelFocus );
370} 370}
371 371
372//FIXME: make proper destructor 372//FIXME: make proper destructor
373// Here's a start (David) 373// Here's a start (David)
374TEWidget::~TEWidget() 374TEWidget::~TEWidget()
375{ 375{
376 qApp->removeEventFilter( this ); 376 qApp->removeEventFilter( this );
377 if (image) free(image); 377 if (image) free(image);
378} 378}
379 379
380/* ------------------------------------------------------------------------- */ 380/* ------------------------------------------------------------------------- */
381/* */ 381/* */
382/* Display Operations */ 382/* Display Operations */
383/* */ 383/* */
384/* ------------------------------------------------------------------------- */ 384/* ------------------------------------------------------------------------- */
385 385
386/*! 386/*!
387 attributed string draw primitive 387 attributed string draw primitive
388*/ 388*/
389 389
390void TEWidget::drawAttrStr(QPainter &paint, QRect rect, 390void TEWidget::drawAttrStr(QPainter &paint, QRect rect,
391 QString& str, ca attr, BOOL pm, BOOL clear) 391 QString& str, ca attr, BOOL pm, BOOL clear)
392{ 392{
393 if (pm && color_table[attr.b].transparent) 393 if (pm && color_table[attr.b].transparent)
394 { 394 {
395 paint.setBackgroundMode( TransparentMode ); 395 paint.setBackgroundMode( TransparentMode );
diff --git a/noncore/apps/tinykate/libkate/qt3back/qregexp3.cpp b/noncore/apps/tinykate/libkate/qt3back/qregexp3.cpp
index 78635b2..7b30b1a 100644
--- a/noncore/apps/tinykate/libkate/qt3back/qregexp3.cpp
+++ b/noncore/apps/tinykate/libkate/qt3back/qregexp3.cpp
@@ -1,169 +1,169 @@
1/**************************************************************************** 1/****************************************************************************
2** $Id$ 2** $Id$
3** 3**
4** Implementation of QRegExp class 4** Implementation of QRegExp class
5** 5**
6** Created : 950126 6** Created : 950126
7** 7**
8** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. 8** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
9** 9**
10** This file is part of the tools module of the Qt GUI Toolkit. 10** This file is part of the tools module of the Qt GUI Toolkit.
11** 11**
12** This file may be distributed under the terms of the Q Public License 12** This file may be distributed under the terms of the Q Public License
13** as defined by Trolltech AS of Norway and appearing in the file 13** as defined by Trolltech AS of Norway and appearing in the file
14** LICENSE.QPL included in the packaging of this file. 14** LICENSE.QPL included in the packaging of this file.
15** 15**
16** This file may be distributed and/or modified under the terms of the 16** This file may be distributed and/or modified under the terms of the
17** GNU General Public License version 2 as published by the Free Software 17** GNU General Public License version 2 as published by the Free Software
18** Foundation and appearing in the file LICENSE.GPL included in the 18** Foundation and appearing in the file LICENSE.GPL included in the
19** packaging of this file. 19** packaging of this file.
20** 20**
21** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition 21** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
22** licenses may use this file in accordance with the Qt Commercial License 22** licenses may use this file in accordance with the Qt Commercial License
23** Agreement provided with the Software. 23** Agreement provided with the Software.
24** 24**
25** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 25** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
26** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 26** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
27** 27**
28** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for 28** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
29** information about Qt Commercial License Agreements. 29** information about Qt Commercial License Agreements.
30** See http://www.trolltech.com/qpl/ for QPL licensing information. 30** See http://www.trolltech.com/qpl/ for QPL licensing information.
31** See http://www.trolltech.com/gpl/ for GPL licensing information. 31** See http://www.trolltech.com/gpl/ for GPL licensing information.
32** 32**
33** Contact info@trolltech.com if any conditions of this licensing are 33** Contact info@trolltech.com if any conditions of this licensing are
34** not clear to you. 34** not clear to you.
35** 35**
36**********************************************************************/ 36**********************************************************************/
37#if QT_VERSION >=300 37#if QT_VERSION >= 0x030000
38#error QRegExp3 is now in QT 3 use QRegExp instead 38#error QRegExp3 is now in QT 3 use QRegExp instead
39#endif 39#endif
40 40
41#if QT_VERSION < 300 41#if QT_VERSION < 0x030000
42#include "./qregexp3.h" 42#include "./qregexp3.h"
43#else 43#else
44#include "qregexp.h" 44#include "qregexp.h"
45#endif 45#endif
46 46
47/* OPIE */ 47/* OPIE */
48#include <opie2/odebug.h> 48#include <opie2/odebug.h>
49 49
50/* QT */ 50/* QT */
51#include <qarray.h> 51#include <qarray.h>
52#include <qbitarray.h> 52#include <qbitarray.h>
53#include <qcache.h> 53#include <qcache.h>
54#include <qintdict.h> 54#include <qintdict.h>
55#include <qmap.h> 55#include <qmap.h>
56#include <qstring.h> 56#include <qstring.h>
57#include <qtl.h> 57#include <qtl.h>
58#include <qvector.h> 58#include <qvector.h>
59 59
60/* STD */ 60/* STD */
61#include <limits.h> 61#include <limits.h>
62 62
63/* 63/*
64 WARNING! Be sure to read qregexp.tex before modifying this file. 64 WARNING! Be sure to read qregexp.tex before modifying this file.
65*/ 65*/
66 66
67/*! 67/*!
68 \class QRegExp3 qregexp.h 68 \class QRegExp3 qregexp.h
69 69
70 \brief The QRegExp class provides pattern matching using regular expressions. 70 \brief The QRegExp class provides pattern matching using regular expressions.
71 71
72 \ingroup tools 72 \ingroup tools
73 \ingroup misc 73 \ingroup misc
74 \ingroup shared 74 \ingroup shared
75 75
76 76
77 Regular expressions, "regexps", provide a way to find patterns 77 Regular expressions, "regexps", provide a way to find patterns
78 within text. This is useful in many contexts, for example: 78 within text. This is useful in many contexts, for example:
79 79
80 <ol> 80 <ol>
81 <li>\e Validation. A regexp can be used to check whether a piece of 81 <li>\e Validation. A regexp can be used to check whether a piece of
82 text meets some criteria, e.g. is an integer or contains no 82 text meets some criteria, e.g. is an integer or contains no
83 whitespace. 83 whitespace.
84 <li>\e Searching. Regexps provide a much more powerful means of 84 <li>\e Searching. Regexps provide a much more powerful means of
85 searching text than simple string matching does. For example we can 85 searching text than simple string matching does. For example we can
86 create a regexp which says "find one of the words 'mail', 'letter' 86 create a regexp which says "find one of the words 'mail', 'letter'
87 or 'correspondence' but not any of the words 'email', 'mailman' 87 or 'correspondence' but not any of the words 'email', 'mailman'
88 'mailer', 'letterbox' etc." 88 'mailer', 'letterbox' etc."
89 <li><em>Search and Replace.</em> A regexp can be used to replace a 89 <li><em>Search and Replace.</em> A regexp can be used to replace a
90 pattern with a piece of text, for example replace all occurrences of 90 pattern with a piece of text, for example replace all occurrences of
91 '&' with '\&amp;' except where the '&' is already followed by 91 '&' with '\&amp;' except where the '&' is already followed by
92 'amp;'. 92 'amp;'.
93 <li><em>String Splitting.</em> A regexp can be used to identify 93 <li><em>String Splitting.</em> A regexp can be used to identify
94 where a string should be split into its component fields, e.g. 94 where a string should be split into its component fields, e.g.
95 splitting tab delimited strings. 95 splitting tab delimited strings.
96 </ol> 96 </ol>
97 97
98 We present a very brief introduction to regexps, a description of 98 We present a very brief introduction to regexps, a description of
99 Qt's regexp language, some code examples, and finally the function 99 Qt's regexp language, some code examples, and finally the function
100 documentation. QRegExp is modelled on Perl's regexp engine and fully 100 documentation. QRegExp is modelled on Perl's regexp engine and fully
101 supports Unicode. QRegExp may also be used in the weaker 'wildcard' 101 supports Unicode. QRegExp may also be used in the weaker 'wildcard'
102 (globbing) mode which works in a similar way to command shells. A 102 (globbing) mode which works in a similar way to command shells. A
103 good text on regexps is <i>Mastering Regular Expressions: Powerful 103 good text on regexps is <i>Mastering Regular Expressions: Powerful
104 Techniques for Perl and Other Tools</i> by Jeffrey E. Friedl, ISBN 104 Techniques for Perl and Other Tools</i> by Jeffrey E. Friedl, ISBN
105 1565922573. 105 1565922573.
106 106
107 Experienced regexp users may prefer to skip the introduction and 107 Experienced regexp users may prefer to skip the introduction and
108 go directly to the relevant information: 108 go directly to the relevant information:
109 109
110 <ul> 110 <ul>
111 <li><a href="#characters-and-abbreviations-for-sets-of-characters"> 111 <li><a href="#characters-and-abbreviations-for-sets-of-characters">
112 Characters and Abbreviations for Sets of Characters</a> 112 Characters and Abbreviations for Sets of Characters</a>
113 <li><a href="#sets-of-characters">Sets of Characters</a> 113 <li><a href="#sets-of-characters">Sets of Characters</a>
114 <li><a href="#quantifiers">Quantifiers</a> 114 <li><a href="#quantifiers">Quantifiers</a>
115 <li><a href="#capturing-text">Capturing Text</a> 115 <li><a href="#capturing-text">Capturing Text</a>
116 <li><a href="#assertions">Assertions</a> 116 <li><a href="#assertions">Assertions</a>
117 <li><a href="#wildcard-matching">Wildcard Matching (globbing)</a> 117 <li><a href="#wildcard-matching">Wildcard Matching (globbing)</a>
118 <li><a href="#perl-users">Notes for Perl Users</a> 118 <li><a href="#perl-users">Notes for Perl Users</a>
119 <li><a href="#code-examples">Code Examples</a> 119 <li><a href="#code-examples">Code Examples</a>
120 <li><a href="#member-function-documentation">Member Function Documentation</a> 120 <li><a href="#member-function-documentation">Member Function Documentation</a>
121 </ul> 121 </ul>
122 122
123 <b>Introduction</b> 123 <b>Introduction</b>
124 124
125 Regexps are built up from expressions, quantifiers and assertions. 125 Regexps are built up from expressions, quantifiers and assertions.
126 The simplest form of expression is simply a character, e.g. <b>x</b> 126 The simplest form of expression is simply a character, e.g. <b>x</b>
127 or <b>5</b>. An expression can also be a set of characters. For 127 or <b>5</b>. An expression can also be a set of characters. For
128 example, <b>[ABCD]</b>, will match an <b>A</b> or a <b>B</b> or a 128 example, <b>[ABCD]</b>, will match an <b>A</b> or a <b>B</b> or a
129 <b>C</b> or a <b>D</b>. As a shorthand we could write this as 129 <b>C</b> or a <b>D</b>. As a shorthand we could write this as
130 <b>[A-D]</b>. If we want to match any of the captital letters in the 130 <b>[A-D]</b>. If we want to match any of the captital letters in the
131 English alphabet we can write <b>[A-Z]</b>. A quantifier tells the 131 English alphabet we can write <b>[A-Z]</b>. A quantifier tells the
132 regexp engine how many occurrences of the expression we want, e.g. 132 regexp engine how many occurrences of the expression we want, e.g.
133 <b>x{1,1}</b> means match an <b>x</b> which occurs at least once and 133 <b>x{1,1}</b> means match an <b>x</b> which occurs at least once and
134 at most once. We'll look at assertions and more complex expressions 134 at most once. We'll look at assertions and more complex expressions
135 later. Note that regexps cannot be used to check for balanced 135 later. Note that regexps cannot be used to check for balanced
136 brackets or tags (unless you know the maximum level of nesting). 136 brackets or tags (unless you know the maximum level of nesting).
137 137
138 138
139 We'll start by writing a regexp to match integers in the range 0 to 139 We'll start by writing a regexp to match integers in the range 0 to
140 99. We will require at least one digit so we will start with 140 99. We will require at least one digit so we will start with
141 <b>[0-9]{1,1}</b> which means match a digit exactly once. This 141 <b>[0-9]{1,1}</b> which means match a digit exactly once. This
142 regexp alone will match integers in the range 0 to 9. To match one 142 regexp alone will match integers in the range 0 to 9. To match one
143 or two digits we can increase the maximum number of occurrences so 143 or two digits we can increase the maximum number of occurrences so
144 the regexp becomes <b>[0-9]{1,2}</b> meaning match a digit at least 144 the regexp becomes <b>[0-9]{1,2}</b> meaning match a digit at least
145 once and at most twice. However, this regexp as it stands will not 145 once and at most twice. However, this regexp as it stands will not
146 match correctly. This regexp will match one or two digits \e within 146 match correctly. This regexp will match one or two digits \e within
147 a string. To ensure that we match against the whole string we must 147 a string. To ensure that we match against the whole string we must
148 use the anchor assertions. We need <b>^</b> (caret) which when it is 148 use the anchor assertions. We need <b>^</b> (caret) which when it is
149 the first character in the regexp means that the regexp must match 149 the first character in the regexp means that the regexp must match
150 from the beginning of the string. And we also need <b>$</b> (dollar) 150 from the beginning of the string. And we also need <b>$</b> (dollar)
151 which when it is the last character in the regexp means that the 151 which when it is the last character in the regexp means that the
152 regexp must match until the end of the string. So now our regexp is 152 regexp must match until the end of the string. So now our regexp is
153 <b>^[0-9]{1,2}$</b>. Note that assertions do not match any 153 <b>^[0-9]{1,2}$</b>. Note that assertions do not match any
154 characters. 154 characters.
155 155
156 If you've seen regexps elsewhere they may have looked different from 156 If you've seen regexps elsewhere they may have looked different from
157 the one above. This is because some sets of characters and some 157 the one above. This is because some sets of characters and some
158 quantifiers are so common that they have special symbols to 158 quantifiers are so common that they have special symbols to
159 represent them. <b>[0-9]</b> can be replaced with the symbol 159 represent them. <b>[0-9]</b> can be replaced with the symbol
160 <b>\d</b>. The quantifier to match exactly one occurrence, 160 <b>\d</b>. The quantifier to match exactly one occurrence,
161 <b>{1,1}</b>, can be replaced with the expression itself. This means 161 <b>{1,1}</b>, can be replaced with the expression itself. This means
162 that <b>x{1,1}</b> is exactly the same as <b>x</b> alone. So our 0 162 that <b>x{1,1}</b> is exactly the same as <b>x</b> alone. So our 0
163 to 99 matcher could be written: <b>^\d{1,2}$</b>, although most 163 to 99 matcher could be written: <b>^\d{1,2}$</b>, although most
164 people would write it <b>^\d\d?$</b>. The <b>?</b> is the same as 164 people would write it <b>^\d\d?$</b>. The <b>?</b> is the same as
165 the quantifier <b>{0,1}</b>, i.e. a minimum of no occurrences a 165 the quantifier <b>{0,1}</b>, i.e. a minimum of no occurrences a
166 maximum of one occurrence. This is used to make an expression 166 maximum of one occurrence. This is used to make an expression
167 optional. The regexp <b>^\d\d?$</b> means "from the beginning of the 167 optional. The regexp <b>^\d\d?$</b> means "from the beginning of the
168 string match one digit followed by zero or one digits and then the 168 string match one digit followed by zero or one digits and then the
169 end of the string". 169 end of the string".
diff --git a/noncore/apps/tinykate/libkate/qt3back/qregexp3.h b/noncore/apps/tinykate/libkate/qt3back/qregexp3.h
index 5b75131..fd6bc78 100644
--- a/noncore/apps/tinykate/libkate/qt3back/qregexp3.h
+++ b/noncore/apps/tinykate/libkate/qt3back/qregexp3.h
@@ -1,111 +1,111 @@
1/**************************************************************************** 1/****************************************************************************
2** $Id$ 2** $Id$
3** 3**
4** Definition of QRegExp class 4** Definition of QRegExp class
5** 5**
6** Created : 950126 6** Created : 950126
7** 7**
8** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. 8** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
9** 9**
10** This file is part of the tools module of the Qt GUI Toolkit. 10** This file is part of the tools module of the Qt GUI Toolkit.
11** 11**
12** This file may be distributed under the terms of the Q Public License 12** This file may be distributed under the terms of the Q Public License
13** as defined by Trolltech AS of Norway and appearing in the file 13** as defined by Trolltech AS of Norway and appearing in the file
14** LICENSE.QPL included in the packaging of this file. 14** LICENSE.QPL included in the packaging of this file.
15** 15**
16** This file may be distributed and/or modified under the terms of the 16** This file may be distributed and/or modified under the terms of the
17** GNU General Public License version 2 as published by the Free Software 17** GNU General Public License version 2 as published by the Free Software
18** Foundation and appearing in the file LICENSE.GPL included in the 18** Foundation and appearing in the file LICENSE.GPL included in the
19** packaging of this file. 19** packaging of this file.
20** 20**
21** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition 21** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
22** licenses may use this file in accordance with the Qt Commercial License 22** licenses may use this file in accordance with the Qt Commercial License
23** Agreement provided with the Software. 23** Agreement provided with the Software.
24** 24**
25** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 25** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
26** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 26** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
27** 27**
28** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for 28** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
29** information about Qt Commercial License Agreements. 29** information about Qt Commercial License Agreements.
30** See http://www.trolltech.com/qpl/ for QPL licensing information. 30** See http://www.trolltech.com/qpl/ for QPL licensing information.
31** See http://www.trolltech.com/gpl/ for GPL licensing information. 31** See http://www.trolltech.com/gpl/ for GPL licensing information.
32** 32**
33** Contact info@trolltech.com if any conditions of this licensing are 33** Contact info@trolltech.com if any conditions of this licensing are
34** not clear to you. 34** not clear to you.
35** 35**
36**********************************************************************/ 36**********************************************************************/
37 37
38#ifndef QREGEXP3_H 38#ifndef QREGEXP3_H
39#define QREGEXP3_H 39#define QREGEXP3_H
40#ifndef QT_H 40#ifndef QT_H
41#include "qstringlist.h" 41#include "qstringlist.h"
42#endif // QT_H 42#endif // QT_H
43 43
44 44
45#if QT_VERSION >=300 45#if QT_VERSION >= 0x030000
46#include <qregexp.h> 46#include <qregexp.h>
47#else 47#else
48class QRegExpEngine; 48class QRegExpEngine;
49struct QRegExpPrivate; 49struct QRegExpPrivate;
50 50
51class Q_EXPORT QRegExp3 51class Q_EXPORT QRegExp3
52{ 52{
53public: 53public:
54 QRegExp3(); 54 QRegExp3();
55 QRegExp3( const QString& pattern, bool caseSensitive = TRUE, 55 QRegExp3( const QString& pattern, bool caseSensitive = TRUE,
56 bool wildcard = FALSE ); 56 bool wildcard = FALSE );
57 QRegExp3( const QRegExp3& rx ); 57 QRegExp3( const QRegExp3& rx );
58 ~QRegExp3(); 58 ~QRegExp3();
59 QRegExp3& operator=( const QRegExp3& rx ); 59 QRegExp3& operator=( const QRegExp3& rx );
60 60
61 bool operator==( const QRegExp3& rx ) const; 61 bool operator==( const QRegExp3& rx ) const;
62 bool operator!=( const QRegExp3& rx ) const { return !operator==( rx ); } 62 bool operator!=( const QRegExp3& rx ) const { return !operator==( rx ); }
63 63
64 bool isEmpty() const; 64 bool isEmpty() const;
65 bool isValid() const; 65 bool isValid() const;
66 QString pattern() const; 66 QString pattern() const;
67 void setPattern( const QString& pattern ); 67 void setPattern( const QString& pattern );
68 bool caseSensitive() const; 68 bool caseSensitive() const;
69 void setCaseSensitive( bool sensitive ); 69 void setCaseSensitive( bool sensitive );
70#ifndef QT_NO_REGEXP_WILDCARD 70#ifndef QT_NO_REGEXP_WILDCARD
71 bool wildcard() const; 71 bool wildcard() const;
72 void setWildcard( bool wildcard ); 72 void setWildcard( bool wildcard );
73#endif 73#endif
74 bool minimal() const; 74 bool minimal() const;
75 void setMinimal( bool minimal ); 75 void setMinimal( bool minimal );
76 76
77 bool exactMatch( const QString& str ); 77 bool exactMatch( const QString& str );
78 bool exactMatch( const QString& str ) const; 78 bool exactMatch( const QString& str ) const;
79#ifndef QT_NO_COMPAT 79#ifndef QT_NO_COMPAT
80 int match( const QString& str, int index, int *len = 0, 80 int match( const QString& str, int index, int *len = 0,
81 bool indexIsStart = TRUE ); 81 bool indexIsStart = TRUE );
82#endif 82#endif
83 int search( const QString& str, int start = 0 ); 83 int search( const QString& str, int start = 0 );
84 int search( const QString& str, int start = 0 ) const; 84 int search( const QString& str, int start = 0 ) const;
85// QChar versions 85// QChar versions
86#ifdef QCHAR_SUPPORT 86#ifdef QCHAR_SUPPORT
87 int search(const QChar *str,int start=0); 87 int search(const QChar *str,int start=0);
88 int search(const QChar *str,int start=0) const; 88 int search(const QChar *str,int start=0) const;
89 int searchRev(const QChar *str,int start=-1); 89 int searchRev(const QChar *str,int start=-1);
90 int searchRev(const QChar *str,int start=-1) const ; 90 int searchRev(const QChar *str,int start=-1) const ;
91 bool exactMatch(const QChar *str); 91 bool exactMatch(const QChar *str);
92 bool exactMatch(const QChar *str) const; 92 bool exactMatch(const QChar *str) const;
93 // end QChar versions 93 // end QChar versions
94#endif 94#endif
95 int searchRev( const QString& str, int start = -1 ); 95 int searchRev( const QString& str, int start = -1 );
96 int searchRev( const QString& str, int start = -1 ) const; 96 int searchRev( const QString& str, int start = -1 ) const;
97 int matchedLength(); 97 int matchedLength();
98#ifndef QT_NO_REGEXP_CAPTURE 98#ifndef QT_NO_REGEXP_CAPTURE
99 QStringList capturedTexts(); 99 QStringList capturedTexts();
100 QString cap( int nth = 0 ); 100 QString cap( int nth = 0 );
101 int pos( int nth = 0 ); 101 int pos( int nth = 0 );
102#endif 102#endif
103 103
104private: 104private:
105 void compile( bool caseSensitive ); 105 void compile( bool caseSensitive );
106 106
107 QRegExpEngine *eng; 107 QRegExpEngine *eng;
108 QRegExpPrivate *priv; 108 QRegExpPrivate *priv;
109}; 109};
110#endif // QT_VERSION >= 300 110#endif // QT_VERSION >= 0x030000
111#endif // QREGEXP_H 111#endif // QREGEXP_H
diff --git a/noncore/apps/zsafe/shadedlistitem.cpp b/noncore/apps/zsafe/shadedlistitem.cpp
index 72c6261..7f340f9 100644
--- a/noncore/apps/zsafe/shadedlistitem.cpp
+++ b/noncore/apps/zsafe/shadedlistitem.cpp
@@ -1,69 +1,69 @@
1/* 1/*
2 * shadedlistitem.cpp 2 * shadedlistitem.cpp
3 * 3 *
4 * (c) 2003 by Jeremy Bowman <jmbowman@alum.mit.edu> 4 * (c) 2003 by Jeremy Bowman <jmbowman@alum.mit.edu>
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by 7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or 8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version. 9 * (at your option) any later version.
10 */ 10 */
11 11
12#include "zsafe.h" 12#include "zsafe.h"
13#include "shadedlistitem.h" 13#include "shadedlistitem.h"
14 14
15 15
16ShadedListItem::ShadedListItem(int index, QListViewItem *parent) 16ShadedListItem::ShadedListItem(int index, QListViewItem *parent)
17 : QListViewItem(parent) 17 : QListViewItem(parent)
18{ 18{
19 oddRow = (index % 2 != 0); 19 oddRow = (index % 2 != 0);
20} 20}
21 21
22ShadedListItem::ShadedListItem(int index, QListView *parent) 22ShadedListItem::ShadedListItem(int index, QListView *parent)
23 : QListViewItem(parent), lv(parent) 23 : QListViewItem(parent), lv(parent)
24{ 24{
25 oddRow = (index % 2 != 0); 25 oddRow = (index % 2 != 0);
26} 26}
27 27
28ShadedListItem::ShadedListItem(int index, QListView *parent, QListViewItem *after) 28ShadedListItem::ShadedListItem(int index, QListView *parent, QListViewItem *after)
29 : QListViewItem(parent, after), lv(parent) 29 : QListViewItem(parent, after), lv(parent)
30{ 30{
31 oddRow = (index % 2 != 0); 31 oddRow = (index % 2 != 0);
32} 32}
33 33
34ShadedListItem::ShadedListItem(int index, QListView *parent, QString label1, QString label2, QString label3) 34ShadedListItem::ShadedListItem(int index, QListView *parent, QString label1, QString label2, QString label3)
35 : QListViewItem(parent, label1, label2, label3), lv(parent) 35 : QListViewItem(parent, label1, label2, label3), lv(parent)
36{ 36{
37 oddRow = (index % 2 != 0); 37 oddRow = (index % 2 != 0);
38} 38}
39 39
40ShadedListItem::ShadedListItem(int index, QListView *parent, QListViewItem *after, QString label1, QString label2, QString label3) 40ShadedListItem::ShadedListItem(int index, QListView *parent, QListViewItem *after, QString label1, QString label2, QString label3)
41 : QListViewItem(parent, after, label1, label2, label3), lv(parent) 41 : QListViewItem(parent, after, label1, label2, label3), lv(parent)
42{ 42{
43 oddRow = (index % 2 != 0); 43 oddRow = (index % 2 != 0);
44} 44}
45 45
46ShadedListItem::~ShadedListItem() 46ShadedListItem::~ShadedListItem()
47{ 47{
48 48
49} 49}
50 50
51 51
52void ShadedListItem::paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int alignment) 52void ShadedListItem::paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int alignment)
53{ 53{
54 QColorGroup colors(cg); 54 QColorGroup colors(cg);
55#if QT_VERSION >=300 55#if QT_VERSION >= 0x030000
56 const QColorGroup::ColorRole crole = QColorGroup::Base; 56 const QColorGroup::ColorRole crole = QColorGroup::Base;
57 // const QWidget::BackgroundMode bgmode = lv->viewport()->backgroundMode(); 57 // const QWidget::BackgroundMode bgmode = lv->viewport()->backgroundMode();
58 // const QColorGroup::ColorRole crole = QPalette::backgroundRoleFromMode(bgmode); 58 // const QColorGroup::ColorRole crole = QPalette::backgroundRoleFromMode(bgmode);
59#else 59#else
60 const QColorGroup::ColorRole crole = QColorGroup::Base; 60 const QColorGroup::ColorRole crole = QColorGroup::Base;
61#endif 61#endif
62 if (oddRow) { 62 if (oddRow) {
63 colors.setColor(crole, *ZSafe::oddRowColor); 63 colors.setColor(crole, *ZSafe::oddRowColor);
64 } 64 }
65 else { 65 else {
66 colors.setColor(crole, *ZSafe::evenRowColor); 66 colors.setColor(crole, *ZSafe::evenRowColor);
67 } 67 }
68 QListViewItem::paintCell(p, colors, column, width, alignment); 68 QListViewItem::paintCell(p, colors, column, width, alignment);
69} 69}
diff --git a/noncore/net/wellenreiter/gui/configwindow.cpp b/noncore/net/wellenreiter/gui/configwindow.cpp
index 1670f93..9ec5af9 100644
--- a/noncore/net/wellenreiter/gui/configwindow.cpp
+++ b/noncore/net/wellenreiter/gui/configwindow.cpp
@@ -247,250 +247,250 @@ void WellenreiterConfigWindow::getCaptureFileNameClicked()
247 { 247 {
248 captureFileName->setText( name ); 248 captureFileName->setText( name );
249 } 249 }
250} 250}
251 251
252 252
253void WellenreiterConfigWindow::channelAllClicked(int state) 253void WellenreiterConfigWindow::channelAllClicked(int state)
254{ 254{
255 bool b = state; 255 bool b = state;
256 channel1->setChecked( b ); 256 channel1->setChecked( b );
257 channel2->setChecked( b ); 257 channel2->setChecked( b );
258 channel3->setChecked( b ); 258 channel3->setChecked( b );
259 channel4->setChecked( b ); 259 channel4->setChecked( b );
260 channel5->setChecked( b ); 260 channel5->setChecked( b );
261 channel6->setChecked( b ); 261 channel6->setChecked( b );
262 channel7->setChecked( b ); 262 channel7->setChecked( b );
263 channel8->setChecked( b ); 263 channel8->setChecked( b );
264 channel9->setChecked( b ); 264 channel9->setChecked( b );
265 channel10->setChecked( b ); 265 channel10->setChecked( b );
266 channel11->setChecked( b ); 266 channel11->setChecked( b );
267 channel12->setChecked( b ); 267 channel12->setChecked( b );
268 channel13->setChecked( b ); 268 channel13->setChecked( b );
269 channel14->setChecked( b ); 269 channel14->setChecked( b );
270} 270}
271 271
272 272
273bool WellenreiterConfigWindow::useGPS() const 273bool WellenreiterConfigWindow::useGPS() const
274{ 274{
275 return enableGPS->isChecked(); 275 return enableGPS->isChecked();
276} 276}
277 277
278 278
279const QString WellenreiterConfigWindow::gpsHost() const 279const QString WellenreiterConfigWindow::gpsHost() const
280{ 280{
281 return useGPS() ? gpsdHost->currentText() : QString::null; 281 return useGPS() ? gpsdHost->currentText() : QString::null;
282} 282}
283 283
284 284
285int WellenreiterConfigWindow::gpsPort() const 285int WellenreiterConfigWindow::gpsPort() const
286{ 286{
287 return useGPS() ? gpsdPort->value() : -1; 287 return useGPS() ? gpsdPort->value() : -1;
288} 288}
289 289
290 290
291void WellenreiterConfigWindow::performAction( const QString& type, 291void WellenreiterConfigWindow::performAction( const QString& type,
292 const QString& essid, 292 const QString& essid,
293 const QString& mac, 293 const QString& mac,
294 bool wep, 294 bool wep,
295 int channel, 295 int channel,
296 int /* signal */ 296 int /* signal */
297 /* , const GpsLocation& loc */ ) 297 /* , const GpsLocation& loc */ )
298{ 298{
299 int action; 299 int action;
300 QString script; 300 QString script;
301 301
302 if ( type == "network" ) 302 if ( type == "network" )
303 { 303 {
304 action = newNetworkAction->currentItem(); 304 action = newNetworkAction->currentItem();
305 script = newNetworkScript->text(); 305 script = newNetworkScript->text();
306 } 306 }
307 else if ( type == "managed" || type == "adhoc" ) 307 else if ( type == "managed" || type == "adhoc" )
308 { 308 {
309 action = newClientAction->currentItem(); 309 action = newClientAction->currentItem();
310 script = newClientScript->text(); 310 script = newClientScript->text();
311 } 311 }
312 else if ( type == "station" ) 312 else if ( type == "station" )
313 { 313 {
314 action = newStationAction->currentItem(); 314 action = newStationAction->currentItem();
315 script = newStationScript->text(); 315 script = newStationScript->text();
316 } 316 }
317 else 317 else
318 { 318 {
319 owarn << "WellenreiterConfigWindow::performAction(): unknown type '" << type << "'" << oendl; 319 owarn << "WellenreiterConfigWindow::performAction(): unknown type '" << type << "'" << oendl;
320 return; 320 return;
321 } 321 }
322 322
323 odebug << "for event '" << type << "' I'm going to perform action " << action << " (script='" << script << "')" << oendl; 323 odebug << "for event '" << type << "' I'm going to perform action " << action << " (script='" << script << "')" << oendl;
324 324
325 switch( action ) 325 switch( action )
326 { 326 {
327 case 0: /* Ignore */ return; 327 case 0: /* Ignore */ return;
328 case 1: /* Play Alarm */ ODevice::inst()->playAlarmSound(); return; 328 case 1: /* Play Alarm */ ODevice::inst()->playAlarmSound(); return;
329 case 2: /* Play Click */ ODevice::inst()->playTouchSound(); return; 329 case 2: /* Play Click */ ODevice::inst()->playTouchSound(); return;
330 case 3: /* Blink LED */ break; //FIXME: Implement this 330 case 3: /* Blink LED */ break; //FIXME: Implement this
331 case 4: /* Run Script */ 331 case 4: /* Run Script */
332 { 332 {
333 /** 333 /**
334 * 334 *
335 * Script Substitution Information: 335 * Script Substitution Information:
336 * 336 *
337 * $SSID = SSID 337 * $SSID = SSID
338 * $MAC = MAC 338 * $MAC = MAC
339 * $WEP = Wep 339 * $WEP = Wep
340 * $CHAN = Channel 340 * $CHAN = Channel
341 * 341 *
342 **/ 342 **/
343 script = script.replace( QRegExp( "$SSID" ), essid ); 343 script = script.replace( QRegExp( "$SSID" ), essid );
344 script = script.replace( QRegExp( "$MAC" ), mac ); 344 script = script.replace( QRegExp( "$MAC" ), mac );
345 script = script.replace( QRegExp( "$WEP" ), wep ? QString( "true" ) : QString( "false" ) ); 345 script = script.replace( QRegExp( "$WEP" ), wep ? QString( "true" ) : QString( "false" ) );
346 script = script.replace( QRegExp( "$CHAN" ), QString::number( channel ) ); 346 script = script.replace( QRegExp( "$CHAN" ), QString::number( channel ) );
347 347
348 odebug << "going to call script '" << script << "'" << oendl; 348 odebug << "going to call script '" << script << "'" << oendl;
349 ::system( script ); 349 ::system( script );
350 odebug << "script returned." << oendl; 350 odebug << "script returned." << oendl;
351 return; 351 return;
352 } 352 }
353 default: assert( false ); 353 default: assert( false );
354 } 354 }
355} 355}
356 356
357 357
358void WellenreiterConfigWindow::load() 358void WellenreiterConfigWindow::load()
359{ 359{
360#ifdef Q_WS_X11 360#ifdef Q_WS_X11
361 #warning Persistent Configuration not yet implemented for standalone X11 build 361 #warning Persistent Configuration not yet implemented for standalone X11 build
362 performAutodetection(); 362 performAutodetection();
363#else 363#else
364 odebug << "loading configuration settings..." << oendl; 364 odebug << "loading configuration settings..." << oendl;
365 365
366 /* This is dumb monkey typing stuff... We _need_ to do this automatically! */ 366 /* This is dumb monkey typing stuff... We _need_ to do this automatically! */
367 367
368 OConfig* c = oApp->config(); 368 OConfig* c = oApp->config();
369 369
370 c->setGroup( "Interface" ); 370 c->setGroup( "Interface" );
371 371
372 QString interface = c->readEntry( "name", "<none>" ); 372 QString interface = c->readEntry( "name", "<none>" );
373 if ( interface != "<none>" ) 373 if ( interface != "<none>" )
374 { 374 {
375#if QT_VERSION < 300 375#if QT_VERSION < 0x030000
376 interfaceName->insertItem( interface, 0 ); 376 interfaceName->insertItem( interface, 0 );
377 interfaceName->setCurrentItem( 0 ); 377 interfaceName->setCurrentItem( 0 );
378#else 378#else
379 interfaceName->setCurrentText( interface ); 379 interfaceName->setCurrentText( interface );
380#endif 380#endif
381 381
382 QString device = c->readEntry( "type", "<select>" ); 382 QString device = c->readEntry( "type", "<select>" );
383#if QT_VERSION < 300 383#if QT_VERSION < 0x030000
384 for ( int i = 0; i < deviceType->count(); ++i ) 384 for ( int i = 0; i < deviceType->count(); ++i )
385 { 385 {
386 if ( deviceType->text( i ) == device ) 386 if ( deviceType->text( i ) == device )
387 { 387 {
388 deviceType->setCurrentItem( i ); 388 deviceType->setCurrentItem( i );
389 break; 389 break;
390 } 390 }
391 } 391 }
392#else 392#else
393 deviceType->setCurrentText( device ); 393 deviceType->setCurrentText( device );
394#endif 394#endif
395 } 395 }
396 else 396 else
397 { 397 {
398 performAutodetection(); 398 performAutodetection();
399 } 399 }
400 400
401 prismHeader->setChecked( c->readBoolEntry( "prism", false ) ); 401 prismHeader->setChecked( c->readBoolEntry( "prism", false ) );
402 hopChannels->setChecked( c->readBoolEntry( "hop", true ) ); 402 hopChannels->setChecked( c->readBoolEntry( "hop", true ) );
403 hopInterval->setValue( c->readNumEntry( "interval", 250 ) ); 403 hopInterval->setValue( c->readNumEntry( "interval", 250 ) );
404 adaptiveHopping->setChecked( c->readBoolEntry( "adaptive", true ) ); 404 adaptiveHopping->setChecked( c->readBoolEntry( "adaptive", true ) );
405 405
406 c->setGroup( "Capture" ); 406 c->setGroup( "Capture" );
407 writeCaptureFile->setChecked( c->readBoolEntry( "writeCaptureFile", true ) ); 407 writeCaptureFile->setChecked( c->readBoolEntry( "writeCaptureFile", true ) );
408 captureFileName->setEnabled( writeCaptureFile->isChecked() ); 408 captureFileName->setEnabled( writeCaptureFile->isChecked() );
409 getCaptureFileName->setEnabled( writeCaptureFile->isChecked() ); 409 getCaptureFileName->setEnabled( writeCaptureFile->isChecked() );
410 parsePackets->setEnabled( writeCaptureFile->isChecked() ); 410 parsePackets->setEnabled( writeCaptureFile->isChecked() );
411 captureFileName->setText( c->readEntry( "filename", "/tmp/capture" ) ); 411 captureFileName->setText( c->readEntry( "filename", "/tmp/capture" ) );
412 hexViewBufferUnlimited->setChecked( c->readBoolEntry( "hexViewBufferUnlimited", true ) ); 412 hexViewBufferUnlimited->setChecked( c->readBoolEntry( "hexViewBufferUnlimited", true ) );
413 hexViewBufferLimited->setChecked( !c->readBoolEntry( "hexViewBufferUnlimited", true ) ); 413 hexViewBufferLimited->setChecked( !c->readBoolEntry( "hexViewBufferUnlimited", true ) );
414 hexViewBufferSize->setValue( c->readNumEntry( "hexViewBufferSize", 2000 ) ); 414 hexViewBufferSize->setValue( c->readNumEntry( "hexViewBufferSize", 2000 ) );
415 415
416 c->setGroup( "UI" ); 416 c->setGroup( "UI" );
417 lookupVendor->setChecked( c->readBoolEntry( "lookupVendor", true ) ); 417 lookupVendor->setChecked( c->readBoolEntry( "lookupVendor", true ) );
418 openTree->setChecked( c->readBoolEntry( "openTree", true ) ); 418 openTree->setChecked( c->readBoolEntry( "openTree", true ) );
419 disablePM->setChecked( c->readBoolEntry( "disablePM", true ) ); 419 disablePM->setChecked( c->readBoolEntry( "disablePM", true ) );
420 newNetworkAction->setCurrentItem( c->readNumEntry( "newNetworkAction", 1 ) ); // Default: Play Alarm 420 newNetworkAction->setCurrentItem( c->readNumEntry( "newNetworkAction", 1 ) ); // Default: Play Alarm
421 newNetworkScript->setText( c->readEntry( "newNetworkScript", "" ) ); 421 newNetworkScript->setText( c->readEntry( "newNetworkScript", "" ) );
422 newClientAction->setCurrentItem( c->readNumEntry( "newClientAction", 2 ) ); // Default: Play Click 422 newClientAction->setCurrentItem( c->readNumEntry( "newClientAction", 2 ) ); // Default: Play Click
423 newClientScript->setText( c->readEntry( "newClientScript", "" ) ); 423 newClientScript->setText( c->readEntry( "newClientScript", "" ) );
424 newStationAction->setCurrentItem( c->readNumEntry( "newStationAction", 2 ) ); // Default: Play Click 424 newStationAction->setCurrentItem( c->readNumEntry( "newStationAction", 2 ) ); // Default: Play Click
425 newStationScript->setText( c->readEntry( "newStationScript", "" ) ); 425 newStationScript->setText( c->readEntry( "newStationScript", "" ) );
426 synchronizeActionsAndScripts(); // needed for showing/hiding the script QLineEdit on demand 426 synchronizeActionsAndScripts(); // needed for showing/hiding the script QLineEdit on demand
427 427
428 c->setGroup( "GPS" ); 428 c->setGroup( "GPS" );
429 enableGPS->setChecked( c->readBoolEntry( "use", false ) ); 429 enableGPS->setChecked( c->readBoolEntry( "use", false ) );
430#if QT_VERSION < 300 430#if QT_VERSION < 0x030000
431 gpsdHost->insertItem( c->readEntry( "host", "localhost" ), 0 ); 431 gpsdHost->insertItem( c->readEntry( "host", "localhost" ), 0 );
432 gpsdHost->setCurrentItem( 0 ); 432 gpsdHost->setCurrentItem( 0 );
433#else 433#else
434 gpsdHost->setCurrentText( c->readEntry( "host", "localhost" ) ); 434 gpsdHost->setCurrentText( c->readEntry( "host", "localhost" ) );
435#endif 435#endif
436 gpsdPort->setValue( c->readNumEntry( "port", 2947 ) ); 436 gpsdPort->setValue( c->readNumEntry( "port", 2947 ) );
437 startGPS->setChecked( c->readBoolEntry( "start", false ) ); 437 startGPS->setChecked( c->readBoolEntry( "start", false ) );
438 commandGPS->setText( c->readEntry( "command", "gpsd -p /dev/ttyS3 -s 57600" ) ); 438 commandGPS->setText( c->readEntry( "command", "gpsd -p /dev/ttyS3 -s 57600" ) );
439 439
440#endif 440#endif
441} 441}
442 442
443 443
444void WellenreiterConfigWindow::save() 444void WellenreiterConfigWindow::save()
445{ 445{
446#ifdef Q_WS_X11 446#ifdef Q_WS_X11
447 #warning Persistent Configuration not yet implemented for standalone X11 build 447 #warning Persistent Configuration not yet implemented for standalone X11 build
448#else 448#else
449 odebug << "saving configuration settings..." << oendl; 449 odebug << "saving configuration settings..." << oendl;
450 450
451 /* This is dumb monkey typing stuff... We _need_ to do this automatically! */ 451 /* This is dumb monkey typing stuff... We _need_ to do this automatically! */
452 452
453 OConfig* c = oApp->config(); 453 OConfig* c = oApp->config();
454 454
455 c->setGroup( "Interface" ); 455 c->setGroup( "Interface" );
456 c->writeEntry( "name", interfaceName->currentText() ); 456 c->writeEntry( "name", interfaceName->currentText() );
457 c->writeEntry( "type", deviceType->currentText() ); 457 c->writeEntry( "type", deviceType->currentText() );
458 c->writeEntry( "prism", prismHeader->isChecked() ); 458 c->writeEntry( "prism", prismHeader->isChecked() );
459 c->writeEntry( "hop", hopChannels->isChecked() ); 459 c->writeEntry( "hop", hopChannels->isChecked() );
460 c->writeEntry( "interval", hopInterval->value() ); 460 c->writeEntry( "interval", hopInterval->value() );
461 c->writeEntry( "adaptive", adaptiveHopping->isChecked() ); 461 c->writeEntry( "adaptive", adaptiveHopping->isChecked() );
462 462
463 c->setGroup( "Capture" ); 463 c->setGroup( "Capture" );
464 c->writeEntry( "writeCaptureFile", writeCaptureFile->isChecked() ); 464 c->writeEntry( "writeCaptureFile", writeCaptureFile->isChecked() );
465 c->writeEntry( "filename", captureFileName->text() ); 465 c->writeEntry( "filename", captureFileName->text() );
466 c->writeEntry( "hexViewBufferUnlimited", hexViewBufferUnlimited->isChecked() ); 466 c->writeEntry( "hexViewBufferUnlimited", hexViewBufferUnlimited->isChecked() );
467 c->writeEntry( "hexViewBufferSize", hexViewBufferSize->value() ); 467 c->writeEntry( "hexViewBufferSize", hexViewBufferSize->value() );
468 468
469 c->setGroup( "UI" ); 469 c->setGroup( "UI" );
470 c->writeEntry( "lookupVendor", lookupVendor->isChecked() ); 470 c->writeEntry( "lookupVendor", lookupVendor->isChecked() );
471 c->writeEntry( "openTree", openTree->isChecked() ); 471 c->writeEntry( "openTree", openTree->isChecked() );
472 c->writeEntry( "disablePM", disablePM->isChecked() ); 472 c->writeEntry( "disablePM", disablePM->isChecked() );
473 c->writeEntry( "newNetworkAction", newNetworkAction->currentItem() ); 473 c->writeEntry( "newNetworkAction", newNetworkAction->currentItem() );
474 c->writeEntry( "newNetworkScript", newNetworkScript->text() ); 474 c->writeEntry( "newNetworkScript", newNetworkScript->text() );
475 c->writeEntry( "newClientAction", newClientAction->currentItem() ); 475 c->writeEntry( "newClientAction", newClientAction->currentItem() );
476 c->writeEntry( "newClientScript", newClientScript->text() ); 476 c->writeEntry( "newClientScript", newClientScript->text() );
477 c->writeEntry( "newStationAction", newStationAction->currentItem() ); 477 c->writeEntry( "newStationAction", newStationAction->currentItem() );
478 c->writeEntry( "newStationScript", newStationScript->text() ); 478 c->writeEntry( "newStationScript", newStationScript->text() );
479 479
480 c->setGroup( "GPS" ); 480 c->setGroup( "GPS" );
481 c->writeEntry( "use", enableGPS->isChecked() ); 481 c->writeEntry( "use", enableGPS->isChecked() );
482 c->writeEntry( "host", gpsdHost->currentText() ); 482 c->writeEntry( "host", gpsdHost->currentText() );
483 c->writeEntry( "port", gpsdPort->value() ); 483 c->writeEntry( "port", gpsdPort->value() );
484 c->writeEntry( "start", startGPS->isChecked() ); 484 c->writeEntry( "start", startGPS->isChecked() );
485 c->writeEntry( "command", commandGPS->text() ); 485 c->writeEntry( "command", commandGPS->text() );
486 486
487 c->write(); 487 c->write();
488 488
489#endif 489#endif
490} 490}
491 491
492 492
493int WellenreiterConfigWindow::hexViewBuffer() const 493int WellenreiterConfigWindow::hexViewBuffer() const
494{ 494{
495 return hexViewBufferUnlimited->isChecked() ? -1 : hexViewBufferSize->value(); 495 return hexViewBufferUnlimited->isChecked() ? -1 : hexViewBufferSize->value();
496} 496}
diff --git a/noncore/settings/appearance2/appearance.cpp b/noncore/settings/appearance2/appearance.cpp
index 9638686..088171c 100644
--- a/noncore/settings/appearance2/appearance.cpp
+++ b/noncore/settings/appearance2/appearance.cpp
@@ -1,261 +1,261 @@
1/* 1/*
2                This file is part of the OPIE Project 2                This file is part of the OPIE Project
3 Copyright (c) 2002 Trolltech AS <info@trolltech.com> 3 Copyright (c) 2002 Trolltech AS <info@trolltech.com>
4 =. Copyright (c) 2002 Dan Williams <williamsdr@acm.org> 4 =. Copyright (c) 2002 Dan Williams <williamsdr@acm.org>
5             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> 5             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org>
6           .>+-= 6           .>+-=
7 _;:,     .>    :=|. This file is free software; you can 7 _;:,     .>    :=|. This file is free software; you can
8.> <`_,   >  .   <= redistribute it and/or modify it under 8.> <`_,   >  .   <= redistribute it and/or modify it under
9:`=1 )Y*s>-.--   : the terms of the GNU General Public 9:`=1 )Y*s>-.--   : the terms of the GNU General Public
10.="- .-=="i,     .._ License as published by the Free Software 10.="- .-=="i,     .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; either version 2 of the License, 11 - .   .-<_>     .<> Foundation; either version 2 of the License,
12     ._= =}       : or (at your option) any later version. 12     ._= =}       : or (at your option) any later version.
13    .%`+i>       _;_. 13    .%`+i>       _;_.
14    .i_,=:_.      -<s. This file is distributed in the hope that 14    .i_,=:_.      -<s. This file is distributed in the hope that
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
16    : ..    .:,     . . . without even the implied warranty of 16    : ..    .:,     . . . without even the implied warranty of
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General 18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
19..}^=.=       =       ; Public License for more details. 19..}^=.=       =       ; Public License for more details.
20++=   -.     .`     .: 20++=   -.     .`     .:
21 :     =  ...= . :.=- You should have received a copy of the GNU 21 :     =  ...= . :.=- You should have received a copy of the GNU
22 -.   .:....=;==+<; General Public License along with this file; 22 -.   .:....=;==+<; General Public License along with this file;
23  -_. . .   )=.  = see the file COPYING. If not, write to the 23  -_. . .   )=.  = see the file COPYING. If not, write to the
24    --        :-=` Free Software Foundation, Inc., 24    --        :-=` Free Software Foundation, Inc.,
25 59 Temple Place - Suite 330, 25 59 Temple Place - Suite 330,
26 Boston, MA 02111-1307, USA. 26 Boston, MA 02111-1307, USA.
27 27
28*/ 28*/
29 29
30#include "appearance.h" 30#include "appearance.h"
31#include "editScheme.h" 31#include "editScheme.h"
32#include "stylelistitem.h" 32#include "stylelistitem.h"
33#include "decolistitem.h" 33#include "decolistitem.h"
34#include "colorlistitem.h" 34#include "colorlistitem.h"
35#include "exceptlistitem.h" 35#include "exceptlistitem.h"
36#include "sample.h" 36#include "sample.h"
37 37
38/* OPIE */ 38/* OPIE */
39#include <opie2/odevice.h> 39#include <opie2/odevice.h>
40#include <opie2/ofiledialog.h> 40#include <opie2/ofiledialog.h>
41#include <opie2/otabwidget.h> 41#include <opie2/otabwidget.h>
42#include <opie2/odebug.h> 42#include <opie2/odebug.h>
43 43
44#include <qpe/config.h> 44#include <qpe/config.h>
45#include <qpe/global.h> 45#include <qpe/global.h>
46#include <qpe/qpeapplication.h> 46#include <qpe/qpeapplication.h>
47#include <qpe/qpemessagebox.h> 47#include <qpe/qpemessagebox.h>
48#include <qpe/qcopenvelope_qws.h> 48#include <qpe/qcopenvelope_qws.h>
49#include <qpe/qpestyle.h> 49#include <qpe/qpestyle.h>
50#include <qpe/lightstyle.h> 50#include <qpe/lightstyle.h>
51#include <qpe/styleinterface.h> 51#include <qpe/styleinterface.h>
52 52
53/* QT */ 53/* QT */
54#include <qbuttongroup.h> 54#include <qbuttongroup.h>
55#include <qcheckbox.h> 55#include <qcheckbox.h>
56#include <qcombobox.h> 56#include <qcombobox.h>
57#include <qdialog.h> 57#include <qdialog.h>
58#include <qdir.h> 58#include <qdir.h>
59#include <qlabel.h> 59#include <qlabel.h>
60#include <qlayout.h> 60#include <qlayout.h>
61#include <qlineedit.h> 61#include <qlineedit.h>
62#include <qlistbox.h> 62#include <qlistbox.h>
63#include <qmessagebox.h> 63#include <qmessagebox.h>
64#include <qpushbutton.h> 64#include <qpushbutton.h>
65#include <qradiobutton.h> 65#include <qradiobutton.h>
66#if QT_VERSION >= 300 66#if QT_VERSION >= 0x030000
67#include <qstylefactory.h> 67#include <qstylefactory.h>
68#endif 68#endif
69#include <qtoolbutton.h> 69#include <qtoolbutton.h>
70#include <qwindowsstyle.h> 70#include <qwindowsstyle.h>
71#include <qlistview.h> 71#include <qlistview.h>
72#include <qheader.h> 72#include <qheader.h>
73#include <qvbox.h> 73#include <qvbox.h>
74#include <qwhatsthis.h> 74#include <qwhatsthis.h>
75 75
76using namespace Opie; 76using namespace Opie;
77using namespace Opie::Ui; 77using namespace Opie::Ui;
78using namespace Opie::Core; 78using namespace Opie::Core;
79 79
80class DefaultWindowDecoration : public WindowDecorationInterface 80class DefaultWindowDecoration : public WindowDecorationInterface
81{ 81{
82public: 82public:
83 DefaultWindowDecoration() : ref(0) {} 83 DefaultWindowDecoration() : ref(0) {}
84 QString name() const 84 QString name() const
85 { 85 {
86 return "Default"; 86 return "Default";
87 } 87 }
88 QPixmap icon() const 88 QPixmap icon() const
89 { 89 {
90 return QPixmap(); 90 return QPixmap();
91 } 91 }
92 QRESULT queryInterface( const QUuid &uuid, QUnknownInterface **iface ) 92 QRESULT queryInterface( const QUuid &uuid, QUnknownInterface **iface )
93 { 93 {
94 *iface = 0; 94 *iface = 0;
95 if ( uuid == IID_QUnknown ) 95 if ( uuid == IID_QUnknown )
96 *iface = this; 96 *iface = this;
97 else if ( uuid == IID_WindowDecoration ) 97 else if ( uuid == IID_WindowDecoration )
98 *iface = this; 98 *iface = this;
99 99
100 if ( *iface ) 100 if ( *iface )
101 (*iface)->addRef(); 101 (*iface)->addRef();
102 return QS_OK; 102 return QS_OK;
103 } 103 }
104 Q_REFCOUNT 104 Q_REFCOUNT
105 105
106private: 106private:
107 ulong ref; 107 ulong ref;
108}; 108};
109 109
110 110
111 111
112 112
113 113
114 114
115 115
116QWidget *Appearance::createStyleTab ( QWidget *parent, Config &cfg ) 116QWidget *Appearance::createStyleTab ( QWidget *parent, Config &cfg )
117{ 117{
118 QWidget* tab = new QWidget( parent, "StyleTab" ); 118 QWidget* tab = new QWidget( parent, "StyleTab" );
119 QVBoxLayout* vertLayout = new QVBoxLayout( tab, 3, 3 ); 119 QVBoxLayout* vertLayout = new QVBoxLayout( tab, 3, 3 );
120 120
121 m_style_list = new QListBox( tab, "m_style_list" ); 121 m_style_list = new QListBox( tab, "m_style_list" );
122 vertLayout->addWidget( m_style_list ); 122 vertLayout->addWidget( m_style_list );
123 QWhatsThis::add( m_style_list, tr( "Styles control the way items such as buttons and scroll bars appear in all applications.\n\nClick here to select an available style." ) ); 123 QWhatsThis::add( m_style_list, tr( "Styles control the way items such as buttons and scroll bars appear in all applications.\n\nClick here to select an available style." ) );
124 124
125 m_style_settings = new QPushButton ( tr( "Settings..." ), tab ); 125 m_style_settings = new QPushButton ( tr( "Settings..." ), tab );
126 connect ( m_style_settings, SIGNAL( clicked()), this, SLOT( styleSettingsClicked())); 126 connect ( m_style_settings, SIGNAL( clicked()), this, SLOT( styleSettingsClicked()));
127 vertLayout-> addWidget ( m_style_settings ); 127 vertLayout-> addWidget ( m_style_settings );
128 QWhatsThis::add( m_style_settings, tr( "Click here to configure the currently selected style.\n\nNote: This option is not available for all styles." ) ); 128 QWhatsThis::add( m_style_settings, tr( "Click here to configure the currently selected style.\n\nNote: This option is not available for all styles." ) );
129 129
130 QString s = cfg. readEntry ( "Style", "Light" ); 130 QString s = cfg. readEntry ( "Style", "Light" );
131 131
132 132
133#if QT_VERSION >= 300 133#if QT_VERSION >= 0x030000
134 m_style_list->insertStringList(QStyleFactory::styles()); 134 m_style_list->insertStringList(QStyleFactory::styles());
135#else 135#else
136 m_style_list-> insertItem ( new StyleListItem ( "Windows", new QWindowsStyle ( ))); 136 m_style_list-> insertItem ( new StyleListItem ( "Windows", new QWindowsStyle ( )));
137 m_style_list-> insertItem ( new StyleListItem ( "Light", new LightStyle ( ))); 137 m_style_list-> insertItem ( new StyleListItem ( "Light", new LightStyle ( )));
138 m_style_list-> insertItem ( new StyleListItem ( "QPE", new QPEStyle ( ))); 138 m_style_list-> insertItem ( new StyleListItem ( "QPE", new QPEStyle ( )));
139#endif 139#endif
140 140
141 { 141 {
142 QString path = QPEApplication::qpeDir ( ); 142 QString path = QPEApplication::qpeDir ( );
143 path.append( "/plugins/styles/" ); 143 path.append( "/plugins/styles/" );
144 QStringList sl = QDir ( path, "lib*.so" ). entryList ( ); 144 QStringList sl = QDir ( path, "lib*.so" ). entryList ( );
145 145
146 for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) 146 for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it )
147 { 147 {
148 QString libstr = path; 148 QString libstr = path;
149 libstr.append( "/" ); 149 libstr.append( "/" );
150 libstr.append( *it ); 150 libstr.append( *it );
151 QLibrary *lib = new QLibrary ( libstr ); 151 QLibrary *lib = new QLibrary ( libstr );
152 StyleInterface *iface; 152 StyleInterface *iface;
153 153
154 if (( lib-> queryInterface ( IID_Style, (QUnknownInterface **) &iface ) == QS_OK ) && iface ) 154 if (( lib-> queryInterface ( IID_Style, (QUnknownInterface **) &iface ) == QS_OK ) && iface )
155 { 155 {
156 StyleListItem *slit = new StyleListItem ( lib, iface ); 156 StyleListItem *slit = new StyleListItem ( lib, iface );
157 m_style_list-> insertItem ( slit ); 157 m_style_list-> insertItem ( slit );
158 158
159 if ( slit-> key ( ) == s ) 159 if ( slit-> key ( ) == s )
160 m_style_list-> setCurrentItem ( slit ); 160 m_style_list-> setCurrentItem ( slit );
161 } 161 }
162 else 162 else
163 delete lib; 163 delete lib;
164 } 164 }
165 } 165 }
166 166
167 m_original_style = m_style_list-> currentItem ( ); 167 m_original_style = m_style_list-> currentItem ( );
168 styleClicked ( m_original_style ); 168 styleClicked ( m_original_style );
169 169
170 connect( m_style_list, SIGNAL( highlighted(int) ), this, SLOT( styleClicked(int) ) ); 170 connect( m_style_list, SIGNAL( highlighted(int) ), this, SLOT( styleClicked(int) ) );
171 171
172 return tab; 172 return tab;
173} 173}
174 174
175QWidget *Appearance::createDecoTab ( QWidget *parent, Config &cfg ) 175QWidget *Appearance::createDecoTab ( QWidget *parent, Config &cfg )
176{ 176{
177 QWidget* tab = new QWidget( parent, "DecoTab" ); 177 QWidget* tab = new QWidget( parent, "DecoTab" );
178 QVBoxLayout* vertLayout = new QVBoxLayout( tab, 3, 3 ); 178 QVBoxLayout* vertLayout = new QVBoxLayout( tab, 3, 3 );
179 179
180 m_deco_list = new QListBox( tab, "m_deco_list" ); 180 m_deco_list = new QListBox( tab, "m_deco_list" );
181 vertLayout->addWidget( m_deco_list ); 181 vertLayout->addWidget( m_deco_list );
182 QWhatsThis::add( m_deco_list, tr( "Window decorations control the way the application title bar and its buttons appear.\n\nClick here to select an available decoration." ) ); 182 QWhatsThis::add( m_deco_list, tr( "Window decorations control the way the application title bar and its buttons appear.\n\nClick here to select an available decoration." ) );
183 183
184 QString s = cfg. readEntry ( "Decoration", "libflat.so" ); 184 QString s = cfg. readEntry ( "Decoration", "libflat.so" );
185 185
186 m_deco_list-> insertItem ( new DecoListItem ( "QPE" )); 186 m_deco_list-> insertItem ( new DecoListItem ( "QPE" ));
187 187
188 { 188 {
189 QString path = QPEApplication::qpeDir(); 189 QString path = QPEApplication::qpeDir();
190 path.append( "/plugins/decorations/" ); 190 path.append( "/plugins/decorations/" );
191 QStringList sl = QDir ( path, "lib*.so" ). entryList ( ); 191 QStringList sl = QDir ( path, "lib*.so" ). entryList ( );
192 192
193 for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) 193 for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it )
194 { 194 {
195 QString libstr = path; 195 QString libstr = path;
196 libstr.append( "/" ); 196 libstr.append( "/" );
197 libstr.append( *it ); 197 libstr.append( *it );
198 QLibrary *lib = new QLibrary ( libstr ); 198 QLibrary *lib = new QLibrary ( libstr );
199 WindowDecorationInterface *iface; 199 WindowDecorationInterface *iface;
200 200
201 if ( lib-> queryInterface ( IID_WindowDecoration, (QUnknownInterface **) &iface ) == QS_OK ) 201 if ( lib-> queryInterface ( IID_WindowDecoration, (QUnknownInterface **) &iface ) == QS_OK )
202 { 202 {
203 DecoListItem *dlit = new DecoListItem ( lib, iface ); 203 DecoListItem *dlit = new DecoListItem ( lib, iface );
204 m_deco_list-> insertItem ( dlit ); 204 m_deco_list-> insertItem ( dlit );
205 205
206 if ( dlit-> key ( ) == s ) 206 if ( dlit-> key ( ) == s )
207 m_deco_list-> setCurrentItem ( dlit ); 207 m_deco_list-> setCurrentItem ( dlit );
208 } 208 }
209 else 209 else
210 delete lib; 210 delete lib;
211 } 211 }
212 } 212 }
213 213
214 m_original_deco = m_deco_list-> currentItem ( ); 214 m_original_deco = m_deco_list-> currentItem ( );
215 if ( m_deco_list-> currentItem ( ) < 0 ) 215 if ( m_deco_list-> currentItem ( ) < 0 )
216 m_deco_list-> setCurrentItem ( 0 ); 216 m_deco_list-> setCurrentItem ( 0 );
217 decoClicked ( m_original_deco ); 217 decoClicked ( m_original_deco );
218 218
219 connect( m_deco_list, SIGNAL( highlighted(int) ), this, SLOT( decoClicked(int) ) ); 219 connect( m_deco_list, SIGNAL( highlighted(int) ), this, SLOT( decoClicked(int) ) );
220 220
221 return tab; 221 return tab;
222} 222}
223 223
224QWidget *Appearance::createFontTab ( QWidget *parent, Config &cfg ) 224QWidget *Appearance::createFontTab ( QWidget *parent, Config &cfg )
225{ 225{
226 QString familyStr = cfg. readEntry ( "FontFamily", "Helvetica" ); 226 QString familyStr = cfg. readEntry ( "FontFamily", "Helvetica" );
227 QString styleStr = cfg. readEntry ( "FontStyle", "Regular" ); 227 QString styleStr = cfg. readEntry ( "FontStyle", "Regular" );
228 int size = cfg. readNumEntry ( "FontSize", 10 ); 228 int size = cfg. readNumEntry ( "FontSize", 10 );
229 229
230 m_fontselect = new OFontSelector ( false, parent, "FontTab" ); 230 m_fontselect = new OFontSelector ( false, parent, "FontTab" );
231 m_fontselect-> setSelectedFont ( familyStr, styleStr, size ); 231 m_fontselect-> setSelectedFont ( familyStr, styleStr, size );
232 QWhatsThis::add( m_fontselect, tr( "Select the desired name, style and size of the default font applications will use." ) ); 232 QWhatsThis::add( m_fontselect, tr( "Select the desired name, style and size of the default font applications will use." ) );
233 233
234 connect( m_fontselect, SIGNAL( fontSelected(const QFont&)), 234 connect( m_fontselect, SIGNAL( fontSelected(const QFont&)),
235 this, SLOT( fontClicked(const QFont&))); 235 this, SLOT( fontClicked(const QFont&)));
236 236
237 return m_fontselect; 237 return m_fontselect;
238} 238}
239 239
240QWidget *Appearance::createColorTab ( QWidget *parent, Config &cfg ) 240QWidget *Appearance::createColorTab ( QWidget *parent, Config &cfg )
241{ 241{
242 QWidget *tab = new QWidget( parent, "ColorTab" ); 242 QWidget *tab = new QWidget( parent, "ColorTab" );
243 QGridLayout *gridLayout = new QGridLayout( tab, 0, 0, 3, 3 ); 243 QGridLayout *gridLayout = new QGridLayout( tab, 0, 0, 3, 3 );
244 gridLayout->setRowStretch ( 3, 10 ); 244 gridLayout->setRowStretch ( 3, 10 );
245 245
246 m_color_list = new QListBox ( tab ); 246 m_color_list = new QListBox ( tab );
247 gridLayout->addMultiCellWidget ( m_color_list, 0, 3, 0, 0 ); 247 gridLayout->addMultiCellWidget ( m_color_list, 0, 3, 0, 0 );
248 connect( m_color_list, SIGNAL( highlighted(int) ), this, SLOT( colorClicked(int) ) ); 248 connect( m_color_list, SIGNAL( highlighted(int) ), this, SLOT( colorClicked(int) ) );
249 QWhatsThis::add( m_color_list, tr( "Color schemes are a collection of colors which are used for various parts of the display.\n\nClick here to select an available scheme." ) ); 249 QWhatsThis::add( m_color_list, tr( "Color schemes are a collection of colors which are used for various parts of the display.\n\nClick here to select an available scheme." ) );
250 250
251 m_color_list-> insertItem ( new ColorListItem ( tr( "Current scheme" ), cfg )); 251 m_color_list-> insertItem ( new ColorListItem ( tr( "Current scheme" ), cfg ));
252 252
253 QString path = QPEApplication::qpeDir ( ); 253 QString path = QPEApplication::qpeDir ( );
254 path.append( "/etc/colors/" ); 254 path.append( "/etc/colors/" );
255 QStringList sl = QDir ( path ). entryList ( "*.scheme" ); 255 QStringList sl = QDir ( path ). entryList ( "*.scheme" );
256 256
257 for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) 257 for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it )
258 { 258 {
259 QString name = (*it). left ((*it). find ( ".scheme" )); 259 QString name = (*it). left ((*it). find ( ".scheme" ));
260 QString pathstr = path; 260 QString pathstr = path;
261 pathstr.append( *it ); 261 pathstr.append( *it );
diff --git a/noncore/settings/doctab/doctab.cpp b/noncore/settings/doctab/doctab.cpp
index feaf538..72eda6b 100644
--- a/noncore/settings/doctab/doctab.cpp
+++ b/noncore/settings/doctab/doctab.cpp
@@ -1,94 +1,94 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 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#include "doctab.h" 21#include "doctab.h"
22 22
23#include <qpe/global.h> 23#include <qpe/global.h>
24#include <qpe/fontmanager.h> 24#include <qpe/fontmanager.h>
25#include <qpe/config.h> 25#include <qpe/config.h>
26#include <qpe/applnk.h> 26#include <qpe/applnk.h>
27#include <qpe/qpedialog.h> 27#include <qpe/qpedialog.h>
28#include <qpe/qpeapplication.h> 28#include <qpe/qpeapplication.h>
29#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 29#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
30#include <qpe/qcopenvelope_qws.h> 30#include <qpe/qcopenvelope_qws.h>
31#endif 31#endif
32 32
33#include <qlabel.h> 33#include <qlabel.h>
34#include <qcheckbox.h> 34#include <qcheckbox.h>
35#include <qradiobutton.h> 35#include <qradiobutton.h>
36#include <qtabwidget.h> 36#include <qtabwidget.h>
37#include <qslider.h> 37#include <qslider.h>
38#include <qfile.h> 38#include <qfile.h>
39#include <qtextstream.h> 39#include <qtextstream.h>
40#include <qdatastream.h> 40#include <qdatastream.h>
41#include <qmessagebox.h> 41#include <qmessagebox.h>
42#include <qcombobox.h> 42#include <qcombobox.h>
43#include <qspinbox.h> 43#include <qspinbox.h>
44#include <qlistbox.h> 44#include <qlistbox.h>
45#include <qdir.h> 45#include <qdir.h>
46#if QT_VERSION >= 300 46#if QT_VERSION >= 0x030000
47#include <qstylefactory.h> 47#include <qstylefactory.h>
48#endif 48#endif
49 49
50#include <stdlib.h> 50#include <stdlib.h>
51 51
52 52
53DocTabSettings::DocTabSettings( QWidget* parent, const char* name, WFlags fl ) 53DocTabSettings::DocTabSettings( QWidget* parent, const char* name, WFlags fl )
54 : DocTabSettingsBase( parent, name, TRUE, fl ) 54 : DocTabSettingsBase( parent, name, TRUE, fl )
55{ 55{
56 dl = new QPEDialogListener(this); 56 dl = new QPEDialogListener(this);
57 reset(); 57 reset();
58} 58}
59 59
60DocTabSettings::~DocTabSettings() 60DocTabSettings::~DocTabSettings()
61{} 61{}
62 62
63void DocTabSettings::accept() 63void DocTabSettings::accept()
64{ 64{
65 applyDocTab(); 65 applyDocTab();
66 QDialog::accept(); 66 QDialog::accept();
67} 67}
68 68
69void DocTabSettings::applyDocTab() 69void DocTabSettings::applyDocTab()
70{ 70{
71 Config cfg( "Launcher" ); 71 Config cfg( "Launcher" );
72 cfg.setGroup( "DocTab" ); 72 cfg.setGroup( "DocTab" );
73 cfg.writeEntry( "Enable", yes->isChecked() ); 73 cfg.writeEntry( "Enable", yes->isChecked() );
74 cfg.write(); 74 cfg.write();
75} 75}
76 76
77 77
78void DocTabSettings::reject() 78void DocTabSettings::reject()
79{ 79{
80 reset(); 80 reset();
81 QDialog::reject(); 81 QDialog::reject();
82} 82}
83 83
84void DocTabSettings::reset() 84void DocTabSettings::reset()
85{ 85{
86} 86}
87 87
88QString DocTabSettings::actualDocTab; 88QString DocTabSettings::actualDocTab;
89 89
90void DocTabSettings::done(int r) 90void DocTabSettings::done(int r)
91{ 91{
92 QDialog::done(r); 92 QDialog::done(r);
93 close(); 93 close();
94} 94}
diff --git a/noncore/settings/language/language.cpp b/noncore/settings/language/language.cpp
index 14750ac..bf90576 100644
--- a/noncore/settings/language/language.cpp
+++ b/noncore/settings/language/language.cpp
@@ -1,159 +1,159 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 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#include "settings.h" 21#include "settings.h"
22 22
23#include <qpe/global.h> 23#include <qpe/global.h>
24#include <qpe/fontmanager.h> 24#include <qpe/fontmanager.h>
25#include <qpe/config.h> 25#include <qpe/config.h>
26#include <qpe/applnk.h> 26#include <qpe/applnk.h>
27#include <qpe/qpedialog.h> 27#include <qpe/qpedialog.h>
28#include <qpe/qpeapplication.h> 28#include <qpe/qpeapplication.h>
29#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 29#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
30#include <qpe/qcopenvelope_qws.h> 30#include <qpe/qcopenvelope_qws.h>
31#endif 31#endif
32 32
33#include <qlabel.h> 33#include <qlabel.h>
34#include <qcheckbox.h> 34#include <qcheckbox.h>
35#include <qradiobutton.h> 35#include <qradiobutton.h>
36#include <qtabwidget.h> 36#include <qtabwidget.h>
37#include <qslider.h> 37#include <qslider.h>
38#include <qfile.h> 38#include <qfile.h>
39#include <qtextstream.h> 39#include <qtextstream.h>
40#include <qdatastream.h> 40#include <qdatastream.h>
41#include <qmessagebox.h> 41#include <qmessagebox.h>
42#include <qcombobox.h> 42#include <qcombobox.h>
43#include <qspinbox.h> 43#include <qspinbox.h>
44#include <qlistbox.h> 44#include <qlistbox.h>
45#include <qdir.h> 45#include <qdir.h>
46#if QT_VERSION >= 300 46#if QT_VERSION >= 0x030000
47#include <qstylefactory.h> 47#include <qstylefactory.h>
48#endif 48#endif
49 49
50#include <stdlib.h> 50#include <stdlib.h>
51 51
52 52
53LanguageSettings::LanguageSettings( QWidget* parent, const char* name, WFlags fl ) 53LanguageSettings::LanguageSettings( QWidget* parent, const char* name, WFlags fl )
54 : LanguageSettingsBase( parent, name, TRUE, fl ) 54 : LanguageSettingsBase( parent, name, TRUE, fl )
55{ 55{
56 if ( FontManager::hasUnicodeFont() ) 56 if ( FontManager::hasUnicodeFont() )
57 languages->setFont(FontManager::unicodeFont(FontManager::Proportional)); 57 languages->setFont(FontManager::unicodeFont(FontManager::Proportional));
58 58
59 59
60 QString tfn = QPEApplication::qpeDir() + "i18n/"; 60 QString tfn = QPEApplication::qpeDir() + "i18n/";
61 QDir langDir = tfn; 61 QDir langDir = tfn;
62 QStringList list = langDir.entryList("*", QDir::Dirs ); 62 QStringList list = langDir.entryList("*", QDir::Dirs );
63 63
64 QStringList::Iterator it; 64 QStringList::Iterator it;
65 65
66 for ( it = list.begin(); it != list.end(); ++it ) { 66 for ( it = list.begin(); it != list.end(); ++it ) {
67 QString name = (*it); 67 QString name = (*it);
68 QFileInfo desktopFile( tfn + "/" + name + "/.directory" ); 68 QFileInfo desktopFile( tfn + "/" + name + "/.directory" );
69 if ( desktopFile.exists() ) { 69 if ( desktopFile.exists() ) {
70 langAvail.append(name); 70 langAvail.append(name);
71 Config conf( desktopFile.filePath(), Config::File ); 71 Config conf( desktopFile.filePath(), Config::File );
72 QString langName = conf.readEntry( "Name" ); 72 QString langName = conf.readEntry( "Name" );
73 QString ownName = conf.readEntryDirect( "Name[" + name + "]" ); 73 QString ownName = conf.readEntryDirect( "Name[" + name + "]" );
74 if ( ownName.isEmpty() ) 74 if ( ownName.isEmpty() )
75 ownName = conf.readEntryDirect( "Name" ); 75 ownName = conf.readEntryDirect( "Name" );
76 if ( !ownName.isEmpty() && ownName != langName ) 76 if ( !ownName.isEmpty() && ownName != langName )
77 langName = langName + " [" + ownName + "]"; 77 langName = langName + " [" + ownName + "]";
78 languages->insertItem( langName ); 78 languages->insertItem( langName );
79 79
80 } 80 }
81 } 81 }
82 if ( langAvail. find ( "en" ) == -1 ) { 82 if ( langAvail. find ( "en" ) == -1 ) {
83 langAvail. prepend ( "" ); // no tr 83 langAvail. prepend ( "" ); // no tr
84 languages-> insertItem ( QString ( "English [%1] (%2)" /* no tr (!) */ ). arg ( tr ( "English" )). arg ( tr( "default" )), 0 ); 84 languages-> insertItem ( QString ( "English [%1] (%2)" /* no tr (!) */ ). arg ( tr ( "English" )). arg ( tr( "default" )), 0 );
85 } 85 }
86 86
87 dl = new QPEDialogListener(this); 87 dl = new QPEDialogListener(this);
88 reset(); 88 reset();
89} 89}
90 90
91LanguageSettings::~LanguageSettings() 91LanguageSettings::~LanguageSettings()
92{} 92{}
93 93
94void LanguageSettings::accept() 94void LanguageSettings::accept()
95{ 95{
96 Config c( "qpe" ); 96 Config c( "qpe" );
97 c.setGroup( "Startup" ); 97 c.setGroup( "Startup" );
98 if ( ( c.readNumEntry( "FirstUse", 42 ) == 0 ) && 98 if ( ( c.readNumEntry( "FirstUse", 42 ) == 0 ) &&
99 ( QMessageBox::warning( this, tr("Language"), tr("<qt>Attention, all windows will be closed by changing the language\n" 99 ( QMessageBox::warning( this, tr("Language"), tr("<qt>Attention, all windows will be closed by changing the language\n"
100 "without saving the Data.<br><br>Go on?</qt>"), 1, 2) ) 100 "without saving the Data.<br><br>Go on?</qt>"), 1, 2) )
101 == QMessageBox::Cancel ) 101 == QMessageBox::Cancel )
102 return; 102 return;
103 applyLanguage(); 103 applyLanguage();
104 QDialog::accept(); 104 QDialog::accept();
105} 105}
106 106
107void LanguageSettings::applyLanguage() 107void LanguageSettings::applyLanguage()
108{ 108{
109 setLanguage ( langAvail. at ( languages-> currentItem ( ))); 109 setLanguage ( langAvail. at ( languages-> currentItem ( )));
110} 110}
111 111
112 112
113void LanguageSettings::reject() 113void LanguageSettings::reject()
114{ 114{
115 reset(); 115 reset();
116 QDialog::reject(); 116 QDialog::reject();
117} 117}
118 118
119void LanguageSettings::reset() 119void LanguageSettings::reset()
120{ 120{
121 QString l = getenv("LANG"); 121 QString l = getenv("LANG");
122 Config config("locale"); 122 Config config("locale");
123 config.setGroup("Language"); 123 config.setGroup("Language");
124 l = config.readEntry( "Language", l ); 124 l = config.readEntry( "Language", l );
125 actualLanguage = l; 125 actualLanguage = l;
126 if (l.isEmpty()) 126 if (l.isEmpty())
127 l = "en"; 127 l = "en";
128 128
129 int n = langAvail.find( l ); 129 int n = langAvail.find( l );
130 languages->setCurrentItem( n ); 130 languages->setCurrentItem( n );
131} 131}
132 132
133QString LanguageSettings::actualLanguage; 133QString LanguageSettings::actualLanguage;
134 134
135void LanguageSettings::setLanguage(const QString& lang) 135void LanguageSettings::setLanguage(const QString& lang)
136{ 136{
137 if ( lang != actualLanguage ) { 137 if ( lang != actualLanguage ) {
138 Config config("locale"); 138 Config config("locale");
139 config.setGroup( "Language" ); 139 config.setGroup( "Language" );
140 if ( lang. isEmpty ( )) 140 if ( lang. isEmpty ( ))
141 config. removeEntry ( "Language" ); 141 config. removeEntry ( "Language" );
142 else 142 else
143 config.writeEntry( "Language", lang ); 143 config.writeEntry( "Language", lang );
144 config.write(); 144 config.write();
145 145
146#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 146#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
147 147
148 QCopEnvelope e("QPE/System", "language(QString)"); 148 QCopEnvelope e("QPE/System", "language(QString)");
149 e << lang; 149 e << lang;
150#endif 150#endif
151 151
152 } 152 }
153} 153}
154 154
155void LanguageSettings::done(int r) 155void LanguageSettings::done(int r)
156{ 156{
157 QDialog::done(r); 157 QDialog::done(r);
158 close(); 158 close();
159} 159}
diff --git a/noncore/settings/networksettings/interfaces/module.h b/noncore/settings/networksettings/interfaces/module.h
index 9dc913e..13189c3 100644
--- a/noncore/settings/networksettings/interfaces/module.h
+++ b/noncore/settings/networksettings/interfaces/module.h
@@ -1,133 +1,133 @@
1#ifndef NETCONF_MODULE_H 1#ifndef NETCONF_MODULE_H
2#define NETCONF_MODULE_H 2#define NETCONF_MODULE_H
3 3
4#include <qobject.h> 4#include <qobject.h>
5#if QT_VERSION < 300 5#if QT_VERSION < 0x030000
6#include <qlist.h> 6#include <qlist.h>
7#else 7#else
8#include <qptrlist.h> 8#include <qptrlist.h>
9#endif 9#endif
10#include <qmap.h> 10#include <qmap.h>
11#include "interface.h" 11#include "interface.h"
12 12
13class QWidget; 13class QWidget;
14class QTabWidget; 14class QTabWidget;
15 15
16 16
17/** 17/**
18 * \brief The basis of all plugins 18 * \brief The basis of all plugins
19 * 19 *
20 * This is the way to extend networksettings with 20 * This is the way to extend networksettings with
21 * extra functionality. 21 * extra functionality.
22 * 22 *
23 * 23 *
24 * Networksettings in the 1.0 release does not use QCOM 24 * Networksettings in the 1.0 release does not use QCOM
25 * for activation. You need to provide the following function yourself. 25 * for activation. You need to provide the following function yourself.
26 * 26 *
27 * A module needs to provide Name, Images, and methods for 27 * A module needs to provide Name, Images, and methods for
28 * claiming interfaces. For example you can claim physicla 28 * claiming interfaces. For example you can claim physicla
29 * interfaces like wlan0, ppp0 or virtual like a VPN 29 * interfaces like wlan0, ppp0 or virtual like a VPN
30 * connection and hide the real ppp device or ethernet device 30 * connection and hide the real ppp device or ethernet device
31 * behind your VPN plugin. 31 * behind your VPN plugin.
32 * 32 *
33 * During start up. The main application searches for network devices 33 * During start up. The main application searches for network devices
34 * and then looks for an owner under the plugins for them. 34 * and then looks for an owner under the plugins for them.
35 * For example the WLAN Plugin looks if there is a WLAN Extension 35 * For example the WLAN Plugin looks if there is a WLAN Extension
36 * on that interface and then claims it by returning true from isOwner() 36 * on that interface and then claims it by returning true from isOwner()
37 * 37 *
38 * \code 38 * \code
39 * extern "C" 39 * extern "C"
40 * { 40 * {
41 * void* create_plugin() { 41 * void* create_plugin() {
42 * return new WLANModule(); 42 * return new WLANModule();
43 * } 43 * }
44 * }; 44 * };
45 * \endcode 45 * \endcode
46 * @see isOwner(Interface*) 46 * @see isOwner(Interface*)
47 */ 47 */
48class Module : private QObject{ 48class Module : private QObject{
49 49
50signals: 50signals:
51/** 51/**
52 * Emit this Signal once you change the Interface 52 * Emit this Signal once you change the Interface
53 * you're operating on 53 * you're operating on
54 * 54 *
55 * @param i The Interface 55 * @param i The Interface
56 */ 56 */
57 void updateInterface(Interface *i); 57 void updateInterface(Interface *i);
58 58
59 59
60public: 60public:
61 Module(){}; 61 Module(){};
62 62
63 /** 63 /**
64 * The type of the plugin 64 * The type of the plugin
65 * and the name of the qcop call 65 * and the name of the qcop call
66 */ 66 */
67 virtual const QString type() = 0; 67 virtual const QString type() = 0;
68 68
69 /** 69 /**
70 * The current profile has been changed and the module should do any 70 * The current profile has been changed and the module should do any
71 * neccesary changes also. 71 * neccesary changes also.
72 * As of Opie1.0 profiles are disabled. 72 * As of Opie1.0 profiles are disabled.
73 * 73 *
74 * @param newProfile what the profile should be changed to. 74 * @param newProfile what the profile should be changed to.
75 */ 75 */
76 virtual void setProfile(const QString &newProfile) = 0; 76 virtual void setProfile(const QString &newProfile) = 0;
77 77
78 /** 78 /**
79 * get the icon name for this device. 79 * get the icon name for this device.
80 * @param Interface* can be used in determining the icon. 80 * @param Interface* can be used in determining the icon.
81 * @return QString the icon name (minus .png, .gif etc) 81 * @return QString the icon name (minus .png, .gif etc)
82 */ 82 */
83 virtual QString getPixmapName(Interface *) = 0; 83 virtual QString getPixmapName(Interface *) = 0;
84 84
85 /** 85 /**
86 * Check to see if the interface i is owned by this module. 86 * Check to see if the interface i is owned by this module.
87 * See if you can handle it. And if you can claim ownership 87 * See if you can handle it. And if you can claim ownership
88 * by returning true. 88 * by returning true.
89 * For physical devices you will be asked if you want to own the 89 * For physical devices you will be asked if you want to own the
90 * device. But you can also create new \sa Interface Implementations. 90 * device. But you can also create new \sa Interface Implementations.
91 * 91 *
92 * If you want to own the Interface add it to your internal interface 92 * If you want to own the Interface add it to your internal interface
93 * list 93 * list
94 * 94 *
95 * @param Interface* interface to check against 95 * @param Interface* interface to check against
96 * @return bool true if i is owned by this module, false otherwise. 96 * @return bool true if i is owned by this module, false otherwise.
97 * 97 *
98 * @see getInterfaces 98 * @see getInterfaces
99 */ 99 */
100 virtual bool isOwner(Interface *){ return false; }; 100 virtual bool isOwner(Interface *){ return false; };
101 101
102 /** 102 /**
103 * Create and return the Configure Module 103 * Create and return the Configure Module
104 * @param Interface *i the interface to configure. 104 * @param Interface *i the interface to configure.
105 * @return QWidget* pointer to this modules configure. 105 * @return QWidget* pointer to this modules configure.
106 * 106 *
107 * @see InterfaceSetupImp 107 * @see InterfaceSetupImp
108 */ 108 */
109 virtual QWidget *configure(Interface *){ return NULL; } ; 109 virtual QWidget *configure(Interface *){ return NULL; } ;
110 110
111 /** 111 /**
112 * Create, and return the Information Module. 112 * Create, and return the Information Module.
113 * 113 *
114 * An default Implementation is InterfaceInformationImp 114 * An default Implementation is InterfaceInformationImp
115 * 115 *
116 * @param Interface *i the interface to get info on. 116 * @param Interface *i the interface to get info on.
117 * @return QWidget* pointer to this modules info. 117 * @return QWidget* pointer to this modules info.
118 * 118 *
119 * @see InterfaceInformationImp 119 * @see InterfaceInformationImp
120 * 120 *
121 */ 121 */
122 virtual QWidget *information(Interface *){ return NULL; }; 122 virtual QWidget *information(Interface *){ return NULL; };
123 123
124 /** 124 /**
125 * Get all active (up or down) interfaces managed by this 125 * Get all active (up or down) interfaces managed by this
126 * module. 126 * module.
127 * At the end of initialisation you will be asked to return your interfaces 127 * At the end of initialisation you will be asked to return your interfaces
128 * Return all of your interfaces even the ones you claimed by isOnwer. 128 * Return all of your interfaces even the ones you claimed by isOnwer.
129 * Here you can also return your 'virtual' Interface Objects 129 * Here you can also return your 'virtual' Interface Objects
130 * 130 *
131 * @return QList<Interface> A list of interfaces that exsist that havn't 131 * @return QList<Interface> A list of interfaces that exsist that havn't
132 * been called by isOwner() 132 * been called by isOwner()
133 */ 133 */
diff --git a/noncore/settings/networksettings/mainwindow/addconnectionimp.cpp b/noncore/settings/networksettings/mainwindow/addconnectionimp.cpp
index 84f1cf6..9049af4 100644
--- a/noncore/settings/networksettings/mainwindow/addconnectionimp.cpp
+++ b/noncore/settings/networksettings/mainwindow/addconnectionimp.cpp
@@ -1,41 +1,41 @@
1#include "addconnectionimp.h" 1#include "addconnectionimp.h"
2#include <qlistview.h> 2#include <qlistview.h>
3#if QT_VERSION < 300 3#if QT_VERSION < 0x030000
4#include <qlist.h> 4#include <qlist.h>
5#else 5#else
6#include <qptrlist.h> 6#include <qptrlist.h>
7#endif 7#endif
8#include <qlabel.h> 8#include <qlabel.h>
9#include <qheader.h> 9#include <qheader.h>
10 10
11/** 11/**
12 * Constructor 12 * Constructor
13 */ 13 */
14AddConnectionImp::AddConnectionImp(QWidget *parent, const char *name, WFlags f):AddConnection(parent, name, f){ 14AddConnectionImp::AddConnectionImp(QWidget *parent, const char *name, WFlags f):AddConnection(parent, name, f){
15 connect(registeredServicesList, SIGNAL(selectionChanged()), this, SLOT(changed())); 15 connect(registeredServicesList, SIGNAL(selectionChanged()), this, SLOT(changed()));
16 registeredServicesList->header()->hide(); 16 registeredServicesList->header()->hide();
17}; 17};
18 18
19/** 19/**
20 * The current item changed, update the discription. 20 * The current item changed, update the discription.
21 */ 21 */
22void AddConnectionImp::changed(){ 22void AddConnectionImp::changed(){
23 QListViewItem *item = registeredServicesList->currentItem(); 23 QListViewItem *item = registeredServicesList->currentItem();
24 if(item) 24 if(item)
25 help->setText(list[item->text(0)]); 25 help->setText(list[item->text(0)]);
26} 26}
27 27
28/** 28/**
29 * Save a copy of newList for the discriptions and append them all to the view 29 * Save a copy of newList for the discriptions and append them all to the view
30 * @param newList the new list of possible interfaces 30 * @param newList the new list of possible interfaces
31 */ 31 */
32void AddConnectionImp::addConnections(const QMap<QString, QString> &newList){ 32void AddConnectionImp::addConnections(const QMap<QString, QString> &newList){
33 list = newList; 33 list = newList;
34 QMap<QString, QString>::Iterator it; 34 QMap<QString, QString>::Iterator it;
35 for( it = list.begin(); it != list.end(); ++it ) 35 for( it = list.begin(); it != list.end(); ++it )
36 (void)new QListViewItem(registeredServicesList, it.key()); 36 (void)new QListViewItem(registeredServicesList, it.key());
37 registeredServicesList->setCurrentItem(registeredServicesList->firstChild()); 37 registeredServicesList->setCurrentItem(registeredServicesList->firstChild());
38} 38}
39 39
40// addserviceimp.cpp 40// addserviceimp.cpp
41 41
diff --git a/noncore/settings/networksettings/mainwindow/mainwindowimp.cpp b/noncore/settings/networksettings/mainwindow/mainwindowimp.cpp
index 5f23aea..8feb7a5 100644
--- a/noncore/settings/networksettings/mainwindow/mainwindowimp.cpp
+++ b/noncore/settings/networksettings/mainwindow/mainwindowimp.cpp
@@ -1,156 +1,156 @@
1 1
2#include "mainwindowimp.h" 2#include "mainwindowimp.h"
3#include "addconnectionimp.h" 3#include "addconnectionimp.h"
4#include "interfaceinformationimp.h" 4#include "interfaceinformationimp.h"
5#include "interfacesetupimp.h" 5#include "interfacesetupimp.h"
6#include "interfaces.h" 6#include "interfaces.h"
7#include "module.h" 7#include "module.h"
8 8
9/* OPIE */ 9/* OPIE */
10#include <opie2/odebug.h> 10#include <opie2/odebug.h>
11#include <qpe/qcopenvelope_qws.h> 11#include <qpe/qcopenvelope_qws.h>
12#include <qpe/qpeapplication.h> 12#include <qpe/qpeapplication.h>
13#include <qpe/config.h> 13#include <qpe/config.h>
14#include <qpe/qlibrary.h> 14#include <qpe/qlibrary.h>
15#include <qpe/resource.h> 15#include <qpe/resource.h>
16 16
17/* QT */ 17/* QT */
18#include <qpushbutton.h> 18#include <qpushbutton.h>
19#include <qlistbox.h> 19#include <qlistbox.h>
20#include <qlineedit.h> 20#include <qlineedit.h>
21#include <qlistview.h> 21#include <qlistview.h>
22#include <qheader.h> 22#include <qheader.h>
23#include <qlabel.h> 23#include <qlabel.h>
24#include <qtabwidget.h> // in order to disable the profiles tab 24#include <qtabwidget.h> // in order to disable the profiles tab
25#include <qmessagebox.h> 25#include <qmessagebox.h>
26 26
27 27
28#if QT_VERSION < 300 28#if QT_VERSION < 0x030000
29#include <qlist.h> 29#include <qlist.h>
30#else 30#else
31#include <qptrlist.h> 31#include <qptrlist.h>
32#endif 32#endif
33#include <qdir.h> 33#include <qdir.h>
34#include <qfile.h> 34#include <qfile.h>
35#include <qtextstream.h> 35#include <qtextstream.h>
36#include <qregexp.h> 36#include <qregexp.h>
37 37
38/* STD */ 38/* STD */
39#include <net/if.h> 39#include <net/if.h>
40#include <sys/ioctl.h> 40#include <sys/ioctl.h>
41#include <sys/socket.h> 41#include <sys/socket.h>
42 42
43#define DEFAULT_SCHEME "/var/lib/pcmcia/scheme" 43#define DEFAULT_SCHEME "/var/lib/pcmcia/scheme"
44#define _PROCNETDEV "/proc/net/dev" 44#define _PROCNETDEV "/proc/net/dev"
45 45
46MainWindowImp::MainWindowImp(QWidget *parent, const char *name, WFlags) : MainWindow(parent, name, Qt::WStyle_ContextHelp), advancedUserMode(true), scheme(DEFAULT_SCHEME) 46MainWindowImp::MainWindowImp(QWidget *parent, const char *name, WFlags) : MainWindow(parent, name, Qt::WStyle_ContextHelp), advancedUserMode(true), scheme(DEFAULT_SCHEME)
47{ 47{
48 connect(addConnectionButton, SIGNAL(clicked()), this, SLOT(addClicked())); 48 connect(addConnectionButton, SIGNAL(clicked()), this, SLOT(addClicked()));
49 connect(removeConnectionButton, SIGNAL(clicked()), this, SLOT(removeClicked())); 49 connect(removeConnectionButton, SIGNAL(clicked()), this, SLOT(removeClicked()));
50 connect(informationConnectionButton, SIGNAL(clicked()), this, SLOT(informationClicked())); 50 connect(informationConnectionButton, SIGNAL(clicked()), this, SLOT(informationClicked()));
51 connect(configureConnectionButton, SIGNAL(clicked()), this, SLOT(configureClicked())); 51 connect(configureConnectionButton, SIGNAL(clicked()), this, SLOT(configureClicked()));
52 52
53 //remove tab with no function 53 //remove tab with no function
54 tabWidget->removePage( tab ); 54 tabWidget->removePage( tab );
55 55
56 // Load connections. 56 // Load connections.
57 // /usr/local/kde/lib/libinterfaces.la 57 // /usr/local/kde/lib/libinterfaces.la
58 loadModules(QPEApplication::qpeDir() + "plugins/networksettings"); 58 loadModules(QPEApplication::qpeDir() + "plugins/networksettings");
59 getAllInterfaces(); 59 getAllInterfaces();
60 60
61 Interfaces i; 61 Interfaces i;
62 QStringList list = i.getInterfaceList(); 62 QStringList list = i.getInterfaceList();
63 QMap<QString, Interface*>::Iterator it; 63 QMap<QString, Interface*>::Iterator it;
64 for ( QStringList::Iterator ni = list.begin(); ni != list.end(); ++ni ) 64 for ( QStringList::Iterator ni = list.begin(); ni != list.end(); ++ni )
65 { 65 {
66 /* 66 /*
67 * we skipped it in getAllInterfaces now 67 * we skipped it in getAllInterfaces now
68 * we need to ignore it as well 68 * we need to ignore it as well
69 */ 69 */
70 if (m_handledIfaces.contains( *ni) ) 70 if (m_handledIfaces.contains( *ni) )
71 { 71 {
72 odebug << "Not up iface handled by module" << oendl; 72 odebug << "Not up iface handled by module" << oendl;
73 continue; 73 continue;
74 } 74 }
75 bool found = false; 75 bool found = false;
76 for( it = interfaceNames.begin(); it != interfaceNames.end(); ++it ) 76 for( it = interfaceNames.begin(); it != interfaceNames.end(); ++it )
77 { 77 {
78 if(it.key() == (*ni)) 78 if(it.key() == (*ni))
79 found = true; 79 found = true;
80 } 80 }
81 if(!found) 81 if(!found)
82 { 82 {
83 if(!(*ni).contains("_")) 83 if(!(*ni).contains("_"))
84 { 84 {
85 Interface *i = new Interface(this, *ni, false); 85 Interface *i = new Interface(this, *ni, false);
86 i->setAttached(false); 86 i->setAttached(false);
87 i->setHardwareName(tr("Disconnected")); 87 i->setHardwareName(tr("Disconnected"));
88 interfaceNames.insert(i->getInterfaceName(), i); 88 interfaceNames.insert(i->getInterfaceName(), i);
89 updateInterface(i); 89 updateInterface(i);
90 connect(i, SIGNAL(updateInterface(Interface*)), this, SLOT(updateInterface(Interface*))); 90 connect(i, SIGNAL(updateInterface(Interface*)), this, SLOT(updateInterface(Interface*)));
91 } 91 }
92 } 92 }
93 } 93 }
94 94
95 //getInterfaceList(); 95 //getInterfaceList();
96 connectionList->header()->hide(); 96 connectionList->header()->hide();
97 97
98 Config cfg("NetworkSetup"); 98 Config cfg("NetworkSetup");
99 profiles = QStringList::split(" ", cfg.readEntry("Profiles", "All")); 99 profiles = QStringList::split(" ", cfg.readEntry("Profiles", "All"));
100 for ( QStringList::Iterator it = profiles.begin(); 100 for ( QStringList::Iterator it = profiles.begin();
101 it != profiles.end(); ++it) 101 it != profiles.end(); ++it)
102 profilesList->insertItem((*it)); 102 profilesList->insertItem((*it));
103 currentProfileLabel->setText(cfg.readEntry("CurrentProfile", "All")); 103 currentProfileLabel->setText(cfg.readEntry("CurrentProfile", "All"));
104 advancedUserMode = cfg.readBoolEntry("AdvancedUserMode", false); 104 advancedUserMode = cfg.readBoolEntry("AdvancedUserMode", false);
105 scheme = cfg.readEntry("SchemeFile", DEFAULT_SCHEME); 105 scheme = cfg.readEntry("SchemeFile", DEFAULT_SCHEME);
106 106
107 QFile file(scheme); 107 QFile file(scheme);
108 if ( file.open(IO_ReadOnly) ) 108 if ( file.open(IO_ReadOnly) )
109 { // file opened successfully 109 { // file opened successfully
110 QTextStream stream( &file ); // use a text stream 110 QTextStream stream( &file ); // use a text stream
111 while ( !stream.eof() ) 111 while ( !stream.eof() )
112 { // until end of file... 112 { // until end of file...
113 QString line = stream.readLine(); // line of text excluding '\n' 113 QString line = stream.readLine(); // line of text excluding '\n'
114 if(line.contains("SCHEME")) 114 if(line.contains("SCHEME"))
115 { 115 {
116 line = line.mid(7, line.length()); 116 line = line.mid(7, line.length());
117 currentProfileLabel->setText(line); 117 currentProfileLabel->setText(line);
118 break; 118 break;
119 } 119 }
120 } 120 }
121 file.close(); 121 file.close();
122 } 122 }
123 makeChannel(); 123 makeChannel();
124} 124}
125 125
126/** 126/**
127 * Deconstructor. Save profiles. Delete loaded libraries. 127 * Deconstructor. Save profiles. Delete loaded libraries.
128 */ 128 */
129MainWindowImp::~MainWindowImp() 129MainWindowImp::~MainWindowImp()
130{ 130{
131 // Save profiles. 131 // Save profiles.
132 Config cfg("NetworkSetup"); 132 Config cfg("NetworkSetup");
133 cfg.setGroup("General"); 133 cfg.setGroup("General");
134 cfg.writeEntry("Profiles", profiles.join(" ")); 134 cfg.writeEntry("Profiles", profiles.join(" "));
135 135
136 // Delete all interfaces that don't have owners. 136 // Delete all interfaces that don't have owners.
137 QMap<Interface*, QListViewItem*>::Iterator iIt; 137 QMap<Interface*, QListViewItem*>::Iterator iIt;
138 for( iIt = items.begin(); iIt != items.end(); ++iIt ) 138 for( iIt = items.begin(); iIt != items.end(); ++iIt )
139 { 139 {
140 if(iIt.key()->getModuleOwner() == NULL) 140 if(iIt.key()->getModuleOwner() == NULL)
141 delete iIt.key(); 141 delete iIt.key();
142 } 142 }
143 143
144 // Delete Modules and Libraries 144 // Delete Modules and Libraries
145 QMap<Module*, QLibrary*>::Iterator it; 145 QMap<Module*, QLibrary*>::Iterator it;
146 for( it = libraries.begin(); it != libraries.end(); ++it ) 146 for( it = libraries.begin(); it != libraries.end(); ++it )
147 { 147 {
148 delete it.key(); 148 delete it.key();
149 // I wonder why I can't delete the libraries 149 // I wonder why I can't delete the libraries
150 // What fucking shit this is. 150 // What fucking shit this is.
151 //delete it.data(); 151 //delete it.data();
152 } 152 }
153} 153}
154 154
155/** 155/**
156 * Query the kernel for all of the interfaces. 156 * Query the kernel for all of the interfaces.
diff --git a/noncore/unsupported/qpdf/QOutputDev.cpp b/noncore/unsupported/qpdf/QOutputDev.cpp
index 022d938..487177c 100644
--- a/noncore/unsupported/qpdf/QOutputDev.cpp
+++ b/noncore/unsupported/qpdf/QOutputDev.cpp
@@ -469,257 +469,257 @@ void QOutputDev::doFill ( GfxState *state, bool winding )
469 469
470 QPDFDBG( printf ( "FILLING: %d POLYS\n", n )); 470 QPDFDBG( printf ( "FILLING: %d POLYS\n", n ));
471 471
472 QPen oldpen = m_painter-> pen ( ); 472 QPen oldpen = m_painter-> pen ( );
473 m_painter-> setPen ( QPen ( NoPen )); 473 m_painter-> setPen ( QPen ( NoPen ));
474 474
475 // draw each subpath 475 // draw each subpath
476 int j = 0; 476 int j = 0;
477 for ( int i = 0; i < n; i++ ) { 477 for ( int i = 0; i < n; i++ ) {
478 int len = lengths [i]; 478 int len = lengths [i];
479 479
480 if ( len >= 3 ) { 480 if ( len >= 3 ) {
481 QPDFDBG( printf ( " - POLY %d: ", i )); 481 QPDFDBG( printf ( " - POLY %d: ", i ));
482 QPDFDBG( for ( int ii = 0; ii < len; ii++ )) 482 QPDFDBG( for ( int ii = 0; ii < len; ii++ ))
483 QPDFDBG( printf ( "(%d/%d) ", points [j+ii]. x ( ), points [j+ii]. y ( ))); 483 QPDFDBG( printf ( "(%d/%d) ", points [j+ii]. x ( ), points [j+ii]. y ( )));
484 QPDFDBG( printf ( "\n" )); 484 QPDFDBG( printf ( "\n" ));
485 485
486 m_painter-> drawPolygon ( points, winding, j, len ); 486 m_painter-> drawPolygon ( points, winding, j, len );
487 } 487 }
488 j += len; 488 j += len;
489 } 489 }
490 m_painter-> setPen ( oldpen ); 490 m_painter-> setPen ( oldpen );
491 491
492 qApp-> processEvents ( ); 492 qApp-> processEvents ( );
493} 493}
494 494
495void QOutputDev::clip ( GfxState *state ) 495void QOutputDev::clip ( GfxState *state )
496{ 496{
497 doClip ( state, true ); 497 doClip ( state, true );
498} 498}
499 499
500void QOutputDev::eoClip ( GfxState *state ) 500void QOutputDev::eoClip ( GfxState *state )
501{ 501{
502 doClip ( state, false ); 502 doClip ( state, false );
503} 503}
504 504
505void QOutputDev::doClip ( GfxState *state, bool winding ) 505void QOutputDev::doClip ( GfxState *state, bool winding )
506{ 506{
507 QPointArray points; 507 QPointArray points;
508 QArray<int> lengths; 508 QArray<int> lengths;
509 509
510 // transform points 510 // transform points
511 int n = convertPath ( state, points, lengths ); 511 int n = convertPath ( state, points, lengths );
512 512
513 QRegion region; 513 QRegion region;
514 514
515 QPDFDBG( printf ( "CLIPPING: %d POLYS\n", n )); 515 QPDFDBG( printf ( "CLIPPING: %d POLYS\n", n ));
516 516
517 // draw each subpath 517 // draw each subpath
518 int j = 0; 518 int j = 0;
519 for ( int i = 0; i < n; i++ ) { 519 for ( int i = 0; i < n; i++ ) {
520 int len = lengths [i]; 520 int len = lengths [i];
521 521
522 if ( len >= 3 ) { 522 if ( len >= 3 ) {
523 QPointArray dummy; 523 QPointArray dummy;
524 dummy. setRawData ( points. data ( ) + j, len ); 524 dummy. setRawData ( points. data ( ) + j, len );
525 525
526 QPDFDBG( printf ( " - POLY %d: ", i )); 526 QPDFDBG( printf ( " - POLY %d: ", i ));
527 QPDFDBG( for ( int ii = 0; ii < len; ii++ ) printf ( "(%d/%d) ", points [j+ii]. x ( ), points [j+ii]. y ( ))); 527 QPDFDBG( for ( int ii = 0; ii < len; ii++ ) printf ( "(%d/%d) ", points [j+ii]. x ( ), points [j+ii]. y ( )));
528 QPDFDBG( printf ( "\n" )); 528 QPDFDBG( printf ( "\n" ));
529 529
530 region |= QRegion ( dummy, winding ); 530 region |= QRegion ( dummy, winding );
531 531
532 dummy. resetRawData ( points. data ( ) + j, len ); 532 dummy. resetRawData ( points. data ( ) + j, len );
533 } 533 }
534 j += len; 534 j += len;
535 } 535 }
536 536
537 if ( m_painter && m_painter-> hasClipping ( )) 537 if ( m_painter && m_painter-> hasClipping ( ))
538 region &= m_painter-> clipRegion ( ); 538 region &= m_painter-> clipRegion ( );
539 539
540 //m_painter-> setClipRegion ( region ); 540 //m_painter-> setClipRegion ( region );
541 //m_painter-> setClipping ( true ); 541 //m_painter-> setClipping ( true );
542 542
543 //m_painter-> fillRect ( 0, 0, m_pixmap-> width ( ), m_pixmap-> height ( ), red ); 543 //m_painter-> fillRect ( 0, 0, m_pixmap-> width ( ), m_pixmap-> height ( ), red );
544 //m_painter-> drawText ( points [0]. x ( ) + 10, points [0]. y ( ) + 10, "Bla bla" ); 544 //m_painter-> drawText ( points [0]. x ( ) + 10, points [0]. y ( ) + 10, "Bla bla" );
545 qApp-> processEvents ( ); 545 qApp-> processEvents ( );
546} 546}
547 547
548// 548//
549// Transform points in the path and convert curves to line segments. 549// Transform points in the path and convert curves to line segments.
550// Builds a set of subpaths and returns the number of subpaths. 550// Builds a set of subpaths and returns the number of subpaths.
551// If <fillHack> is set, close any unclosed subpaths and activate a 551// If <fillHack> is set, close any unclosed subpaths and activate a
552// kludge for polygon fills: First, it divides up the subpaths into 552// kludge for polygon fills: First, it divides up the subpaths into
553// non-overlapping polygons by simply comparing bounding rectangles. 553// non-overlapping polygons by simply comparing bounding rectangles.
554// Then it connects subaths within a single compound polygon to a single 554// Then it connects subaths within a single compound polygon to a single
555// point so that X can fill the polygon (sort of). 555// point so that X can fill the polygon (sort of).
556// 556//
557int QOutputDev::convertPath ( GfxState *state, QPointArray &points, QArray<int> &lengths ) 557int QOutputDev::convertPath ( GfxState *state, QPointArray &points, QArray<int> &lengths )
558{ 558{
559 GfxPath *path = state-> getPath ( ); 559 GfxPath *path = state-> getPath ( );
560 int n = path-> getNumSubpaths ( ); 560 int n = path-> getNumSubpaths ( );
561 561
562 lengths. resize ( n ); 562 lengths. resize ( n );
563 563
564 // do each subpath 564 // do each subpath
565 for ( int i = 0; i < n; i++ ) { 565 for ( int i = 0; i < n; i++ ) {
566 // transform the points 566 // transform the points
567 lengths [i] = convertSubpath ( state, path-> getSubpath ( i ), points ); 567 lengths [i] = convertSubpath ( state, path-> getSubpath ( i ), points );
568 } 568 }
569 569
570 return n; 570 return n;
571} 571}
572 572
573// 573//
574// Transform points in a single subpath and convert curves to line 574// Transform points in a single subpath and convert curves to line
575// segments. 575// segments.
576// 576//
577int QOutputDev::convertSubpath ( GfxState *state, GfxSubpath *subpath, QPointArray &points ) 577int QOutputDev::convertSubpath ( GfxState *state, GfxSubpath *subpath, QPointArray &points )
578{ 578{
579 int oldcnt = points. count ( ); 579 int oldcnt = points. count ( );
580 580
581 fp_t x0, y0, x1, y1, x2, y2, x3, y3; 581 fp_t x0, y0, x1, y1, x2, y2, x3, y3;
582 582
583 int m = subpath-> getNumPoints ( ); 583 int m = subpath-> getNumPoints ( );
584 int i = 0; 584 int i = 0;
585 585
586 while ( i < m ) { 586 while ( i < m ) {
587 if ( i >= 1 && subpath-> getCurve ( i )) { 587 if ( i >= 1 && subpath-> getCurve ( i )) {
588 state-> transform ( subpath-> getX ( i - 1 ), subpath-> getY ( i - 1 ), &x0, &y0 ); 588 state-> transform ( subpath-> getX ( i - 1 ), subpath-> getY ( i - 1 ), &x0, &y0 );
589 state-> transform ( subpath-> getX ( i ), subpath-> getY ( i ), &x1, &y1 ); 589 state-> transform ( subpath-> getX ( i ), subpath-> getY ( i ), &x1, &y1 );
590 state-> transform ( subpath-> getX ( i + 1 ), subpath-> getY ( i + 1 ), &x2, &y2 ); 590 state-> transform ( subpath-> getX ( i + 1 ), subpath-> getY ( i + 1 ), &x2, &y2 );
591 state-> transform ( subpath-> getX ( i + 2 ), subpath-> getY ( i + 2 ), &x3, &y3 ); 591 state-> transform ( subpath-> getX ( i + 2 ), subpath-> getY ( i + 2 ), &x3, &y3 );
592 592
593 QPointArray tmp; 593 QPointArray tmp;
594 tmp. setPoints ( 4, lrint ( x0 ), lrint ( y0 ), lrint ( x1 ), lrint ( y1 ), 594 tmp. setPoints ( 4, lrint ( x0 ), lrint ( y0 ), lrint ( x1 ), lrint ( y1 ),
595 lrint ( x2 ), lrint ( y2 ), lrint ( x3 ), lrint ( y3 )); 595 lrint ( x2 ), lrint ( y2 ), lrint ( x3 ), lrint ( y3 ));
596 596
597#if QT_VERSION < 300 597#if QT_VERSION < 0x030000
598 tmp = tmp. quadBezier ( ); 598 tmp = tmp. quadBezier ( );
599 599
600 for ( uint loop = 0; loop < tmp. count ( ); loop++ ) { 600 for ( uint loop = 0; loop < tmp. count ( ); loop++ ) {
601 QPoint p = tmp. point ( loop ); 601 QPoint p = tmp. point ( loop );
602 points. putPoints ( points. count ( ), 1, p. x ( ), p. y ( )); 602 points. putPoints ( points. count ( ), 1, p. x ( ), p. y ( ));
603 } 603 }
604#else 604#else
605 tmp = tmp. cubicBezier ( ); 605 tmp = tmp. cubicBezier ( );
606 points. putPoints ( points. count ( ), tmp. count ( ), tmp ); 606 points. putPoints ( points. count ( ), tmp. count ( ), tmp );
607#endif 607#endif
608 608
609 i += 3; 609 i += 3;
610 } 610 }
611 else { 611 else {
612 state-> transform ( subpath-> getX ( i ), subpath-> getY ( i ), &x1, &y1 ); 612 state-> transform ( subpath-> getX ( i ), subpath-> getY ( i ), &x1, &y1 );
613 613
614 points. putPoints ( points. count ( ), 1, lrint ( x1 ), lrint ( y1 )); 614 points. putPoints ( points. count ( ), 1, lrint ( x1 ), lrint ( y1 ));
615 ++i; 615 ++i;
616 } 616 }
617 } 617 }
618 return points. count ( ) - oldcnt; 618 return points. count ( ) - oldcnt;
619} 619}
620 620
621 621
622void QOutputDev::beginString ( GfxState *state, GString */*s*/ ) 622void QOutputDev::beginString ( GfxState *state, GString */*s*/ )
623{ 623{
624 m_text-> beginString ( state ); 624 m_text-> beginString ( state );
625} 625}
626 626
627void QOutputDev::endString ( GfxState */*state*/ ) 627void QOutputDev::endString ( GfxState */*state*/ )
628{ 628{
629 m_text-> endString ( ); 629 m_text-> endString ( );
630} 630}
631 631
632void QOutputDev::drawChar ( GfxState *state, fp_t x, fp_t y, 632void QOutputDev::drawChar ( GfxState *state, fp_t x, fp_t y,
633 fp_t dx, fp_t dy, fp_t originX, fp_t originY, 633 fp_t dx, fp_t dy, fp_t originX, fp_t originY,
634 CharCode code, Unicode *u, int uLen ) 634 CharCode code, Unicode *u, int uLen )
635{ 635{
636 fp_t x1, y1, dx1, dy1; 636 fp_t x1, y1, dx1, dy1;
637 637
638 if ( uLen > 0 ) 638 if ( uLen > 0 )
639 m_text-> addChar ( state, x, y, dx, dy, u, uLen ); 639 m_text-> addChar ( state, x, y, dx, dy, u, uLen );
640 640
641 // check for invisible text -- this is used by Acrobat Capture 641 // check for invisible text -- this is used by Acrobat Capture
642 if (( state-> getRender ( ) & 3 ) == 3 ) { 642 if (( state-> getRender ( ) & 3 ) == 3 ) {
643 return; 643 return;
644 } 644 }
645 645
646 x -= originX; 646 x -= originX;
647 y -= originY; 647 y -= originY;
648 state-> transform ( x, y, &x1, &y1 ); 648 state-> transform ( x, y, &x1, &y1 );
649 state-> transformDelta ( dx, dy, &dx1, &dy1 ); 649 state-> transformDelta ( dx, dy, &dx1, &dy1 );
650 650
651 651
652 if ( uLen > 0 ) { 652 if ( uLen > 0 ) {
653 QString str; 653 QString str;
654 QFontMetrics fm = m_painter-> fontMetrics ( ); 654 QFontMetrics fm = m_painter-> fontMetrics ( );
655 655
656 for ( int i = 0; i < uLen; i++ ) { 656 for ( int i = 0; i < uLen; i++ ) {
657 QChar c = QChar ( u [i] ); 657 QChar c = QChar ( u [i] );
658 658
659 if ( fm. inFont ( c )) { 659 if ( fm. inFont ( c )) {
660 str [i] = QChar ( u [i] ); 660 str [i] = QChar ( u [i] );
661 } 661 }
662 else { 662 else {
663 str [i] = ' '; 663 str [i] = ' ';
664 QPDFDBG( printf ( "CHARACTER NOT IN FONT: %hx\n", c. unicode ( ))); 664 QPDFDBG( printf ( "CHARACTER NOT IN FONT: %hx\n", c. unicode ( )));
665 } 665 }
666 } 666 }
667 667
668 if (( uLen == 1 ) && ( str [0] == ' ' )) 668 if (( uLen == 1 ) && ( str [0] == ' ' ))
669 return; 669 return;
670 670
671 671
672 fp_t m11, m12, m21, m22; 672 fp_t m11, m12, m21, m22;
673 673
674 state-> getFontTransMat ( &m11, &m12, &m21, &m22 ); 674 state-> getFontTransMat ( &m11, &m12, &m21, &m22 );
675 m11 *= state-> getHorizScaling ( ); 675 m11 *= state-> getHorizScaling ( );
676 m12 *= state-> getHorizScaling ( ); 676 m12 *= state-> getHorizScaling ( );
677 677
678 fp_t fsize = m_painter-> font ( ). pixelSize ( ); 678 fp_t fsize = m_painter-> font ( ). pixelSize ( );
679 679
680#ifndef QT_NO_TRANSFORMATIONS 680#ifndef QT_NO_TRANSFORMATIONS
681 QWMatrix oldmat; 681 QWMatrix oldmat;
682 682
683 bool dorot = (( m12 < -0.1 ) || ( m12 > 0.1 )) && (( m21 < -0.1 ) || ( m21 > 0.1 )); 683 bool dorot = (( m12 < -0.1 ) || ( m12 > 0.1 )) && (( m21 < -0.1 ) || ( m21 > 0.1 ));
684 684
685 if ( dorot ) { 685 if ( dorot ) {
686 oldmat = m_painter-> worldMatrix ( ); 686 oldmat = m_painter-> worldMatrix ( );
687 687
688 std::cerr << std::endl << "ROTATED: " << m11 << ", " << m12 << ", " << m21 << ", " << m22 << " / SIZE: " << fsize << " / TEXT: " << str. local8Bit ( ) << endl << endl; 688 std::cerr << std::endl << "ROTATED: " << m11 << ", " << m12 << ", " << m21 << ", " << m22 << " / SIZE: " << fsize << " / TEXT: " << str. local8Bit ( ) << endl << endl;
689 689
690 QWMatrix mat ( lrint ( m11 / fsize ), lrint ( m12 / fsize ), -lrint ( m21 / fsize ), -lrint ( m22 / fsize ), lrint ( x1 ), lrint ( y1 )); 690 QWMatrix mat ( lrint ( m11 / fsize ), lrint ( m12 / fsize ), -lrint ( m21 / fsize ), -lrint ( m22 / fsize ), lrint ( x1 ), lrint ( y1 ));
691 691
692 m_painter-> setWorldMatrix ( mat ); 692 m_painter-> setWorldMatrix ( mat );
693 693
694 x1 = 0; 694 x1 = 0;
695 y1 = 0; 695 y1 = 0;
696 } 696 }
697#endif 697#endif
698 698
699 QPen oldpen = m_painter-> pen ( ); 699 QPen oldpen = m_painter-> pen ( );
700 700
701 if (!( state-> getRender ( ) & 1 )) { 701 if (!( state-> getRender ( ) & 1 )) {
702 QPen fillpen = oldpen; 702 QPen fillpen = oldpen;
703 703
704 fillpen. setColor ( m_painter-> brush ( ). color ( )); 704 fillpen. setColor ( m_painter-> brush ( ). color ( ));
705 m_painter-> setPen ( fillpen ); 705 m_painter-> setPen ( fillpen );
706 } 706 }
707 707
708 if ( fsize > 5 ) 708 if ( fsize > 5 )
709 m_painter-> drawText ( lrint ( x1 ), lrint ( y1 ), str ); 709 m_painter-> drawText ( lrint ( x1 ), lrint ( y1 ), str );
710 else 710 else
711 m_painter-> fillRect ( lrint ( x1 ), lrint ( y1 ), lrint ( QMAX( fp_t(1), dx1 )), lrint ( QMAX( fsize, dy1 )), m_painter-> pen ( ). color ( )); 711 m_painter-> fillRect ( lrint ( x1 ), lrint ( y1 ), lrint ( QMAX( fp_t(1), dx1 )), lrint ( QMAX( fsize, dy1 )), m_painter-> pen ( ). color ( ));
712 712
713 m_painter-> setPen ( oldpen ); 713 m_painter-> setPen ( oldpen );
714 714
715#ifndef QT_NO_TRANSFORMATIONS 715#ifndef QT_NO_TRANSFORMATIONS
716 if ( dorot ) 716 if ( dorot )
717 m_painter-> setWorldMatrix ( oldmat ); 717 m_painter-> setWorldMatrix ( oldmat );
718#endif 718#endif
719 719
720 QPDFDBG( printf ( "DRAW TEXT: \"%s\" at (%ld/%ld)\n", str. local8Bit ( ). data ( ), lrint ( x1 ), lrint ( y1 ))); 720 QPDFDBG( printf ( "DRAW TEXT: \"%s\" at (%ld/%ld)\n", str. local8Bit ( ). data ( ), lrint ( x1 ), lrint ( y1 )));
721 } 721 }
722 else if ( code != 0 ) { 722 else if ( code != 0 ) {
723 // some PDF files use CID 0, which is .notdef, so just ignore it 723 // some PDF files use CID 0, which is .notdef, so just ignore it
724 qWarning ( "Unknown character (CID=%d Unicode=%hx)\n", code, (unsigned short) ( uLen > 0 ? u [0] : (Unicode) 0 )); 724 qWarning ( "Unknown character (CID=%d Unicode=%hx)\n", code, (unsigned short) ( uLen > 0 ? u [0] : (Unicode) 0 ));
725 } 725 }
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index 52419ad..0459caf 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -1,346 +1,346 @@
1/* 1/*
2 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> 2 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
3 * Released under the terms of the GNU GPL v2.0. 3 * Released under the terms of the GNU GPL v2.0.
4 */ 4 */
5 5
6#include <qapplication.h> 6#include <qapplication.h>
7#include <qmainwindow.h> 7#include <qmainwindow.h>
8#include <qtoolbar.h> 8#include <qtoolbar.h>
9#include <qvbox.h> 9#include <qvbox.h>
10#include <qsplitter.h> 10#include <qsplitter.h>
11#include <qlistview.h> 11#include <qlistview.h>
12#include <qtextview.h> 12#include <qtextview.h>
13#include <qlineedit.h> 13#include <qlineedit.h>
14#include <qmenubar.h> 14#include <qmenubar.h>
15#include <qmessagebox.h> 15#include <qmessagebox.h>
16#include <qaction.h> 16#include <qaction.h>
17#include <qheader.h> 17#include <qheader.h>
18#include <qfiledialog.h> 18#include <qfiledialog.h>
19#include <qregexp.h> 19#include <qregexp.h>
20#if QT_VERSION >= 300 20#if QT_VERSION >= 0x030000
21#include <qsettings.h> 21#include <qsettings.h>
22#endif 22#endif
23 23
24#include <stdlib.h> 24#include <stdlib.h>
25 25
26#include "lkc.h" 26#include "lkc.h"
27#include "qconf.h" 27#include "qconf.h"
28 28
29#include "qconf.moc" 29#include "qconf.moc"
30#include "images.c" 30#include "images.c"
31 31
32static QApplication *configApp; 32static QApplication *configApp;
33#if QT_VERSION >= 300 33#if QT_VERSION >= 0x030000
34static QSettings *configSettings; 34static QSettings *configSettings;
35#endif 35#endif
36 36
37/* 37/*
38 * update all the children of a menu entry 38 * update all the children of a menu entry
39 * removes/adds the entries from the parent widget as necessary 39 * removes/adds the entries from the parent widget as necessary
40 * 40 *
41 * parent: either the menu list widget or a menu entry widget 41 * parent: either the menu list widget or a menu entry widget
42 * menu: entry to be updated 42 * menu: entry to be updated
43 */ 43 */
44template <class P> 44template <class P>
45void ConfigList::updateMenuList(P* parent, struct menu* menu) 45void ConfigList::updateMenuList(P* parent, struct menu* menu)
46{ 46{
47 struct menu* child; 47 struct menu* child;
48 ConfigItem* item; 48 ConfigItem* item;
49 ConfigItem* last; 49 ConfigItem* last;
50 bool visible; 50 bool visible;
51 enum prop_type type; 51 enum prop_type type;
52 52
53 if (!menu) { 53 if (!menu) {
54 while ((item = parent->firstChild())) 54 while ((item = parent->firstChild()))
55 delete item; 55 delete item;
56 return; 56 return;
57 } 57 }
58 58
59 last = parent->firstChild(); 59 last = parent->firstChild();
60 if (last && !last->goParent) 60 if (last && !last->goParent)
61 last = 0; 61 last = 0;
62 for (child = menu->list; child; child = child->next) { 62 for (child = menu->list; child; child = child->next) {
63 item = last ? last->nextSibling() : parent->firstChild(); 63 item = last ? last->nextSibling() : parent->firstChild();
64 type = child->prompt ? child->prompt->type : P_UNKNOWN; 64 type = child->prompt ? child->prompt->type : P_UNKNOWN;
65 65
66 switch (mode) { 66 switch (mode) {
67 case menuMode: 67 case menuMode:
68 if (!(child->flags & MENU_ROOT)) 68 if (!(child->flags & MENU_ROOT))
69 goto hide; 69 goto hide;
70 break; 70 break;
71 case symbolMode: 71 case symbolMode:
72 if (child->flags & MENU_ROOT) 72 if (child->flags & MENU_ROOT)
73 goto hide; 73 goto hide;
74 break; 74 break;
75 default: 75 default:
76 break; 76 break;
77 } 77 }
78 78
79 visible = menu_is_visible(child); 79 visible = menu_is_visible(child);
80 if (showAll || visible) { 80 if (showAll || visible) {
81 if (!item || item->menu != child) 81 if (!item || item->menu != child)
82 item = new ConfigItem(parent, last, child, visible); 82 item = new ConfigItem(parent, last, child, visible);
83 else 83 else
84 item->testUpdateMenu(visible); 84 item->testUpdateMenu(visible);
85 85
86 if (mode == fullMode || mode == menuMode || type != P_MENU) 86 if (mode == fullMode || mode == menuMode || type != P_MENU)
87 updateMenuList(item, child); 87 updateMenuList(item, child);
88 else 88 else
89 updateMenuList(item, 0); 89 updateMenuList(item, 0);
90 last = item; 90 last = item;
91 continue; 91 continue;
92 } 92 }
93 hide: 93 hide:
94 if (item && item->menu == child) { 94 if (item && item->menu == child) {
95 last = parent->firstChild(); 95 last = parent->firstChild();
96 if (last == item) 96 if (last == item)
97 last = 0; 97 last = 0;
98 else while (last->nextSibling() != item) 98 else while (last->nextSibling() != item)
99 last = last->nextSibling(); 99 last = last->nextSibling();
100 delete item; 100 delete item;
101 } 101 }
102 } 102 }
103} 103}
104 104
105#if QT_VERSION >= 300 105#if QT_VERSION >= 0x030000
106/* 106/*
107 * set the new data 107 * set the new data
108 * TODO check the value 108 * TODO check the value
109 */ 109 */
110void ConfigItem::okRename(int col) 110void ConfigItem::okRename(int col)
111{ 111{
112 Parent::okRename(col); 112 Parent::okRename(col);
113 sym_set_string_value(menu->sym, text(dataColIdx).latin1()); 113 sym_set_string_value(menu->sym, text(dataColIdx).latin1());
114} 114}
115#endif 115#endif
116 116
117/* 117/*
118 * update the displayed of a menu entry 118 * update the displayed of a menu entry
119 */ 119 */
120void ConfigItem::updateMenu(void) 120void ConfigItem::updateMenu(void)
121{ 121{
122 ConfigList* list; 122 ConfigList* list;
123 struct symbol* sym; 123 struct symbol* sym;
124 struct property *prop; 124 struct property *prop;
125 QString prompt; 125 QString prompt;
126 int type; 126 int type;
127 tristate expr; 127 tristate expr;
128 128
129 list = listView(); 129 list = listView();
130 if (goParent) { 130 if (goParent) {
131 setPixmap(promptColIdx, list->menuBackPix); 131 setPixmap(promptColIdx, list->menuBackPix);
132 prompt = ".."; 132 prompt = "..";
133 goto set_prompt; 133 goto set_prompt;
134 } 134 }
135 135
136 sym = menu->sym; 136 sym = menu->sym;
137 prop = menu->prompt; 137 prop = menu->prompt;
138 prompt = menu_get_prompt(menu); 138 prompt = menu_get_prompt(menu);
139 139
140 if (prop) switch (prop->type) { 140 if (prop) switch (prop->type) {
141 case P_MENU: 141 case P_MENU:
142 if (list->mode == singleMode || list->mode == symbolMode) { 142 if (list->mode == singleMode || list->mode == symbolMode) {
143 /* a menuconfig entry is displayed differently 143 /* a menuconfig entry is displayed differently
144 * depending whether it's at the view root or a child. 144 * depending whether it's at the view root or a child.
145 */ 145 */
146 if (sym && list->rootEntry == menu) 146 if (sym && list->rootEntry == menu)
147 break; 147 break;
148 setPixmap(promptColIdx, list->menuPix); 148 setPixmap(promptColIdx, list->menuPix);
149 } else { 149 } else {
150 if (sym) 150 if (sym)
151 break; 151 break;
152 setPixmap(promptColIdx, 0); 152 setPixmap(promptColIdx, 0);
153 } 153 }
154 goto set_prompt; 154 goto set_prompt;
155 case P_COMMENT: 155 case P_COMMENT:
156 setPixmap(promptColIdx, 0); 156 setPixmap(promptColIdx, 0);
157 goto set_prompt; 157 goto set_prompt;
158 default: 158 default:
159 ; 159 ;
160 } 160 }
161 if (!sym) 161 if (!sym)
162 goto set_prompt; 162 goto set_prompt;
163 163
164 setText(nameColIdx, sym->name); 164 setText(nameColIdx, sym->name);
165 165
166 type = sym_get_type(sym); 166 type = sym_get_type(sym);
167 switch (type) { 167 switch (type) {
168 case S_BOOLEAN: 168 case S_BOOLEAN:
169 case S_TRISTATE: 169 case S_TRISTATE:
170 char ch; 170 char ch;
171 171
172 if (!sym_is_changable(sym) && !list->showAll) { 172 if (!sym_is_changable(sym) && !list->showAll) {
173 setPixmap(promptColIdx, 0); 173 setPixmap(promptColIdx, 0);
174 setText(noColIdx, 0); 174 setText(noColIdx, 0);
175 setText(modColIdx, 0); 175 setText(modColIdx, 0);
176 setText(yesColIdx, 0); 176 setText(yesColIdx, 0);
177 break; 177 break;
178 } 178 }
179 expr = sym_get_tristate_value(sym); 179 expr = sym_get_tristate_value(sym);
180 switch (expr) { 180 switch (expr) {
181 case yes: 181 case yes:
182 if (sym_is_choice_value(sym) && type == S_BOOLEAN) 182 if (sym_is_choice_value(sym) && type == S_BOOLEAN)
183 setPixmap(promptColIdx, list->choiceYesPix); 183 setPixmap(promptColIdx, list->choiceYesPix);
184 else 184 else
185 setPixmap(promptColIdx, list->symbolYesPix); 185 setPixmap(promptColIdx, list->symbolYesPix);
186 setText(yesColIdx, "Y"); 186 setText(yesColIdx, "Y");
187 ch = 'Y'; 187 ch = 'Y';
188 break; 188 break;
189 case mod: 189 case mod:
190 setPixmap(promptColIdx, list->symbolModPix); 190 setPixmap(promptColIdx, list->symbolModPix);
191 setText(modColIdx, "M"); 191 setText(modColIdx, "M");
192 ch = 'M'; 192 ch = 'M';
193 break; 193 break;
194 default: 194 default:
195 if (sym_is_choice_value(sym) && type == S_BOOLEAN) 195 if (sym_is_choice_value(sym) && type == S_BOOLEAN)
196 setPixmap(promptColIdx, list->choiceNoPix); 196 setPixmap(promptColIdx, list->choiceNoPix);
197 else 197 else
198 setPixmap(promptColIdx, list->symbolNoPix); 198 setPixmap(promptColIdx, list->symbolNoPix);
199 setText(noColIdx, "N"); 199 setText(noColIdx, "N");
200 ch = 'N'; 200 ch = 'N';
201 break; 201 break;
202 } 202 }
203 if (expr != no) 203 if (expr != no)
204 setText(noColIdx, sym_tristate_within_range(sym, no) ? "_" : 0); 204 setText(noColIdx, sym_tristate_within_range(sym, no) ? "_" : 0);
205 if (expr != mod) 205 if (expr != mod)
206 setText(modColIdx, sym_tristate_within_range(sym, mod) ? "_" : 0); 206 setText(modColIdx, sym_tristate_within_range(sym, mod) ? "_" : 0);
207 if (expr != yes) 207 if (expr != yes)
208 setText(yesColIdx, sym_tristate_within_range(sym, yes) ? "_" : 0); 208 setText(yesColIdx, sym_tristate_within_range(sym, yes) ? "_" : 0);
209 209
210 setText(dataColIdx, QChar(ch)); 210 setText(dataColIdx, QChar(ch));
211 break; 211 break;
212 case S_INT: 212 case S_INT:
213 case S_HEX: 213 case S_HEX:
214 case S_STRING: 214 case S_STRING:
215 const char* data; 215 const char* data;
216 216
217 data = sym_get_string_value(sym); 217 data = sym_get_string_value(sym);
218#if QT_VERSION >= 300 218#if QT_VERSION >= 0x030000
219 int i = list->mapIdx(dataColIdx); 219 int i = list->mapIdx(dataColIdx);
220 if (i >= 0) 220 if (i >= 0)
221 setRenameEnabled(i, TRUE); 221 setRenameEnabled(i, TRUE);
222#endif 222#endif
223 setText(dataColIdx, data); 223 setText(dataColIdx, data);
224 if (type == S_STRING) 224 if (type == S_STRING)
225 prompt.sprintf("%s: %s", prompt.latin1(), data); 225 prompt.sprintf("%s: %s", prompt.latin1(), data);
226 else 226 else
227 prompt.sprintf("(%s) %s", data, prompt.latin1()); 227 prompt.sprintf("(%s) %s", data, prompt.latin1());
228 break; 228 break;
229 } 229 }
230 if (!sym_has_value(sym) && visible) 230 if (!sym_has_value(sym) && visible)
231 prompt += " (NEW)"; 231 prompt += " (NEW)";
232set_prompt: 232set_prompt:
233 setText(promptColIdx, prompt); 233 setText(promptColIdx, prompt);
234} 234}
235 235
236void ConfigItem::testUpdateMenu(bool v) 236void ConfigItem::testUpdateMenu(bool v)
237{ 237{
238 ConfigItem* i; 238 ConfigItem* i;
239 239
240 visible = v; 240 visible = v;
241 if (!menu) 241 if (!menu)
242 return; 242 return;
243 243
244 sym_calc_value(menu->sym); 244 sym_calc_value(menu->sym);
245 if (menu->flags & MENU_CHANGED) { 245 if (menu->flags & MENU_CHANGED) {
246 /* the menu entry changed, so update all list items */ 246 /* the menu entry changed, so update all list items */
247 menu->flags &= ~MENU_CHANGED; 247 menu->flags &= ~MENU_CHANGED;
248 for (i = (ConfigItem*)menu->data; i; i = i->nextItem) 248 for (i = (ConfigItem*)menu->data; i; i = i->nextItem)
249 i->updateMenu(); 249 i->updateMenu();
250 } else if (listView()->updateAll) 250 } else if (listView()->updateAll)
251 updateMenu(); 251 updateMenu();
252} 252}
253 253
254void ConfigItem::paintCell(QPainter* p, const QColorGroup& cg, int column, int width, int align) 254void ConfigItem::paintCell(QPainter* p, const QColorGroup& cg, int column, int width, int align)
255{ 255{
256 ConfigList* list = listView(); 256 ConfigList* list = listView();
257 257
258 if (visible) { 258 if (visible) {
259 if (isSelected() && !list->hasFocus() && list->mode == menuMode) 259 if (isSelected() && !list->hasFocus() && list->mode == menuMode)
260 Parent::paintCell(p, list->inactivedColorGroup, column, width, align); 260 Parent::paintCell(p, list->inactivedColorGroup, column, width, align);
261 else 261 else
262 Parent::paintCell(p, cg, column, width, align); 262 Parent::paintCell(p, cg, column, width, align);
263 } else 263 } else
264 Parent::paintCell(p, list->disabledColorGroup, column, width, align); 264 Parent::paintCell(p, list->disabledColorGroup, column, width, align);
265} 265}
266 266
267/* 267/*
268 * construct a menu entry 268 * construct a menu entry
269 */ 269 */
270void ConfigItem::init(void) 270void ConfigItem::init(void)
271{ 271{
272 if (menu) { 272 if (menu) {
273 ConfigList* list = listView(); 273 ConfigList* list = listView();
274 nextItem = (ConfigItem*)menu->data; 274 nextItem = (ConfigItem*)menu->data;
275 menu->data = this; 275 menu->data = this;
276 276
277 if (list->mode != fullMode) 277 if (list->mode != fullMode)
278 setOpen(TRUE); 278 setOpen(TRUE);
279 sym_calc_value(menu->sym); 279 sym_calc_value(menu->sym);
280 } 280 }
281 updateMenu(); 281 updateMenu();
282} 282}
283 283
284/* 284/*
285 * destruct a menu entry 285 * destruct a menu entry
286 */ 286 */
287ConfigItem::~ConfigItem(void) 287ConfigItem::~ConfigItem(void)
288{ 288{
289 if (menu) { 289 if (menu) {
290 ConfigItem** ip = (ConfigItem**)&menu->data; 290 ConfigItem** ip = (ConfigItem**)&menu->data;
291 for (; *ip; ip = &(*ip)->nextItem) { 291 for (; *ip; ip = &(*ip)->nextItem) {
292 if (*ip == this) { 292 if (*ip == this) {
293 *ip = nextItem; 293 *ip = nextItem;
294 break; 294 break;
295 } 295 }
296 } 296 }
297 } 297 }
298} 298}
299 299
300void ConfigLineEdit::show(ConfigItem* i) 300void ConfigLineEdit::show(ConfigItem* i)
301{ 301{
302 item = i; 302 item = i;
303 if (sym_get_string_value(item->menu->sym)) 303 if (sym_get_string_value(item->menu->sym))
304 setText(sym_get_string_value(item->menu->sym)); 304 setText(sym_get_string_value(item->menu->sym));
305 else 305 else
306 setText(0); 306 setText(0);
307 Parent::show(); 307 Parent::show();
308 setFocus(); 308 setFocus();
309} 309}
310 310
311void ConfigLineEdit::keyPressEvent(QKeyEvent* e) 311void ConfigLineEdit::keyPressEvent(QKeyEvent* e)
312{ 312{
313 switch (e->key()) { 313 switch (e->key()) {
314 case Key_Escape: 314 case Key_Escape:
315 break; 315 break;
316 case Key_Return: 316 case Key_Return:
317 case Key_Enter: 317 case Key_Enter:
318 sym_set_string_value(item->menu->sym, text().latin1()); 318 sym_set_string_value(item->menu->sym, text().latin1());
319 parent()->updateList(item); 319 parent()->updateList(item);
320 break; 320 break;
321 default: 321 default:
322 Parent::keyPressEvent(e); 322 Parent::keyPressEvent(e);
323 return; 323 return;
324 } 324 }
325 e->accept(); 325 e->accept();
326 parent()->list->setFocus(); 326 parent()->list->setFocus();
327 hide(); 327 hide();
328} 328}
329 329
330ConfigList::ConfigList(ConfigView* p, ConfigMainWindow* cv) 330ConfigList::ConfigList(ConfigView* p, ConfigMainWindow* cv)
331 : Parent(p), cview(cv), 331 : Parent(p), cview(cv),
332 updateAll(false), 332 updateAll(false),
333 symbolYesPix(xpm_symbol_yes), symbolModPix(xpm_symbol_mod), symbolNoPix(xpm_symbol_no), 333 symbolYesPix(xpm_symbol_yes), symbolModPix(xpm_symbol_mod), symbolNoPix(xpm_symbol_no),
334 choiceYesPix(xpm_choice_yes), choiceNoPix(xpm_choice_no), 334 choiceYesPix(xpm_choice_yes), choiceNoPix(xpm_choice_no),
335 menuPix(xpm_menu), menuInvPix(xpm_menu_inv), menuBackPix(xpm_menuback), voidPix(xpm_void), 335 menuPix(xpm_menu), menuInvPix(xpm_menu_inv), menuBackPix(xpm_menuback), voidPix(xpm_void),
336 showAll(false), showName(false), showRange(false), showData(false), 336 showAll(false), showName(false), showRange(false), showData(false),
337 rootEntry(0) 337 rootEntry(0)
338{ 338{
339 int i; 339 int i;
340 340
341 setSorting(-1); 341 setSorting(-1);
342 setRootIsDecorated(TRUE); 342 setRootIsDecorated(TRUE);
343 disabledColorGroup = palette().active(); 343 disabledColorGroup = palette().active();
344 disabledColorGroup.setColor(QColorGroup::Text, palette().disabled().text()); 344 disabledColorGroup.setColor(QColorGroup::Text, palette().disabled().text());
345 inactivedColorGroup = palette().active(); 345 inactivedColorGroup = palette().active();
346 inactivedColorGroup.setColor(QColorGroup::Highlight, palette().disabled().highlight()); 346 inactivedColorGroup.setColor(QColorGroup::Highlight, palette().disabled().highlight());
@@ -365,257 +365,257 @@ void ConfigList::reinit(void)
365 365
366 if (showName) 366 if (showName)
367 addColumn(nameColIdx, "Name"); 367 addColumn(nameColIdx, "Name");
368 if (showRange) { 368 if (showRange) {
369 addColumn(noColIdx, "N"); 369 addColumn(noColIdx, "N");
370 addColumn(modColIdx, "M"); 370 addColumn(modColIdx, "M");
371 addColumn(yesColIdx, "Y"); 371 addColumn(yesColIdx, "Y");
372 } 372 }
373 if (showData) 373 if (showData)
374 addColumn(dataColIdx, "Value"); 374 addColumn(dataColIdx, "Value");
375 375
376 updateListAll(); 376 updateListAll();
377} 377}
378 378
379void ConfigList::updateSelection(void) 379void ConfigList::updateSelection(void)
380{ 380{
381 struct menu *menu; 381 struct menu *menu;
382 enum prop_type type; 382 enum prop_type type;
383 383
384 ConfigItem* item = (ConfigItem*)selectedItem(); 384 ConfigItem* item = (ConfigItem*)selectedItem();
385 if (!item) 385 if (!item)
386 return; 386 return;
387 387
388 cview->setHelp(item); 388 cview->setHelp(item);
389 389
390 menu = item->menu; 390 menu = item->menu;
391 if (!menu) 391 if (!menu)
392 return; 392 return;
393 type = menu->prompt ? menu->prompt->type : P_UNKNOWN; 393 type = menu->prompt ? menu->prompt->type : P_UNKNOWN;
394 if (mode == menuMode && type == P_MENU) 394 if (mode == menuMode && type == P_MENU)
395 emit menuSelected(menu); 395 emit menuSelected(menu);
396} 396}
397 397
398void ConfigList::updateList(ConfigItem* item) 398void ConfigList::updateList(ConfigItem* item)
399{ 399{
400 ConfigItem* last = 0; 400 ConfigItem* last = 0;
401 401
402 if (!rootEntry) 402 if (!rootEntry)
403 goto update; 403 goto update;
404 404
405 if (rootEntry != &rootmenu && (mode == singleMode || 405 if (rootEntry != &rootmenu && (mode == singleMode ||
406 (mode == symbolMode && rootEntry->parent != &rootmenu))) { 406 (mode == symbolMode && rootEntry->parent != &rootmenu))) {
407 item = firstChild(); 407 item = firstChild();
408 if (!item) 408 if (!item)
409 item = new ConfigItem(this, 0, true); 409 item = new ConfigItem(this, 0, true);
410 last = item; 410 last = item;
411 } 411 }
412 if (mode == singleMode && rootEntry->sym && rootEntry->prompt) { 412 if (mode == singleMode && rootEntry->sym && rootEntry->prompt) {
413 item = last ? last->nextSibling() : firstChild(); 413 item = last ? last->nextSibling() : firstChild();
414 if (!item) 414 if (!item)
415 item = new ConfigItem(this, last, rootEntry, true); 415 item = new ConfigItem(this, last, rootEntry, true);
416 416
417 updateMenuList(item, rootEntry); 417 updateMenuList(item, rootEntry);
418 triggerUpdate(); 418 triggerUpdate();
419 return; 419 return;
420 } 420 }
421update: 421update:
422 updateMenuList(this, rootEntry); 422 updateMenuList(this, rootEntry);
423 triggerUpdate(); 423 triggerUpdate();
424} 424}
425 425
426void ConfigList::setAllOpen(bool open) 426void ConfigList::setAllOpen(bool open)
427{ 427{
428 QListViewItemIterator it(this); 428 QListViewItemIterator it(this);
429 429
430 for (; it.current(); it++) 430 for (; it.current(); it++)
431 it.current()->setOpen(open); 431 it.current()->setOpen(open);
432} 432}
433 433
434void ConfigList::setValue(ConfigItem* item, tristate val) 434void ConfigList::setValue(ConfigItem* item, tristate val)
435{ 435{
436 struct symbol* sym; 436 struct symbol* sym;
437 int type; 437 int type;
438 tristate oldval; 438 tristate oldval;
439 439
440 sym = item->menu ? item->menu->sym : 0; 440 sym = item->menu ? item->menu->sym : 0;
441 if (!sym) 441 if (!sym)
442 return; 442 return;
443 443
444 type = sym_get_type(sym); 444 type = sym_get_type(sym);
445 switch (type) { 445 switch (type) {
446 case S_BOOLEAN: 446 case S_BOOLEAN:
447 case S_TRISTATE: 447 case S_TRISTATE:
448 oldval = sym_get_tristate_value(sym); 448 oldval = sym_get_tristate_value(sym);
449 449
450 if (!sym_set_tristate_value(sym, val)) 450 if (!sym_set_tristate_value(sym, val))
451 return; 451 return;
452 if (oldval == no && item->menu->list) 452 if (oldval == no && item->menu->list)
453 item->setOpen(TRUE); 453 item->setOpen(TRUE);
454 parent()->updateList(item); 454 parent()->updateList(item);
455 break; 455 break;
456 } 456 }
457} 457}
458 458
459void ConfigList::changeValue(ConfigItem* item) 459void ConfigList::changeValue(ConfigItem* item)
460{ 460{
461 struct symbol* sym; 461 struct symbol* sym;
462 struct menu* menu; 462 struct menu* menu;
463 int type, oldexpr, newexpr; 463 int type, oldexpr, newexpr;
464 464
465 menu = item->menu; 465 menu = item->menu;
466 if (!menu) 466 if (!menu)
467 return; 467 return;
468 sym = menu->sym; 468 sym = menu->sym;
469 if (!sym) { 469 if (!sym) {
470 if (item->menu->list) 470 if (item->menu->list)
471 item->setOpen(!item->isOpen()); 471 item->setOpen(!item->isOpen());
472 return; 472 return;
473 } 473 }
474 474
475 type = sym_get_type(sym); 475 type = sym_get_type(sym);
476 switch (type) { 476 switch (type) {
477 case S_BOOLEAN: 477 case S_BOOLEAN:
478 case S_TRISTATE: 478 case S_TRISTATE:
479 oldexpr = sym_get_tristate_value(sym); 479 oldexpr = sym_get_tristate_value(sym);
480 newexpr = sym_toggle_tristate_value(sym); 480 newexpr = sym_toggle_tristate_value(sym);
481 if (item->menu->list) { 481 if (item->menu->list) {
482 if (oldexpr == newexpr) 482 if (oldexpr == newexpr)
483 item->setOpen(!item->isOpen()); 483 item->setOpen(!item->isOpen());
484 else if (oldexpr == no) 484 else if (oldexpr == no)
485 item->setOpen(TRUE); 485 item->setOpen(TRUE);
486 } 486 }
487 if (oldexpr != newexpr) 487 if (oldexpr != newexpr)
488 parent()->updateList(item); 488 parent()->updateList(item);
489 break; 489 break;
490 case S_INT: 490 case S_INT:
491 case S_HEX: 491 case S_HEX:
492 case S_STRING: 492 case S_STRING:
493#if QT_VERSION >= 300 493#if QT_VERSION >= 0x030000
494 if (colMap[dataColIdx] >= 0) 494 if (colMap[dataColIdx] >= 0)
495 item->startRename(colMap[dataColIdx]); 495 item->startRename(colMap[dataColIdx]);
496 else 496 else
497#endif 497#endif
498 parent()->lineEdit->show(item); 498 parent()->lineEdit->show(item);
499 break; 499 break;
500 } 500 }
501} 501}
502 502
503void ConfigList::setRootMenu(struct menu *menu) 503void ConfigList::setRootMenu(struct menu *menu)
504{ 504{
505 enum prop_type type; 505 enum prop_type type;
506 506
507 if (rootEntry == menu) 507 if (rootEntry == menu)
508 return; 508 return;
509 type = menu && menu->prompt ? menu->prompt->type : P_UNKNOWN; 509 type = menu && menu->prompt ? menu->prompt->type : P_UNKNOWN;
510 if (type != P_MENU) 510 if (type != P_MENU)
511 return; 511 return;
512 updateMenuList(this, 0); 512 updateMenuList(this, 0);
513 rootEntry = menu; 513 rootEntry = menu;
514 updateListAll(); 514 updateListAll();
515 setSelected(currentItem(), hasFocus()); 515 setSelected(currentItem(), hasFocus());
516} 516}
517 517
518void ConfigList::setParentMenu(void) 518void ConfigList::setParentMenu(void)
519{ 519{
520 ConfigItem* item; 520 ConfigItem* item;
521 struct menu *oldroot; 521 struct menu *oldroot;
522 522
523 oldroot = rootEntry; 523 oldroot = rootEntry;
524 if (rootEntry == &rootmenu) 524 if (rootEntry == &rootmenu)
525 return; 525 return;
526 setRootMenu(menu_get_parent_menu(rootEntry->parent)); 526 setRootMenu(menu_get_parent_menu(rootEntry->parent));
527 527
528 QListViewItemIterator it(this); 528 QListViewItemIterator it(this);
529 for (; (item = (ConfigItem*)it.current()); it++) { 529 for (; (item = (ConfigItem*)it.current()); it++) {
530 if (item->menu == oldroot) { 530 if (item->menu == oldroot) {
531 setCurrentItem(item); 531 setCurrentItem(item);
532 ensureItemVisible(item); 532 ensureItemVisible(item);
533 break; 533 break;
534 } 534 }
535 } 535 }
536} 536}
537 537
538void ConfigList::keyPressEvent(QKeyEvent* ev) 538void ConfigList::keyPressEvent(QKeyEvent* ev)
539{ 539{
540 QListViewItem* i = currentItem(); 540 QListViewItem* i = currentItem();
541 ConfigItem* item; 541 ConfigItem* item;
542 struct menu *menu; 542 struct menu *menu;
543 enum prop_type type; 543 enum prop_type type;
544 544
545 if (ev->key() == Key_Escape && mode != fullMode) { 545 if (ev->key() == Key_Escape && mode != fullMode) {
546 emit parentSelected(); 546 emit parentSelected();
547 ev->accept(); 547 ev->accept();
548 return; 548 return;
549 } 549 }
550 550
551 if (!i) { 551 if (!i) {
552 Parent::keyPressEvent(ev); 552 Parent::keyPressEvent(ev);
553 return; 553 return;
554 } 554 }
555 item = (ConfigItem*)i; 555 item = (ConfigItem*)i;
556 556
557 switch (ev->key()) { 557 switch (ev->key()) {
558 case Key_Return: 558 case Key_Return:
559 case Key_Enter: 559 case Key_Enter:
560 if (item->goParent) { 560 if (item->goParent) {
561 emit parentSelected(); 561 emit parentSelected();
562 break; 562 break;
563 } 563 }
564 menu = item->menu; 564 menu = item->menu;
565 if (!menu) 565 if (!menu)
566 break; 566 break;
567 type = menu->prompt ? menu->prompt->type : P_UNKNOWN; 567 type = menu->prompt ? menu->prompt->type : P_UNKNOWN;
568 if (type == P_MENU && rootEntry != menu && 568 if (type == P_MENU && rootEntry != menu &&
569 mode != fullMode && mode != menuMode) { 569 mode != fullMode && mode != menuMode) {
570 emit menuSelected(menu); 570 emit menuSelected(menu);
571 break; 571 break;
572 } 572 }
573 case Key_Space: 573 case Key_Space:
574 changeValue(item); 574 changeValue(item);
575 break; 575 break;
576 case Key_N: 576 case Key_N:
577 setValue(item, no); 577 setValue(item, no);
578 break; 578 break;
579 case Key_M: 579 case Key_M:
580 setValue(item, mod); 580 setValue(item, mod);
581 break; 581 break;
582 case Key_Y: 582 case Key_Y:
583 setValue(item, yes); 583 setValue(item, yes);
584 break; 584 break;
585 default: 585 default:
586 Parent::keyPressEvent(ev); 586 Parent::keyPressEvent(ev);
587 return; 587 return;
588 } 588 }
589 ev->accept(); 589 ev->accept();
590} 590}
591 591
592void ConfigList::contentsMousePressEvent(QMouseEvent* e) 592void ConfigList::contentsMousePressEvent(QMouseEvent* e)
593{ 593{
594 //QPoint p(contentsToViewport(e->pos())); 594 //QPoint p(contentsToViewport(e->pos()));
595 //printf("contentsMousePressEvent: %d,%d\n", p.x(), p.y()); 595 //printf("contentsMousePressEvent: %d,%d\n", p.x(), p.y());
596 Parent::contentsMousePressEvent(e); 596 Parent::contentsMousePressEvent(e);
597} 597}
598 598
599void ConfigList::contentsMouseReleaseEvent(QMouseEvent* e) 599void ConfigList::contentsMouseReleaseEvent(QMouseEvent* e)
600{ 600{
601 QPoint p(contentsToViewport(e->pos())); 601 QPoint p(contentsToViewport(e->pos()));
602 ConfigItem* item = (ConfigItem*)itemAt(p); 602 ConfigItem* item = (ConfigItem*)itemAt(p);
603 struct menu *menu; 603 struct menu *menu;
604 enum prop_type ptype; 604 enum prop_type ptype;
605 const QPixmap* pm; 605 const QPixmap* pm;
606 int idx, x; 606 int idx, x;
607 607
608 if (!item) 608 if (!item)
609 goto skip; 609 goto skip;
610 610
611 menu = item->menu; 611 menu = item->menu;
612 x = header()->offset() + p.x(); 612 x = header()->offset() + p.x();
613 idx = colRevMap[header()->sectionAt(x)]; 613 idx = colRevMap[header()->sectionAt(x)];
614 switch (idx) { 614 switch (idx) {
615 case promptColIdx: 615 case promptColIdx:
616 pm = item->pixmap(promptColIdx); 616 pm = item->pixmap(promptColIdx);
617 if (pm) { 617 if (pm) {
618 int off = header()->sectionPos(0) + itemMargin() + 618 int off = header()->sectionPos(0) + itemMargin() +
619 treeStepSize() * (item->depth() + (rootIsDecorated() ? 1 : 0)); 619 treeStepSize() * (item->depth() + (rootIsDecorated() ? 1 : 0));
620 if (x >= off && x < off + pm->width()) { 620 if (x >= off && x < off + pm->width()) {
621 if (item->goParent) { 621 if (item->goParent) {
@@ -626,257 +626,257 @@ void ConfigList::contentsMouseReleaseEvent(QMouseEvent* e)
626 ptype = menu->prompt ? menu->prompt->type : P_UNKNOWN; 626 ptype = menu->prompt ? menu->prompt->type : P_UNKNOWN;
627 if (ptype == P_MENU && rootEntry != menu && 627 if (ptype == P_MENU && rootEntry != menu &&
628 mode != fullMode && mode != menuMode) 628 mode != fullMode && mode != menuMode)
629 emit menuSelected(menu); 629 emit menuSelected(menu);
630 else 630 else
631 changeValue(item); 631 changeValue(item);
632 } 632 }
633 } 633 }
634 break; 634 break;
635 case noColIdx: 635 case noColIdx:
636 setValue(item, no); 636 setValue(item, no);
637 break; 637 break;
638 case modColIdx: 638 case modColIdx:
639 setValue(item, mod); 639 setValue(item, mod);
640 break; 640 break;
641 case yesColIdx: 641 case yesColIdx:
642 setValue(item, yes); 642 setValue(item, yes);
643 break; 643 break;
644 case dataColIdx: 644 case dataColIdx:
645 changeValue(item); 645 changeValue(item);
646 break; 646 break;
647 } 647 }
648 648
649skip: 649skip:
650 //printf("contentsMouseReleaseEvent: %d,%d\n", p.x(), p.y()); 650 //printf("contentsMouseReleaseEvent: %d,%d\n", p.x(), p.y());
651 Parent::contentsMouseReleaseEvent(e); 651 Parent::contentsMouseReleaseEvent(e);
652} 652}
653 653
654void ConfigList::contentsMouseMoveEvent(QMouseEvent* e) 654void ConfigList::contentsMouseMoveEvent(QMouseEvent* e)
655{ 655{
656 //QPoint p(contentsToViewport(e->pos())); 656 //QPoint p(contentsToViewport(e->pos()));
657 //printf("contentsMouseMoveEvent: %d,%d\n", p.x(), p.y()); 657 //printf("contentsMouseMoveEvent: %d,%d\n", p.x(), p.y());
658 Parent::contentsMouseMoveEvent(e); 658 Parent::contentsMouseMoveEvent(e);
659} 659}
660 660
661void ConfigList::contentsMouseDoubleClickEvent(QMouseEvent* e) 661void ConfigList::contentsMouseDoubleClickEvent(QMouseEvent* e)
662{ 662{
663 QPoint p(contentsToViewport(e->pos())); 663 QPoint p(contentsToViewport(e->pos()));
664 ConfigItem* item = (ConfigItem*)itemAt(p); 664 ConfigItem* item = (ConfigItem*)itemAt(p);
665 struct menu *menu; 665 struct menu *menu;
666 enum prop_type ptype; 666 enum prop_type ptype;
667 667
668 if (!item) 668 if (!item)
669 goto skip; 669 goto skip;
670 if (item->goParent) { 670 if (item->goParent) {
671 emit parentSelected(); 671 emit parentSelected();
672 goto skip; 672 goto skip;
673 } 673 }
674 menu = item->menu; 674 menu = item->menu;
675 if (!menu) 675 if (!menu)
676 goto skip; 676 goto skip;
677 ptype = menu->prompt ? menu->prompt->type : P_UNKNOWN; 677 ptype = menu->prompt ? menu->prompt->type : P_UNKNOWN;
678 if (ptype == P_MENU && (mode == singleMode || mode == symbolMode)) 678 if (ptype == P_MENU && (mode == singleMode || mode == symbolMode))
679 emit menuSelected(menu); 679 emit menuSelected(menu);
680 else if (menu->sym) 680 else if (menu->sym)
681 changeValue(item); 681 changeValue(item);
682 682
683skip: 683skip:
684 //printf("contentsMouseDoubleClickEvent: %d,%d\n", p.x(), p.y()); 684 //printf("contentsMouseDoubleClickEvent: %d,%d\n", p.x(), p.y());
685 Parent::contentsMouseDoubleClickEvent(e); 685 Parent::contentsMouseDoubleClickEvent(e);
686} 686}
687 687
688void ConfigList::focusInEvent(QFocusEvent *e) 688void ConfigList::focusInEvent(QFocusEvent *e)
689{ 689{
690 Parent::focusInEvent(e); 690 Parent::focusInEvent(e);
691 691
692 QListViewItem* item = currentItem(); 692 QListViewItem* item = currentItem();
693 if (!item) 693 if (!item)
694 return; 694 return;
695 695
696 setSelected(item, TRUE); 696 setSelected(item, TRUE);
697 emit gotFocus(); 697 emit gotFocus();
698} 698}
699 699
700ConfigView* ConfigView::viewList; 700ConfigView* ConfigView::viewList;
701 701
702ConfigView::ConfigView(QWidget* parent, ConfigMainWindow* cview) 702ConfigView::ConfigView(QWidget* parent, ConfigMainWindow* cview)
703 : Parent(parent) 703 : Parent(parent)
704{ 704{
705 list = new ConfigList(this, cview); 705 list = new ConfigList(this, cview);
706 lineEdit = new ConfigLineEdit(this); 706 lineEdit = new ConfigLineEdit(this);
707 lineEdit->hide(); 707 lineEdit->hide();
708 708
709 this->nextView = viewList; 709 this->nextView = viewList;
710 viewList = this; 710 viewList = this;
711} 711}
712 712
713ConfigView::~ConfigView(void) 713ConfigView::~ConfigView(void)
714{ 714{
715 ConfigView** vp; 715 ConfigView** vp;
716 716
717 for (vp = &viewList; *vp; vp = &(*vp)->nextView) { 717 for (vp = &viewList; *vp; vp = &(*vp)->nextView) {
718 if (*vp == this) { 718 if (*vp == this) {
719 *vp = nextView; 719 *vp = nextView;
720 break; 720 break;
721 } 721 }
722 } 722 }
723} 723}
724 724
725void ConfigView::updateList(ConfigItem* item) 725void ConfigView::updateList(ConfigItem* item)
726{ 726{
727 ConfigView* v; 727 ConfigView* v;
728 728
729 for (v = viewList; v; v = v->nextView) 729 for (v = viewList; v; v = v->nextView)
730 v->list->updateList(item); 730 v->list->updateList(item);
731} 731}
732 732
733void ConfigView::updateListAll(void) 733void ConfigView::updateListAll(void)
734{ 734{
735 ConfigView* v; 735 ConfigView* v;
736 736
737 for (v = viewList; v; v = v->nextView) 737 for (v = viewList; v; v = v->nextView)
738 v->list->updateListAll(); 738 v->list->updateListAll();
739} 739}
740 740
741/* 741/*
742 * Construct the complete config widget 742 * Construct the complete config widget
743 */ 743 */
744ConfigMainWindow::ConfigMainWindow(void) 744ConfigMainWindow::ConfigMainWindow(void)
745{ 745{
746 QMenuBar* menu; 746 QMenuBar* menu;
747 QSplitter* split1; 747 QSplitter* split1;
748 QSplitter* split2; 748 QSplitter* split2;
749 bool ok; 749 bool ok;
750 int x, y, width, height; 750 int x, y, width, height;
751 751
752 QWidget *d = configApp->desktop(); 752 QWidget *d = configApp->desktop();
753 753
754#if QT_VERSION >= 300 754#if QT_VERSION >= 0x030000
755 width = configSettings->readNumEntry("/kconfig/qconf/window width", d->width() - 64); 755 width = configSettings->readNumEntry("/kconfig/qconf/window width", d->width() - 64);
756 height = configSettings->readNumEntry("/kconfig/qconf/window height", d->height() - 64); 756 height = configSettings->readNumEntry("/kconfig/qconf/window height", d->height() - 64);
757 resize(width, height); 757 resize(width, height);
758 x = configSettings->readNumEntry("/kconfig/qconf/window x", 0, &ok); 758 x = configSettings->readNumEntry("/kconfig/qconf/window x", 0, &ok);
759 if (ok) 759 if (ok)
760 y = configSettings->readNumEntry("/kconfig/qconf/window y", 0, &ok); 760 y = configSettings->readNumEntry("/kconfig/qconf/window y", 0, &ok);
761 if (ok) 761 if (ok)
762 move(x, y); 762 move(x, y);
763#else 763#else
764 width = d->width() - 64; 764 width = d->width() - 64;
765 height = d->height() - 64; 765 height = d->height() - 64;
766 resize(width, height); 766 resize(width, height);
767#endif 767#endif
768 768
769 showDebug = false; 769 showDebug = false;
770 770
771 split1 = new QSplitter(this); 771 split1 = new QSplitter(this);
772 split1->setOrientation(QSplitter::Horizontal); 772 split1->setOrientation(QSplitter::Horizontal);
773 setCentralWidget(split1); 773 setCentralWidget(split1);
774 774
775 menuView = new ConfigView(split1, this); 775 menuView = new ConfigView(split1, this);
776 menuList = menuView->list; 776 menuList = menuView->list;
777 777
778 split2 = new QSplitter(split1); 778 split2 = new QSplitter(split1);
779 split2->setOrientation(QSplitter::Vertical); 779 split2->setOrientation(QSplitter::Vertical);
780 780
781 // create config tree 781 // create config tree
782 configView = new ConfigView(split2, this); 782 configView = new ConfigView(split2, this);
783 configList = configView->list; 783 configList = configView->list;
784 784
785 helpText = new QTextView(split2); 785 helpText = new QTextView(split2);
786 helpText->setTextFormat(Qt::RichText); 786 helpText->setTextFormat(Qt::RichText);
787 787
788 setTabOrder(configList, helpText); 788 setTabOrder(configList, helpText);
789 configList->setFocus(); 789 configList->setFocus();
790 790
791 menu = menuBar(); 791 menu = menuBar();
792 toolBar = new QToolBar("Tools", this); 792 toolBar = new QToolBar("Tools", this);
793 793
794 backAction = new QAction("Back", QPixmap(xpm_back), "Back", 0, this); 794 backAction = new QAction("Back", QPixmap(xpm_back), "Back", 0, this);
795 connect(backAction, SIGNAL(activated()), SLOT(goBack())); 795 connect(backAction, SIGNAL(activated()), SLOT(goBack()));
796 backAction->setEnabled(FALSE); 796 backAction->setEnabled(FALSE);
797 QAction *quitAction = new QAction("Quit", "&Quit", CTRL+Key_Q, this); 797 QAction *quitAction = new QAction("Quit", "&Quit", CTRL+Key_Q, this);
798 connect(quitAction, SIGNAL(activated()), SLOT(close())); 798 connect(quitAction, SIGNAL(activated()), SLOT(close()));
799 QAction *loadAction = new QAction("Load", QPixmap(xpm_load), "&Load", CTRL+Key_L, this); 799 QAction *loadAction = new QAction("Load", QPixmap(xpm_load), "&Load", CTRL+Key_L, this);
800 connect(loadAction, SIGNAL(activated()), SLOT(loadConfig())); 800 connect(loadAction, SIGNAL(activated()), SLOT(loadConfig()));
801 QAction *saveAction = new QAction("Save", QPixmap(xpm_save), "&Save", CTRL+Key_S, this); 801 QAction *saveAction = new QAction("Save", QPixmap(xpm_save), "&Save", CTRL+Key_S, this);
802 connect(saveAction, SIGNAL(activated()), SLOT(saveConfig())); 802 connect(saveAction, SIGNAL(activated()), SLOT(saveConfig()));
803 QAction *saveAsAction = new QAction("Save As...", "Save &As...", 0, this); 803 QAction *saveAsAction = new QAction("Save As...", "Save &As...", 0, this);
804 connect(saveAsAction, SIGNAL(activated()), SLOT(saveConfigAs())); 804 connect(saveAsAction, SIGNAL(activated()), SLOT(saveConfigAs()));
805 QAction *singleViewAction = new QAction("Single View", QPixmap(xpm_single_view), "Split View", 0, this); 805 QAction *singleViewAction = new QAction("Single View", QPixmap(xpm_single_view), "Split View", 0, this);
806 connect(singleViewAction, SIGNAL(activated()), SLOT(showSingleView())); 806 connect(singleViewAction, SIGNAL(activated()), SLOT(showSingleView()));
807 QAction *splitViewAction = new QAction("Split View", QPixmap(xpm_split_view), "Split View", 0, this); 807 QAction *splitViewAction = new QAction("Split View", QPixmap(xpm_split_view), "Split View", 0, this);
808 connect(splitViewAction, SIGNAL(activated()), SLOT(showSplitView())); 808 connect(splitViewAction, SIGNAL(activated()), SLOT(showSplitView()));
809 QAction *fullViewAction = new QAction("Full View", QPixmap(xpm_tree_view), "Full View", 0, this); 809 QAction *fullViewAction = new QAction("Full View", QPixmap(xpm_tree_view), "Full View", 0, this);
810 connect(fullViewAction, SIGNAL(activated()), SLOT(showFullView())); 810 connect(fullViewAction, SIGNAL(activated()), SLOT(showFullView()));
811 811
812 QAction *showNameAction = new QAction(NULL, "Show Name", 0, this); 812 QAction *showNameAction = new QAction(NULL, "Show Name", 0, this);
813 showNameAction->setToggleAction(TRUE); 813 showNameAction->setToggleAction(TRUE);
814 showNameAction->setOn(configList->showName); 814 showNameAction->setOn(configList->showName);
815 connect(showNameAction, SIGNAL(toggled(bool)), SLOT(setShowName(bool))); 815 connect(showNameAction, SIGNAL(toggled(bool)), SLOT(setShowName(bool)));
816 QAction *showRangeAction = new QAction(NULL, "Show Range", 0, this); 816 QAction *showRangeAction = new QAction(NULL, "Show Range", 0, this);
817 showRangeAction->setToggleAction(TRUE); 817 showRangeAction->setToggleAction(TRUE);
818 showRangeAction->setOn(configList->showRange); 818 showRangeAction->setOn(configList->showRange);
819 connect(showRangeAction, SIGNAL(toggled(bool)), SLOT(setShowRange(bool))); 819 connect(showRangeAction, SIGNAL(toggled(bool)), SLOT(setShowRange(bool)));
820 QAction *showDataAction = new QAction(NULL, "Show Data", 0, this); 820 QAction *showDataAction = new QAction(NULL, "Show Data", 0, this);
821 showDataAction->setToggleAction(TRUE); 821 showDataAction->setToggleAction(TRUE);
822 showDataAction->setOn(configList->showData); 822 showDataAction->setOn(configList->showData);
823 connect(showDataAction, SIGNAL(toggled(bool)), SLOT(setShowData(bool))); 823 connect(showDataAction, SIGNAL(toggled(bool)), SLOT(setShowData(bool)));
824 QAction *showAllAction = new QAction(NULL, "Show All Options", 0, this); 824 QAction *showAllAction = new QAction(NULL, "Show All Options", 0, this);
825 showAllAction->setToggleAction(TRUE); 825 showAllAction->setToggleAction(TRUE);
826 showAllAction->setOn(configList->showAll); 826 showAllAction->setOn(configList->showAll);
827 connect(showAllAction, SIGNAL(toggled(bool)), SLOT(setShowAll(bool))); 827 connect(showAllAction, SIGNAL(toggled(bool)), SLOT(setShowAll(bool)));
828 QAction *showDebugAction = new QAction(NULL, "Show Debug Info", 0, this); 828 QAction *showDebugAction = new QAction(NULL, "Show Debug Info", 0, this);
829 showDebugAction->setToggleAction(TRUE); 829 showDebugAction->setToggleAction(TRUE);
830 showDebugAction->setOn(showDebug); 830 showDebugAction->setOn(showDebug);
831 connect(showDebugAction, SIGNAL(toggled(bool)), SLOT(setShowDebug(bool))); 831 connect(showDebugAction, SIGNAL(toggled(bool)), SLOT(setShowDebug(bool)));
832 832
833 QAction *showIntroAction = new QAction(NULL, "Introduction", 0, this); 833 QAction *showIntroAction = new QAction(NULL, "Introduction", 0, this);
834 connect(showIntroAction, SIGNAL(activated()), SLOT(showIntro())); 834 connect(showIntroAction, SIGNAL(activated()), SLOT(showIntro()));
835 QAction *showAboutAction = new QAction(NULL, "About", 0, this); 835 QAction *showAboutAction = new QAction(NULL, "About", 0, this);
836 connect(showAboutAction, SIGNAL(activated()), SLOT(showAbout())); 836 connect(showAboutAction, SIGNAL(activated()), SLOT(showAbout()));
837 837
838 // init tool bar 838 // init tool bar
839 backAction->addTo(toolBar); 839 backAction->addTo(toolBar);
840 toolBar->addSeparator(); 840 toolBar->addSeparator();
841 loadAction->addTo(toolBar); 841 loadAction->addTo(toolBar);
842 saveAction->addTo(toolBar); 842 saveAction->addTo(toolBar);
843 toolBar->addSeparator(); 843 toolBar->addSeparator();
844 singleViewAction->addTo(toolBar); 844 singleViewAction->addTo(toolBar);
845 splitViewAction->addTo(toolBar); 845 splitViewAction->addTo(toolBar);
846 fullViewAction->addTo(toolBar); 846 fullViewAction->addTo(toolBar);
847 847
848 // create config menu 848 // create config menu
849 QPopupMenu* config = new QPopupMenu(this); 849 QPopupMenu* config = new QPopupMenu(this);
850 menu->insertItem("&File", config); 850 menu->insertItem("&File", config);
851 loadAction->addTo(config); 851 loadAction->addTo(config);
852 saveAction->addTo(config); 852 saveAction->addTo(config);
853 saveAsAction->addTo(config); 853 saveAsAction->addTo(config);
854 config->insertSeparator(); 854 config->insertSeparator();
855 quitAction->addTo(config); 855 quitAction->addTo(config);
856 856
857 // create options menu 857 // create options menu
858 QPopupMenu* optionMenu = new QPopupMenu(this); 858 QPopupMenu* optionMenu = new QPopupMenu(this);
859 menu->insertItem("&Option", optionMenu); 859 menu->insertItem("&Option", optionMenu);
860 showNameAction->addTo(optionMenu); 860 showNameAction->addTo(optionMenu);
861 showRangeAction->addTo(optionMenu); 861 showRangeAction->addTo(optionMenu);
862 showDataAction->addTo(optionMenu); 862 showDataAction->addTo(optionMenu);
863 optionMenu->insertSeparator(); 863 optionMenu->insertSeparator();
864 showAllAction->addTo(optionMenu); 864 showAllAction->addTo(optionMenu);
865 showDebugAction->addTo(optionMenu); 865 showDebugAction->addTo(optionMenu);
866 866
867 // create help menu 867 // create help menu
868 QPopupMenu* helpMenu = new QPopupMenu(this); 868 QPopupMenu* helpMenu = new QPopupMenu(this);
869 menu->insertSeparator(); 869 menu->insertSeparator();
870 menu->insertItem("&Help", helpMenu); 870 menu->insertItem("&Help", helpMenu);
871 showIntroAction->addTo(helpMenu); 871 showIntroAction->addTo(helpMenu);
872 showAboutAction->addTo(helpMenu); 872 showAboutAction->addTo(helpMenu);
873 873
874 connect(configList, SIGNAL(menuSelected(struct menu *)), 874 connect(configList, SIGNAL(menuSelected(struct menu *)),
875 SLOT(changeMenu(struct menu *))); 875 SLOT(changeMenu(struct menu *)));
876 connect(configList, SIGNAL(parentSelected()), 876 connect(configList, SIGNAL(parentSelected()),
877 SLOT(goBack())); 877 SLOT(goBack()));
878 connect(menuList, SIGNAL(menuSelected(struct menu *)), 878 connect(menuList, SIGNAL(menuSelected(struct menu *)),
879 SLOT(changeMenu(struct menu *))); 879 SLOT(changeMenu(struct menu *)));
880 880
881 connect(configList, SIGNAL(gotFocus(void)), 881 connect(configList, SIGNAL(gotFocus(void)),
882 SLOT(listFocusChanged(void))); 882 SLOT(listFocusChanged(void)));
@@ -1141,164 +1141,164 @@ void ConfigMainWindow::setShowAll(bool b)
1141 menuList->showAll = b; 1141 menuList->showAll = b;
1142 menuList->updateListAll(); 1142 menuList->updateListAll();
1143} 1143}
1144 1144
1145void ConfigMainWindow::setShowDebug(bool b) 1145void ConfigMainWindow::setShowDebug(bool b)
1146{ 1146{
1147 if (showDebug == b) 1147 if (showDebug == b)
1148 return; 1148 return;
1149 showDebug = b; 1149 showDebug = b;
1150} 1150}
1151 1151
1152void ConfigMainWindow::setShowName(bool b) 1152void ConfigMainWindow::setShowName(bool b)
1153{ 1153{
1154 if (configList->showName == b) 1154 if (configList->showName == b)
1155 return; 1155 return;
1156 configList->showName = b; 1156 configList->showName = b;
1157 configList->reinit(); 1157 configList->reinit();
1158 menuList->showName = b; 1158 menuList->showName = b;
1159 menuList->reinit(); 1159 menuList->reinit();
1160} 1160}
1161 1161
1162void ConfigMainWindow::setShowRange(bool b) 1162void ConfigMainWindow::setShowRange(bool b)
1163{ 1163{
1164 if (configList->showRange == b) 1164 if (configList->showRange == b)
1165 return; 1165 return;
1166 configList->showRange = b; 1166 configList->showRange = b;
1167 configList->reinit(); 1167 configList->reinit();
1168 menuList->showRange = b; 1168 menuList->showRange = b;
1169 menuList->reinit(); 1169 menuList->reinit();
1170} 1170}
1171 1171
1172void ConfigMainWindow::setShowData(bool b) 1172void ConfigMainWindow::setShowData(bool b)
1173{ 1173{
1174 if (configList->showData == b) 1174 if (configList->showData == b)
1175 return; 1175 return;
1176 configList->showData = b; 1176 configList->showData = b;
1177 configList->reinit(); 1177 configList->reinit();
1178 menuList->showData = b; 1178 menuList->showData = b;
1179 menuList->reinit(); 1179 menuList->reinit();
1180} 1180}
1181 1181
1182/* 1182/*
1183 * ask for saving configuration before quitting 1183 * ask for saving configuration before quitting
1184 * TODO ask only when something changed 1184 * TODO ask only when something changed
1185 */ 1185 */
1186void ConfigMainWindow::closeEvent(QCloseEvent* e) 1186void ConfigMainWindow::closeEvent(QCloseEvent* e)
1187{ 1187{
1188 if (!sym_change_count) { 1188 if (!sym_change_count) {
1189 e->accept(); 1189 e->accept();
1190 return; 1190 return;
1191 } 1191 }
1192 QMessageBox mb("qconf", "Save configuration?", QMessageBox::Warning, 1192 QMessageBox mb("qconf", "Save configuration?", QMessageBox::Warning,
1193 QMessageBox::Yes | QMessageBox::Default, QMessageBox::No, QMessageBox::Cancel | QMessageBox::Escape); 1193 QMessageBox::Yes | QMessageBox::Default, QMessageBox::No, QMessageBox::Cancel | QMessageBox::Escape);
1194 mb.setButtonText(QMessageBox::Yes, "&Save Changes"); 1194 mb.setButtonText(QMessageBox::Yes, "&Save Changes");
1195 mb.setButtonText(QMessageBox::No, "&Discard Changes"); 1195 mb.setButtonText(QMessageBox::No, "&Discard Changes");
1196 mb.setButtonText(QMessageBox::Cancel, "Cancel Exit"); 1196 mb.setButtonText(QMessageBox::Cancel, "Cancel Exit");
1197 switch (mb.exec()) { 1197 switch (mb.exec()) {
1198 case QMessageBox::Yes: 1198 case QMessageBox::Yes:
1199 conf_write(NULL); 1199 conf_write(NULL);
1200 case QMessageBox::No: 1200 case QMessageBox::No:
1201 e->accept(); 1201 e->accept();
1202 break; 1202 break;
1203 case QMessageBox::Cancel: 1203 case QMessageBox::Cancel:
1204 e->ignore(); 1204 e->ignore();
1205 break; 1205 break;
1206 } 1206 }
1207} 1207}
1208 1208
1209void ConfigMainWindow::showIntro(void) 1209void ConfigMainWindow::showIntro(void)
1210{ 1210{
1211 static char str[] = "Welcome to the qconf graphical kernel configuration tool for Linux.\n\n" 1211 static char str[] = "Welcome to the qconf graphical kernel configuration tool for Linux.\n\n"
1212 "For each option, a blank box indicates the feature is disabled, a check\n" 1212 "For each option, a blank box indicates the feature is disabled, a check\n"
1213 "indicates it is enabled, and a dot indicates that it is to be compiled\n" 1213 "indicates it is enabled, and a dot indicates that it is to be compiled\n"
1214 "as a module. Clicking on the box will cycle through the three states.\n\n" 1214 "as a module. Clicking on the box will cycle through the three states.\n\n"
1215 "If you do not see an option (e.g., a device driver) that you believe\n" 1215 "If you do not see an option (e.g., a device driver) that you believe\n"
1216 "should be present, try turning on Show All Options under the Options menu.\n" 1216 "should be present, try turning on Show All Options under the Options menu.\n"
1217 "Although there is no cross reference yet to help you figure out what other\n" 1217 "Although there is no cross reference yet to help you figure out what other\n"
1218 "options must be enabled to support the option you are interested in, you can\n" 1218 "options must be enabled to support the option you are interested in, you can\n"
1219 "still view the help of a grayed-out option.\n\n" 1219 "still view the help of a grayed-out option.\n\n"
1220 "Toggling Show Debug Info under the Options menu will show the dependencies,\n" 1220 "Toggling Show Debug Info under the Options menu will show the dependencies,\n"
1221 "which you can then match by examining other options.\n\n"; 1221 "which you can then match by examining other options.\n\n";
1222 1222
1223 QMessageBox::information(this, "qconf", str); 1223 QMessageBox::information(this, "qconf", str);
1224} 1224}
1225 1225
1226void ConfigMainWindow::showAbout(void) 1226void ConfigMainWindow::showAbout(void)
1227{ 1227{
1228 static char str[] = "qconf is Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>.\n\n" 1228 static char str[] = "qconf is Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>.\n\n"
1229 "Bug reports and feature request can also be entered at http://bugzilla.kernel.org/\n"; 1229 "Bug reports and feature request can also be entered at http://bugzilla.kernel.org/\n";
1230 1230
1231 QMessageBox::information(this, "qconf", str); 1231 QMessageBox::information(this, "qconf", str);
1232} 1232}
1233 1233
1234void fixup_rootmenu(struct menu *menu) 1234void fixup_rootmenu(struct menu *menu)
1235{ 1235{
1236 struct menu *child; 1236 struct menu *child;
1237 static int menu_cnt = 0; 1237 static int menu_cnt = 0;
1238 1238
1239 menu->flags |= MENU_ROOT; 1239 menu->flags |= MENU_ROOT;
1240 for (child = menu->list; child; child = child->next) { 1240 for (child = menu->list; child; child = child->next) {
1241 if (child->prompt && child->prompt->type == P_MENU) { 1241 if (child->prompt && child->prompt->type == P_MENU) {
1242 menu_cnt++; 1242 menu_cnt++;
1243 fixup_rootmenu(child); 1243 fixup_rootmenu(child);
1244 menu_cnt--; 1244 menu_cnt--;
1245 } else if (!menu_cnt) 1245 } else if (!menu_cnt)
1246 fixup_rootmenu(child); 1246 fixup_rootmenu(child);
1247 } 1247 }
1248} 1248}
1249 1249
1250static const char *progname; 1250static const char *progname;
1251 1251
1252static void usage(void) 1252static void usage(void)
1253{ 1253{
1254 printf("%s <config>\n", progname); 1254 printf("%s <config>\n", progname);
1255 exit(0); 1255 exit(0);
1256} 1256}
1257 1257
1258int main(int ac, char** av) 1258int main(int ac, char** av)
1259{ 1259{
1260 ConfigMainWindow* v; 1260 ConfigMainWindow* v;
1261 const char *name; 1261 const char *name;
1262 1262
1263#ifndef LKC_DIRECT_LINK 1263#ifndef LKC_DIRECT_LINK
1264 kconfig_load(); 1264 kconfig_load();
1265#endif 1265#endif
1266 1266
1267 progname = av[0]; 1267 progname = av[0];
1268 configApp = new QApplication(ac, av); 1268 configApp = new QApplication(ac, av);
1269#if QT_VERSION >= 300 1269#if QT_VERSION >= 0x030000
1270 configSettings = new QSettings; 1270 configSettings = new QSettings;
1271#endif 1271#endif
1272 if (ac > 1 && av[1][0] == '-') { 1272 if (ac > 1 && av[1][0] == '-') {
1273 switch (av[1][1]) { 1273 switch (av[1][1]) {
1274 case 'h': 1274 case 'h':
1275 case '?': 1275 case '?':
1276 usage(); 1276 usage();
1277 } 1277 }
1278 name = av[2]; 1278 name = av[2];
1279 } else 1279 } else
1280 name = av[1]; 1280 name = av[1];
1281 if (!name) 1281 if (!name)
1282 usage(); 1282 usage();
1283 1283
1284 conf_parse(name); 1284 conf_parse(name);
1285 fixup_rootmenu(&rootmenu); 1285 fixup_rootmenu(&rootmenu);
1286 conf_read(NULL); 1286 conf_read(NULL);
1287 //zconfdump(stdout); 1287 //zconfdump(stdout);
1288 1288
1289 v = new ConfigMainWindow(); 1289 v = new ConfigMainWindow();
1290 1290
1291 //zconfdump(stdout); 1291 //zconfdump(stdout);
1292 v->show(); 1292 v->show();
1293 configApp->connect(configApp, SIGNAL(lastWindowClosed()), SLOT(quit())); 1293 configApp->connect(configApp, SIGNAL(lastWindowClosed()), SLOT(quit()));
1294 configApp->exec(); 1294 configApp->exec();
1295 1295
1296#if QT_VERSION >= 300 1296#if QT_VERSION >= 0x030000
1297 configSettings->writeEntry("/kconfig/qconf/window x", v->pos().x()); 1297 configSettings->writeEntry("/kconfig/qconf/window x", v->pos().x());
1298 configSettings->writeEntry("/kconfig/qconf/window y", v->pos().y()); 1298 configSettings->writeEntry("/kconfig/qconf/window y", v->pos().y());
1299 configSettings->writeEntry("/kconfig/qconf/window width", v->size().width()); 1299 configSettings->writeEntry("/kconfig/qconf/window width", v->size().width());
1300 configSettings->writeEntry("/kconfig/qconf/window height", v->size().height()); 1300 configSettings->writeEntry("/kconfig/qconf/window height", v->size().height());
1301 delete configSettings; 1301 delete configSettings;
1302#endif 1302#endif
1303 return 0; 1303 return 0;
1304} 1304}
diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h
index c548884..dee5254 100644
--- a/scripts/kconfig/qconf.h
+++ b/scripts/kconfig/qconf.h
@@ -16,223 +16,223 @@ class ConfigView : public QVBox {
16public: 16public:
17 ConfigView(QWidget* parent, ConfigMainWindow* cview); 17 ConfigView(QWidget* parent, ConfigMainWindow* cview);
18 ~ConfigView(void); 18 ~ConfigView(void);
19 static void updateList(ConfigItem* item); 19 static void updateList(ConfigItem* item);
20 static void updateListAll(void); 20 static void updateListAll(void);
21 21
22public: 22public:
23 ConfigList* list; 23 ConfigList* list;
24 ConfigLineEdit* lineEdit; 24 ConfigLineEdit* lineEdit;
25 25
26 static ConfigView* viewList; 26 static ConfigView* viewList;
27 ConfigView* nextView; 27 ConfigView* nextView;
28}; 28};
29 29
30enum colIdx { 30enum colIdx {
31 promptColIdx, nameColIdx, noColIdx, modColIdx, yesColIdx, dataColIdx, colNr 31 promptColIdx, nameColIdx, noColIdx, modColIdx, yesColIdx, dataColIdx, colNr
32}; 32};
33enum listMode { 33enum listMode {
34 singleMode, menuMode, symbolMode, fullMode 34 singleMode, menuMode, symbolMode, fullMode
35}; 35};
36 36
37class ConfigList : public QListView { 37class ConfigList : public QListView {
38 Q_OBJECT 38 Q_OBJECT
39 typedef class QListView Parent; 39 typedef class QListView Parent;
40public: 40public:
41 ConfigList(ConfigView* p, ConfigMainWindow* cview); 41 ConfigList(ConfigView* p, ConfigMainWindow* cview);
42 void reinit(void); 42 void reinit(void);
43 ConfigView* parent(void) const 43 ConfigView* parent(void) const
44 { 44 {
45 return (ConfigView*)Parent::parent(); 45 return (ConfigView*)Parent::parent();
46 } 46 }
47 47
48protected: 48protected:
49 ConfigMainWindow* cview; 49 ConfigMainWindow* cview;
50 50
51 void keyPressEvent(QKeyEvent *e); 51 void keyPressEvent(QKeyEvent *e);
52 void contentsMousePressEvent(QMouseEvent *e); 52 void contentsMousePressEvent(QMouseEvent *e);
53 void contentsMouseReleaseEvent(QMouseEvent *e); 53 void contentsMouseReleaseEvent(QMouseEvent *e);
54 void contentsMouseMoveEvent(QMouseEvent *e); 54 void contentsMouseMoveEvent(QMouseEvent *e);
55 void contentsMouseDoubleClickEvent(QMouseEvent *e); 55 void contentsMouseDoubleClickEvent(QMouseEvent *e);
56 void focusInEvent(QFocusEvent *e); 56 void focusInEvent(QFocusEvent *e);
57public slots: 57public slots:
58 void setRootMenu(struct menu *menu); 58 void setRootMenu(struct menu *menu);
59 59
60 void updateList(ConfigItem *item); 60 void updateList(ConfigItem *item);
61 void setValue(ConfigItem* item, tristate val); 61 void setValue(ConfigItem* item, tristate val);
62 void changeValue(ConfigItem* item); 62 void changeValue(ConfigItem* item);
63 void updateSelection(void); 63 void updateSelection(void);
64signals: 64signals:
65 void menuSelected(struct menu *menu); 65 void menuSelected(struct menu *menu);
66 void parentSelected(void); 66 void parentSelected(void);
67 void gotFocus(void); 67 void gotFocus(void);
68 68
69public: 69public:
70 void updateListAll(void) 70 void updateListAll(void)
71 { 71 {
72 updateAll = true; 72 updateAll = true;
73 updateList(NULL); 73 updateList(NULL);
74 updateAll = false; 74 updateAll = false;
75 } 75 }
76 ConfigList* listView() 76 ConfigList* listView()
77 { 77 {
78 return this; 78 return this;
79 } 79 }
80 ConfigItem* firstChild() const 80 ConfigItem* firstChild() const
81 { 81 {
82 return (ConfigItem *)Parent::firstChild(); 82 return (ConfigItem *)Parent::firstChild();
83 } 83 }
84 int mapIdx(colIdx idx) 84 int mapIdx(colIdx idx)
85 { 85 {
86 return colMap[idx]; 86 return colMap[idx];
87 } 87 }
88 void addColumn(colIdx idx, const QString& label) 88 void addColumn(colIdx idx, const QString& label)
89 { 89 {
90 colMap[idx] = Parent::addColumn(label); 90 colMap[idx] = Parent::addColumn(label);
91 colRevMap[colMap[idx]] = idx; 91 colRevMap[colMap[idx]] = idx;
92 } 92 }
93 void removeColumn(colIdx idx) 93 void removeColumn(colIdx idx)
94 { 94 {
95 int col = colMap[idx]; 95 int col = colMap[idx];
96 if (col >= 0) { 96 if (col >= 0) {
97 Parent::removeColumn(col); 97 Parent::removeColumn(col);
98 colRevMap[col] = colMap[idx] = -1; 98 colRevMap[col] = colMap[idx] = -1;
99 } 99 }
100 } 100 }
101 void setAllOpen(bool open); 101 void setAllOpen(bool open);
102 void setParentMenu(void); 102 void setParentMenu(void);
103 103
104 template <class P> 104 template <class P>
105 void ConfigList::updateMenuList(P*, struct menu*); 105 void ConfigList::updateMenuList(P*, struct menu*);
106 106
107 bool updateAll; 107 bool updateAll;
108 108
109 QPixmap symbolYesPix, symbolModPix, symbolNoPix; 109 QPixmap symbolYesPix, symbolModPix, symbolNoPix;
110 QPixmap choiceYesPix, choiceNoPix; 110 QPixmap choiceYesPix, choiceNoPix;
111 QPixmap menuPix, menuInvPix, menuBackPix, voidPix; 111 QPixmap menuPix, menuInvPix, menuBackPix, voidPix;
112 112
113 bool showAll, showName, showRange, showData; 113 bool showAll, showName, showRange, showData;
114 enum listMode mode; 114 enum listMode mode;
115 struct menu *rootEntry; 115 struct menu *rootEntry;
116 QColorGroup disabledColorGroup; 116 QColorGroup disabledColorGroup;
117 QColorGroup inactivedColorGroup; 117 QColorGroup inactivedColorGroup;
118 118
119private: 119private:
120 int colMap[colNr]; 120 int colMap[colNr];
121 int colRevMap[colNr]; 121 int colRevMap[colNr];
122}; 122};
123 123
124class ConfigItem : public QListViewItem { 124class ConfigItem : public QListViewItem {
125 typedef class QListViewItem Parent; 125 typedef class QListViewItem Parent;
126public: 126public:
127 ConfigItem(QListView *parent, ConfigItem *after, struct menu *m, bool v) 127 ConfigItem(QListView *parent, ConfigItem *after, struct menu *m, bool v)
128 : Parent(parent, after), menu(m), visible(v), goParent(false) 128 : Parent(parent, after), menu(m), visible(v), goParent(false)
129 { 129 {
130 init(); 130 init();
131 } 131 }
132 ConfigItem(ConfigItem *parent, ConfigItem *after, struct menu *m, bool v) 132 ConfigItem(ConfigItem *parent, ConfigItem *after, struct menu *m, bool v)
133 : Parent(parent, after), menu(m), visible(v), goParent(false) 133 : Parent(parent, after), menu(m), visible(v), goParent(false)
134 { 134 {
135 init(); 135 init();
136 } 136 }
137 ConfigItem(QListView *parent, ConfigItem *after, bool v) 137 ConfigItem(QListView *parent, ConfigItem *after, bool v)
138 : Parent(parent, after), menu(0), visible(v), goParent(true) 138 : Parent(parent, after), menu(0), visible(v), goParent(true)
139 { 139 {
140 init(); 140 init();
141 } 141 }
142 ~ConfigItem(void); 142 ~ConfigItem(void);
143 void init(void); 143 void init(void);
144#if QT_VERSION >= 300 144#if QT_VERSION >= 0x030000
145 void okRename(int col); 145 void okRename(int col);
146#endif 146#endif
147 void updateMenu(void); 147 void updateMenu(void);
148 void testUpdateMenu(bool v); 148 void testUpdateMenu(bool v);
149 ConfigList* listView() const 149 ConfigList* listView() const
150 { 150 {
151 return (ConfigList*)Parent::listView(); 151 return (ConfigList*)Parent::listView();
152 } 152 }
153 ConfigItem* firstChild() const 153 ConfigItem* firstChild() const
154 { 154 {
155 return (ConfigItem *)Parent::firstChild(); 155 return (ConfigItem *)Parent::firstChild();
156 } 156 }
157 ConfigItem* nextSibling() const 157 ConfigItem* nextSibling() const
158 { 158 {
159 return (ConfigItem *)Parent::nextSibling(); 159 return (ConfigItem *)Parent::nextSibling();
160 } 160 }
161 void setText(colIdx idx, const QString& text) 161 void setText(colIdx idx, const QString& text)
162 { 162 {
163 Parent::setText(listView()->mapIdx(idx), text); 163 Parent::setText(listView()->mapIdx(idx), text);
164 } 164 }
165 QString text(colIdx idx) const 165 QString text(colIdx idx) const
166 { 166 {
167 return Parent::text(listView()->mapIdx(idx)); 167 return Parent::text(listView()->mapIdx(idx));
168 } 168 }
169 void setPixmap(colIdx idx, const QPixmap& pm) 169 void setPixmap(colIdx idx, const QPixmap& pm)
170 { 170 {
171 Parent::setPixmap(listView()->mapIdx(idx), pm); 171 Parent::setPixmap(listView()->mapIdx(idx), pm);
172 } 172 }
173 const QPixmap* pixmap(colIdx idx) const 173 const QPixmap* pixmap(colIdx idx) const
174 { 174 {
175 return Parent::pixmap(listView()->mapIdx(idx)); 175 return Parent::pixmap(listView()->mapIdx(idx));
176 } 176 }
177 void paintCell(QPainter* p, const QColorGroup& cg, int column, int width, int align); 177 void paintCell(QPainter* p, const QColorGroup& cg, int column, int width, int align);
178 178
179 ConfigItem* nextItem; 179 ConfigItem* nextItem;
180 struct menu *menu; 180 struct menu *menu;
181 bool visible; 181 bool visible;
182 bool goParent; 182 bool goParent;
183}; 183};
184 184
185class ConfigLineEdit : public QLineEdit { 185class ConfigLineEdit : public QLineEdit {
186 Q_OBJECT 186 Q_OBJECT
187 typedef class QLineEdit Parent; 187 typedef class QLineEdit Parent;
188public: 188public:
189 ConfigLineEdit(ConfigView* parent) 189 ConfigLineEdit(ConfigView* parent)
190 : Parent(parent) 190 : Parent(parent)
191 { } 191 { }
192 ConfigView* parent(void) const 192 ConfigView* parent(void) const
193 { 193 {
194 return (ConfigView*)Parent::parent(); 194 return (ConfigView*)Parent::parent();
195 } 195 }
196 void show(ConfigItem *i); 196 void show(ConfigItem *i);
197 void keyPressEvent(QKeyEvent *e); 197 void keyPressEvent(QKeyEvent *e);
198 198
199public: 199public:
200 ConfigItem *item; 200 ConfigItem *item;
201}; 201};
202 202
203class ConfigMainWindow : public QMainWindow { 203class ConfigMainWindow : public QMainWindow {
204 Q_OBJECT 204 Q_OBJECT
205public: 205public:
206 ConfigMainWindow(void); 206 ConfigMainWindow(void);
207public slots: 207public slots:
208 void setHelp(QListViewItem* item); 208 void setHelp(QListViewItem* item);
209 void changeMenu(struct menu *); 209 void changeMenu(struct menu *);
210 void listFocusChanged(void); 210 void listFocusChanged(void);
211 void goBack(void); 211 void goBack(void);
212 void loadConfig(void); 212 void loadConfig(void);
213 void saveConfig(void); 213 void saveConfig(void);
214 void saveConfigAs(void); 214 void saveConfigAs(void);
215 void showSingleView(void); 215 void showSingleView(void);
216 void showSplitView(void); 216 void showSplitView(void);
217 void showFullView(void); 217 void showFullView(void);
218 void setShowAll(bool); 218 void setShowAll(bool);
219 void setShowDebug(bool); 219 void setShowDebug(bool);
220 void setShowRange(bool); 220 void setShowRange(bool);
221 void setShowName(bool); 221 void setShowName(bool);
222 void setShowData(bool); 222 void setShowData(bool);
223 void showIntro(void); 223 void showIntro(void);
224 void showAbout(void); 224 void showAbout(void);
225 225
226protected: 226protected:
227 void closeEvent(QCloseEvent *e); 227 void closeEvent(QCloseEvent *e);
228 228
229 ConfigView *menuView; 229 ConfigView *menuView;
230 ConfigList *menuList; 230 ConfigList *menuList;
231 ConfigView *configView; 231 ConfigView *configView;
232 ConfigList *configList; 232 ConfigList *configList;
233 QTextView *helpText; 233 QTextView *helpText;
234 QToolBar *toolBar; 234 QToolBar *toolBar;
235 QAction *backAction; 235 QAction *backAction;
236 236
237 bool showDebug; 237 bool showDebug;
238}; 238};