summaryrefslogtreecommitdiff
path: root/libopie2/opieui
Unidiff
Diffstat (limited to 'libopie2/opieui') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opieui/big-screen/obigscreen_p.h9
-rw-r--r--libopie2/opieui/big-screen/osplitter.cpp13
-rw-r--r--libopie2/opieui/big-screen/osplitter.h15
-rw-r--r--libopie2/opieui/big-screen/owidgetstack.cpp9
-rw-r--r--libopie2/opieui/big-screen/owidgetstack.h7
-rw-r--r--libopie2/opieui/fileselector/ofiledialog.cpp2
-rw-r--r--libopie2/opieui/fileselector/ofiledialog.h7
-rw-r--r--libopie2/opieui/fileselector/ofileselector.cpp9
-rw-r--r--libopie2/opieui/fileselector/ofileselector.h19
-rw-r--r--libopie2/opieui/fileselector/ofileselector_p.h10
-rw-r--r--libopie2/opieui/fileselector/ofileview.h9
-rw-r--r--libopie2/opieui/oclickablelabel.cpp2
-rw-r--r--libopie2/opieui/oclickablelabel.h7
-rw-r--r--libopie2/opieui/odialog.cpp2
-rw-r--r--libopie2/opieui/odialog.h5
-rw-r--r--libopie2/opieui/ofontselector.cpp19
-rw-r--r--libopie2/opieui/ofontselector.h12
-rw-r--r--libopie2/opieui/oimageeffect.cpp7
-rw-r--r--libopie2/opieui/oimageeffect.h5
-rw-r--r--libopie2/opieui/olistview.cpp7
-rw-r--r--libopie2/opieui/olistview.h25
-rw-r--r--libopie2/opieui/opieui.pro3
-rw-r--r--libopie2/opieui/opixmapeffect.cpp2
-rw-r--r--libopie2/opieui/opixmapeffect.h6
-rw-r--r--libopie2/opieui/opixmapprovider.cpp2
-rw-r--r--libopie2/opieui/opixmapprovider.h8
-rw-r--r--libopie2/opieui/opopupmenu.cpp3
-rw-r--r--libopie2/opieui/opopupmenu.h5
-rw-r--r--libopie2/opieui/oselector.cpp18
-rw-r--r--libopie2/opieui/oselector.h5
-rw-r--r--libopie2/opieui/oseparator.cpp2
-rw-r--r--libopie2/opieui/oseparator.h5
-rw-r--r--libopie2/opieui/otabbar.cpp2
-rw-r--r--libopie2/opieui/otabbar.h7
-rw-r--r--libopie2/opieui/otabinfo.h7
-rw-r--r--libopie2/opieui/otabwidget.cpp2
-rw-r--r--libopie2/opieui/otabwidget.h8
-rw-r--r--libopie2/opieui/otaskbarapplet.cpp52
-rw-r--r--libopie2/opieui/otaskbarapplet.h49
-rw-r--r--libopie2/opieui/otimepicker.cpp15
-rw-r--r--libopie2/opieui/otimepicker.h19
-rw-r--r--libopie2/opieui/otimepickerbase.ui38
-rw-r--r--libopie2/opieui/oversatileview.cpp43
-rw-r--r--libopie2/opieui/oversatileview.h83
-rw-r--r--libopie2/opieui/oversatileviewitem.cpp2
-rw-r--r--libopie2/opieui/oversatileviewitem.h5
-rw-r--r--libopie2/opieui/owait.cpp2
-rw-r--r--libopie2/opieui/owait.h6
48 files changed, 378 insertions, 221 deletions
diff --git a/libopie2/opieui/big-screen/obigscreen_p.h b/libopie2/opieui/big-screen/obigscreen_p.h
index db8fc83..a85a56c 100644
--- a/libopie2/opieui/big-screen/obigscreen_p.h
+++ b/libopie2/opieui/big-screen/obigscreen_p.h
@@ -1,28 +1,31 @@
1#ifndef OPIE_BIG_SCREEN_PRIVATE 1#ifndef OPIE_BIG_SCREEN_PRIVATE
2#define OPIE_BIG_SCREEN_PRIVATE 2#define OPIE_BIG_SCREEN_PRIVATE
3 3
4/* QT */ 4/* QT */
5#include <qstring.h> 5#include <qstring.h>
6 6
7class QWidget; 7class QWidget;
8 8
9namespace Opie 9namespace Opie {
10{ 10namespace Ui {
11namespace Private{
11 12
12struct OSplitterContainer 13struct OSplitterContainer
13{ 14{
14 bool operator==( const OSplitterContainer& o) const 15 bool operator==( const OSplitterContainer& o) const
15 { 16 {
16 if (widget != o.widget ) return false; 17 if (widget != o.widget ) return false;
17 if (icon != o.icon ) return false; 18 if (icon != o.icon ) return false;
18 if (name != o.name ) return false; 19 if (name != o.name ) return false;
19 return true; 20 return true;
20 } 21 }
21 QWidget* widget; 22 QWidget* widget;
22 QString icon; 23 QString icon;
23 QString name; 24 QString name;
24}; 25};
25 26
26}; 27}
28}
29}
27 30
28#endif 31#endif
diff --git a/libopie2/opieui/big-screen/osplitter.cpp b/libopie2/opieui/big-screen/osplitter.cpp
index 89f3793..bcfd3a6 100644
--- a/libopie2/opieui/big-screen/osplitter.cpp
+++ b/libopie2/opieui/big-screen/osplitter.cpp
@@ -14,49 +14,50 @@
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 16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
17..}^=.=       =       ; Library General Public License for more 17..}^=.=       =       ; Library General Public License for more
18++=   -.     .`     .: details. 18++=   -.     .`     .: details.
19 :     =  ...= . :.=- 19 :     =  ...= . :.=-
20 -.   .:....=;==+<; You should have received a copy of the GNU 20 -.   .:....=;==+<; You should have received a copy of the GNU
21  -_. . .   )=.  = Library General Public License along with 21  -_. . .   )=.  = Library General Public License along with
22    --        :-=` this library; see the file COPYING.LIB. 22    --        :-=` this library; see the file COPYING.LIB.
23 If not, write to the Free Software Foundation, 23 If not, write to the Free Software Foundation,
24 Inc., 59 Temple Place - Suite 330, 24 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 25 Boston, MA 02111-1307, USA.
26 26
27*/ 27*/
28 28
29#include "osplitter.h" 29#include "osplitter.h"
30 30
31/* OPIE */ 31/* OPIE */
32#include <opie2/otabwidget.h> 32#include <opie2/otabwidget.h>
33 33
34/* QT */ 34/* QT */
35#include <qvaluelist.h> 35#include <qvaluelist.h>
36#include <qvbox.h> 36#include <qvbox.h>
37 37
38using namespace Opie; 38using namespace Opie::Ui;
39using namespace Opie::Ui::Private;
39 40
40/** 41/**
41 * 42 *
42 * This is the constructor of OSplitter 43 * This is the constructor of OSplitter
43 * You might want to call setSizeChange to tell 44 * You might want to call setSizeChange to tell
44 * OSplitter to change its layout when a specefic 45 * OSplitter to change its layout when a specefic
45 * mark was crossed. OSplitter sets a default value. 46 * mark was crossed. OSplitter sets a default value.
46 * 47 *
47 * You cann add widget with addWidget to the OSplitter. 48 * You cann add widget with addWidget to the OSplitter.
48 * OSplitter supports also grouping of Splitters where they 49 * OSplitter supports also grouping of Splitters where they
49 * can share one OTabBar in small screen mode. This can be used 50 * can share one OTabBar in small screen mode. This can be used
50 * for email clients like vies but see the example. 51 * for email clients like vies but see the example.
51 * 52 *
52 * @param orient The orientation wether to layout horizontal or vertical 53 * @param orient The orientation wether to layout horizontal or vertical
53 * @param parent The parent of this widget 54 * @param parent The parent of this widget
54 * @param name The name passed on to QObject 55 * @param name The name passed on to QObject
55 * @param fl Additional widgets flags passed to QWidget 56 * @param fl Additional widgets flags passed to QWidget
56 * 57 *
57 * @short single c'tor of the OSplitter 58 * @short single c'tor of the OSplitter
58 */ 59 */
59OSplitter::OSplitter( Orientation orient, QWidget* parent, const char* name, WFlags fl ) 60OSplitter::OSplitter( Orientation orient, QWidget* parent, const char* name, WFlags fl )
60 : QFrame( parent, name, fl ) 61 : QFrame( parent, name, fl )
61{ 62{
62 m_orient = orient; 63 m_orient = orient;
@@ -147,94 +148,94 @@ QString OSplitter::label()const
147void OSplitter::setSizeChange( int width_height ) 148void OSplitter::setSizeChange( int width_height )
148{ 149{
149 m_size_policy = width_height; 150 m_size_policy = width_height;
150 QSize sz(width(), height() ); 151 QSize sz(width(), height() );
151 QResizeEvent ev(sz, sz ); 152 QResizeEvent ev(sz, sz );
152 resizeEvent(&ev); 153 resizeEvent(&ev);
153} 154}
154 155
155/** 156/**
156 * This functions allows to add another OSplitter and to share 157 * This functions allows to add another OSplitter and to share
157 * the OTabBar in small screen mode. The ownerships gets transfered. 158 * the OTabBar in small screen mode. The ownerships gets transfered.
158 * OSplitters are always added after normal widget items 159 * OSplitters are always added after normal widget items
159 */ 160 */
160void OSplitter::addWidget( OSplitter* split ) 161void OSplitter::addWidget( OSplitter* split )
161{ 162{
162 m_splitter.append( split ); 163 m_splitter.append( split );
163 164
164 /* 165 /*
165 * set tab widget 166 * set tab widget
166 */ 167 */
167 if (m_tabWidget ) 168 if (m_tabWidget )
168 setTabWidget( m_parentTab ); 169 setTabWidget( m_parentTab );
169 else 170 else
170 { 171 {
171 Opie::OSplitterContainer con; 172 OSplitterContainer con;
172 con.widget =split; 173 con.widget =split;
173 addToBox( con ); 174 addToBox( con );
174 } 175 }
175} 176}
176 177
177/* 178/*
178 * If in a tab it should be removed 179 * If in a tab it should be removed
179 * and if in a hbox the reparent kills it too 180 * and if in a hbox the reparent kills it too
180 */ 181 */
181/** 182/**
182 * This removes the splitter again. You currently need to call this 183 * This removes the splitter again. You currently need to call this
183 * before you delete or otherwise you can get mem corruption 184 * before you delete or otherwise you can get mem corruption
184 * or other weird behaviour. 185 * or other weird behaviour.
185 * Owner ship gets transfered back to you it's current parent 186 * Owner ship gets transfered back to you it's current parent
186 * is 0 187 * is 0
187 */ 188 */
188void OSplitter::removeWidget( OSplitter* split) 189void OSplitter::removeWidget( OSplitter* split)
189{ 190{
190 split->setTabWidget( 0 ); 191 split->setTabWidget( 0 );
191 split->reparent( 0, 0, QPoint(0, 0) ); 192 split->reparent( 0, 0, QPoint(0, 0) );
192} 193}
193 194
194/** 195/**
195 * Adds a widget to the Splitter. The widgets gets inserted 196 * Adds a widget to the Splitter. The widgets gets inserted
196 * at the end of either the Box or TabWidget. 197 * at the end of either the Box or TabWidget.
197 * Ownership gets transfered and the widgets gets reparented. 198 * Ownership gets transfered and the widgets gets reparented.
198 * Note: icon and label is only available on small screensizes 199 * Note: icon and label is only available on small screensizes
199 * if size is smaller than the mark 200 * if size is smaller than the mark
200 * Warning: No null checking of the widget is done. Only on debug 201 * Warning: No null checking of the widget is done. Only on debug
201 * a message will be outputtet 202 * a message will be outputtet
202 * 203 *
203 * @param wid The widget which will be added 204 * @param wid The widget which will be added
204 * @param icon The icon of the possible Tab 205 * @param icon The icon of the possible Tab
205 * @param label The label of the possible Tab 206 * @param label The label of the possible Tab
206 */ 207 */
207void OSplitter::addWidget( QWidget* wid, const QString& icon, const QString& label ) 208void OSplitter::addWidget( QWidget* wid, const QString& icon, const QString& label )
208{ 209{
209#ifdef DEBUG 210#ifdef DEBUG
210 if (!wid ) 211 if (!wid )
211 { 212 {
212 qWarning("Widget is not valid!"); 213 qWarning("Widget is not valid!");
213 return; 214 return;
214 } 215 }
215#endif 216#endif
216 Opie::OSplitterContainer cont; 217 OSplitterContainer cont;
217 cont.widget = wid; 218 cont.widget = wid;
218 cont.icon =icon; 219 cont.icon =icon;
219 cont.name = label; 220 cont.name = label;
220 221
221 m_container.append( cont ); 222 m_container.append( cont );
222 223
223 /* 224 /*
224 * 225 *
225 */ 226 */
226 if (!m_splitter.isEmpty() && (m_tabWidget || m_parentTab ) ) 227 if (!m_splitter.isEmpty() && (m_tabWidget || m_parentTab ) )
227 setTabWidget( m_parentTab ); 228 setTabWidget( m_parentTab );
228 else 229 else
229 { 230 {
230 if (m_hbox ) 231 if (m_hbox )
231 addToBox( cont ); 232 addToBox( cont );
232 else 233 else
233 addToTab( cont ); 234 addToTab( cont );
234 } 235 }
235} 236}
236 237
237 238
238/** 239/**
239 * Removes the widget from the tab widgets if necessary. 240 * Removes the widget from the tab widgets if necessary.
240 * OSplitter drops ownership of this widget and the widget 241 * OSplitter drops ownership of this widget and the widget
@@ -375,63 +376,63 @@ void OSplitter::resizeEvent( QResizeEvent* res )
375 mode = false; 376 mode = false;
376 } 377 }
377 else if ( (res->size().width() <= m_size_policy && 378 else if ( (res->size().width() <= m_size_policy &&
378 m_orient == Horizontal ) || 379 m_orient == Horizontal ) ||
379 (res->size().height() <= m_size_policy && 380 (res->size().height() <= m_size_policy &&
380 m_orient == Vertical ) ) 381 m_orient == Vertical ) )
381 { 382 {
382 changeTab(); 383 changeTab();
383 } 384 }
384 else if ( res->size().height() > m_size_policy && 385 else if ( res->size().height() > m_size_policy &&
385 m_orient == Vertical ) 386 m_orient == Vertical )
386 { 387 {
387 qWarning("Changng to vbox %s", name() ); 388 qWarning("Changng to vbox %s", name() );
388 changeVBox(); 389 changeVBox();
389 mode = false; 390 mode = false;
390 } 391 }
391 392
392 emit sizeChanged(mode, m_orient ); 393 emit sizeChanged(mode, m_orient );
393} 394}
394 395
395/* 396/*
396 * Adds a container to a tab either the parent tab 397 * Adds a container to a tab either the parent tab
397 * or our own 398 * or our own
398 */ 399 */
399void OSplitter::addToTab( const Opie::OSplitterContainer& con ) 400void OSplitter::addToTab( const Opie::Ui::Private::OSplitterContainer& con )
400{ 401{
401 QWidget *wid = con.widget; 402 QWidget *wid = con.widget;
402 // not needed widgetstack will reparent as well wid.reparent(m_tabWidget, wid->getWFlags(), QPoint(0, 0) ); 403 // not needed widgetstack will reparent as well wid.reparent(m_tabWidget, wid->getWFlags(), QPoint(0, 0) );
403 if (m_parentTab ) 404 if (m_parentTab )
404 m_parentTab->addTab( wid, con.icon, con.name ); 405 m_parentTab->addTab( wid, con.icon, con.name );
405 else 406 else
406 m_tabWidget->addTab( wid, con.icon, con.name ); 407 m_tabWidget->addTab( wid, con.icon, con.name );
407} 408}
408 409
409 410
410/* 411/*
411 * adds a container to the box 412 * adds a container to the box
412 */ 413 */
413void OSplitter::addToBox( const Opie::OSplitterContainer& con ) 414void OSplitter::addToBox( const Opie::Ui::Private::OSplitterContainer& con )
414{ 415{
415 QWidget* wid = con.widget; 416 QWidget* wid = con.widget;
416 wid->reparent(m_hbox, 0, QPoint(0, 0) ); 417 wid->reparent(m_hbox, 0, QPoint(0, 0) );
417} 418}
418 419
419 420
420/* 421/*
421 * Removes a widget from the tab 422 * Removes a widget from the tab
422 */ 423 */
423void OSplitter::removeFromTab( QWidget* wid ) 424void OSplitter::removeFromTab( QWidget* wid )
424{ 425{
425 if (m_parentTab ) 426 if (m_parentTab )
426 m_parentTab->removePage( wid ); 427 m_parentTab->removePage( wid );
427 else 428 else
428 m_tabWidget->removePage( wid ); 429 m_tabWidget->removePage( wid );
429} 430}
430 431
431/* 432/*
432 * switches over to a OTabWidget layout 433 * switches over to a OTabWidget layout
433 * it is recursive 434 * it is recursive
434 */ 435 */
435void OSplitter::changeTab() 436void OSplitter::changeTab()
436{ 437{
437 /* if we're the owner of the tab widget */ 438 /* if we're the owner of the tab widget */
@@ -524,49 +525,49 @@ void OSplitter::changeVBox()
524} 525}
525 526
526/* 527/*
527 * common box code 528 * common box code
528 * first remove and add children 529 * first remove and add children
529 * the other splitters 530 * the other splitters
530 * it is recursive as well due the call to setTabWidget 531 * it is recursive as well due the call to setTabWidget
531 */ 532 */
532void OSplitter::commonChangeBox() 533void OSplitter::commonChangeBox()
533{ 534{
534 qWarning(" Name of Splitters is %s", name() ); 535 qWarning(" Name of Splitters is %s", name() );
535 536
536 for (ContainerList::Iterator it = m_container.begin(); it != m_container.end(); ++it ) 537 for (ContainerList::Iterator it = m_container.begin(); it != m_container.end(); ++it )
537 { 538 {
538 /* only if parent tab.. m_tabWidgets gets deleted and would do that as well */ 539 /* only if parent tab.. m_tabWidgets gets deleted and would do that as well */
539 if (m_parentTab ) 540 if (m_parentTab )
540 removeFromTab( (*it).widget ); 541 removeFromTab( (*it).widget );
541 qWarning("Adding to box %s", (*it).name.latin1() ); 542 qWarning("Adding to box %s", (*it).name.latin1() );
542 addToBox( (*it) ); 543 addToBox( (*it) );
543 } 544 }
544 for ( OSplitter* split = m_splitter.first(); split; split = m_splitter.next() ) 545 for ( OSplitter* split = m_splitter.first(); split; split = m_splitter.next() )
545 { 546 {
546 /* tell them the world had changed */ 547 /* tell them the world had changed */
547 split->setTabWidget( 0 ); 548 split->setTabWidget( 0 );
548 Opie::OSplitterContainer con; 549 OSplitterContainer con;
549 con.widget = split; 550 con.widget = split;
550 // con.widget = split->m_tabWidget ? static_cast<QWidget*>(split->m_tabWidget) 551 // con.widget = split->m_tabWidget ? static_cast<QWidget*>(split->m_tabWidget)
551 // : static_cast<QWidget*>(split->m_hbox); 552 // : static_cast<QWidget*>(split->m_hbox);
552 addToBox( con ); 553 addToBox( con );
553 } 554 }
554 555
555 556
556 557
557 if (m_parentTab ) 558 if (m_parentTab )
558 m_parentTab->addTab(m_hbox, iconName(), label() ); 559 m_parentTab->addTab(m_hbox, iconName(), label() );
559 else 560 else
560 { 561 {
561 qWarning(" setting Box geometry for %s", name() ); 562 qWarning(" setting Box geometry for %s", name() );
562 m_hbox->setGeometry( frameRect() ); 563 m_hbox->setGeometry( frameRect() );
563 m_hbox->show(); 564 m_hbox->show();
564 delete m_tabWidget; 565 delete m_tabWidget;
565 m_tabWidget = 0; 566 m_tabWidget = 0;
566 show(); // also show this widget 567 show(); // also show this widget
567 } 568 }
568} 569}
569 570
570/* 571/*
571 * sets the tabwidget, removes tabs, and relayouts the widget 572 * sets the tabwidget, removes tabs, and relayouts the widget
572 */ 573 */
diff --git a/libopie2/opieui/big-screen/osplitter.h b/libopie2/opieui/big-screen/osplitter.h
index 2daae7f..7b5ea53 100644
--- a/libopie2/opieui/big-screen/osplitter.h
+++ b/libopie2/opieui/big-screen/osplitter.h
@@ -2,99 +2,99 @@
2               =. This file is part of the OPIE Project 2               =. This file is part of the OPIE Project
3             .=l. Copyright (c) 2003 hOlgAr <zecke@handhelds.org> 3             .=l. Copyright (c) 2003 hOlgAr <zecke@handhelds.org>
4           .>+-= 4           .>+-=
5 _;:,     .>    :=|. This library is free software; you can 5 _;:,     .>    :=|. This library 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 Library General Public 7:`=1 )Y*s>-.--   : the terms of the GNU Library 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 library is distributed in the hope that 12    .i_,=:_.      -<s. This library 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 16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
17..}^=.=       =       ; Library General Public License for more 17..}^=.=       =       ; Library General Public License for more
18++=   -.     .`     .: details. 18++=   -.     .`     .: details.
19 :     =  ...= . :.=- 19 :     =  ...= . :.=-
20 -.   .:....=;==+<; You should have received a copy of the GNU 20 -.   .:....=;==+<; You should have received a copy of the GNU
21  -_. . .   )=.  = Library General Public License along with 21  -_. . .   )=.  = Library General Public License along with
22    --        :-=` this library; see the file COPYING.LIB. 22    --        :-=` this library; see the file COPYING.LIB.
23 If not, write to the Free Software Foundation, 23 If not, write to the Free Software Foundation,
24 Inc., 59 Temple Place - Suite 330, 24 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 25 Boston, MA 02111-1307, USA.
26 26
27*/ 27*/
28 28
29#ifndef OSPLITTER_H 29#ifndef OSPLITTER_H
30#define OSPLITTER_H 30#define OSPLITTER_H
31 31
32#include "obigscreen_p.h" 32#include "obigscreen_p.h"
33 33
34/* QT */ 34/* QT */
35#include <qframe.h> 35#include <qframe.h>
36#include <qlist.h> 36#include <qlist.h>
37#include <qstring.h> 37#include <qstring.h>
38#include <qvaluelist.h> 38#include <qvaluelist.h>
39 39
40class QHBox; 40class QHBox;
41 41
42//template class QValueList<Opie::OSplitterContainer>; 42//template class QValueList<Opie::OSplitterContainer>;
43 43
44/* 44/*
45 * TODO 45 * TODO
46 * -check API docu 46 * -check API docu
47 * -one more example 47 * -one more example
48 * -allow inserting at a position 48 * -allow inserting at a position
49 */ 49 */
50 50
51namespace Opie 51namespace Opie{
52{ 52namespace Ui {
53class OTabWidget; 53class OTabWidget;
54 54
55/** 55/**
56 * 56 *
57 * If you've widgets that could be placed side by side but you think 57 * If you've widgets that could be placed side by side but you think
58 * on small resolutions is not enough place but it would really make sense 58 * on small resolutions is not enough place but it would really make sense
59 * on bigger resolutions this class will help you. 59 * on bigger resolutions this class will help you.
60 * You can add as many widgets you want to it. Set a poliy on which width/height it 60 * You can add as many widgets you want to it. Set a poliy on which width/height it
61 * should switch the layout. 61 * should switch the layout.
62 * You can either say to place widgets vertical or horizontal. 62 * You can either say to place widgets vertical or horizontal.
63 * This class uses QHBox, QVBox and QTAbWidget internally. 63 * This class uses QHBox, QVBox and QTAbWidget internally.
64 * OSplitter takes ownership of the widgets 64 * OSplitter takes ownership of the widgets
65 * 65 *
66 * @since 1.2 66 * @since 1.2
67 * 67 *
68 * @short a small dynamically changing its layout to store two or more widgets side by side 68 * @short a small dynamically changing its layout to store two or more widgets side by side
69 * @version 0.1 69 * @version 0.1
70 * @author zecke 70 * @author zecke
71 */ 71 */
72class OSplitter : public QFrame 72class OSplitter : public QFrame
73{ 73{
74 Q_OBJECT 74 Q_OBJECT
75public: 75public:
76 typedef QValueList<Opie::OSplitterContainer> ContainerList; 76 typedef QValueList<Opie::Ui::Private::OSplitterContainer> ContainerList;
77 OSplitter( Qt::Orientation = Horizontal, QWidget *parent = 0, 77 OSplitter( Qt::Orientation = Horizontal, QWidget *parent = 0,
78 const char* name = 0, WFlags fl = 0 ); 78 const char* name = 0, WFlags fl = 0 );
79 ~OSplitter(); 79 ~OSplitter();
80 80
81 void setLabel( const QString& name ); 81 void setLabel( const QString& name );
82 void setIconName( const QString& name ); 82 void setIconName( const QString& name );
83 QString label()const; 83 QString label()const;
84 QString iconName()const; 84 QString iconName()const;
85 85
86 void setSizeChange( int width_height ); 86 void setSizeChange( int width_height );
87 87
88 void addWidget( OSplitter* splitter ); 88 void addWidget( OSplitter* splitter );
89 void addWidget( QWidget* wid, const QString& icon, const QString& label ); 89 void addWidget( QWidget* wid, const QString& icon, const QString& label );
90 void removeWidget( QWidget* ); 90 void removeWidget( QWidget* );
91 void removeWidget( OSplitter* ); 91 void removeWidget( OSplitter* );
92 92
93 void setCurrentWidget( QWidget* ); 93 void setCurrentWidget( QWidget* );
94 void setCurrentWidget( const QString& label ); 94 void setCurrentWidget( const QString& label );
95 void setCurrentWidget( int ); 95 void setCurrentWidget( int );
96 QWidget* currentWidget()const; 96 QWidget* currentWidget()const;
97 97
98 98
99signals: 99signals:
100 /** 100 /**
@@ -103,48 +103,49 @@ signals:
103 */ 103 */
104 void currentChanged( QWidget* ); 104 void currentChanged( QWidget* );
105 105
106 /** 106 /**
107 * emitted whenever a border is crossed 107 * emitted whenever a border is crossed
108 * true if in small screen mode 108 * true if in small screen mode
109 * false if in bigscreen 109 * false if in bigscreen
110 * this signal is emitted after the layout switch 110 * this signal is emitted after the layout switch
111 * @param b The layout mode 111 * @param b The layout mode
112 * @param ori The orientation 112 * @param ori The orientation
113 */ 113 */
114 void sizeChanged( bool b, Orientation ori); 114 void sizeChanged( bool b, Orientation ori);
115public: 115public:
116 // QSize sizeHint()const; 116 // QSize sizeHint()const;
117 // QSize minimumSizeHint()const; 117 // QSize minimumSizeHint()const;
118 118
119protected: 119protected:
120 void resizeEvent( QResizeEvent* ); 120 void resizeEvent( QResizeEvent* );
121 121
122private: 122private:
123 /* true if OTabMode */ 123 /* true if OTabMode */
124 bool layoutMode()const; 124 bool layoutMode()const;
125 // void reparentAll(); 125 // void reparentAll();
126 void setTabWidget( OTabWidget*); 126 void setTabWidget( OTabWidget*);
127 void addToTab( const Opie::OSplitterContainer& ); 127 void addToTab( const Opie::Ui::Private::OSplitterContainer& );
128 void addToBox( const Opie::OSplitterContainer& ); 128 void addToBox( const Opie::Ui::Private::OSplitterContainer& );
129 void removeFromTab( QWidget* ); 129 void removeFromTab( QWidget* );
130 void changeTab(); 130 void changeTab();
131 void changeHBox(); 131 void changeHBox();
132 void changeVBox(); 132 void changeVBox();
133 void commonChangeBox(); 133 void commonChangeBox();
134 QHBox *m_hbox; 134 QHBox *m_hbox;
135 OTabWidget *m_tabWidget; 135 OTabWidget *m_tabWidget;
136 OTabWidget *m_parentTab; 136 OTabWidget *m_parentTab;
137 Orientation m_orient; 137 Orientation m_orient;
138 int m_size_policy; 138 int m_size_policy;
139 139
140 ContainerList m_container; 140 ContainerList m_container;
141 QList<OSplitter> m_splitter; 141 QList<OSplitter> m_splitter;
142 142
143 QString m_icon, m_name; 143 QString m_icon, m_name;
144 144
145 struct Private; 145 struct Private;
146 Private *d; 146 Private *d;
147}; 147};
148}; 148}
149}
149 150
150#endif 151#endif
diff --git a/libopie2/opieui/big-screen/owidgetstack.cpp b/libopie2/opieui/big-screen/owidgetstack.cpp
index 57e97e3..a0a6355 100644
--- a/libopie2/opieui/big-screen/owidgetstack.cpp
+++ b/libopie2/opieui/big-screen/owidgetstack.cpp
@@ -11,53 +11,53 @@
11    .%`+i>       _;_. 11    .%`+i>       _;_.
12    .i_,=:_.      -<s. This library is distributed in the hope that 12    .i_,=:_.      -<s. This library 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 16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
17..}^=.=       =       ; Library General Public License for more 17..}^=.=       =       ; Library General Public License for more
18++=   -.     .`     .: details. 18++=   -.     .`     .: details.
19 :     =  ...= . :.=- 19 :     =  ...= . :.=-
20 -.   .:....=;==+<; You should have received a copy of the GNU 20 -.   .:....=;==+<; You should have received a copy of the GNU
21  -_. . .   )=.  = Library General Public License along with 21  -_. . .   )=.  = Library General Public License along with
22    --        :-=` this library; see the file COPYING.LIB. 22    --        :-=` this library; see the file COPYING.LIB.
23 If not, write to the Free Software Foundation, 23 If not, write to the Free Software Foundation,
24 Inc., 59 Temple Place - Suite 330, 24 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 25 Boston, MA 02111-1307, USA.
26 26
27*/ 27*/
28 28
29#include "owidgetstack.h" 29#include "owidgetstack.h"
30 30
31/* QT */ 31/* QT */
32#include <qapplication.h> 32#include <qapplication.h>
33#include <qwidgetstack.h> 33#include <qwidgetstack.h>
34 34
35namespace { 35namespace Opie {
36namespace Ui {
36 const int mode_size = 330; 37 const int mode_size = 330;
37}
38 38
39using namespace Opie; 39
40 40
41/** 41/**
42 * This is the standard widget. For simple usage see the example. Normally this widget 42 * This is the standard widget. For simple usage see the example. Normally this widget
43 * is the central widget of a QMainWindow. 43 * is the central widget of a QMainWindow.
44 * Use removeWidget before you delete a widget yourself. OWidgetStack does not 44 * Use removeWidget before you delete a widget yourself. OWidgetStack does not
45 * yet recognize removal of children. 45 * yet recognize removal of children.
46 * 46 *
47 * @param parent The parent widget. It maybe 0 but then you need to take care of deletion. 47 * @param parent The parent widget. It maybe 0 but then you need to take care of deletion.
48 * Or you use QPEApplication::showMainWidget(). 48 * Or you use QPEApplication::showMainWidget().
49 * @param name Name will be passed on to QObject 49 * @param name Name will be passed on to QObject
50 * @param fl Additional window flags passed to QFrame. see @Qt::WFlags 50 * @param fl Additional window flags passed to QFrame. see @Qt::WFlags
51 */ 51 */
52OWidgetStack::OWidgetStack( QWidget* parent, const char* name, WFlags fl) 52OWidgetStack::OWidgetStack( QWidget* parent, const char* name, WFlags fl)
53 : QFrame( parent, name, fl ) 53 : QFrame( parent, name, fl )
54{ 54{
55 m_last = m_mWidget = 0; 55 m_last = m_mWidget = 0;
56 m_forced = false; 56 m_forced = false;
57 57
58 QApplication::desktop()->installEventFilter( this ); 58 QApplication::desktop()->installEventFilter( this );
59 setFontPropagation ( AllChildren ); 59 setFontPropagation ( AllChildren );
60 setPalettePropagation( AllChildren ); 60 setPalettePropagation( AllChildren );
61 61
62 /* sets m_mode and initializes more */ 62 /* sets m_mode and initializes more */
63 /* if you change this call change switchTop as well */ 63 /* if you change this call change switchTop as well */
@@ -412,24 +412,27 @@ void OWidgetStack::switchTop() {
412 /* this works because it is guaranteed that switchStack was called at least once*/ 412 /* this works because it is guaranteed that switchStack was called at least once*/
413 if (!m_stack && m_mWidget) { 413 if (!m_stack && m_mWidget) {
414 m_mWidget->setGeometry( frameRect() ); 414 m_mWidget->setGeometry( frameRect() );
415 return; 415 return;
416 }else if (!m_stack) 416 }else if (!m_stack)
417 return; 417 return;
418 418
419 if (!m_list.isEmpty() ) { 419 if (!m_list.isEmpty() ) {
420 QMap<int, QWidget*>::Iterator it = m_list.begin(); 420 QMap<int, QWidget*>::Iterator it = m_list.begin();
421 for ( ; it != m_list.end(); ++it ) { 421 for ( ; it != m_list.end(); ++it ) {
422 /* better than reparenting twice */ 422 /* better than reparenting twice */
423 if ( it.data() == m_mWidget ) { 423 if ( it.data() == m_mWidget ) {
424 m_mWidget->reparent(this, 0, frameRect().topLeft() ); 424 m_mWidget->reparent(this, 0, frameRect().topLeft() );
425 m_mWidget->setGeometry( frameRect() ); 425 m_mWidget->setGeometry( frameRect() );
426 m_mWidget->show(); 426 m_mWidget->show();
427 }else 427 }else
428 /* ### FIXME we need to place the widget better */ 428 /* ### FIXME we need to place the widget better */
429 it.data()->reparent(0, WType_TopLevel, QPoint(10, 10) ); 429 it.data()->reparent(0, WType_TopLevel, QPoint(10, 10) );
430 } 430 }
431 } 431 }
432 432
433 delete m_stack; 433 delete m_stack;
434 m_stack = 0; 434 m_stack = 0;
435} 435}
436
437}
438} \ No newline at end of file
diff --git a/libopie2/opieui/big-screen/owidgetstack.h b/libopie2/opieui/big-screen/owidgetstack.h
index 53818c8..d2f9a9f 100644
--- a/libopie2/opieui/big-screen/owidgetstack.h
+++ b/libopie2/opieui/big-screen/owidgetstack.h
@@ -14,50 +14,50 @@
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 16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
17..}^=.=       =       ; Library General Public License for more 17..}^=.=       =       ; Library General Public License for more
18++=   -.     .`     .: details. 18++=   -.     .`     .: details.
19 :     =  ...= . :.=- 19 :     =  ...= . :.=-
20 -.   .:....=;==+<; You should have received a copy of the GNU 20 -.   .:....=;==+<; You should have received a copy of the GNU
21  -_. . .   )=.  = Library General Public License along with 21  -_. . .   )=.  = Library General Public License along with
22    --        :-=` this library; see the file COPYING.LIB. 22    --        :-=` this library; see the file COPYING.LIB.
23 If not, write to the Free Software Foundation, 23 If not, write to the Free Software Foundation,
24 Inc., 59 Temple Place - Suite 330, 24 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 25 Boston, MA 02111-1307, USA.
26 26
27*/ 27*/
28 28
29#ifndef OWIDGETSTACK_H 29#ifndef OWIDGETSTACK_H
30#define OWIDGETSTACK_H 30#define OWIDGETSTACK_H
31 31
32/* QT*/ 32/* QT*/
33#include <qframe.h> 33#include <qframe.h>
34#include <qmap.h> 34#include <qmap.h>
35 35
36class QWidgetStack; 36class QWidgetStack;
37 37
38namespace Opie 38namespace Opie {
39{ 39namespace Ui {
40/** 40/**
41 * 41 *
42 * OWidgetStack is the answer to the problem of using Opie at different screen 42 * OWidgetStack is the answer to the problem of using Opie at different screen
43 * sizes and to have a different behaviour. Most applications use a QWidgetStack 43 * sizes and to have a different behaviour. Most applications use a QWidgetStack
44 * to supply a view on click. And by clicking the (X) you go back but this 44 * to supply a view on click. And by clicking the (X) you go back but this
45 * behaviour feels strange on bigger screens. It's ok on smaller one because 45 * behaviour feels strange on bigger screens. It's ok on smaller one because
46 * one can't determine the difference. 46 * one can't determine the difference.
47 * This stack reads the default out of the size of the desktop widget but 47 * This stack reads the default out of the size of the desktop widget but
48 * can be forced to have either the one or the other behaviour. 48 * can be forced to have either the one or the other behaviour.
49 * The first widget added is considered the 'main' widget and its 49 * The first widget added is considered the 'main' widget and its
50 * sizeHint will be taking if in BigScreen mode. 50 * sizeHint will be taking if in BigScreen mode.
51 * In small screen mode this widget behaves exactly like a QWidgetStack and in BigScreen 51 * In small screen mode this widget behaves exactly like a QWidgetStack and in BigScreen
52 * mode it'll use the MainWindow as child of this widget and arranges the others as 52 * mode it'll use the MainWindow as child of this widget and arranges the others as
53 * hidden top level widgets. 53 * hidden top level widgets.
54 * 54 *
55 * @version 0.1 55 * @version 0.1
56 * @author hOlgAr F. 56 * @author hOlgAr F.
57 * @short Either a true stack or a list of top Level widgets 57 * @short Either a true stack or a list of top Level widgets
58 */ 58 */
59class OWidgetStack : public QFrame { 59class OWidgetStack : public QFrame {
60 Q_OBJECT 60 Q_OBJECT
61public: 61public:
62 enum Mode { SmallScreen, BigScreen, NoForce }; 62 enum Mode { SmallScreen, BigScreen, NoForce };
63 OWidgetStack( QWidget* parent, const char* name = 0, WFlags fl = 0 ); 63 OWidgetStack( QWidget* parent, const char* name = 0, WFlags fl = 0 );
@@ -106,27 +106,28 @@ public slots:
106 void raiseWidget( QWidget* ); 106 void raiseWidget( QWidget* );
107 void hideWidget( int ); 107 void hideWidget( int );
108 void hideWidget( QWidget* ); 108 void hideWidget( QWidget* );
109 void setMainWindow( QWidget* ); 109 void setMainWindow( QWidget* );
110 void setMainWindow( int ); 110 void setMainWindow( int );
111 111
112protected: 112protected:
113 void resizeEvent( QResizeEvent* ); 113 void resizeEvent( QResizeEvent* );
114 114
115private: 115private:
116 void switchStack(); 116 void switchStack();
117 void switchTop(); 117 void switchTop();
118 QMap<int, QWidget*> m_list; 118 QMap<int, QWidget*> m_list;
119 QWidgetStack *m_stack; 119 QWidgetStack *m_stack;
120 QWidget *m_mWidget; 120 QWidget *m_mWidget;
121 QWidget *m_last; 121 QWidget *m_last;
122 122
123 enum Mode m_mode; 123 enum Mode m_mode;
124 bool m_forced : 1; 124 bool m_forced : 1;
125 125
126 struct Private; 126 struct Private;
127 Private *d; 127 Private *d;
128}; 128};
129 129
130}; 130}
131}
131 132
132#endif 133#endif
diff --git a/libopie2/opieui/fileselector/ofiledialog.cpp b/libopie2/opieui/fileselector/ofiledialog.cpp
index e7daead..beb4d6c 100644
--- a/libopie2/opieui/fileselector/ofiledialog.cpp
+++ b/libopie2/opieui/fileselector/ofiledialog.cpp
@@ -18,49 +18,49 @@
18++=   -.     .`     .: details. 18++=   -.     .`     .: details.
19 :     =  ...= . :.=- 19 :     =  ...= . :.=-
20 -.   .:....=;==+<; You should have received a copy of the GNU 20 -.   .:....=;==+<; You should have received a copy of the GNU
21  -_. . .   )=.  = Library General Public License along with 21  -_. . .   )=.  = Library General Public License along with
22    --        :-=` this library; see the file COPYING.LIB. 22    --        :-=` this library; see the file COPYING.LIB.
23 If not, write to the Free Software Foundation, 23 If not, write to the Free Software Foundation,
24 Inc., 59 Temple Place - Suite 330, 24 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 25 Boston, MA 02111-1307, USA.
26 26
27*/ 27*/
28 28
29 29
30/* OPIE */ 30/* OPIE */
31#include <opie2/ofiledialog.h> 31#include <opie2/ofiledialog.h>
32#include <qpe/applnk.h> 32#include <qpe/applnk.h>
33#include <qpe/config.h> 33#include <qpe/config.h>
34#include <qpe/qpeapplication.h> 34#include <qpe/qpeapplication.h>
35 35
36/* QT */ 36/* QT */
37#include <qfileinfo.h> 37#include <qfileinfo.h>
38#include <qstring.h> 38#include <qstring.h>
39#include <qapplication.h> 39#include <qapplication.h>
40#include <qlayout.h> 40#include <qlayout.h>
41 41
42using namespace Opie; 42using namespace Opie::Ui;
43 43
44namespace 44namespace
45{ 45{
46/* 46/*
47 * helper functions to load the start dir 47 * helper functions to load the start dir
48 * and to save it 48 * and to save it
49 * helper to extract the dir out of a file name 49 * helper to extract the dir out of a file name
50 */ 50 */
51/** 51/**
52 * This method will use Config( argv[0] ); 52 * This method will use Config( argv[0] );
53 * @param key The group key used 53 * @param key The group key used
54 */ 54 */
55QString lastUsedDir( const QString& key ) 55QString lastUsedDir( const QString& key )
56{ 56{
57 if ( qApp->argc() < 1 ) 57 if ( qApp->argc() < 1 )
58 return QString::null; 58 return QString::null;
59 59
60 Config cfg( QFileInfo(qApp->argv()[0]).fileName() ); // appname 60 Config cfg( QFileInfo(qApp->argv()[0]).fileName() ); // appname
61 cfg.setGroup( key ); 61 cfg.setGroup( key );
62 return cfg.readEntry("LastDir", QPEApplication::documentDir() ); 62 return cfg.readEntry("LastDir", QPEApplication::documentDir() );
63} 63}
64 64
65void saveLastDir( const QString& key, const QString& file ) 65void saveLastDir( const QString& key, const QString& file )
66{ 66{
diff --git a/libopie2/opieui/fileselector/ofiledialog.h b/libopie2/opieui/fileselector/ofiledialog.h
index 01a599b..dfecf3d 100644
--- a/libopie2/opieui/fileselector/ofiledialog.h
+++ b/libopie2/opieui/fileselector/ofiledialog.h
@@ -14,50 +14,50 @@
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 16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
17..}^=.=       =       ; Library General Public License for more 17..}^=.=       =       ; Library General Public License for more
18++=   -.     .`     .: details. 18++=   -.     .`     .: details.
19 :     =  ...= . :.=- 19 :     =  ...= . :.=-
20 -.   .:....=;==+<; You should have received a copy of the GNU 20 -.   .:....=;==+<; You should have received a copy of the GNU
21  -_. . .   )=.  = Library General Public License along with 21  -_. . .   )=.  = Library General Public License along with
22    --        :-=` this library; see the file COPYING.LIB. 22    --        :-=` this library; see the file COPYING.LIB.
23 If not, write to the Free Software Foundation, 23 If not, write to the Free Software Foundation,
24 Inc., 59 Temple Place - Suite 330, 24 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 25 Boston, MA 02111-1307, USA.
26 26
27*/ 27*/
28 28
29#ifndef OFILEDIALOG_H 29#ifndef OFILEDIALOG_H
30#define OFILEDIALOG_H 30#define OFILEDIALOG_H
31 31
32/* OPIE */ 32/* OPIE */
33#include <opie2/ofileselector.h> 33#include <opie2/ofileselector.h>
34 34
35/* QT */ 35/* QT */
36#include <qdialog.h> 36#include <qdialog.h>
37 37
38namespace Opie 38namespace Opie {
39{ 39namespace Ui {
40 40
41/** 41/**
42 * This class places a OFileSelector inside a QDialog. 42 * This class places a OFileSelector inside a QDialog.
43 * It provides static method for letting a user chose 43 * It provides static method for letting a user chose
44 * a file for either opening or saving. 44 * a file for either opening or saving.
45 * Most of the time the c'tor will not be used instead using 45 * Most of the time the c'tor will not be used instead using
46 * the static member functions is prefered. 46 * the static member functions is prefered.
47 * 47 *
48 * <pre> 48 * <pre>
49 * QMap<QString, QStringList> mimeTypes; 49 * QMap<QString, QStringList> mimeTypes;
50 * QStringList types; 50 * QStringList types;
51 * types << "text[slash]* "; 51 * types << "text[slash]* ";
52 * mimeTypes.insert( tr("Text"), types ); 52 * mimeTypes.insert( tr("Text"), types );
53 * mimeTypes.insert( tr("All"), " * / * " ); // remove the spaces in the 2nd comment 53 * mimeTypes.insert( tr("All"), " * / * " ); // remove the spaces in the 2nd comment
54 * QString fileName= OFileDialog::getOpenFileName( OFileSelector::EXTENDED_ALL, 54 * QString fileName= OFileDialog::getOpenFileName( OFileSelector::EXTENDED_ALL,
55 * "foo","bar", mimeTypes); 55 * "foo","bar", mimeTypes);
56 * </pre> 56 * </pre>
57 * 57 *
58 * @short A small QDialog swalloing a FileSelector 58 * @short A small QDialog swalloing a FileSelector
59 * @see QDialog 59 * @see QDialog
60 * @see OFileSelector 60 * @see OFileSelector
61 * @version 0.1-unfinished 61 * @version 0.1-unfinished
62 * @author Holger Freyther ( zecke@handhelds.org ) 62 * @author Holger Freyther ( zecke@handhelds.org )
63 */ 63 */
@@ -83,27 +83,28 @@ public:
83 const QString &caption = QString::null ); 83 const QString &caption = QString::null );
84 84
85 static QString getSaveFileName(int selector, 85 static QString getSaveFileName(int selector,
86 const QString& startDir = QString::null, 86 const QString& startDir = QString::null,
87 const QString& fileName = QString::null, 87 const QString& fileName = QString::null,
88 const MimeTypes& mimefilter = MimeTypes(), 88 const MimeTypes& mimefilter = MimeTypes(),
89 QWidget *wid = 0, 89 QWidget *wid = 0,
90 const QString &caption = QString::null ); 90 const QString &caption = QString::null );
91 91
92 //let's OFileSelector catch up first 92 //let's OFileSelector catch up first
93 //static QString getExistingDirectory(const QString& startDir = QString::null, 93 //static QString getExistingDirectory(const QString& startDir = QString::null,
94 //QWidget *parent = 0, const QString& caption = QString::null ); 94 //QWidget *parent = 0, const QString& caption = QString::null );
95 95
96private: 96private:
97 class OFileDialogPrivate; 97 class OFileDialogPrivate;
98 OFileDialogPrivate *d; 98 OFileDialogPrivate *d;
99 OFileSelector *file; 99 OFileSelector *file;
100 100
101private slots: 101private slots:
102 void slotFileSelected( const QString & ); 102 void slotFileSelected( const QString & );
103 void slotDirSelected(const QString & ); 103 void slotDirSelected(const QString & );
104 void slotSelectorOk(); 104 void slotSelectorOk();
105}; 105};
106 106
107}; 107}
108}
108 109
109#endif 110#endif
diff --git a/libopie2/opieui/fileselector/ofileselector.cpp b/libopie2/opieui/fileselector/ofileselector.cpp
index 15cadd4..c4d5033 100644
--- a/libopie2/opieui/fileselector/ofileselector.cpp
+++ b/libopie2/opieui/fileselector/ofileselector.cpp
@@ -34,50 +34,53 @@
34#include "ofileselector_p.h" 34#include "ofileselector_p.h"
35 35
36/* OPIE */ 36/* OPIE */
37#include <opie2/ofileselector.h> 37#include <opie2/ofileselector.h>
38 38
39#include <qpe/qpeapplication.h> 39#include <qpe/qpeapplication.h>
40#include <qpe/mimetype.h> 40#include <qpe/mimetype.h>
41#include <qpe/resource.h> 41#include <qpe/resource.h>
42#include <qpe/storage.h> 42#include <qpe/storage.h>
43 43
44/* QT */ 44/* QT */
45#include <qcombobox.h> 45#include <qcombobox.h>
46#include <qdir.h> 46#include <qdir.h>
47#include <qhbox.h> 47#include <qhbox.h>
48#include <qheader.h> 48#include <qheader.h>
49#include <qlabel.h> 49#include <qlabel.h>
50#include <qlayout.h> 50#include <qlayout.h>
51#include <qlineedit.h> 51#include <qlineedit.h>
52#include <qlistview.h> 52#include <qlistview.h>
53#include <qpopupmenu.h> 53#include <qpopupmenu.h>
54#include <qwidgetstack.h> 54#include <qwidgetstack.h>
55#include <qregexp.h> 55#include <qregexp.h>
56#include <qobjectlist.h> 56#include <qobjectlist.h>
57 57
58using namespace Opie; 58using namespace Opie::Ui::Private;
59 59
60namespace Opie {
61namespace Ui {
62namespace Private {
60OFileViewInterface::OFileViewInterface( OFileSelector* selector ) 63OFileViewInterface::OFileViewInterface( OFileSelector* selector )
61 : m_selector( selector ) 64 : m_selector( selector )
62{} 65{}
63 66
64OFileViewInterface::~OFileViewInterface() 67OFileViewInterface::~OFileViewInterface()
65{} 68{}
66 69
67QString OFileViewInterface::name()const 70QString OFileViewInterface::name()const
68{ 71{
69 return m_name; 72 return m_name;
70} 73}
71 74
72void OFileViewInterface::setName( const QString& name ) 75void OFileViewInterface::setName( const QString& name )
73{ 76{
74 m_name = name; 77 m_name = name;
75} 78}
76 79
77OFileSelector* OFileViewInterface::selector()const 80OFileSelector* OFileViewInterface::selector()const
78{ 81{
79 return m_selector; 82 return m_selector;
80} 83}
81 84
82DocLnk OFileViewInterface::selectedDocument()const 85DocLnk OFileViewInterface::selectedDocument()const
83{ 86{
@@ -789,48 +792,50 @@ void OFileViewFileSystem::reread()
789 m_view->reread( m_all ); 792 m_view->reread( m_all );
790} 793}
791 794
792int OFileViewFileSystem::fileCount()const 795int OFileViewFileSystem::fileCount()const
793{ 796{
794 if (!m_view ) 797 if (!m_view )
795 return -1; 798 return -1;
796 return m_view->fileCount(); 799 return m_view->fileCount();
797} 800}
798 801
799QWidget* OFileViewFileSystem::widget( QWidget* parent ) 802QWidget* OFileViewFileSystem::widget( QWidget* parent )
800{ 803{
801 if (!m_view ) 804 if (!m_view )
802 { 805 {
803 m_view = new OFileViewFileListView( parent, startDirectory(), selector() ); 806 m_view = new OFileViewFileListView( parent, startDirectory(), selector() );
804 } 807 }
805 return m_view; 808 return m_view;
806} 809}
807 810
808void OFileViewFileSystem::activate( const QString& str) 811void OFileViewFileSystem::activate( const QString& str)
809{ 812{
810 m_all = (str != QObject::tr("Files") ); 813 m_all = (str != QObject::tr("Files") );
811} 814}
812 815
816
817}
813/* Selector */ 818/* Selector */
814/** 819/**
815 * @short new and complete c'tor 820 * @short new and complete c'tor
816 * 821 *
817 * Create a OFileSelector to let the user select a file. It can 822 * Create a OFileSelector to let the user select a file. It can
818 * either be used to open a file, select a save name in a dir or 823 * either be used to open a file, select a save name in a dir or
819 * as a dropin for the FileSelector. 824 * as a dropin for the FileSelector.
820 * 825 *
821 * <pre> 826 * <pre>
822 * QMap<QString, QStringList> mimeTypes; 827 * QMap<QString, QStringList> mimeTypes;
823 * QStringList types; 828 * QStringList types;
824 * types << "text@slash* "; 829 * types << "text@slash* ";
825 * types << "audio@slash*"; 830 * types << "audio@slash*";
826 * mimeTypes.insert( tr("Audio and Text"), types ); 831 * mimeTypes.insert( tr("Audio and Text"), types );
827 * mimeTypes.insert( tr("All"), "*@slash*); 832 * mimeTypes.insert( tr("All"), "*@slash*);
828 * 833 *
829 * now you could create your fileselector 834 * now you could create your fileselector
830 * </pre> 835 * </pre>
831 * 836 *
832 * 837 *
833 * @param parent the parent of this widget 838 * @param parent the parent of this widget
834 * @param mode The mode from the enum Mode (Open,Save,FILESELECTOR) 839 * @param mode The mode from the enum Mode (Open,Save,FILESELECTOR)
835 * @param sel The selector to be used 840 * @param sel The selector to be used
836 * @param dirName The name of the dir to start int 841 * @param dirName The name of the dir to start int
@@ -1143,24 +1148,26 @@ void OFileSelector::slotViewChange( const QString& view )
1143 1148
1144 id++; 1149 id++;
1145} 1150}
1146 1151
1147void OFileSelector::setNewVisible( bool b ) 1152void OFileSelector::setNewVisible( bool b )
1148{ 1153{
1149 m_shNew = b; 1154 m_shNew = b;
1150 currentView()->reread(); 1155 currentView()->reread();
1151} 1156}
1152 1157
1153void OFileSelector::setCloseVisible( bool b ) 1158void OFileSelector::setCloseVisible( bool b )
1154{ 1159{
1155 m_shClose = b; 1160 m_shClose = b;
1156 currentView()->reread(); 1161 currentView()->reread();
1157} 1162}
1158 1163
1159void OFileSelector::setNameVisible( bool b ) 1164void OFileSelector::setNameVisible( bool b )
1160{ 1165{
1161 if ( b ) 1166 if ( b )
1162 m_nameBox->show(); 1167 m_nameBox->show();
1163 else 1168 else
1164 m_nameBox->hide(); 1169 m_nameBox->hide();
1165} 1170}
1166 1171
1172}
1173}
diff --git a/libopie2/opieui/fileselector/ofileselector.h b/libopie2/opieui/fileselector/ofileselector.h
index 7fa657b..2205963 100644
--- a/libopie2/opieui/fileselector/ofileselector.h
+++ b/libopie2/opieui/fileselector/ofileselector.h
@@ -31,71 +31,73 @@
31 L. J. Potter ljp@llornkcor.com 31 L. J. Potter ljp@llornkcor.com
32 Thanks a lot 32 Thanks a lot
33*/ 33*/
34 34
35#ifndef OFILESELECTOR_H 35#ifndef OFILESELECTOR_H
36#define OFILESELECTOR_H 36#define OFILESELECTOR_H
37 37
38/* OPIE */ 38/* OPIE */
39#include <qpe/applnk.h> 39#include <qpe/applnk.h>
40 40
41/* QT */ 41/* QT */
42#include <qlist.h> 42#include <qlist.h>
43#include <qwidget.h> 43#include <qwidget.h>
44#include <qmap.h> 44#include <qmap.h>
45#include <qvaluelist.h> 45#include <qvaluelist.h>
46#include <qstringlist.h> 46#include <qstringlist.h>
47 47
48class QLineEdit; 48class QLineEdit;
49class QComboBox; 49class QComboBox;
50class QWidgetStack; 50class QWidgetStack;
51class QHBox; 51class QHBox;
52 52
53typedef QMap<QString, QStringList> MimeTypes; 53typedef QMap<QString, QStringList> MimeTypes;
54 54
55namespace Opie 55namespace Opie {
56{ 56namespace Ui {
57 57
58namespace Private {
58class OFileViewInterface; 59class OFileViewInterface;
59class OFileViewFileListView; 60class OFileViewFileListView;
61}
60 62
61 63
62/** 64/**
63 * @short a dropin replacement for the FileSelector 65 * @short a dropin replacement for the FileSelector
64 * 66 *
65 * This class is first used insert the OFileDialog. 67 * This class is first used insert the OFileDialog.
66 * It supports multiple view and mimetype filtering for now. 68 * It supports multiple view and mimetype filtering for now.
67 * 69 *
68 * @see OFileDialog 70 * @see OFileDialog
69 * @see FileSelector 71 * @see FileSelector
70 * @author zecke 72 * @author zecke
71 * @version 0.1 73 * @version 0.1
72 */ 74 */
73class OFileSelector : public QWidget 75class OFileSelector : public QWidget
74{ 76{
75 Q_OBJECT 77 Q_OBJECT
76 friend class Opie::OFileViewInterface; 78 friend class Private::OFileViewInterface;
77 friend class Opie::OFileViewFileListView; 79 friend class Private::OFileViewFileListView;
78 80
79public: 81public:
80 /** 82 /**
81 * The Mode of the Fileselector 83 * The Mode of the Fileselector
82 * Open = Open A File 84 * Open = Open A File
83 * Save = Save a File 85 * Save = Save a File
84 * FILESELECTOR = As A GUI in a screen to select a file 86 * FILESELECTOR = As A GUI in a screen to select a file
85 */ 87 */
86 enum Mode { Open=1, Save=2, FileSelector=4, OPEN=1, SAVE=2, FILESELECTOR=4 }; 88 enum Mode { Open=1, Save=2, FileSelector=4, OPEN=1, SAVE=2, FILESELECTOR=4 };
87 // enum OldMode { OPEN=1, SAVE=2, FILESELECTOR = 4 }; 89 // enum OldMode { OPEN=1, SAVE=2, FILESELECTOR = 4 };
88 /** 90 /**
89 * Normal = The old FileSelector 91 * Normal = The old FileSelector
90 * Extended = Dir View 92 * Extended = Dir View
91 * ExtendedAll = Dir View with all hidden files 93 * ExtendedAll = Dir View with all hidden files
92 * Default = What the vendor considers best 94 * Default = What the vendor considers best
93 */ 95 */
94 enum Selector { Normal = 0, Extended=1, ExtendedAll =2, Default=3, NORMAL=0,EXTENDED=1, EXTENDED_ALL =2, DEFAULT=3 }; 96 enum Selector { Normal = 0, Extended=1, ExtendedAll =2, Default=3, NORMAL=0,EXTENDED=1, EXTENDED_ALL =2, DEFAULT=3 };
95 // enum OldSelector { NORMAL = 0, EXTENDED =1, EXTENDED_ALL = 2}; 97 // enum OldSelector { NORMAL = 0, EXTENDED =1, EXTENDED_ALL = 2};
96 98
97 OFileSelector(QWidget* parent, int mode, int selector, 99 OFileSelector(QWidget* parent, int mode, int selector,
98 const QString& dirName, 100 const QString& dirName,
99 const QString& fileName, 101 const QString& fileName,
100 const MimeTypes& mimetypes = MimeTypes(), 102 const MimeTypes& mimetypes = MimeTypes(),
101 bool newVisible = FALSE, bool closeVisible = FALSE ); 103 bool newVisible = FALSE, bool closeVisible = FALSE );
@@ -164,56 +166,57 @@ signals:
164 * in the line edit 166 * in the line edit
165 */ 167 */
166 void ok(); 168 void ok();
167 void cancel(); 169 void cancel();
168 170
169 /* used by the ViewInterface */ 171 /* used by the ViewInterface */
170private: 172private:
171 bool showNew()const; 173 bool showNew()const;
172 bool showClose()const; 174 bool showClose()const;
173 MimeTypes mimeTypes()const; 175 MimeTypes mimeTypes()const;
174 QStringList currentMimeType()const; 176 QStringList currentMimeType()const;
175 177
176private: 178private:
177 /* inits the Widgets */ 179 /* inits the Widgets */
178 void initUI(); 180 void initUI();
179 /* inits the MimeType ComboBox content + connects signals and slots */ 181 /* inits the MimeType ComboBox content + connects signals and slots */
180 void initMime(); 182 void initMime();
181 /* init the Views :) */ 183 /* init the Views :) */
182 void initViews(); 184 void initViews();
183 185
184private: 186private:
185 QLineEdit* m_lneEdit; // the LineEdit for the Name 187 QLineEdit* m_lneEdit; // the LineEdit for the Name
186 QComboBox *m_cmbView, *m_cmbMime; // two ComboBoxes to select the View and MimeType 188 QComboBox *m_cmbView, *m_cmbMime; // two ComboBoxes to select the View and MimeType
187 QWidgetStack* m_stack; // our widget stack which will contain the views 189 QWidgetStack* m_stack; // our widget stack which will contain the views
188 OFileViewInterface* currentView() const; // returns the currentView 190 Private::OFileViewInterface* currentView() const; // returns the currentView
189 OFileViewInterface* m_current; // here is the view saved 191 Private::OFileViewInterface* m_current; // here is the view saved
190 bool m_shNew : 1; // should we show New? 192 bool m_shNew : 1; // should we show New?
191 bool m_shClose : 1; // should we show Close? 193 bool m_shClose : 1; // should we show Close?
192 MimeTypes m_mimeType; // list of mimetypes 194 MimeTypes m_mimeType; // list of mimetypes
193 195
194 QMap<QString, OFileViewInterface*> m_views; // QString translated view name + ViewInterface Ptr 196 QMap<QString, Private::OFileViewInterface*> m_views; // QString translated view name + ViewInterface Ptr
195 QHBox* m_nameBox; // the LineEdit + Label is hold here 197 QHBox* m_nameBox; // the LineEdit + Label is hold here
196 QHBox* m_cmbBox; // this holds the two combo boxes 198 QHBox* m_cmbBox; // this holds the two combo boxes
197 199
198 QString m_startDir; 200 QString m_startDir;
199 int m_mode; 201 int m_mode;
200 int m_selector; 202 int m_selector;
201 203
202 struct Data; // used for future versions 204 struct Data; // used for future versions
203 Data *d; 205 Data *d;
204 206
205private slots: 207private slots:
206 void slotMimeTypeChanged(); 208 void slotMimeTypeChanged();
207 209
208 /* will set the text of the lineedit and emit a fileChanged signal */ 210 /* will set the text of the lineedit and emit a fileChanged signal */
209 void slotDocLnkBridge( const DocLnk& ); 211 void slotDocLnkBridge( const DocLnk& );
210 void slotFileBridge( const QString& ); 212 void slotFileBridge( const QString& );
211 void slotViewChange( const QString& ); 213 void slotViewChange( const QString& );
212 214
213 bool eventFilter (QObject *o, QEvent *e); 215 bool eventFilter (QObject *o, QEvent *e);
214 216
215}; 217};
216 218
217}; 219}
220}
218 221
219#endif 222#endif
diff --git a/libopie2/opieui/fileselector/ofileselector_p.h b/libopie2/opieui/fileselector/ofileselector_p.h
index 818ced9..376dc98 100644
--- a/libopie2/opieui/fileselector/ofileselector_p.h
+++ b/libopie2/opieui/fileselector/ofileselector_p.h
@@ -35,52 +35,52 @@
35 35
36/* QT */ 36/* QT */
37#include <qmap.h> 37#include <qmap.h>
38#include <qstringlist.h> 38#include <qstringlist.h>
39#include <qwidget.h> 39#include <qwidget.h>
40#include <qlistview.h> 40#include <qlistview.h>
41 41
42/* 42/*
43 * How to avoid having really two different objects 43 * How to avoid having really two different objects
44 * for Extended and ExtendedAll 44 * for Extended and ExtendedAll
45 * The only difference is the Lister... 45 * The only difference is the Lister...
46 * a) static object? 46 * a) static object?
47 * b) leave some object inside the OFileSelector which can be used? 47 * b) leave some object inside the OFileSelector which can be used?
48 * c) when switching views tell which view we want o have.. internally we can switch then 48 * c) when switching views tell which view we want o have.. internally we can switch then
49 * 49 *
50 * I'll take c) -zecke 50 * I'll take c) -zecke
51 */ 51 */
52 52
53typedef QMap<QString, QStringList> MimeTypes; 53typedef QMap<QString, QStringList> MimeTypes;
54 54
55/* the View Interface */ 55/* the View Interface */
56class QFileInfo; 56class QFileInfo;
57class QToolButton; 57class QToolButton;
58 58
59namespace Opie 59namespace Opie{
60{ 60namespace Ui{
61
62class OFileSelector; 61class OFileSelector;
62namespace Private {
63 63
64class OFileViewInterface 64class OFileViewInterface
65{ 65{
66public: 66public:
67 OFileViewInterface( OFileSelector* selector ); 67 OFileViewInterface( OFileSelector* selector );
68 virtual ~OFileViewInterface(); 68 virtual ~OFileViewInterface();
69 virtual QString selectedName()const = 0; 69 virtual QString selectedName()const = 0;
70 virtual QString selectedPath()const = 0; 70 virtual QString selectedPath()const = 0;
71 virtual QString directory()const = 0; 71 virtual QString directory()const = 0;
72 virtual void reread() = 0; 72 virtual void reread() = 0;
73 virtual int fileCount()const = 0; 73 virtual int fileCount()const = 0;
74 virtual DocLnk selectedDocument()const; 74 virtual DocLnk selectedDocument()const;
75 virtual QWidget* widget( QWidget* parent) = 0; 75 virtual QWidget* widget( QWidget* parent) = 0;
76 virtual void activate( const QString& ); 76 virtual void activate( const QString& );
77 QString name()const; 77 QString name()const;
78protected: 78protected:
79 OFileSelector* selector()const; 79 OFileSelector* selector()const;
80 void setName( const QString& ); 80 void setName( const QString& );
81 bool showNew()const; 81 bool showNew()const;
82 bool showClose()const; 82 bool showClose()const;
83 MimeTypes mimeTypes()const; 83 MimeTypes mimeTypes()const;
84 QStringList currentMimeType()const; 84 QStringList currentMimeType()const;
85 QString startDirectory()const; 85 QString startDirectory()const;
86protected: 86protected:
@@ -165,27 +165,29 @@ private slots:
165 void slotFSActivated(int); 165 void slotFSActivated(int);
166 166
167protected: 167protected:
168 OFileSelector* selector(); 168 OFileSelector* selector();
169 169
170private: 170private:
171 QMap<QString, QString> m_dev; 171 QMap<QString, QString> m_dev;
172 bool m_all : 1; 172 bool m_all : 1;
173 OFileSelector* m_sel; 173 OFileSelector* m_sel;
174 QPopupMenu* m_fsPop; 174 QPopupMenu* m_fsPop;
175 bool compliesMime( const QString& ); 175 bool compliesMime( const QString& );
176 QStringList m_mimes; // used in compy mime 176 QStringList m_mimes; // used in compy mime
177 QString m_currentDir; 177 QString m_currentDir;
178 QToolButton *m_btnNew, *m_btnClose; 178 QToolButton *m_btnNew, *m_btnClose;
179 void connectSlots(); 179 void connectSlots();
180 void addFile( QFileInfo* info, bool symlink = FALSE ); 180 void addFile( QFileInfo* info, bool symlink = FALSE );
181 void addDir ( QFileInfo* info, bool symlink = FALSE ); 181 void addDir ( QFileInfo* info, bool symlink = FALSE );
182 void addSymlink( QFileInfo* info, bool = FALSE ); 182 void addSymlink( QFileInfo* info, bool = FALSE );
183 183
184 184
185private: 185private:
186 QListView* m_view; 186 QListView* m_view;
187}; 187};
188 188
189}; 189}
190}
191}
190 192
191#endif 193#endif
diff --git a/libopie2/opieui/fileselector/ofileview.h b/libopie2/opieui/fileselector/ofileview.h
index 495401b..aaf56b1 100644
--- a/libopie2/opieui/fileselector/ofileview.h
+++ b/libopie2/opieui/fileselector/ofileview.h
@@ -16,50 +16,51 @@
16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
17..}^=.=       =       ; Library General Public License for more 17..}^=.=       =       ; Library General Public License for more
18++=   -.     .`     .: details. 18++=   -.     .`     .: details.
19 :     =  ...= . :.=- 19 :     =  ...= . :.=-
20 -.   .:....=;==+<; You should have received a copy of the GNU 20 -.   .:....=;==+<; You should have received a copy of the GNU
21  -_. . .   )=.  = Library General Public License along with 21  -_. . .   )=.  = Library General Public License along with
22    --        :-=` this library; see the file COPYING.LIB. 22    --        :-=` this library; see the file COPYING.LIB.
23 If not, write to the Free Software Foundation, 23 If not, write to the Free Software Foundation,
24 Inc., 59 Temple Place - Suite 330, 24 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 25 Boston, MA 02111-1307, USA.
26 26
27*/ 27*/
28 28
29#ifndef OFILEVIEW_H 29#ifndef OFILEVIEW_H
30#define OFILEVIEW_H 30#define OFILEVIEW_H
31 31
32/* QT */ 32/* QT */
33#include <qobject.h> 33#include <qobject.h>
34#include <qwidget.h> 34#include <qwidget.h>
35 35
36class QFileInfo; 36class QFileInfo;
37class QDir; 37class QDir;
38class DocLnk; 38class DocLnk;
39 39
40namespace Opie 40namespace Opie {
41{ 41namespace Ui {
42namespace Private {
42 43
43/** 44/**
44 * A OFileView is a specialised View for the 45 * A OFileView is a specialised View for the
45 * OFileSelector 46 * OFileSelector
46 * With a View you can chage the user visible 47 * With a View you can chage the user visible
47 * representation of a OFileLister 48 * representation of a OFileLister
48 * OFileView is just a basic interface which helps you to 49 * OFileView is just a basic interface which helps you to
49 * write new views 50 * write new views
50 */ 51 */
51class OFileView : public QWidget 52class OFileView : public QWidget
52{ 53{
53 Q_OBJECT 54 Q_OBJECT
54public: 55public:
55 OFileView(QWidget *widget, 56 OFileView(QWidget *widget,
56 const char *name ); 57 const char *name );
57 58
58 OFileView(); 59 OFileView();
59 60
60 virtual void addFile(const QString &mine, 61 virtual void addFile(const QString &mine,
61 QFileInfo *info, 62 QFileInfo *info,
62 bool isSymlink = FALSE ) = 0; 63 bool isSymlink = FALSE ) = 0;
63 64
64 virtual void addDir (const QString &mine, 65 virtual void addDir (const QString &mine,
65 QFileInfo *info, 66 QFileInfo *info,
@@ -69,27 +70,29 @@ public:
69 QFileInfo *info, 70 QFileInfo *info,
70 bool isSymlink = FALSE ) = 0; 71 bool isSymlink = FALSE ) = 0;
71 72
72 virtual void cd(const QString &path ) = 0; 73 virtual void cd(const QString &path ) = 0;
73signals: 74signals:
74 void fileSelected(const QString &); 75 void fileSelected(const QString &);
75 void fileSelected(const DocLnk & ); 76 void fileSelected(const DocLnk & );
76 void contextMenu(); 77 void contextMenu();
77 void changedDir(const QString &); 78 void changedDir(const QString &);
78 void changedDir(const QDir & ); 79 void changedDir(const QDir & );
79}; 80};
80 81
81 82
82class OFileViewFactory 83class OFileViewFactory
83{ 84{
84 // Q_OBJECT 85 // Q_OBJECT
85public: 86public:
86 OFileViewFactory() {} ; 87 OFileViewFactory() {} ;
87 virtual ~OFileViewFactory() = 0; 88 virtual ~OFileViewFactory() = 0;
88 89
89 OFileView* newView(QWidget *parent, const char *name ); 90 OFileView* newView(QWidget *parent, const char *name );
90 QString name()const; 91 QString name()const;
91}; 92};
92 93
93}; 94}
95}
96}
94 97
95#endif 98#endif
diff --git a/libopie2/opieui/oclickablelabel.cpp b/libopie2/opieui/oclickablelabel.cpp
index 4c4e581..53cb77a 100644
--- a/libopie2/opieui/oclickablelabel.cpp
+++ b/libopie2/opieui/oclickablelabel.cpp
@@ -8,49 +8,49 @@
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 Library General Public 9:`=1 )Y*s>-.--   : the terms of the GNU Library 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 program is distributed in the hope that 14    .i_,=:_.      -<s. This program 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 18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.=       =       ; Library General Public License for more 19..}^=.=       =       ; Library General Public License for more
20++=   -.     .`     .: details. 20++=   -.     .`     .: details.
21 :     =  ...= . :.=- 21 :     =  ...= . :.=-
22 -.   .:....=;==+<; You should have received a copy of the GNU 22 -.   .:....=;==+<; You should have received a copy of the GNU
23  -_. . .   )=.  = Library General Public License along with 23  -_. . .   )=.  = Library General Public License along with
24    --        :-=` this library; see the file COPYING.LIB. 24    --        :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28*/ 28*/
29 29
30#include <opie2/oclickablelabel.h> 30#include <opie2/oclickablelabel.h>
31 31
32using namespace Opie; 32using namespace Opie::Ui;
33 33
34/** 34/**
35 * This constructs the clickable ButtonLabel 35 * This constructs the clickable ButtonLabel
36 * 36 *
37 * @param parent The parent of this label 37 * @param parent The parent of this label
38 * @param name A name of this label @see QObject 38 * @param name A name of this label @see QObject
39 * @param fl The windowing flags 39 * @param fl The windowing flags
40 */ 40 */
41OClickableLabel::OClickableLabel(QWidget* parent, const char* name, WFlags fl) 41OClickableLabel::OClickableLabel(QWidget* parent, const char* name, WFlags fl)
42 :QLabel(parent,name,fl) 42 :QLabel(parent,name,fl)
43{ 43{
44 textInverted=false; 44 textInverted=false;
45 isToggle=false; 45 isToggle=false;
46 isDown=false; 46 isDown=false;
47 showState(false); 47 showState(false);
48 setFrameShadow(Sunken); 48 setFrameShadow(Sunken);
49} 49}
50 50
51/** 51/**
52 * This method makes the label behave as a toggle button 52 * This method makes the label behave as a toggle button
53 * 53 *
54 * @param t Whether or not to behave like a toggle button 54 * @param t Whether or not to behave like a toggle button
55 */ 55 */
56void OClickableLabel::setToggleButton(bool t) 56void OClickableLabel::setToggleButton(bool t)
diff --git a/libopie2/opieui/oclickablelabel.h b/libopie2/opieui/oclickablelabel.h
index b224d61..90859a0 100644
--- a/libopie2/opieui/oclickablelabel.h
+++ b/libopie2/opieui/oclickablelabel.h
@@ -12,50 +12,50 @@
12     ._= =}       : or (at your option) any later version. 12     ._= =}       : or (at your option) any later version.
13    .%`+i>       _;_. 13    .%`+i>       _;_.
14    .i_,=:_.      -<s. This program is distributed in the hope that 14    .i_,=:_.      -<s. This program 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 18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.=       =       ; Library General Public License for more 19..}^=.=       =       ; Library General Public License for more
20++=   -.     .`     .: details. 20++=   -.     .`     .: details.
21 :     =  ...= . :.=- 21 :     =  ...= . :.=-
22 -.   .:....=;==+<; You should have received a copy of the GNU 22 -.   .:....=;==+<; You should have received a copy of the GNU
23  -_. . .   )=.  = Library General Public License along with 23  -_. . .   )=.  = Library General Public License along with
24    --        :-=` this library; see the file COPYING.LIB. 24    --        :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28*/ 28*/
29 29
30#ifndef OCLICKABLELABEL_H 30#ifndef OCLICKABLELABEL_H
31#define OCLICKABLELABEL_H 31#define OCLICKABLELABEL_H
32 32
33/* QT */ 33/* QT */
34#include <qlabel.h> 34#include <qlabel.h>
35 35
36namespace Opie 36namespace Opie{
37{ 37namespace Ui {
38 38
39/** 39/**
40 * This class is a special QLabel which can behave 40 * This class is a special QLabel which can behave
41 * as a QPushButton or QToggleButton. 41 * as a QPushButton or QToggleButton.
42 * The reason to use a clickable is if you want to save space 42 * The reason to use a clickable is if you want to save space
43 * or you want to skip the border of a normal button 43 * or you want to skip the border of a normal button
44 * 44 *
45 * <pre> 45 * <pre>
46 * QLabel* lbl = new OClickableLabel( parent, "PushLabel" ); 46 * QLabel* lbl = new OClickableLabel( parent, "PushLabel" );
47 * lbl->setPixmap( "config" ); 47 * lbl->setPixmap( "config" );
48 * QWhatsThis::add( lbl, tr("Click here to do something") ); 48 * QWhatsThis::add( lbl, tr("Click here to do something") );
49 * </pre> 49 * </pre>
50 * 50 *
51 * @short A Label behaving as button 51 * @short A Label behaving as button
52 * @author Hakan Ardo, Maximillian Reiß ( harlekin@handhelds.org ) 52 * @author Hakan Ardo, Maximillian Reiß ( harlekin@handhelds.org )
53 * @see QLabel 53 * @see QLabel
54 * @see QPushButton 54 * @see QPushButton
55 * @see QToggleButton 55 * @see QToggleButton
56 * @version 1.0 56 * @version 1.0
57 */ 57 */
58 58
59class OClickableLabel: public QLabel 59class OClickableLabel: public QLabel
60{ 60{
61 Q_OBJECT 61 Q_OBJECT
@@ -77,27 +77,28 @@ public slots:
77signals: 77signals:
78 /** 78 /**
79 * emitted when the labels gets clicked 79 * emitted when the labels gets clicked
80 */ 80 */
81 void clicked(); 81 void clicked();
82 82
83 /** 83 /**
84 * emitted when the labels gets toggled 84 * emitted when the labels gets toggled
85 * @param on the new new state of the label 85 * @param on the new new state of the label
86 */ 86 */
87 void toggled(bool on); 87 void toggled(bool on);
88private: 88private:
89 bool isToggle : 1; 89 bool isToggle : 1;
90 bool isDown : 1; 90 bool isDown : 1;
91 bool textInverted : 1; 91 bool textInverted : 1;
92 92
93 void showState(bool on); 93 void showState(bool on);
94 void setInverted(bool on); 94 void setInverted(bool on);
95 95
96private: 96private:
97 class Private; 97 class Private;
98 Private *d; // private d pointer 98 Private *d; // private d pointer
99}; 99};
100 100
101}; 101}
102}
102 103
103#endif 104#endif
diff --git a/libopie2/opieui/odialog.cpp b/libopie2/opieui/odialog.cpp
index 4d269d4..27f8d20 100644
--- a/libopie2/opieui/odialog.cpp
+++ b/libopie2/opieui/odialog.cpp
@@ -11,45 +11,47 @@
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 program is distributed in the hope that 14    .i_,=:_.      -<s. This program 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 18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.=       =       ; Library General Public License for more 19..}^=.=       =       ; Library General Public License for more
20++=   -.     .`     .: details. 20++=   -.     .`     .: details.
21 :     =  ...= . :.=- 21 :     =  ...= . :.=-
22 -.   .:....=;==+<; You should have received a copy of the GNU 22 -.   .:....=;==+<; You should have received a copy of the GNU
23  -_. . .   )=.  = Library General Public License along with 23  -_. . .   )=.  = Library General Public License along with
24    --        :-=` this library; see the file COPYING.LIB. 24    --        :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28 28
29*/ 29*/
30 30
31#include <opie2/odialog.h> 31#include <opie2/odialog.h>
32 32
33#warning Make Margin and Spacing device dependend and configurable! 33#warning Make Margin and Spacing device dependend and configurable!
34 34
35using namespace Opie::Ui;
36
35int ODialog::mMarginSize = 5; 37int ODialog::mMarginSize = 5;
36int ODialog::mSpacingSize = 2; 38int ODialog::mSpacingSize = 2;
37 39
38ODialog::ODialog(QWidget *parent, const char *name, bool modal, WFlags f) 40ODialog::ODialog(QWidget *parent, const char *name, bool modal, WFlags f)
39 :QDialog(parent, name, modal, f) 41 :QDialog(parent, name, modal, f)
40{ 42{
41 // d = new ODialogPrivate(); 43 // d = new ODialogPrivate();
42} 44}
43 45
44int ODialog::marginHint() 46int ODialog::marginHint()
45{ 47{
46 return( mMarginSize ); 48 return( mMarginSize );
47} 49}
48 50
49 51
50int ODialog::spacingHint() 52int ODialog::spacingHint()
51{ 53{
52 return( mSpacingSize ); 54 return( mSpacingSize );
53} 55}
54 56
55// Placeholder for even more sophisticed things 57// Placeholder for even more sophisticed things
diff --git a/libopie2/opieui/odialog.h b/libopie2/opieui/odialog.h
index ceff612..57f534c 100644
--- a/libopie2/opieui/odialog.h
+++ b/libopie2/opieui/odialog.h
@@ -34,58 +34,63 @@
34class QLayoutItem; 34class QLayoutItem;
35 35
36#include <qdialog.h> 36#include <qdialog.h>
37 37
38/** 38/**
39 * Dialog with extended nonmodal support and methods for OPIE standard 39 * Dialog with extended nonmodal support and methods for OPIE standard
40 * compliance. 40 * compliance.
41 * 41 *
42 * The @ref marginHint() and @ref spacingHint() sizes shall be used 42 * The @ref marginHint() and @ref spacingHint() sizes shall be used
43 * whenever you layout the interior of a dialog. One special note. If 43 * whenever you layout the interior of a dialog. One special note. If
44 * you make your own action buttons (OK, Cancel etc), the space 44 * you make your own action buttons (OK, Cancel etc), the space
45 * beteween the buttons shall be @ref spacingHint(), whereas the space 45 * beteween the buttons shall be @ref spacingHint(), whereas the space
46 * above, below, to the right and to the left shall be @ref marginHint(). 46 * above, below, to the right and to the left shall be @ref marginHint().
47 * If you add a separator line above the buttons, there shall be a 47 * If you add a separator line above the buttons, there shall be a
48 * @ref marginHint() between the buttons and the separator and a 48 * @ref marginHint() between the buttons and the separator and a
49 * @ref marginHint() above the separator as well. 49 * @ref marginHint() above the separator as well.
50 * 50 *
51 * @author Michael 'Mickey' Lauer <mickey@Vanille.de> 51 * @author Michael 'Mickey' Lauer <mickey@Vanille.de>
52 */ 52 */
53 53
54 // lets fix up Qt instead! Size does matter. -zecke 54 // lets fix up Qt instead! Size does matter. -zecke
55 // while that may be true, reducing maintainance effort for the future does also matter - 55 // while that may be true, reducing maintainance effort for the future does also matter -
56 // and I believe that maintaining a patch against QtE is more work than our classes -mml 56 // and I believe that maintaining a patch against QtE is more work than our classes -mml
57 57
58namespace Opie {
59namespace Ui {
60
58class ODialog : public QDialog 61class ODialog : public QDialog
59{ 62{
60 Q_OBJECT 63 Q_OBJECT
61 64
62 public: 65 public:
63 66
64 /** 67 /**
65 * Constructor. 68 * Constructor.
66 * 69 *
67 * Takes the same arguments as @ref QDialog. 70 * Takes the same arguments as @ref QDialog.
68 */ 71 */
69 ODialog(QWidget *parent = 0, const char *name = 0, bool modal = false, WFlags f = 0); 72 ODialog(QWidget *parent = 0, const char *name = 0, bool modal = false, WFlags f = 0);
70 73
71 /** 74 /**
72 * Return the number of pixels you shall use between a 75 * Return the number of pixels you shall use between a
73 * dialog edge and the outermost widget(s) according to the KDE standard. 76 * dialog edge and the outermost widget(s) according to the KDE standard.
74 **/ 77 **/
75 static int marginHint(); 78 static int marginHint();
76 79
77 /** 80 /**
78 * Return the number of pixels you shall use between 81 * Return the number of pixels you shall use between
79 * widgets inside a dialog according to the KDE standard. 82 * widgets inside a dialog according to the KDE standard.
80 */ 83 */
81 static int spacingHint(); 84 static int spacingHint();
82 85
83 private: 86 private:
84 static int mMarginSize; 87 static int mMarginSize;
85 static int mSpacingSize; 88 static int mSpacingSize;
86 89
87 class ODialogPrivate; 90 class ODialogPrivate;
88 ODialogPrivate *d; 91 ODialogPrivate *d;
89 92
90}; 93};
94}
95}
91#endif // ODIALOG_H 96#endif // ODIALOG_H
diff --git a/libopie2/opieui/ofontselector.cpp b/libopie2/opieui/ofontselector.cpp
index f93781f..b19c26e 100644
--- a/libopie2/opieui/ofontselector.cpp
+++ b/libopie2/opieui/ofontselector.cpp
@@ -17,118 +17,118 @@
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.=       =       ; Library General Public License for more 19..}^=.=       =       ; Library General Public License for more
20++=   -.     .`     .: details. 20++=   -.     .`     .: details.
21 :     =  ...= . :.=- 21 :     =  ...= . :.=-
22 -.   .:....=;==+<; You should have received a copy of the GNU 22 -.   .:....=;==+<; You should have received a copy of the GNU
23  -_. . .   )=.  = Library General Public License along with 23  -_. . .   )=.  = Library General Public License along with
24    --        :-=` this library; see the file COPYING.LIB. 24    --        :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28*/ 28*/
29 29
30/* OPIE */ 30/* OPIE */
31#include <opie2/ofontselector.h> 31#include <opie2/ofontselector.h>
32#include <qpe/fontdatabase.h> 32#include <qpe/fontdatabase.h>
33 33
34/* QT */ 34/* QT */
35#include <qlayout.h> 35#include <qlayout.h>
36#include <qlistbox.h> 36#include <qlistbox.h>
37#include <qcombobox.h> 37#include <qcombobox.h>
38#include <qlabel.h> 38#include <qlabel.h>
39#include <qmultilineedit.h> 39#include <qmultilineedit.h>
40 40
41using namespace Opie;
42 41
43namespace Opie 42namespace Opie {
44{ 43namespace Ui {
44namespace Private {
45 45
46class OFontSelectorPrivate 46class OFontSelectorPrivate
47{ 47{
48public: 48public:
49 QListBox * m_font_family_list; 49 QListBox * m_font_family_list;
50 QComboBox * m_font_style_list; 50 QComboBox * m_font_style_list;
51 QComboBox * m_font_size_list; 51 QComboBox * m_font_size_list;
52 QMultiLineEdit *m_preview; 52 QMultiLineEdit *m_preview;
53 53
54 bool m_pointbug : 1; 54 bool m_pointbug : 1;
55 55
56 FontDatabase m_fdb; 56 FontDatabase m_fdb;
57}; 57};
58 58
59};
60
61namespace
62{
63
64class FontListItem : public QListBoxText 59class FontListItem : public QListBoxText
65{ 60{
66public: 61public:
67 FontListItem ( const QString &t, const QStringList &styles, const QValueList<int> &sizes ) : QListBoxText() 62 FontListItem ( const QString &t, const QStringList &styles, const QValueList<int> &sizes ) : QListBoxText()
68 { 63 {
69 m_name = t; 64 m_name = t;
70 m_styles = styles; 65 m_styles = styles;
71 m_sizes = sizes; 66 m_sizes = sizes;
72 67
73 QString str = t; 68 QString str = t;
74 str [0] = str [0]. upper(); 69 str [0] = str [0]. upper();
75 setText ( str ); 70 setText ( str );
76 } 71 }
77 72
78 QString family() const 73 QString family() const
79 { 74 {
80 return m_name; 75 return m_name;
81 } 76 }
82 77
83 const QStringList &styles() const 78 const QStringList &styles() const
84 { 79 {
85 return m_styles; 80 return m_styles;
86 } 81 }
87 82
88 const QValueList<int> &sizes() const 83 const QValueList<int> &sizes() const
89 { 84 {
90 return m_sizes; 85 return m_sizes;
91 } 86 }
92 87
93private: 88private:
94 QStringList m_styles; 89 QStringList m_styles;
95 QValueList<int> m_sizes; 90 QValueList<int> m_sizes;
96 QString m_name; 91 QString m_name;
97}; 92};
93}
94}
95}
96
98 97
98using namespace Opie::Ui;
99using namespace Opie::Ui::Private;
99 100
100static int findItemCB( QComboBox *box, const QString &str ) 101static int findItemCB( QComboBox *box, const QString &str )
101{ 102{
102 for ( int i = 0; i < box->count(); i++ ) 103 for ( int i = 0; i < box->count(); i++ )
103 { 104 {
104 if ( box->text ( i ) == str ) 105 if ( box->text ( i ) == str )
105 return i; 106 return i;
106 } 107 }
107 return -1; 108 return -1;
108} 109}
109 110
110}
111/* static same as anon. namespace */ 111/* static same as anon. namespace */
112static int qt_version() 112static int qt_version()
113{ 113{
114 const char *qver = qVersion(); 114 const char *qver = qVersion();
115 115
116 return ( qver [0] - '0' ) * 100 + ( qver [2] - '0' ) * 10 + ( qver [4] - '0' ); 116 return ( qver [0] - '0' ) * 100 + ( qver [2] - '0' ) * 10 + ( qver [4] - '0' );
117} 117}
118 118
119/** 119/**
120 * Constructs the Selector object 120 * Constructs the Selector object
121 * @param withpreview If a font preview should be given 121 * @param withpreview If a font preview should be given
122 * @param parent The parent of the Font Selector 122 * @param parent The parent of the Font Selector
123 * @param name The name of the object 123 * @param name The name of the object
124 * @param fl WidgetFlags 124 * @param fl WidgetFlags
125 */ 125 */
126OFontSelector::OFontSelector( bool withpreview, QWidget *parent, const char *name, WFlags fl ) : QWidget ( parent, name, fl ) 126OFontSelector::OFontSelector( bool withpreview, QWidget *parent, const char *name, WFlags fl ) : QWidget ( parent, name, fl )
127{ 127{
128 d = new OFontSelectorPrivate(); 128 d = new OFontSelectorPrivate();
129 129
130 QGridLayout *gridLayout = new QGridLayout( this, 0, 0, 4, 4 ); 130 QGridLayout *gridLayout = new QGridLayout( this, 0, 0, 4, 4 );
131 gridLayout->setRowStretch( 4, 10 ); 131 gridLayout->setRowStretch( 4, 10 );
132 132
133 d->m_font_family_list = new QListBox( this, "FontListBox" ); 133 d->m_font_family_list = new QListBox( this, "FontListBox" );
134 gridLayout->addMultiCellWidget( d->m_font_family_list, 0, 4, 0, 0 ); 134 gridLayout->addMultiCellWidget( d->m_font_family_list, 0, 4, 0, 0 );
@@ -405,24 +405,25 @@ QFont OFontSelector::selectedFont()
405 { 405 {
406 return d->m_fdb. font ( fli->family(), \ 406 return d->m_fdb. font ( fli->family(), \
407 fst >= 0 ? fli->styles() [fst] : QString::null, \ 407 fst >= 0 ? fli->styles() [fst] : QString::null, \
408 fsi >= 0 ? fli->sizes() [fsi] : 10, \ 408 fsi >= 0 ? fli->sizes() [fsi] : 10, \
409 d->m_fdb. charSets ( fli->family()) [0] ); 409 d->m_fdb. charSets ( fli->family()) [0] );
410 } 410 }
411 else 411 else
412 return QFont(); 412 return QFont();
413} 413}
414 414
415void OFontSelector::resizeEvent ( QResizeEvent *re ) 415void OFontSelector::resizeEvent ( QResizeEvent *re )
416{ 416{
417 if ( d->m_preview ) 417 if ( d->m_preview )
418 { 418 {
419 d->m_preview->setMinimumHeight ( 1 ); 419 d->m_preview->setMinimumHeight ( 1 );
420 d->m_preview->setMaximumHeight ( 32767 ); 420 d->m_preview->setMaximumHeight ( 32767 );
421 } 421 }
422 422
423 QWidget::resizeEvent ( re ); 423 QWidget::resizeEvent ( re );
424 424
425 if ( d->m_preview ) 425 if ( d->m_preview )
426 d->m_preview->setFixedHeight ( d->m_preview->height()); 426 d->m_preview->setFixedHeight ( d->m_preview->height());
427 427
428} 428}
429
diff --git a/libopie2/opieui/ofontselector.h b/libopie2/opieui/ofontselector.h
index ad51819..1d97233 100644
--- a/libopie2/opieui/ofontselector.h
+++ b/libopie2/opieui/ofontselector.h
@@ -14,52 +14,53 @@
14    .i_,=:_.      -<s. This program is distributed in the hope that 14    .i_,=:_.      -<s. This program 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 18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.=       =       ; Library General Public License for more 19..}^=.=       =       ; Library General Public License for more
20++=   -.     .`     .: details. 20++=   -.     .`     .: details.
21 :     =  ...= . :.=- 21 :     =  ...= . :.=-
22 -.   .:....=;==+<; You should have received a copy of the GNU 22 -.   .:....=;==+<; You should have received a copy of the GNU
23  -_. . .   )=.  = Library General Public License along with 23  -_. . .   )=.  = Library General Public License along with
24    --        :-=` this library; see the file COPYING.LIB. 24    --        :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28*/ 28*/
29 29
30#ifndef OFONTSELECTOR_H 30#ifndef OFONTSELECTOR_H
31#define OFONTSELECTOR_H 31#define OFONTSELECTOR_H
32 32
33/* QT */ 33/* QT */
34#include <qwidget.h> 34#include <qwidget.h>
35 35
36class QListBox; 36class QListBox;
37 37
38namespace Opie 38namespace Opie {
39{ 39namespace Ui {
40 40namespace Private {
41class OFontSelectorPrivate; 41class OFontSelectorPrivate;
42}
42 43
43/** 44/**
44 * This class lets you chose a Font out of a list of Fonts. 45 * This class lets you chose a Font out of a list of Fonts.
45 * It can show a preview too. This selector will use all available 46 * It can show a preview too. This selector will use all available
46 * fonts 47 * fonts
47 * 48 *
48 * 49 *
49 * @short A widget to select a font 50 * @short A widget to select a font
50 * @see QWidget 51 * @see QWidget
51 * @see QFont 52 * @see QFont
52 * @author Rober Griebl 53 * @author Rober Griebl
53 */ 54 */
54class OFontSelector : public QWidget 55class OFontSelector : public QWidget
55{ 56{
56 Q_OBJECT 57 Q_OBJECT
57 58
58public: 59public:
59 OFontSelector ( bool withpreview, QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); 60 OFontSelector ( bool withpreview, QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
60 virtual ~OFontSelector ( ); 61 virtual ~OFontSelector ( );
61 62
62 bool selectedFont ( QString &family, QString &style, int &size ); 63 bool selectedFont ( QString &family, QString &style, int &size );
63 bool selectedFont ( QString &family, QString &style, int &size, QString &charset ); 64 bool selectedFont ( QString &family, QString &style, int &size, QString &charset );
64 65
65 QFont selectedFont ( ); 66 QFont selectedFont ( );
@@ -74,31 +75,32 @@ public:
74 75
75signals: 76signals:
76 /** 77 /**
77 * This signal gets emitted when a font got chosen 78 * This signal gets emitted when a font got chosen
78 */ 79 */
79 void fontSelected ( const QFont & ); 80 void fontSelected ( const QFont & );
80 81
81protected slots: 82protected slots:
82 /** @internal */ 83 /** @internal */
83 virtual void fontFamilyClicked ( int ); 84 virtual void fontFamilyClicked ( int );
84 /** @internal */ 85 /** @internal */
85 virtual void fontStyleClicked ( int ); 86 virtual void fontStyleClicked ( int );
86 /** @internal */ 87 /** @internal */
87 virtual void fontSizeClicked ( int ); 88 virtual void fontSizeClicked ( int );
88 89
89protected: 90protected:
90 virtual void resizeEvent ( QResizeEvent *re ); 91 virtual void resizeEvent ( QResizeEvent *re );
91 92
92private: 93private:
93 void loadFonts ( QListBox * ); 94 void loadFonts ( QListBox * );
94 95
95 void changeFont ( ); 96 void changeFont ( );
96 97
97private: 98private:
98 OFontSelectorPrivate *d; 99 Private::OFontSelectorPrivate *d;
99}; 100};
100 101
101}; 102}
103}
102 104
103#endif 105#endif
104 106
diff --git a/libopie2/opieui/oimageeffect.cpp b/libopie2/opieui/oimageeffect.cpp
index 9a58bb9..be47eb2 100644
--- a/libopie2/opieui/oimageeffect.cpp
+++ b/libopie2/opieui/oimageeffect.cpp
@@ -20,48 +20,52 @@ OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28*/ 28*/
29 29
30// $Id$ 30// $Id$
31 31
32#include <math.h> 32#include <math.h>
33 33
34#include <qimage.h> 34#include <qimage.h>
35#include <stdlib.h> 35#include <stdlib.h>
36 36
37#include <opie2/oimageeffect.h> 37#include <opie2/oimageeffect.h>
38#include <opie2/odebug.h> 38#include <opie2/odebug.h>
39 39
40#define MaxRGB 255L 40#define MaxRGB 255L
41#define DegreesToRadians(x) ((x)*M_PI/180.0) 41#define DegreesToRadians(x) ((x)*M_PI/180.0)
42 42
43using namespace std; 43using namespace std;
44using namespace Opie::Core;
45
46namespace Opie {
47namespace Ui {
44 48
45inline unsigned int intensityValue(unsigned int color) 49inline unsigned int intensityValue(unsigned int color)
46{ 50{
47 return((unsigned int)((0.299*qRed(color) + 51 return((unsigned int)((0.299*qRed(color) +
48 0.587*qGreen(color) + 52 0.587*qGreen(color) +
49 0.1140000000000001*qBlue(color)))); 53 0.1140000000000001*qBlue(color))));
50} 54}
51 55
52//====================================================================== 56//======================================================================
53// 57//
54// Gradient effects 58// Gradient effects
55// 59//
56//====================================================================== 60//======================================================================
57 61
58QImage OImageEffect::gradient(const QSize &size, const QColor &ca, 62QImage OImageEffect::gradient(const QSize &size, const QColor &ca,
59 const QColor &cb, GradientType eff, int ncols) 63 const QColor &cb, GradientType eff, int ncols)
60{ 64{
61 int rDiff, gDiff, bDiff; 65 int rDiff, gDiff, bDiff;
62 int rca, gca, bca, rcb, gcb, bcb; 66 int rca, gca, bca, rcb, gcb, bcb;
63 67
64 QImage image(size, 32); 68 QImage image(size, 32);
65 69
66 if (size.width() == 0 || size.height() == 0) { 70 if (size.width() == 0 || size.height() == 0) {
67 odebug << "WARNING: OImageEffect::gradient: invalid image" << oendl; 71 odebug << "WARNING: OImageEffect::gradient: invalid image" << oendl;
@@ -3744,25 +3748,26 @@ void OImageEffect::contrastHSV(QImage &img, bool sharpen)
3744 } 3748 }
3745 else{ 3749 else{
3746 count = img.numColors(); 3750 count = img.numColors();
3747 data = (unsigned int *)img.colorTable(); 3751 data = (unsigned int *)img.colorTable();
3748 } 3752 }
3749 for(i=0; i < count; ++i){ 3753 for(i=0; i < count; ++i){
3750 c.setRgb(data[i]); 3754 c.setRgb(data[i]);
3751 c.hsv(&h, &s, &v); 3755 c.hsv(&h, &s, &v);
3752 brightness = v/255.0; 3756 brightness = v/255.0;
3753 theta=(brightness-0.5)*M_PI; 3757 theta=(brightness-0.5)*M_PI;
3754 brightness+=scale*(((scale*((sin(theta)+1.0)))-brightness)*sign); 3758 brightness+=scale*(((scale*((sin(theta)+1.0)))-brightness)*sign);
3755 if (brightness > 1.0) 3759 if (brightness > 1.0)
3756 brightness=1.0; 3760 brightness=1.0;
3757 else 3761 else
3758 if (brightness < 0) 3762 if (brightness < 0)
3759 brightness=0.0; 3763 brightness=0.0;
3760 v = (int)(brightness*255); 3764 v = (int)(brightness*255);
3761 c.setHsv(h, s, v); 3765 c.setHsv(h, s, v);
3762 data[i] = qRgba(c.red(), c.green(), c.blue(), qAlpha(data[i])); 3766 data[i] = qRgba(c.red(), c.green(), c.blue(), qAlpha(data[i]));
3763 } 3767 }
3764} 3768}
3765 3769
3766 3770
3767 3771
3768 3772}
3773}
diff --git a/libopie2/opieui/oimageeffect.h b/libopie2/opieui/oimageeffect.h
index fb4d22d..4f86d5b 100644
--- a/libopie2/opieui/oimageeffect.h
+++ b/libopie2/opieui/oimageeffect.h
@@ -18,48 +18,50 @@ are met:
18 documentation and/or other materials provided with the distribution. 18 documentation and/or other materials provided with the distribution.
19 19
20THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 20THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
21IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 21IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
22OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 22OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 23IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
24INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 24INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 28(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 30
31*/ 31*/
32 32
33// $Id$ 33// $Id$
34 34
35#ifndef OIMAGEEFFECT_H 35#ifndef OIMAGEEFFECT_H
36#define OIMAGEEFFECT_H 36#define OIMAGEEFFECT_H
37 37
38class QImage; 38class QImage;
39class QSize; 39class QSize;
40class QColor; 40class QColor;
41 41
42namespace Opie {
43namespace Ui {
42/** 44/**
43 * This class includes various @ref QImage based graphical effects. 45 * This class includes various @ref QImage based graphical effects.
44 * 46 *
45 * Everything is 47 * Everything is
46 * static, so there is no need to create an instance of this class. You can 48 * static, so there is no need to create an instance of this class. You can
47 * just call the static methods. They are encapsulated here merely to provide 49 * just call the static methods. They are encapsulated here merely to provide
48 * a common namespace. 50 * a common namespace.
49 */ 51 */
50 52
51class OImageEffect 53class OImageEffect
52{ 54{
53public: 55public:
54 enum GradientType { VerticalGradient, HorizontalGradient, 56 enum GradientType { VerticalGradient, HorizontalGradient,
55 DiagonalGradient, CrossDiagonalGradient, 57 DiagonalGradient, CrossDiagonalGradient,
56 PyramidGradient, RectangleGradient, 58 PyramidGradient, RectangleGradient,
57 PipeCrossGradient, EllipticGradient }; 59 PipeCrossGradient, EllipticGradient };
58 enum RGBComponent { Red, Green, Blue, Gray, All }; 60 enum RGBComponent { Red, Green, Blue, Gray, All };
59 61
60 enum Lighting {NorthLite, NWLite, WestLite, SWLite, 62 enum Lighting {NorthLite, NWLite, WestLite, SWLite,
61 SouthLite, SELite, EastLite, NELite}; 63 SouthLite, SELite, EastLite, NELite};
62 64
63 enum ModulationType { Intensity, Saturation, HueShift, Contrast }; 65 enum ModulationType { Intensity, Saturation, HueShift, Contrast };
64 66
65 enum NoiseType { UniformNoise=0, GaussianNoise, MultiplicativeGaussianNoise, 67 enum NoiseType { UniformNoise=0, GaussianNoise, MultiplicativeGaussianNoise,
@@ -535,25 +537,28 @@ public:
535 unsigned int background = 0xFFFFFFFF); 537 unsigned int background = 0xFFFFFFFF);
536 538
537private: 539private:
538 540
539 /** 541 /**
540 * Helper function to fast calc some altered (lighten, shaded) colors 542 * Helper function to fast calc some altered (lighten, shaded) colors
541 * 543 *
542 */ 544 */
543 static unsigned int lHash(unsigned int c); 545 static unsigned int lHash(unsigned int c);
544 static unsigned int uHash(unsigned int c); 546 static unsigned int uHash(unsigned int c);
545 547
546 /** 548 /**
547 * Helper function to find the nearest color to the RBG triplet 549 * Helper function to find the nearest color to the RBG triplet
548 */ 550 */
549 static int nearestColor( int r, int g, int b, const QColor *pal, int size ); 551 static int nearestColor( int r, int g, int b, const QColor *pal, int size );
550 552
551 static void hull(const int x_offset, const int y_offset, const int polarity, 553 static void hull(const int x_offset, const int y_offset, const int polarity,
552 const int width, const int height, 554 const int width, const int height,
553 unsigned int *f, unsigned int *g); 555 unsigned int *f, unsigned int *g);
554 static unsigned int generateNoise(unsigned int pixel, NoiseType type); 556 static unsigned int generateNoise(unsigned int pixel, NoiseType type);
555 static unsigned int interpolateColor(QImage *image, double x, double y, 557 static unsigned int interpolateColor(QImage *image, double x, double y,
556 unsigned int background); 558 unsigned int background);
557}; 559};
558 560
561}
562}
563
559#endif 564#endif
diff --git a/libopie2/opieui/olistview.cpp b/libopie2/opieui/olistview.cpp
index 0ee2fde..38670b4 100644
--- a/libopie2/opieui/olistview.cpp
+++ b/libopie2/opieui/olistview.cpp
@@ -15,48 +15,53 @@
15    : ..    .:,     . . . without even the implied warranty of 15    : ..    .:,     . . . without even the implied warranty of
16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
18..}^=.=       =       ; Library General Public License for more 18..}^=.=       =       ; Library General Public License for more
19++=   -.     .`     .: details. 19++=   -.     .`     .: details.
20 :     =  ...= . :.=- 20 :     =  ...= . :.=-
21 -.   .:....=;==+<; You should have received a copy of the GNU 21 -.   .:....=;==+<; You should have received a copy of the GNU
22  -_. . .   )=.  = Library General Public License along with 22  -_. . .   )=.  = Library General Public License along with
23    --        :-=` this library; see the file COPYING.LIB. 23    --        :-=` this library; see the file COPYING.LIB.
24 If not, write to the Free Software Foundation, 24 If not, write to the Free Software Foundation,
25 Inc., 59 Temple Place - Suite 330, 25 Inc., 59 Temple Place - Suite 330,
26 Boston, MA 02111-1307, USA. 26 Boston, MA 02111-1307, USA.
27 27
28*/ 28*/
29 29
30/* QT */ 30/* QT */
31 31
32#include <qpixmap.h> 32#include <qpixmap.h>
33 33
34/* OPIE */ 34/* OPIE */
35 35
36#include <opie2/odebug.h> 36#include <opie2/odebug.h>
37#include <opie2/olistview.h> 37#include <opie2/olistview.h>
38 38
39using namespace Opie::Core;
40
41
42namespace Opie {
43namespace Ui {
39/*====================================================================================== 44/*======================================================================================
40 * OListView 45 * OListView
41 *======================================================================================*/ 46 *======================================================================================*/
42 47
43OListView::OListView( QWidget *parent, const char *name ) 48OListView::OListView( QWidget *parent, const char *name )
44 :QListView( parent, name ) 49 :QListView( parent, name )
45{ 50{
46 //FIXME: get from global settings and calculate ==> see oglobalsettings.* 51 //FIXME: get from global settings and calculate ==> see oglobalsettings.*
47 52
48 m_alternateBackground = QColor( 238, 246, 255 ); 53 m_alternateBackground = QColor( 238, 246, 255 );
49 m_columnSeparator = QPen( QColor( 150, 160, 170 ), 0, DotLine ); 54 m_columnSeparator = QPen( QColor( 150, 160, 170 ), 0, DotLine );
50 m_fullWidth = true; 55 m_fullWidth = true;
51 connect( this, SIGNAL(expanded(QListViewItem*)), SLOT(expand(QListViewItem*))); 56 connect( this, SIGNAL(expanded(QListViewItem*)), SLOT(expand(QListViewItem*)));
52} 57}
53 58
54OListView::~OListView() 59OListView::~OListView()
55{ 60{
56} 61}
57 62
58void OListView::setFullWidth( bool fullWidth ) 63void OListView::setFullWidth( bool fullWidth )
59{ 64{
60 m_fullWidth = m_fullWidth; 65 m_fullWidth = m_fullWidth;
61 #if QT_VERSION > 290 66 #if QT_VERSION > 290
62 header()->setStretchEnabled( fullWidth, columns()-1 ); 67 header()->setStretchEnabled( fullWidth, columns()-1 );
@@ -734,24 +739,26 @@ void ONamedListViewItem::setText( const QString& column, const QString& text )
734 //FIXME: I will optimize later by using a hash map. 739 //FIXME: I will optimize later by using a hash map.
735 int col = ( (ONamedListView*) listView() )->findColumn( column ); 740 int col = ( (ONamedListView*) listView() )->findColumn( column );
736 if ( col != -1 ) 741 if ( col != -1 )
737 OListViewItem::setText( col, text ); 742 OListViewItem::setText( col, text );
738 else 743 else
739 qWarning( "ONamedListViewItem::setText(): Warning! Columntext '%s' not found.", (const char*) column ); 744 qWarning( "ONamedListViewItem::setText(): Warning! Columntext '%s' not found.", (const char*) column );
740} 745}
741 746
742 747
743ONamedListViewItem* ONamedListViewItem::find( int column, const QString& text, int recurse ) const 748ONamedListViewItem* ONamedListViewItem::find( int column, const QString& text, int recurse ) const
744{ 749{
745 return ( (ONamedListView*) listView() )->find( (ONamedListViewItem*) firstChild(), column, text, recurse ); 750 return ( (ONamedListView*) listView() )->find( (ONamedListViewItem*) firstChild(), column, text, recurse );
746} 751}
747 752
748 753
749ONamedListViewItem* ONamedListViewItem::find( const QString& column, const QString& text, int recurse ) const 754ONamedListViewItem* ONamedListViewItem::find( const QString& column, const QString& text, int recurse ) const
750{ 755{
751 int col = ( (ONamedListView*) listView() )->findColumn( column ); 756 int col = ( (ONamedListView*) listView() )->findColumn( column );
752 if ( col != -1 ) 757 if ( col != -1 )
753 return ( (ONamedListView*) listView() )->find( (ONamedListViewItem*) firstChild(), col, text, recurse ); 758 return ( (ONamedListView*) listView() )->find( (ONamedListViewItem*) firstChild(), col, text, recurse );
754 else 759 else
755 return 0; 760 return 0;
756} 761}
757 762
763}
764}
diff --git a/libopie2/opieui/olistview.h b/libopie2/opieui/olistview.h
index 59b0973..8195a62 100644
--- a/libopie2/opieui/olistview.h
+++ b/libopie2/opieui/olistview.h
@@ -15,66 +15,70 @@
15    : ..    .:,     . . . without even the implied warranty of 15    : ..    .:,     . . . without even the implied warranty of
16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
18..}^=.=       =       ; Library General Public License for more 18..}^=.=       =       ; Library General Public License for more
19++=   -.     .`     .: details. 19++=   -.     .`     .: details.
20 :     =  ...= . :.=- 20 :     =  ...= . :.=-
21 -.   .:....=;==+<; You should have received a copy of the GNU 21 -.   .:....=;==+<; You should have received a copy of the GNU
22  -_. . .   )=.  = Library General Public License along with 22  -_. . .   )=.  = Library General Public License along with
23    --        :-=` this library; see the file COPYING.LIB. 23    --        :-=` this library; see the file COPYING.LIB.
24 If not, write to the Free Software Foundation, 24 If not, write to the Free Software Foundation,
25 Inc., 59 Temple Place - Suite 330, 25 Inc., 59 Temple Place - Suite 330,
26 Boston, MA 02111-1307, USA. 26 Boston, MA 02111-1307, USA.
27 27
28*/ 28*/
29 29
30#ifndef OLISTVIEW_H 30#ifndef OLISTVIEW_H
31#define OLISTVIEW_H 31#define OLISTVIEW_H
32 32
33#include <qcolor.h> 33#include <qcolor.h>
34#include <qlistview.h> 34#include <qlistview.h>
35#include <qpen.h> 35#include <qpen.h>
36#include <qdatastream.h> 36#include <qdatastream.h>
37#include <qstringlist.h> 37#include <qstringlist.h>
38 38
39
40namespace Opie {
41namespace Ui {
39class OListViewItem; 42class OListViewItem;
40 43
41 44
42/*====================================================================================== 45/*======================================================================================
43 * OListView 46 * OListView
44 *======================================================================================*/ 47 *======================================================================================*/
45 48
46/** 49/**
47 * @brief A list/tree widget. 50 * @brief A list/tree widget.
48 * 51 *
49 * A @ref QListView variant featuring visual and functional enhancements 52 * A @ref QListView variant featuring visual and functional enhancements
50 * like an alternate background for odd rows, an autostretch mode 53 * like an alternate background for odd rows, an autostretch mode
51 * for the width of the widget ( >= Qt 3 only ) and persistence capabilities. 54 * for the width of the widget ( >= Qt 3 only ) and persistence capabilities.
52 * 55 *
53 * @author Michael 'Mickey' Lauer <mickey@vanille.de> 56 * @author Michael 'Mickey' Lauer <mickey@vanille.de>
54 */ 57 */
55class OListView: public QListView 58class OListView: public QListView
56{ 59{
60 Q_OBJECT
57 public: 61 public:
58 /** 62 /**
59 * Constructor. 63 * Constructor.
60 * 64 *
61 * The parameters @a parent and @a name are handled by 65 * The parameters @a parent and @a name are handled by
62 * @ref QListView, as usual. 66 * @ref QListView, as usual.
63 */ 67 */
64 OListView( QWidget* parent = 0, const char* name = 0 ); 68 OListView( QWidget* parent = 0, const char* name = 0 );
65 /** 69 /**
66 * Destructor. 70 * Destructor.
67 */ 71 */
68 virtual ~OListView(); 72 virtual ~OListView();
69 /** 73 /**
70 * Let the last column fit exactly all the available width. 74 * Let the last column fit exactly all the available width.
71 */ 75 */
72 void setFullWidth( bool fullWidth ); 76 void setFullWidth( bool fullWidth );
73 /** 77 /**
74 * Returns whether the last column is set to fit the available width. 78 * Returns whether the last column is set to fit the available width.
75 */ 79 */
76 bool fullWidth() const; 80 bool fullWidth() const;
77 /** 81 /**
78 * Reimplemented for full width support 82 * Reimplemented for full width support
79 */ 83 */
80 virtual int addColumn( const QString& label, int width = -1 ); 84 virtual int addColumn( const QString& label, int width = -1 );
@@ -118,50 +122,52 @@ class OListView: public QListView
118 /** 122 /**
119 * Serialize this object from a @ref QDataStream @a stream 123 * Serialize this object from a @ref QDataStream @a stream
120 */ 124 */
121 virtual void serializeFrom( QDataStream& s ); 125 virtual void serializeFrom( QDataStream& s );
122#endif 126#endif
123 127
124 public slots: 128 public slots:
125 /** 129 /**
126 * Expand all items 130 * Expand all items
127 */ 131 */
128 void expand(); 132 void expand();
129 /** 133 /**
130 * Collapse all items 134 * Collapse all items
131 */ 135 */
132 void collapse(); 136 void collapse();
133 137
134 protected slots: 138 protected slots:
135 /** 139 /**
136 * expand the current OListViewItem 140 * expand the current OListViewItem
137 */ 141 */
138 void expand(QListViewItem*); 142 void expand(QListViewItem*);
139 143
140 private: 144 private:
141 QColor m_alternateBackground; 145 QColor m_alternateBackground;
142 bool m_fullWidth; 146 bool m_fullWidth : 1;
143 QPen m_columnSeparator; 147 QPen m_columnSeparator;
148 class Private;
149 Private *d;
144}; 150};
145 151
146#ifndef QT_NO_DATASTREAM 152#ifndef QT_NO_DATASTREAM
147/** 153/**
148 * @relates OListView 154 * @relates OListView
149 * Writes @a listview to the @a stream and returns a reference to the stream. 155 * Writes @a listview to the @a stream and returns a reference to the stream.
150 */ 156 */
151QDataStream& operator<<( QDataStream& stream, const OListView& listview ); 157QDataStream& operator<<( QDataStream& stream, const OListView& listview );
152/** 158/**
153 * @relates OListView 159 * @relates OListView
154 * Reads @a listview from the @a stream and returns a reference to the stream. 160 * Reads @a listview from the @a stream and returns a reference to the stream.
155 */ 161 */
156QDataStream& operator>>( QDataStream& stream, OListView& listview ); 162QDataStream& operator>>( QDataStream& stream, OListView& listview );
157#endif // QT_NO_DATASTREAM 163#endif // QT_NO_DATASTREAM
158 164
159/*====================================================================================== 165/*======================================================================================
160 * OListViewItem 166 * OListViewItem
161 *======================================================================================*/ 167 *======================================================================================*/
162 168
163class OListViewItem: public QListViewItem 169class OListViewItem: public QListViewItem
164{ 170{
165 friend class OCheckListItem; 171 friend class OCheckListItem;
166 public: 172 public:
167 /** 173 /**
@@ -221,50 +227,52 @@ class OListViewItem: public QListViewItem
221 * create a list view item as child of this object 227 * create a list view item as child of this object
222 * @returns the new object 228 * @returns the new object
223 */ 229 */
224 virtual OListViewItem* childFactory(); 230 virtual OListViewItem* childFactory();
225 #ifndef QT_NO_DATASTREAM 231 #ifndef QT_NO_DATASTREAM
226 /** 232 /**
227 * serialize this object to or from a @ref QDataStream 233 * serialize this object to or from a @ref QDataStream
228 * @param s the stream used to serialize this object. 234 * @param s the stream used to serialize this object.
229 */ 235 */
230 virtual void serializeTo( QDataStream& s ) const; 236 virtual void serializeTo( QDataStream& s ) const;
231 237
232 /** 238 /**
233 * serialize this object to or from a @ref QDataStream 239 * serialize this object to or from a @ref QDataStream
234 * @param s the stream used to serialize this object. 240 * @param s the stream used to serialize this object.
235 */ 241 */
236 virtual void serializeFrom( QDataStream& s ); 242 virtual void serializeFrom( QDataStream& s );
237 #endif 243 #endif
238 244
239 /** 245 /**
240 * expand the the item 246 * expand the the item
241 */ 247 */
242 virtual void expand(){}; 248 virtual void expand(){};
243 249
244 private: 250 private:
245 bool m_known; 251 bool m_known : 1;
246 bool m_odd; 252 bool m_odd : 1;
253 class Private;
254 Private *d;
247}; 255};
248 256
249#ifndef QT_NO_DATASTREAM 257#ifndef QT_NO_DATASTREAM
250/** 258/**
251 * @relates QListViewItem 259 * @relates QListViewItem
252 * Writes listview @a item and all subitems recursively to @a stream 260 * Writes listview @a item and all subitems recursively to @a stream
253 * and returns a reference to the stream. 261 * and returns a reference to the stream.
254 */ 262 */
255QDataStream& operator<<( QDataStream& stream, const OListViewItem& item ); 263QDataStream& operator<<( QDataStream& stream, const OListViewItem& item );
256/** 264/**
257 * @relates QListViewItem 265 * @relates QListViewItem
258 * Reads listview @a item from @a stream and returns a reference to the stream. 266 * Reads listview @a item from @a stream and returns a reference to the stream.
259 */ 267 */
260QDataStream& operator>>( QDataStream& stream, OListViewItem& item ); 268QDataStream& operator>>( QDataStream& stream, OListViewItem& item );
261#endif // QT_NO_DATASTREAM 269#endif // QT_NO_DATASTREAM
262 270
263 271
264/*====================================================================================== 272/*======================================================================================
265 * OCheckListItem 273 * OCheckListItem
266 *======================================================================================*/ 274 *======================================================================================*/
267 275
268class OCheckListItem : public QCheckListItem 276class OCheckListItem : public QCheckListItem
269{ 277{
270 public: 278 public:
@@ -333,48 +341,51 @@ class ONamedListView: public OListView
333 */ 341 */
334 virtual ~ONamedListView(); 342 virtual ~ONamedListView();
335 /** 343 /**
336 * Add a number of @a columns to the listview. 344 * Add a number of @a columns to the listview.
337 */ 345 */
338 virtual void addColumns( const QStringList& columns ); 346 virtual void addColumns( const QStringList& columns );
339 /** 347 /**
340 * @returns the column index matching to @a text or -1 if not found. 348 * @returns the column index matching to @a text or -1 if not found.
341 */ 349 */
342 virtual int findColumn( const QString& text ) const; 350 virtual int findColumn( const QString& text ) const;
343 /** 351 /**
344 * @returns the first item which has a @a text in column @a column. 352 * @returns the first item which has a @a text in column @a column.
345 * Set @a recurse to indicate how much subchild levels to search, e.g.<ul> 353 * Set @a recurse to indicate how much subchild levels to search, e.g.<ul>
346 * <li>set it to 0 to search only among direct childs, 354 * <li>set it to 0 to search only among direct childs,
347 * <li>set it to 1 to search direct childs and all 1st order subchilds 355 * <li>set it to 1 to search direct childs and all 1st order subchilds
348 * <li>set it to -1 for maximum recursion. 356 * <li>set it to -1 for maximum recursion.
349 * </ul> 357 * </ul>
350 * @sa ONamedListViewItem::find() 358 * @sa ONamedListViewItem::find()
351 */ 359 */
352 virtual ONamedListViewItem* find( ONamedListViewItem* start, int column, const QString& text, int recurse = -1 ) const; 360 virtual ONamedListViewItem* find( ONamedListViewItem* start, int column, const QString& text, int recurse = -1 ) const;
353 virtual ONamedListViewItem* find( int column, const QString& text, int recurse = -1 ) const; 361 virtual ONamedListViewItem* find( int column, const QString& text, int recurse = -1 ) const;
354 362
355 virtual ONamedListViewItem* find( ONamedListViewItem* start, const QString& column, const QString& text, int recurse = -1 ) const; 363 virtual ONamedListViewItem* find( ONamedListViewItem* start, const QString& column, const QString& text, int recurse = -1 ) const;
356 virtual ONamedListViewItem* find( const QString& column, const QString& text, int recurse = -1 ) const; 364 virtual ONamedListViewItem* find( const QString& column, const QString& text, int recurse = -1 ) const;
365 private:
366 class Private;
367 Private *d;
357}; 368};
358 369
359/*====================================================================================== 370/*======================================================================================
360 * ONamedListViewItem 371 * ONamedListViewItem
361 *======================================================================================*/ 372 *======================================================================================*/
362 373
363/** 374/**
364 * @brief An OListView variant with named columns. 375 * @brief An OListView variant with named columns.
365 * 376 *
366 * This class provides a higher-level interface to an OListViewItem. 377 * This class provides a higher-level interface to an OListViewItem.
367 * 378 *
368 * @author Michael 'Mickey' Lauer <mickey@vanille.de> 379 * @author Michael 'Mickey' Lauer <mickey@vanille.de>
369 */ 380 */
370class ONamedListViewItem: public OListViewItem 381class ONamedListViewItem: public OListViewItem
371{ 382{
372 public: 383 public:
373 /** 384 /**
374 * Constructor. Accepts the same parameters as a @ref OListViewItem, 385 * Constructor. Accepts the same parameters as a @ref OListViewItem,
375 * plus a @ref QStringList which holds an arbitrary number of @a texts. 386 * plus a @ref QStringList which holds an arbitrary number of @a texts.
376 */ 387 */
377 ONamedListViewItem( QListView* parent, const QStringList& texts ); 388 ONamedListViewItem( QListView* parent, const QStringList& texts );
378 ONamedListViewItem( QListViewItem* parent, const QStringList& texts ); 389 ONamedListViewItem( QListViewItem* parent, const QStringList& texts );
379 ONamedListViewItem( QListView* parent, QListViewItem* after, const QStringList& texts ); 390 ONamedListViewItem( QListView* parent, QListViewItem* after, const QStringList& texts );
380 ONamedListViewItem( QListViewItem* parent, QListViewItem* after, const QStringList& texts ); 391 ONamedListViewItem( QListViewItem* parent, QListViewItem* after, const QStringList& texts );
@@ -382,28 +393,34 @@ class ONamedListViewItem: public OListViewItem
382 * Destructor. 393 * Destructor.
383 */ 394 */
384 virtual ~ONamedListViewItem(); 395 virtual ~ONamedListViewItem();
385 /** 396 /**
386 * Sets the text in column @a column to @a text. 397 * Sets the text in column @a column to @a text.
387 * This method differs from @ref QListViewItem::setText() in that it 398 * This method differs from @ref QListViewItem::setText() in that it
388 * accepts a string as column indicator instead of an int. 399 * accepts a string as column indicator instead of an int.
389 */ 400 */
390 virtual void setText( const QString& column, const QString& text ); 401 virtual void setText( const QString& column, const QString& text );
391 /** 402 /**
392 * Sets a number of @a texts for this item. 403 * Sets a number of @a texts for this item.
393 */ 404 */
394 virtual void setText( const QStringList& texts ); 405 virtual void setText( const QStringList& texts );
395 /** 406 /**
396 * @returns the first child which has a @a text in column @a column. 407 * @returns the first child which has a @a text in column @a column.
397 * Set @a recurse to indicate how much subchild levels to search, e.g.<ul> 408 * Set @a recurse to indicate how much subchild levels to search, e.g.<ul>
398 * <li>set it to 0 to search only among direct childs, 409 * <li>set it to 0 to search only among direct childs,
399 * <li>set it to 1 to search direct childs and all 1st order subchilds 410 * <li>set it to 1 to search direct childs and all 1st order subchilds
400 * <li>set it to -1 for maximum recursion. 411 * <li>set it to -1 for maximum recursion.
401 * </ul> 412 * </ul>
402 * @sa ONamedListView::find() 413 * @sa ONamedListView::find()
403 */ 414 */
404 virtual ONamedListViewItem* find( int column, const QString& text, int recurse = -1 ) const; 415 virtual ONamedListViewItem* find( int column, const QString& text, int recurse = -1 ) const;
405 virtual ONamedListViewItem* find( const QString& column, const QString& text, int recurse = -1 ) const; 416 virtual ONamedListViewItem* find( const QString& column, const QString& text, int recurse = -1 ) const;
406};
407 417
418 private:
419 class Private;
420 Private *d;
421
422};
423}
424}
408 425
409#endif // OLISTVIEW_H 426#endif // OLISTVIEW_H
diff --git a/libopie2/opieui/opieui.pro b/libopie2/opieui/opieui.pro
index 1be8db5..e895edc 100644
--- a/libopie2/opieui/opieui.pro
+++ b/libopie2/opieui/opieui.pro
@@ -1,58 +1,55 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG += qt warn_on debug 2CONFIG += qt warn_on debug
3DESTDIR = $(OPIEDIR)/lib 3DESTDIR = $(OPIEDIR)/lib
4HEADERS = oclickablelabel.h \ 4HEADERS = oclickablelabel.h \
5 odialog.h \ 5 odialog.h \
6 ofontselector.h \ 6 ofontselector.h \
7 oimageeffect.h \ 7 oimageeffect.h \
8 olistview.h \ 8 olistview.h \
9 omessagebox.h \
10 opixmapeffect.h \ 9 opixmapeffect.h \
11 opopupmenu.h \ 10 opopupmenu.h \
12 opixmapprovider.h \ 11 opixmapprovider.h \
13 oresource.h \
14 oselector.h \ 12 oselector.h \
15 oseparator.h \ 13 oseparator.h \
16 otabinfo.h \ 14 otabinfo.h \
17 otabbar.h \ 15 otabbar.h \
18 otabwidget.h \ 16 otabwidget.h \
19 otaskbarapplet.h \ 17 otaskbarapplet.h \
20 oticker.h \ 18 oticker.h \
21 otimepicker.h \ 19 otimepicker.h \
22 oversatileview.h \ 20 oversatileview.h \
23 oversatileviewitem.h \ 21 oversatileviewitem.h \
24 owait.h 22 owait.h
25 23
26SOURCES = oclickablelabel.cpp \ 24SOURCES = oclickablelabel.cpp \
27 odialog.cpp \ 25 odialog.cpp \
28 ofontselector.cpp \ 26 ofontselector.cpp \
29 oimageeffect.cpp \ 27 oimageeffect.cpp \
30 olistview.cpp \ 28 olistview.cpp \
31 opixmapeffect.cpp \ 29 opixmapeffect.cpp \
32 opopupmenu.cpp \ 30 opopupmenu.cpp \
33 opixmapprovider.cpp \ 31 opixmapprovider.cpp \
34 oresource.cpp \
35 oselector.cpp \ 32 oselector.cpp \
36 oseparator.cpp \ 33 oseparator.cpp \
37 otabbar.cpp \ 34 otabbar.cpp \
38 otabwidget.cpp \ 35 otabwidget.cpp \
39 otaskbarapplet.cpp \ 36 otaskbarapplet.cpp \
40 oticker.cpp \ 37 oticker.cpp \
41 otimepicker.cpp \ 38 otimepicker.cpp \
42 oversatileview.cpp \ 39 oversatileview.cpp \
43 oversatileviewitem.cpp \ 40 oversatileviewitem.cpp \
44 owait.cpp 41 owait.cpp
45 42
46include ( big-screen/big-screen.pro ) 43include ( big-screen/big-screen.pro )
47include ( fileselector/fileselector.pro ) 44include ( fileselector/fileselector.pro )
48 45
49INTERFACES = otimepickerbase.ui 46INTERFACES = otimepickerbase.ui
50 47
51TARGET = opieui2 48TARGET = opieui2
52VERSION = 1.8.5 49VERSION = 1.8.5
53 50
54INCLUDEPATH += $(OPIEDIR)/include 51INCLUDEPATH += $(OPIEDIR)/include
55DEPENDPATH += $(OPIEDIR)/include 52DEPENDPATH += $(OPIEDIR)/include
56 53
57LIBS += -lopiecore2 54LIBS += -lopiecore2
58 55
diff --git a/libopie2/opieui/opixmapeffect.cpp b/libopie2/opieui/opixmapeffect.cpp
index 05f851d..794c7b2 100644
--- a/libopie2/opieui/opixmapeffect.cpp
+++ b/libopie2/opieui/opixmapeffect.cpp
@@ -1,43 +1,45 @@
1/* This file is part of the KDE libraries 1/* This file is part of the KDE libraries
2 Copyright (C) 1998, 1999 Christian Tibirna <ctibirna@total.net> 2 Copyright (C) 1998, 1999 Christian Tibirna <ctibirna@total.net>
3 (C) 1998, 1999 Daniel M. Duley <mosfet@kde.org> 3 (C) 1998, 1999 Daniel M. Duley <mosfet@kde.org>
4 (C) 1998, 1999 Dirk A. Mueller <mueller@kde.org> 4 (C) 1998, 1999 Dirk A. Mueller <mueller@kde.org>
5 5
6*/ 6*/
7 7
8// $Id$ 8// $Id$
9 9
10/* QT */ 10/* QT */
11 11
12#include <qimage.h> 12#include <qimage.h>
13#include <qpainter.h> 13#include <qpainter.h>
14 14
15/* OPIE */ 15/* OPIE */
16 16
17#include <opie2/opixmapeffect.h> 17#include <opie2/opixmapeffect.h>
18#include <opie2/oimageeffect.h> 18#include <opie2/oimageeffect.h>
19 19
20
21using namespace Opie::Ui;
20//====================================================================== 22//======================================================================
21// 23//
22// Gradient effects 24// Gradient effects
23// 25//
24//====================================================================== 26//======================================================================
25 27
26 28
27OPixmap& OPixmapEffect::gradient(OPixmap &pixmap, const QColor &ca, 29OPixmap& OPixmapEffect::gradient(OPixmap &pixmap, const QColor &ca,
28 const QColor &cb, GradientType eff, int ncols) 30 const QColor &cb, GradientType eff, int ncols)
29{ 31{
30 if(pixmap.depth() > 8 && 32 if(pixmap.depth() > 8 &&
31 (eff == VerticalGradient || eff == HorizontalGradient)) { 33 (eff == VerticalGradient || eff == HorizontalGradient)) {
32 34
33 int rDiff, gDiff, bDiff; 35 int rDiff, gDiff, bDiff;
34 int rca, gca, bca /*, rcb, gcb, bcb*/; 36 int rca, gca, bca /*, rcb, gcb, bcb*/;
35 37
36 register int x, y; 38 register int x, y;
37 39
38 rDiff = (/*rcb = */ cb.red()) - (rca = ca.red()); 40 rDiff = (/*rcb = */ cb.red()) - (rca = ca.red());
39 gDiff = (/*gcb = */ cb.green()) - (gca = ca.green()); 41 gDiff = (/*gcb = */ cb.green()) - (gca = ca.green());
40 bDiff = (/*bcb = */ cb.blue()) - (bca = ca.blue()); 42 bDiff = (/*bcb = */ cb.blue()) - (bca = ca.blue());
41 43
42 register int rl = rca << 16; 44 register int rl = rca << 16;
43 register int gl = gca << 16; 45 register int gl = gca << 16;
diff --git a/libopie2/opieui/opixmapeffect.h b/libopie2/opieui/opixmapeffect.h
index 283fe2d..b780f9f 100644
--- a/libopie2/opieui/opixmapeffect.h
+++ b/libopie2/opieui/opixmapeffect.h
@@ -1,41 +1,44 @@
1/* This file is part of the KDE libraries 1/* This file is part of the KDE libraries
2 Copyright (C) 1998, 1999 Christian Tibirna <ctibirna@total.net> 2 Copyright (C) 1998, 1999 Christian Tibirna <ctibirna@total.net>
3 (C) 1998, 1999 Daniel M. Duley <mosfet@kde.org> 3 (C) 1998, 1999 Daniel M. Duley <mosfet@kde.org>
4 (C) 1998, 1999 Dirk A. Mueller <mueller@kde.org> 4 (C) 1998, 1999 Dirk A. Mueller <mueller@kde.org>
5 5
6*/ 6*/
7 7
8// $Id$ 8// $Id$
9 9
10#ifndef __OPIXMAP_EFFECT_H 10#ifndef __OPIXMAP_EFFECT_H
11#define __OPIXMAP_EFFECT_H 11#define __OPIXMAP_EFFECT_H
12 12
13 13
14#include <qsize.h> 14#include <qsize.h>
15typedef QPixmap OPixmap; 15typedef QPixmap OPixmap;
16class QColor; 16class QColor;
17 17
18
19namespace Opie {
20namespace Ui {
18/** 21/**
19 * This class includes various pixmap-based graphical effects. 22 * This class includes various pixmap-based graphical effects.
20 * 23 *
21 * Everything is 24 * Everything is
22 * static, so there is no need to create an instance of this class. You can 25 * static, so there is no need to create an instance of this class. You can
23 * just call the static methods. They are encapsulated here merely to provide 26 * just call the static methods. They are encapsulated here merely to provide
24 * a common namespace. 27 * a common namespace.
25 */ 28 */
26class OPixmapEffect 29class OPixmapEffect
27{ 30{
28public: 31public:
29 enum GradientType { VerticalGradient, HorizontalGradient, 32 enum GradientType { VerticalGradient, HorizontalGradient,
30 DiagonalGradient, CrossDiagonalGradient, 33 DiagonalGradient, CrossDiagonalGradient,
31 PyramidGradient, RectangleGradient, 34 PyramidGradient, RectangleGradient,
32 PipeCrossGradient, EllipticGradient }; 35 PipeCrossGradient, EllipticGradient };
33 enum RGBComponent { Red, Green, Blue }; 36 enum RGBComponent { Red, Green, Blue };
34 37
35 enum Lighting {NorthLite, NWLite, WestLite, SWLite, 38 enum Lighting {NorthLite, NWLite, WestLite, SWLite,
36 SouthLite, SELite, EastLite, NELite}; 39 SouthLite, SELite, EastLite, NELite};
37 40
38 /** 41 /**
39 * Creates a gradient from color a to color b of the specified type. 42 * Creates a gradient from color a to color b of the specified type.
40 * 43 *
41 * @param pixmap The pixmap to process. 44 * @param pixmap The pixmap to process.
@@ -189,27 +192,28 @@ public:
189 * @param c A contrast value between -255 and 255. 192 * @param c A contrast value between -255 and 255.
190 * @return Returns the @ref pixmap(), provided for convenience. 193 * @return Returns the @ref pixmap(), provided for convenience.
191 */ 194 */
192 static OPixmap& contrast(OPixmap& pixmap, int c); 195 static OPixmap& contrast(OPixmap& pixmap, int c);
193 196
194 /** 197 /**
195 * Dithers a pixmap using Floyd-Steinberg dithering for low-color 198 * Dithers a pixmap using Floyd-Steinberg dithering for low-color
196 * situations. 199 * situations.
197 * 200 *
198 * @param pixmap The pixmap to process. 201 * @param pixmap The pixmap to process.
199 * @param palette The color palette to use. 202 * @param palette The color palette to use.
200 * @param size The size of the palette. 203 * @param size The size of the palette.
201 * @return Returns the @ref pixmap(), provided for convenience. 204 * @return Returns the @ref pixmap(), provided for convenience.
202 */ 205 */
203 static OPixmap& dither(OPixmap &pixmap, const QColor *palette, int size); 206 static OPixmap& dither(OPixmap &pixmap, const QColor *palette, int size);
204 207
205 /** 208 /**
206 * Calculate a 'selected' pixmap, for instance a selected icon 209 * Calculate a 'selected' pixmap, for instance a selected icon
207 * on the desktop. 210 * on the desktop.
208 * @param pixmap the pixmap to select 211 * @param pixmap the pixmap to select
209 * @param col the selected color, usually from QColorGroup::highlight(). 212 * @param col the selected color, usually from QColorGroup::highlight().
210 */ 213 */
211 static OPixmap selectedPixmap( const OPixmap &pixmap, const QColor &col ); 214 static OPixmap selectedPixmap( const OPixmap &pixmap, const QColor &col );
212}; 215};
213 216}
217}
214 218
215#endif 219#endif
diff --git a/libopie2/opieui/opixmapprovider.cpp b/libopie2/opieui/opixmapprovider.cpp
index 7be9e3b..7eb67a2 100644
--- a/libopie2/opieui/opixmapprovider.cpp
+++ b/libopie2/opieui/opixmapprovider.cpp
@@ -1,27 +1,29 @@
1/* This file is part of the KDE libraries 1/* This file is part of the KDE libraries
2 2
3 Copyright (c) 2000 Carsten Pfeiffer <pfeiffer@kde.org> 3 Copyright (c) 2000 Carsten Pfeiffer <pfeiffer@kde.org>
4 4
5 This library is free software; you can redistribute it and/or 5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public 6 modify it under the terms of the GNU Library General Public
7 License (LGPL) as published by the Free Software Foundation; either 7 License (LGPL) as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version. 8 version 2 of the License, or (at your option) any later version.
9 9
10 This library is distributed in the hope that it will be useful, 10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details. 13 Library General Public License for more details.
14 14
15 You should have received a copy of the GNU Library General Public License 15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to 16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20 20
21#include <opie2/opixmapprovider.h> 21#include <opie2/opixmapprovider.h>
22 22
23using namespace Opie::Ui;
24
23OPixmapProvider::~OPixmapProvider() {} 25OPixmapProvider::~OPixmapProvider() {}
24 26
25void OPixmapProvider::virtual_hook( int , void* ) 27void OPixmapProvider::virtual_hook( int , void* )
26{ /*BASE::virtual_hook( id, data );*/ } 28{ /*BASE::virtual_hook( id, data );*/ }
27 29
diff --git a/libopie2/opieui/opixmapprovider.h b/libopie2/opieui/opixmapprovider.h
index 5b76647..9d9bd69 100644
--- a/libopie2/opieui/opixmapprovider.h
+++ b/libopie2/opieui/opixmapprovider.h
@@ -2,53 +2,61 @@
2 2
3 Copyright (c) 2000 Carsten Pfeiffer <pfeiffer@kde.org> 3 Copyright (c) 2000 Carsten Pfeiffer <pfeiffer@kde.org>
4 4
5 This library is free software; you can redistribute it and/or 5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public 6 modify it under the terms of the GNU Library General Public
7 License (LGPL) as published by the Free Software Foundation; either 7 License (LGPL) as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version. 8 version 2 of the License, or (at your option) any later version.
9 9
10 This library is distributed in the hope that it will be useful, 10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details. 13 Library General Public License for more details.
14 14
15 You should have received a copy of the GNU Library General Public License 15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to 16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20 20
21#ifndef OPIXMAPPROVIDER_H 21#ifndef OPIXMAPPROVIDER_H
22#define OPIXMAPPROVIDER_H 22#define OPIXMAPPROVIDER_H
23 23
24#include <qpixmap.h> 24#include <qpixmap.h>
25 25
26namespace Opie {
27namespace Ui {
26/** 28/**
29 * \todo make usefull
27 * A tiny abstract class with just one method: 30 * A tiny abstract class with just one method:
28 * @ref pixmapFor() 31 * @ref pixmapFor()
29 * 32 *
30 * It will be called whenever an icon is searched for @p text. 33 * It will be called whenever an icon is searched for @p text.
31 * 34 *
32 * Used e.g. by @ref KHistoryCombo 35 * Used e.g. by @ref KHistoryCombo
33 * 36 *
34 * @author Carsten Pfeiffer <pfeiffer@kde.org> 37 * @author Carsten Pfeiffer <pfeiffer@kde.org>
35 * @short an abstract interface for looking up icons 38 * @short an abstract interface for looking up icons
36 */ 39 */
37class OPixmapProvider 40class OPixmapProvider
38{ 41{
39public: 42public:
40 virtual ~OPixmapProvider(); 43 virtual ~OPixmapProvider();
41 /** 44 /**
42 * You may subclass this and return a pixmap of size @p size for @p text. 45 * You may subclass this and return a pixmap of size @p size for @p text.
43 * @param text the text that is associated with the pixmap 46 * @param text the text that is associated with the pixmap
44 * @param size the size of the icon in pixels, 0 for defaylt size. 47 * @param size the size of the icon in pixels, 0 for defaylt size.
45 * See @ref KIcon::StdSize. 48 * See @ref KIcon::StdSize.
46 * @return the pixmap for the arguments, or null if there is none 49 * @return the pixmap for the arguments, or null if there is none
47 */ 50 */
48 virtual QPixmap pixmapFor( const QString& text, int size = 0 ) = 0; 51 virtual QPixmap pixmapFor( const QString& text, int size = 0 ) = 0;
49protected: 52protected:
50 virtual void virtual_hook( int id, void* data ); 53 virtual void virtual_hook( int id, void* data );
54private:
55 class Private;
56 Private *d;
51}; 57};
52 58
59}
60}
53 61
54#endif // OPIXMAPPROVIDER_H 62#endif // OPIXMAPPROVIDER_H
diff --git a/libopie2/opieui/opopupmenu.cpp b/libopie2/opieui/opopupmenu.cpp
index d5cc575..3ab8490 100644
--- a/libopie2/opieui/opopupmenu.cpp
+++ b/libopie2/opieui/opopupmenu.cpp
@@ -6,48 +6,51 @@
6 modify it under the terms of the GNU Library General Public 6 modify it under the terms of the GNU Library General Public
7 License version 2 as published by the Free Software Foundation. 7 License version 2 as published by the Free Software Foundation.
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/* QT */ 20/* QT */
21 21
22#include <qdrawutil.h> 22#include <qdrawutil.h>
23#include <qtimer.h> 23#include <qtimer.h>
24 24
25/* OPIE */ 25/* OPIE */
26 26
27#include <opie2/opopupmenu.h> 27#include <opie2/opopupmenu.h>
28#include <opie2/oconfig.h> 28#include <opie2/oconfig.h>
29 29
30using namespace Opie::Core;
31using namespace Opie::Ui;
32
30OPopupTitle::OPopupTitle(QWidget *parent, const char *name) 33OPopupTitle::OPopupTitle(QWidget *parent, const char *name)
31 : QWidget(parent, name) 34 : QWidget(parent, name)
32{ 35{
33 setMinimumSize(16, fontMetrics().height()+8); 36 setMinimumSize(16, fontMetrics().height()+8);
34} 37}
35 38
36OPopupTitle::OPopupTitle(OPixmapEffect::GradientType /* gradient */, 39OPopupTitle::OPopupTitle(OPixmapEffect::GradientType /* gradient */,
37 const QColor &/* color */, const QColor &/* textColor */, 40 const QColor &/* color */, const QColor &/* textColor */,
38 QWidget *parent, const char *name) 41 QWidget *parent, const char *name)
39 : QWidget(parent, name) 42 : QWidget(parent, name)
40{ 43{
41 setMinimumSize(16, fontMetrics().height()+8); 44 setMinimumSize(16, fontMetrics().height()+8);
42} 45}
43 46
44OPopupTitle::OPopupTitle(const OPixmap & /* background */, const QColor &/* color */, 47OPopupTitle::OPopupTitle(const OPixmap & /* background */, const QColor &/* color */,
45 const QColor &/* textColor */, QWidget *parent, 48 const QColor &/* textColor */, QWidget *parent,
46 const char *name) 49 const char *name)
47 : QWidget(parent, name) 50 : QWidget(parent, name)
48{ 51{
49 setMinimumSize(16, fontMetrics().height()+8); 52 setMinimumSize(16, fontMetrics().height()+8);
50} 53}
51 54
52void OPopupTitle::setTitle(const QString &text, const QPixmap *icon) 55void OPopupTitle::setTitle(const QString &text, const QPixmap *icon)
53{ 56{
diff --git a/libopie2/opieui/opopupmenu.h b/libopie2/opieui/opopupmenu.h
index 54e4301..419a954 100644
--- a/libopie2/opieui/opopupmenu.h
+++ b/libopie2/opieui/opopupmenu.h
@@ -10,48 +10,50 @@
10 10
11 This library is distributed in the hope that it will be useful, 11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details. 14 Library General Public License for more details.
15 15
16 You should have received a copy of the GNU Library General Public License 16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to 17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. 19 Boston, MA 02111-1307, USA.
20*/ 20*/
21#ifndef _OPOPUP_H 21#ifndef _OPOPUP_H
22#define _OPOPUP_H 22#define _OPOPUP_H
23 23
24#define INCLUDE_MENUITEM_DEF 24#define INCLUDE_MENUITEM_DEF
25 25
26/* QT */ 26/* QT */
27 27
28#include <qpopupmenu.h> 28#include <qpopupmenu.h>
29 29
30/* OPIE */ 30/* OPIE */
31 31
32#include <opie2/opixmapeffect.h> 32#include <opie2/opixmapeffect.h>
33 33
34namespace Opie {
35namespace Ui {
34/** 36/**
35 * Title widget for use in @ref OPopupMenu. 37 * Title widget for use in @ref OPopupMenu.
36 * 38 *
37 * You usually don't have to create this manually since 39 * You usually don't have to create this manually since
38 * @ref OPopupMenu::insertTitle will do it for you, but it is allowed if 40 * @ref OPopupMenu::insertTitle will do it for you, but it is allowed if
39 * you wish to customize it's look. 41 * you wish to customize it's look.
40 * 42 *
41 * @author Daniel M. Duley <mosfet@kde.org> 43 * @author Daniel M. Duley <mosfet@kde.org>
42 * @short OPopupMenu title widget. 44 * @short OPopupMenu title widget.
43 */ 45 */
44class OPopupTitle : public QWidget 46class OPopupTitle : public QWidget
45{ 47{
46 Q_OBJECT 48 Q_OBJECT
47 49
48public: 50public:
49 /** 51 /**
50 * Constructs a title widget with the user specified gradient, pixmap, 52 * Constructs a title widget with the user specified gradient, pixmap,
51 * and colors. 53 * and colors.
52 */ 54 */
53 OPopupTitle(QWidget *parent=0, const char *name=0); 55 OPopupTitle(QWidget *parent=0, const char *name=0);
54 /** 56 /**
55 * @deprecated 57 * @deprecated
56 * Constructs a title widget with the specified gradient and colors. 58 * Constructs a title widget with the specified gradient and colors.
57 */ 59 */
@@ -235,25 +237,28 @@ signals:
235 void aboutToShowContextMenu(OPopupMenu* menu, int menuItem, QPopupMenu* ctxMenu); 237 void aboutToShowContextMenu(OPopupMenu* menu, int menuItem, QPopupMenu* ctxMenu);
236 238
237protected: 239protected:
238 virtual void closeEvent(QCloseEvent *); 240 virtual void closeEvent(QCloseEvent *);
239 virtual void keyPressEvent(QKeyEvent* e); 241 virtual void keyPressEvent(QKeyEvent* e);
240 virtual bool eventFilter(QObject* obj, QEvent* event); 242 virtual bool eventFilter(QObject* obj, QEvent* event);
241 virtual void hideEvent(QHideEvent*); 243 virtual void hideEvent(QHideEvent*);
242 244
243 virtual void virtual_hook( int id, void* data ); 245 virtual void virtual_hook( int id, void* data );
244 246
245protected slots: 247protected slots:
246 /// @since 3.1 248 /// @since 3.1
247 QString underlineText(const QString& text, uint length); 249 QString underlineText(const QString& text, uint length);
248 /// @since 3.1 250 /// @since 3.1
249 void resetKeyboardVars(bool noMatches = false); 251 void resetKeyboardVars(bool noMatches = false);
250 void itemHighlighted(int whichItem); 252 void itemHighlighted(int whichItem);
251 void showCtxMenu(QPoint pos); 253 void showCtxMenu(QPoint pos);
252 void ctxMenuHiding(); 254 void ctxMenuHiding();
253 255
254private: 256private:
255 class OPopupMenuPrivate; 257 class OPopupMenuPrivate;
256 OPopupMenuPrivate *d; 258 OPopupMenuPrivate *d;
257}; 259};
258 260
261}
262}
263
259#endif 264#endif
diff --git a/libopie2/opieui/oselector.cpp b/libopie2/opieui/oselector.cpp
index 23b3ce3..5f6f10f 100644
--- a/libopie2/opieui/oselector.cpp
+++ b/libopie2/opieui/oselector.cpp
@@ -15,86 +15,88 @@
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/* QT */ 20/* QT */
21 21
22#include <qimage.h> 22#include <qimage.h>
23#include <qdrawutil.h> 23#include <qdrawutil.h>
24 24
25/* OPIE */ 25/* OPIE */
26 26
27#include <opie2/oimageeffect.h> 27#include <opie2/oimageeffect.h>
28#include <opie2/oselector.h> 28#include <opie2/oselector.h>
29 29
30#define STORE_W 8 30#define STORE_W 8
31#define STORE_W2 STORE_W * 2 31#define STORE_W2 STORE_W * 2
32 32
33//----------------------------------------------------------------------------- 33//-----------------------------------------------------------------------------
34/* 34/*
35 * 2D value selector. 35 * 2D value selector.
36 * The contents of the selector are drawn by derived class. 36 * The contents of the selector are drawn by derived class.
37 */ 37 */
38 38
39using namespace Opie::Ui;
40
39OXYSelector::OXYSelector( QWidget *parent, const char *name ) 41OXYSelector::OXYSelector( QWidget *parent, const char *name )
40 : QWidget( parent, name ) 42 : QWidget( parent, name )
41{ 43{
42 xPos = 0; 44 xPos = 0;
43 yPos = 0; 45 yPos = 0;
44 minX = 0; 46 minX = 0;
45 minY = 0; 47 minY = 0;
46 maxX = 100; 48 maxX = 100;
47 maxY = 100; 49 maxY = 100;
48 store.setOptimization( QPixmap::BestOptim ); 50 store.setOptimization( QPixmap::BestOptim );
49 store.resize( STORE_W2, STORE_W2 ); 51 store.resize( STORE_W2, STORE_W2 );
50} 52}
51 53
52 54
53OXYSelector::~OXYSelector() 55OXYSelector::~OXYSelector()
54{} 56{}
55 57
56 58
57void OXYSelector::setRange( int _minX, int _minY, int _maxX, int _maxY ) 59void OXYSelector::setRange( int _minX, int _minY, int _maxX, int _maxY )
58{ 60{
59 px = 2; 61 px = 2;
60 py = 2; 62 py = 2;
61 minX = _minX; 63 minX = _minX;
62 minY = _minY; 64 minY = _minY;
63 maxX = _maxX; 65 maxX = _maxX;
64 maxY = _maxY; 66 maxY = _maxY;
65} 67}
66 68
67void OXYSelector::setValues( int _xPos, int _yPos ) 69void OXYSelector::setValues( int _xPos, int _yPos )
68{ 70{
69 xPos = _xPos; 71 xPos = _xPos;
70 yPos = _yPos; 72 yPos = _yPos;
71 73
72 if ( xPos > maxX ) 74 if ( xPos > maxX )
73 xPos = maxX; 75 xPos = maxX;
74 else if ( xPos < minX ) 76 else if ( xPos < minX )
75 xPos = minX; 77 xPos = minX;
76 78
77 if ( yPos > maxY ) 79 if ( yPos > maxY )
78 yPos = maxY; 80 yPos = maxY;
79 else if ( yPos < minY ) 81 else if ( yPos < minY )
80 yPos = minY; 82 yPos = minY;
81 83
82 int xp = 2 + (width() - 4) * xPos / (maxX - minX); 84 int xp = 2 + (width() - 4) * xPos / (maxX - minX);
83 int yp = height() - 2 - (height() - 4) * yPos / (maxY - minY); 85 int yp = height() - 2 - (height() - 4) * yPos / (maxY - minY);
84 86
85 setPosition( xp, yp ); 87 setPosition( xp, yp );
86} 88}
87 89
88QRect OXYSelector::contentsRect() const 90QRect OXYSelector::contentsRect() const
89{ 91{
90 return QRect( 2, 2, width()-4, height()-4 ); 92 return QRect( 2, 2, width()-4, height()-4 );
91} 93}
92 94
93void OXYSelector::paintEvent( QPaintEvent *ev ) 95void OXYSelector::paintEvent( QPaintEvent *ev )
94{ 96{
95 QRect cursorRect( px - STORE_W, py - STORE_W, STORE_W2, STORE_W2); 97 QRect cursorRect( px - STORE_W, py - STORE_W, STORE_W2, STORE_W2);
96 QRect paintRect = ev->rect(); 98 QRect paintRect = ev->rect();
97 99
98 QPainter painter; 100 QPainter painter;
99 painter.begin( this ); 101 painter.begin( this );
100 102
@@ -237,82 +239,82 @@ QRect OSelector::contentsRect() const
237 return QRect( 5, 2, width()-10, height()-9 ); 239 return QRect( 5, 2, width()-10, height()-9 );
238} 240}
239 241
240void OSelector::paintEvent( QPaintEvent * ) 242void OSelector::paintEvent( QPaintEvent * )
241{ 243{
242 QPainter painter; 244 QPainter painter;
243 245
244 painter.begin( this ); 246 painter.begin( this );
245 247
246 drawContents( &painter ); 248 drawContents( &painter );
247 249
248 QBrush brush; 250 QBrush brush;
249 251
250 if ( indent() ) 252 if ( indent() )
251 { 253 {
252 if ( orientation() == Vertical ) 254 if ( orientation() == Vertical )
253 qDrawShadePanel( &painter, 0, 3, width()-5, height()-6, 255 qDrawShadePanel( &painter, 0, 3, width()-5, height()-6,
254 colorGroup(), TRUE, 2, &brush ); 256 colorGroup(), TRUE, 2, &brush );
255 else 257 else
256 qDrawShadePanel( &painter, 3, 0, width()-6, height()-5, 258 qDrawShadePanel( &painter, 3, 0, width()-6, height()-5,
257 colorGroup(), TRUE, 2, &brush ); 259 colorGroup(), TRUE, 2, &brush );
258 } 260 }
259 261
260 QPoint pos = calcArrowPos( value() ); 262 QPoint pos = calcArrowPos( value() );
261 drawArrow( &painter, TRUE, pos ); 263 drawArrow( &painter, TRUE, pos );
262 264
263 painter.end(); 265 painter.end();
264} 266}
265 267
266void OSelector::mousePressEvent( QMouseEvent *e ) 268void OSelector::mousePressEvent( QMouseEvent *e )
267{ 269{
268 moveArrow( e->pos() ); 270 moveArrow( e->pos() );
269} 271}
270 272
271void OSelector::mouseMoveEvent( QMouseEvent *e ) 273void OSelector::mouseMoveEvent( QMouseEvent *e )
272{ 274{
273 moveArrow( e->pos() ); 275 moveArrow( e->pos() );
274} 276}
275 277
276void OSelector::wheelEvent( QWheelEvent *e ) 278void OSelector::wheelEvent( QWheelEvent *e )
277{ 279{
278 int val = value() + e->delta()/120; 280 int val = value() + e->delta()/120;
279 emit valueChanged( val ); 281 emit valueChanged( val );
280 setValue( val ); 282 setValue( val );
281} 283}
282 284
283void OSelector::valueChange() 285void OSelector::valueChange()
284{ 286{
285 QPainter painter; 287 QPainter painter;
286 QPoint pos; 288 QPoint pos;
287 289
288 painter.begin( this ); 290 painter.begin( this );
289 291
290 pos = calcArrowPos( prevValue() ); 292 pos = calcArrowPos( prevValue() );
291 drawArrow( &painter, FALSE, pos ); 293 drawArrow( &painter, FALSE, pos );
292 294
293 pos = calcArrowPos( value() ); 295 pos = calcArrowPos( value() );
294 drawArrow( &painter, TRUE, pos ); 296 drawArrow( &painter, TRUE, pos );
295 297
296 painter.end(); 298 painter.end();
297} 299}
298 300
299void OSelector::moveArrow( const QPoint &pos ) 301void OSelector::moveArrow( const QPoint &pos )
300{ 302{
301 int val; 303 int val;
302 304
303 if ( orientation() == Vertical ) 305 if ( orientation() == Vertical )
304 val = ( maxValue() - minValue() ) * (height()-pos.y()-3) 306 val = ( maxValue() - minValue() ) * (height()-pos.y()-3)
305 / (height()-10) + minValue(); 307 / (height()-10) + minValue();
306 else 308 else
307 val = ( maxValue() - minValue() ) * (width()-pos.x()-3) 309 val = ( maxValue() - minValue() ) * (width()-pos.x()-3)
308 / (width()-10) + minValue(); 310 / (width()-10) + minValue();
309 311
310 if ( val > maxValue() ) 312 if ( val > maxValue() )
311 val = maxValue(); 313 val = maxValue();
312 if ( val < minValue() ) 314 if ( val < minValue() )
313 val = minValue(); 315 val = minValue();
314 316
315 emit valueChanged( val ); 317 emit valueChanged( val );
316 setValue( val ); 318 setValue( val );
317} 319}
318 320
@@ -340,88 +342,88 @@ void OSelector::drawContents( QPainter * )
340{} 342{}
341 343
342void OSelector::drawArrow( QPainter *painter, bool show, const QPoint &pos ) 344void OSelector::drawArrow( QPainter *painter, bool show, const QPoint &pos )
343{ 345{
344 if ( show ) 346 if ( show )
345 { 347 {
346 QPointArray array(3); 348 QPointArray array(3);
347 349
348 painter->setPen( QPen() ); 350 painter->setPen( QPen() );
349 painter->setBrush( QBrush( colorGroup().buttonText() ) ); 351 painter->setBrush( QBrush( colorGroup().buttonText() ) );
350 if ( orientation() == Vertical ) 352 if ( orientation() == Vertical )
351 { 353 {
352 array.setPoint( 0, pos.x()+0, pos.y()+0 ); 354 array.setPoint( 0, pos.x()+0, pos.y()+0 );
353 array.setPoint( 1, pos.x()+5, pos.y()+5 ); 355 array.setPoint( 1, pos.x()+5, pos.y()+5 );
354 array.setPoint( 2, pos.x()+5, pos.y()-5 ); 356 array.setPoint( 2, pos.x()+5, pos.y()-5 );
355 } 357 }
356 else 358 else
357 { 359 {
358 array.setPoint( 0, pos.x()+0, pos.y()+0 ); 360 array.setPoint( 0, pos.x()+0, pos.y()+0 );
359 array.setPoint( 1, pos.x()+5, pos.y()+5 ); 361 array.setPoint( 1, pos.x()+5, pos.y()+5 );
360 array.setPoint( 2, pos.x()-5, pos.y()+5 ); 362 array.setPoint( 2, pos.x()-5, pos.y()+5 );
361 } 363 }
362 364
363 painter->drawPolygon( array ); 365 painter->drawPolygon( array );
364 } 366 }
365 else 367 else
366 { 368 {
367 if ( orientation() == Vertical ) 369 if ( orientation() == Vertical )
368 { 370 {
369 repaint(pos.x(), pos.y()-5, 6, 11, true); 371 repaint(pos.x(), pos.y()-5, 6, 11, true);
370 } 372 }
371 else 373 else
372 { 374 {
373 repaint(pos.x()-5, pos.y(), 11, 6, true); 375 repaint(pos.x()-5, pos.y(), 11, 6, true);
374 } 376 }
375 } 377 }
376} 378}
377 379
378//---------------------------------------------------------------------------- 380//----------------------------------------------------------------------------
379 381
380OGradientSelector::OGradientSelector( QWidget *parent, const char *name ) 382OGradientSelector::OGradientSelector( QWidget *parent, const char *name )
381 : OSelector( parent, name ) 383 : OSelector( parent, name )
382{ 384{
383 init(); 385 init();
384} 386}
385 387
386 388
387OGradientSelector::OGradientSelector( Orientation o, QWidget *parent, 389OGradientSelector::OGradientSelector( Orientation o, QWidget *parent,
388 const char *name ) 390 const char *name )
389 : OSelector( o, parent, name ) 391 : OSelector( o, parent, name )
390{ 392{
391 init(); 393 init();
392} 394}
393 395
394 396
395OGradientSelector::~OGradientSelector() 397OGradientSelector::~OGradientSelector()
396{} 398{}
397 399
398 400
399void OGradientSelector::init() 401void OGradientSelector::init()
400{ 402{
401 color1.setRgb( 0, 0, 0 ); 403 color1.setRgb( 0, 0, 0 );
402 color2.setRgb( 255, 255, 255 ); 404 color2.setRgb( 255, 255, 255 );
403 405
404 text1 = text2 = ""; 406 text1 = text2 = "";
405} 407}
406 408
407 409
408void OGradientSelector::drawContents( QPainter *painter ) 410void OGradientSelector::drawContents( QPainter *painter )
409{ 411{
410 QImage image( contentsRect().width(), contentsRect().height(), 32 ); 412 QImage image( contentsRect().width(), contentsRect().height(), 32 );
411 413
412 QColor col; 414 QColor col;
413 float scale; 415 float scale;
414 416
415 int redDiff = color2.red() - color1.red(); 417 int redDiff = color2.red() - color1.red();
416 int greenDiff = color2.green() - color1.green(); 418 int greenDiff = color2.green() - color1.green();
417 int blueDiff = color2.blue() - color1.blue(); 419 int blueDiff = color2.blue() - color1.blue();
418 420
419 if ( orientation() == Vertical ) 421 if ( orientation() == Vertical )
420 { 422 {
421 for ( int y = 0; y < image.height(); y++ ) 423 for ( int y = 0; y < image.height(); y++ )
422 { 424 {
423 scale = 1.0 * y / image.height(); 425 scale = 1.0 * y / image.height();
424 col.setRgb( color1.red() + int(redDiff*scale), 426 col.setRgb( color1.red() + int(redDiff*scale),
425 color1.green() + int(greenDiff*scale), 427 color1.green() + int(greenDiff*scale),
426 color1.blue() + int(blueDiff*scale) ); 428 color1.blue() + int(blueDiff*scale) );
427 429
@@ -451,49 +453,49 @@ void OGradientSelector::drawContents( QPainter *painter )
451 QColor ditherPalette[8]; 453 QColor ditherPalette[8];
452 454
453 for ( int s = 0; s < 8; s++ ) 455 for ( int s = 0; s < 8; s++ )
454 ditherPalette[s].setRgb( color1.red() + redDiff * s / 8, 456 ditherPalette[s].setRgb( color1.red() + redDiff * s / 8,
455 color1.green() + greenDiff * s / 8, 457 color1.green() + greenDiff * s / 8,
456 color1.blue() + blueDiff * s / 8 ); 458 color1.blue() + blueDiff * s / 8 );
457 459
458 OImageEffect::dither( image, ditherPalette, 8 ); 460 OImageEffect::dither( image, ditherPalette, 8 );
459 461
460 QPixmap p; 462 QPixmap p;
461 p.convertFromImage( image ); 463 p.convertFromImage( image );
462 464
463 painter->drawPixmap( contentsRect().x(), contentsRect().y(), p ); 465 painter->drawPixmap( contentsRect().x(), contentsRect().y(), p );
464 466
465 if ( orientation() == Vertical ) 467 if ( orientation() == Vertical )
466 { 468 {
467 int yPos = contentsRect().top() + painter->fontMetrics().ascent() + 2; 469 int yPos = contentsRect().top() + painter->fontMetrics().ascent() + 2;
468 int xPos = contentsRect().left() + (contentsRect().width() - 470 int xPos = contentsRect().left() + (contentsRect().width() -
469 painter->fontMetrics().width( text2 )) / 2; 471 painter->fontMetrics().width( text2 )) / 2;
470 QPen pen( color2 ); 472 QPen pen( color2 );
471 painter->setPen( pen ); 473 painter->setPen( pen );
472 painter->drawText( xPos, yPos, text2 ); 474 painter->drawText( xPos, yPos, text2 );
473 475
474 yPos = contentsRect().bottom() - painter->fontMetrics().descent() - 2; 476 yPos = contentsRect().bottom() - painter->fontMetrics().descent() - 2;
475 xPos = contentsRect().left() + (contentsRect().width() - 477 xPos = contentsRect().left() + (contentsRect().width() -
476 painter->fontMetrics().width( text1 )) / 2; 478 painter->fontMetrics().width( text1 )) / 2;
477 pen.setColor( color1 ); 479 pen.setColor( color1 );
478 painter->setPen( pen ); 480 painter->setPen( pen );
479 painter->drawText( xPos, yPos, text1 ); 481 painter->drawText( xPos, yPos, text1 );
480 } 482 }
481 else 483 else
482 { 484 {
483 int yPos = contentsRect().bottom()-painter->fontMetrics().descent()-2; 485 int yPos = contentsRect().bottom()-painter->fontMetrics().descent()-2;
484 486
485 QPen pen( color2 ); 487 QPen pen( color2 );
486 painter->setPen( pen ); 488 painter->setPen( pen );
487 painter->drawText( contentsRect().left() + 2, yPos, text1 ); 489 painter->drawText( contentsRect().left() + 2, yPos, text1 );
488 490
489 pen.setColor( color1 ); 491 pen.setColor( color1 );
490 painter->setPen( pen ); 492 painter->setPen( pen );
491 painter->drawText( contentsRect().right() - 493 painter->drawText( contentsRect().right() -
492 painter->fontMetrics().width( text2 ) - 2, yPos, text2 ); 494 painter->fontMetrics().width( text2 ) - 2, yPos, text2 );
493 } 495 }
494} 496}
495 497
496//----------------------------------------------------------------------------- 498//-----------------------------------------------------------------------------
497 499
498static QColor *standardPalette = 0; 500static QColor *standardPalette = 0;
499 501
diff --git a/libopie2/opieui/oselector.h b/libopie2/opieui/oselector.h
index f832239..fe75a46 100644
--- a/libopie2/opieui/oselector.h
+++ b/libopie2/opieui/oselector.h
@@ -6,48 +6,51 @@
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// Selector widgets for KDE Color Selector, but probably useful for other 20// Selector widgets for KDE Color Selector, but probably useful for other
21// stuff also. 21// stuff also.
22 22
23#ifndef __OSELECT_H__ 23#ifndef __OSELECT_H__
24#define __OSELECT_H__ 24#define __OSELECT_H__
25 25
26#include <qwidget.h> 26#include <qwidget.h>
27#include <qrangecontrol.h> 27#include <qrangecontrol.h>
28#include <qpixmap.h> 28#include <qpixmap.h>
29 29
30
31namespace Opie {
32namespace Ui {
30/** 33/**
31 * OXYSelector is the base class for other widgets which 34 * OXYSelector is the base class for other widgets which
32 * provides the ability to choose from a two-dimensional 35 * provides the ability to choose from a two-dimensional
33 * range of values. The currently chosen value is indicated 36 * range of values. The currently chosen value is indicated
34 * by a cross. An example is the @ref OHSSelector which 37 * by a cross. An example is the @ref OHSSelector which
35 * allows to choose from a range of colors, and which is 38 * allows to choose from a range of colors, and which is
36 * used in OColorDialog. 39 * used in OColorDialog.
37 * 40 *
38 * A custom drawing routine for the widget surface has 41 * A custom drawing routine for the widget surface has
39 * to be provided by the subclass. 42 * to be provided by the subclass.
40 */ 43 */
41class OXYSelector : public QWidget 44class OXYSelector : public QWidget
42{ 45{
43 Q_OBJECT 46 Q_OBJECT
44 47
45public: 48public:
46 /** 49 /**
47 * Constructs a two-dimensional selector widget which 50 * Constructs a two-dimensional selector widget which
48 * has a value range of [0..100] in both directions. 51 * has a value range of [0..100] in both directions.
49 */ 52 */
50 OXYSelector( QWidget *parent=0, const char *name=0 ); 53 OXYSelector( QWidget *parent=0, const char *name=0 );
51 /** 54 /**
52 * Destructs the widget. 55 * Destructs the widget.
53 */ 56 */
@@ -491,28 +494,30 @@ public:
491 OColor( const QColor &col); 494 OColor( const QColor &col);
492 495
493 OColor& operator=( const OColor& col); 496 OColor& operator=( const OColor& col);
494 497
495 bool operator==( const OColor& col) const; 498 bool operator==( const OColor& col) const;
496 499
497 void setHsv(int _h, int _s, int _v); 500 void setHsv(int _h, int _s, int _v);
498 void setRgb(int _r, int _g, int _b); 501 void setRgb(int _r, int _g, int _b);
499 502
500 void rgb(int *_r, int *_g, int *_b) const; 503 void rgb(int *_r, int *_g, int *_b) const;
501 void hsv(int *_h, int *_s, int *_v) const; 504 void hsv(int *_h, int *_s, int *_v) const;
502protected: 505protected:
503 int h; 506 int h;
504 int s; 507 int s;
505 int v; 508 int v;
506 int r; 509 int r;
507 int g; 510 int g;
508 int b; 511 int b;
509 512
510private: 513private:
511 class OColorPrivate; 514 class OColorPrivate;
512 OColorPrivate *d; 515 OColorPrivate *d;
513}; 516};
514 517
518}
519}
515 520
516 521
517 #endif // __OSELECT_H__ 522 #endif // __OSELECT_H__
518 523
diff --git a/libopie2/opieui/oseparator.cpp b/libopie2/opieui/oseparator.cpp
index b93c225..bbc4381 100644
--- a/libopie2/opieui/oseparator.cpp
+++ b/libopie2/opieui/oseparator.cpp
@@ -15,48 +15,50 @@
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;
40using namespace Opie::Ui;
39 41
40OSeparator::OSeparator(QWidget* parent, const char* name, WFlags f) 42OSeparator::OSeparator(QWidget* parent, const char* name, WFlags f)
41 : QFrame(parent, name, f) 43 : QFrame(parent, name, f)
42{ 44{
43 setLineWidth(1); 45 setLineWidth(1);
44 setMidLineWidth(0); 46 setMidLineWidth(0);
45 setOrientation( HLine ); 47 setOrientation( HLine );
46} 48}
47 49
48 50
49 51
50OSeparator::OSeparator(int orientation, QWidget* parent, const char* name, WFlags f) 52OSeparator::OSeparator(int orientation, QWidget* parent, const char* name, WFlags f)
51 : QFrame(parent, name, f) 53 : QFrame(parent, name, f)
52{ 54{
53 setLineWidth(1); 55 setLineWidth(1);
54 setMidLineWidth(0); 56 setMidLineWidth(0);
55 setOrientation( orientation ); 57 setOrientation( orientation );
56} 58}
57 59
58 60
59 61
60void OSeparator::setOrientation(int orientation) 62void OSeparator::setOrientation(int orientation)
61{ 63{
62 switch(orientation) 64 switch(orientation)
diff --git a/libopie2/opieui/oseparator.h b/libopie2/opieui/oseparator.h
index e59b3f4..6fc4344 100644
--- a/libopie2/opieui/oseparator.h
+++ b/libopie2/opieui/oseparator.h
@@ -14,48 +14,51 @@
14     ._= =}       : or (at your option) any later version. 14     ._= =}       : or (at your option) any later version.
15    .%`+i>       _;_. 15    .%`+i>       _;_.
16    .i_,=:_.      -<s. This program is distributed in the hope that 16    .i_,=:_.      -<s. This program is distributed in the hope that
17     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 17     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
18    : ..    .:,     . . . without even the implied warranty of 18    : ..    .:,     . . . without even the implied warranty of
19    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 19    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
20  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 20  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
21..}^=.=       =       ; Library General Public License for more 21..}^=.=       =       ; Library General Public License for more
22++=   -.     .`     .: details. 22++=   -.     .`     .: details.
23 :     =  ...= . :.=- 23 :     =  ...= . :.=-
24 -.   .:....=;==+<; You should have received a copy of the GNU 24 -.   .:....=;==+<; You should have received a copy of the GNU
25  -_. . .   )=.  = Library General Public License along with 25  -_. . .   )=.  = Library General Public License along with
26    --        :-=` this library; see the file COPYING.LIB. 26    --        :-=` this library; see the file COPYING.LIB.
27 If not, write to the Free Software Foundation, 27 If not, write to the Free Software Foundation,
28 Inc., 59 Temple Place - Suite 330, 28 Inc., 59 Temple Place - Suite 330,
29 Boston, MA 02111-1307, USA. 29 Boston, MA 02111-1307, USA.
30 30
31*/ 31*/
32 32
33#ifndef OSEPARATOR_H 33#ifndef OSEPARATOR_H
34#define OSEPARATOR_H 34#define OSEPARATOR_H
35 35
36#include <qframe.h> 36#include <qframe.h>
37 37
38namespace Opie {
39namespace Ui {
40
38/** 41/**
39 * Standard horizontal or vertical separator. 42 * Standard horizontal or vertical separator.
40 * 43 *
41 * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> 44 * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de>
42 * @author Michael Roth <mroth@wirlweb.de> 45 * @author Michael Roth <mroth@wirlweb.de>
43 * @version $Id$ 46 * @version $Id$
44*/ 47*/
45class OSeparator : public QFrame 48class OSeparator : public QFrame
46{ 49{
47 Q_OBJECT 50 Q_OBJECT
48 Q_PROPERTY( int orientation READ orientation WRITE setOrientation ) 51 Q_PROPERTY( int orientation READ orientation WRITE setOrientation )
49 public: 52 public:
50 /** 53 /**
51 * Constructor. 54 * Constructor.
52 **/ 55 **/
53 OSeparator(QWidget* parent=0, const char* name=0, WFlags f=0); 56 OSeparator(QWidget* parent=0, const char* name=0, WFlags f=0);
54 /** 57 /**
55 * Constructor. 58 * Constructor.
56 * 59 *
57 * @param orientation Set the orientation of the separator. 60 * @param orientation Set the orientation of the separator.
58 * Possible values are HLine or Horizontal and VLine or Vertical. 61 * Possible values are HLine or Horizontal and VLine or Vertical.
59 **/ 62 **/
60 OSeparator(int orientation, QWidget* parent=0, const char* name=0, 63 OSeparator(int orientation, QWidget* parent=0, const char* name=0,
61 WFlags f=0); 64 WFlags f=0);
@@ -65,26 +68,28 @@ class OSeparator : public QFrame
65 * 68 *
66 * Possible values are VLine and HLine. 69 * Possible values are VLine and HLine.
67 **/ 70 **/
68 int orientation() const; 71 int orientation() const;
69 72
70 /** 73 /**
71 * Set the orientation of the separator to @p orient 74 * Set the orientation of the separator to @p orient
72 * 75 *
73 * Possible values are VLine and HLine. 76 * Possible values are VLine and HLine.
74 */ 77 */
75 void setOrientation(int orient); 78 void setOrientation(int orient);
76 79
77 /** 80 /**
78 * The recommended height (width) for a horizontal (vertical) separator. 81 * The recommended height (width) for a horizontal (vertical) separator.
79 **/ 82 **/
80 virtual QSize sizeHint() const; 83 virtual QSize sizeHint() const;
81 84
82protected: 85protected:
83 virtual void drawFrame( QPainter * ); 86 virtual void drawFrame( QPainter * );
84 87
85private: 88private:
86 class OSeparatorPrivate* d; 89 class OSeparatorPrivate* d;
87}; 90};
88 91
92}
93}
89 94
90#endif // OSEPARATOR_H 95#endif // OSEPARATOR_H
diff --git a/libopie2/opieui/otabbar.cpp b/libopie2/opieui/otabbar.cpp
index cd3a34b..a62e18b 100644
--- a/libopie2/opieui/otabbar.cpp
+++ b/libopie2/opieui/otabbar.cpp
@@ -10,49 +10,49 @@
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#include <opie2/otabbar.h> 32#include <opie2/otabbar.h>
33 33
34using namespace Opie; 34using namespace Opie::Ui;
35 35
36OTabBar::OTabBar( QWidget *parent , const char *name ) 36OTabBar::OTabBar( QWidget *parent , const char *name )
37 :QTabBar( parent, name ) 37 :QTabBar( parent, name )
38{} 38{}
39 39
40void OTabBar::paintLabel( QPainter* p, const QRect& br, QTab* t, bool has_focus ) const 40void OTabBar::paintLabel( QPainter* p, const QRect& br, QTab* t, bool has_focus ) const
41{ 41{
42 42
43 QRect r = br; 43 QRect r = br;
44 if ( t->iconset) 44 if ( t->iconset)
45 { 45 {
46 QIconSet::Mode mode = (t->enabled && isEnabled()) ? QIconSet::Normal : QIconSet::Disabled; 46 QIconSet::Mode mode = (t->enabled && isEnabled()) ? QIconSet::Normal : QIconSet::Disabled;
47 if ( mode == QIconSet::Normal && has_focus ) 47 if ( mode == QIconSet::Normal && has_focus )
48 { 48 {
49 mode = QIconSet::Active; 49 mode = QIconSet::Active;
50 } 50 }
51 QPixmap pixmap = t->iconset->pixmap( QIconSet::Small, mode ); 51 QPixmap pixmap = t->iconset->pixmap( QIconSet::Small, mode );
52 int pixw = pixmap.width(); 52 int pixw = pixmap.width();
53 int pixh = pixmap.height(); 53 int pixh = pixmap.height();
54 r.setLeft( r.left() + pixw + 2 ); 54 r.setLeft( r.left() + pixw + 2 );
55 p->drawPixmap( br.left()+2, br.center().y()-pixh/2, pixmap ); 55 p->drawPixmap( br.left()+2, br.center().y()-pixh/2, pixmap );
56 } 56 }
57 57
58 QRect tr = r; 58 QRect tr = r;
diff --git a/libopie2/opieui/otabbar.h b/libopie2/opieui/otabbar.h
index 2f35c85..925ae96 100644
--- a/libopie2/opieui/otabbar.h
+++ b/libopie2/opieui/otabbar.h
@@ -14,72 +14,73 @@
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#ifndef OTABBAR_H 32#ifndef OTABBAR_H
33#define OTABBAR_H 33#define OTABBAR_H
34 34
35/* QT */ 35/* QT */
36#include <qtabbar.h> 36#include <qtabbar.h>
37 37
38namespace Opie 38namespace Opie {
39{ 39namespace Ui {
40 40
41/** 41/**
42 * @class OTabBar 42 * @class OTabBar
43 * @brief The OTabBar class is a derivative of QTabBar. 43 * @brief The OTabBar class is a derivative of QTabBar.
44 * 44 *
45 * OTabBar is a derivation of TrollTech's QTabBar which provides 45 * OTabBar is a derivation of TrollTech's QTabBar which provides
46 * a row of tabs for selection. The only difference between this 46 * a row of tabs for selection. The only difference between this
47 * class and QTabBar is that there is no dotted line box around 47 * class and QTabBar is that there is no dotted line box around
48 * the label of the tab with the current focus. 48 * the label of the tab with the current focus.
49 */ 49 */
50class OTabBar : public QTabBar 50class OTabBar : public QTabBar
51{ 51{
52 Q_OBJECT 52 Q_OBJECT
53 53
54public: 54public:
55 /** 55 /**
56 * @fn OTabBar( QWidget *parent = 0, const char *name = 0 ) 56 * @fn OTabBar( QWidget *parent = 0, const char *name = 0 )
57 * @brief Object constructor. 57 * @brief Object constructor.
58 * 58 *
59 * @param parent Pointer to parent of this control. 59 * @param parent Pointer to parent of this control.
60 * @param name Name of control. 60 * @param name Name of control.
61 * 61 *
62 * Constructs a new OTabBar control with parent and name. 62 * Constructs a new OTabBar control with parent and name.
63 */ 63 */
64 OTabBar( QWidget * = 0, const char * = 0 ); 64 OTabBar( QWidget * = 0, const char * = 0 );
65 65
66protected: 66protected:
67 /** 67 /**
68 * @fn paintLabel( QPainter* p, const QRect& br , QTab* t, bool has_focus)const 68 * @fn paintLabel( QPainter* p, const QRect& br , QTab* t, bool has_focus)const
69 * @brief Internal function to draw a tab's label. 69 * @brief Internal function to draw a tab's label.
70 * 70 *
71 * @param p Pointer to QPainter used for drawing. 71 * @param p Pointer to QPainter used for drawing.
72 * @param br QRect providing region to draw label in. 72 * @param br QRect providing region to draw label in.
73 * @param t Tab to draw label for. 73 * @param t Tab to draw label for.
74 * @param has_focus Boolean value not used, retained for compatibility reasons. 74 * @param has_focus Boolean value not used, retained for compatibility reasons.
75 */ 75 */
76 void paintLabel( QPainter *, const QRect &, QTab *, bool ) const; 76 void paintLabel( QPainter *, const QRect &, QTab *, bool ) const;
77 77
78private: 78private:
79 class Private; 79 class Private;
80 Private *d; 80 Private *d;
81}; 81};
82 82
83}; 83}
84}
84 85
85#endif 86#endif
diff --git a/libopie2/opieui/otabinfo.h b/libopie2/opieui/otabinfo.h
index 4a6ce14..426c45a 100644
--- a/libopie2/opieui/otabinfo.h
+++ b/libopie2/opieui/otabinfo.h
@@ -17,50 +17,50 @@
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#ifndef OTABINFO_H 32#ifndef OTABINFO_H
33#define OTABINFO_H 33#define OTABINFO_H
34 34
35/* QT */ 35/* QT */
36#include <qlist.h> 36#include <qlist.h>
37#include <qstring.h> 37#include <qstring.h>
38 38
39class QWidget; 39class QWidget;
40 40
41namespace Opie 41namespace Opie{
42{ 42namespace Ui {
43 43
44/** 44/**
45 * @class OTabInfo 45 * @class OTabInfo
46 * @brief The OTabInfo class is used internally by OTabWidget to keep track 46 * @brief The OTabInfo class is used internally by OTabWidget to keep track
47 * of widgets added to the control. 47 * of widgets added to the control.
48 * 48 *
49 * OTabInfo provides the following information about a widget added to an 49 * OTabInfo provides the following information about a widget added to an
50 * OTabWidget control: 50 * OTabWidget control:
51 * 51 *
52 * ID - integer tab bar ID 52 * ID - integer tab bar ID
53 * Control - QWidget pointer to child widget 53 * Control - QWidget pointer to child widget
54 * Label - QString text label for OTabWidget selection control 54 * Label - QString text label for OTabWidget selection control
55 * Icon - QString name of icon file 55 * Icon - QString name of icon file
56 */ 56 */
57class OTabInfo 57class OTabInfo
58{ 58{
59public: 59public:
60 /** 60 /**
61 * @fn OTabInfo() 61 * @fn OTabInfo()
62 * @brief Object constructor. 62 * @brief Object constructor.
63 * 63 *
64 * @param parent Pointer to parent of this control. 64 * @param parent Pointer to parent of this control.
65 * @param name Name of control. 65 * @param name Name of control.
66 * @param s Style of widget selection control. 66 * @param s Style of widget selection control.
@@ -114,27 +114,28 @@ public:
114 114
115 /** 115 /**
116 * @fn setIcon( const QString &icon ) 116 * @fn setIcon( const QString &icon )
117 * @brief Set icon for tab. 117 * @brief Set icon for tab.
118 * 118 *
119 * @param icon QString name of icon file. 119 * @param icon QString name of icon file.
120 */ 120 */
121 void setIcon( const QString &icon ) { p = icon; } 121 void setIcon( const QString &icon ) { p = icon; }
122 122
123private: 123private:
124 int i; 124 int i;
125 QWidget *c; 125 QWidget *c;
126 QString p; 126 QString p;
127 QString l; 127 QString l;
128 class Private; 128 class Private;
129 Private *d; 129 Private *d;
130}; 130};
131 131
132/** 132/**
133 * @class OTabInfoList 133 * @class OTabInfoList
134 * @brief A list of OTabInfo objects used by OTabWidget. 134 * @brief A list of OTabInfo objects used by OTabWidget.
135 */ 135 */
136typedef QList<OTabInfo> OTabInfoList; 136typedef QList<OTabInfo> OTabInfoList;
137 137
138}; 138}
139}
139 140
140#endif 141#endif
diff --git a/libopie2/opieui/otabwidget.cpp b/libopie2/opieui/otabwidget.cpp
index f47c90b..a9f7da9 100644
--- a/libopie2/opieui/otabwidget.cpp
+++ b/libopie2/opieui/otabwidget.cpp
@@ -20,49 +20,49 @@
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#include <opie2/otabwidget.h> 32#include <opie2/otabwidget.h>
33 33
34/* OPIE */ 34/* OPIE */
35#include <qpe/applnk.h> 35#include <qpe/applnk.h>
36#include <qpe/config.h> 36#include <qpe/config.h>
37#include <qpe/resource.h> 37#include <qpe/resource.h>
38#include <opie2/otabbar.h> 38#include <opie2/otabbar.h>
39 39
40/* QT */ 40/* QT */
41#include <qcombobox.h> 41#include <qcombobox.h>
42#include <qwidgetstack.h> 42#include <qwidgetstack.h>
43 43
44using namespace Opie; 44using namespace Opie::Ui;
45 45
46OTabWidget::OTabWidget( QWidget *parent, const char *name, TabStyle s, TabPosition p ) 46OTabWidget::OTabWidget( QWidget *parent, const char *name, TabStyle s, TabPosition p )
47 : QWidget( parent, name ) 47 : QWidget( parent, name )
48{ 48{
49 if ( s == Global ) 49 if ( s == Global )
50 { 50 {
51 Config config( "qpe" ); 51 Config config( "qpe" );
52 config.setGroup( "Appearance" ); 52 config.setGroup( "Appearance" );
53 s = ( TabStyle ) config.readNumEntry( "TabStyle", (int) IconTab ); 53 s = ( TabStyle ) config.readNumEntry( "TabStyle", (int) IconTab );
54 if ( s <= Global || s > IconList) 54 if ( s <= Global || s > IconList)
55 { 55 {
56 s = IconTab; 56 s = IconTab;
57 } 57 }
58 QString pos = config.readEntry( "TabPosition", "Top"); 58 QString pos = config.readEntry( "TabPosition", "Top");
59 if ( pos == "Bottom" ) 59 if ( pos == "Bottom" )
60 { 60 {
61 p = Bottom; 61 p = Bottom;
62 } 62 }
63 else 63 else
64 { 64 {
65 p = Top; 65 p = Top;
66 } 66 }
67 } 67 }
68 68
diff --git a/libopie2/opieui/otabwidget.h b/libopie2/opieui/otabwidget.h
index 092f22c..6a64b7d 100644
--- a/libopie2/opieui/otabwidget.h
+++ b/libopie2/opieui/otabwidget.h
@@ -17,57 +17,56 @@
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.=       =       ; Library General Public License for more 19..}^=.=       =       ; Library General Public License for more
20++=   -.     .`     .: details. 20++=   -.     .`     .: details.
21 :     =  ...= . :.=- 21 :     =  ...= . :.=-
22 -.   .:....=;==+<; You should have received a copy of the GNU 22 -.   .:....=;==+<; You should have received a copy of the GNU
23  -_. . .   )=.  = Library General Public License along with 23  -_. . .   )=.  = Library General Public License along with
24    --        :-=` this library; see the file COPYING.LIB. 24    --        :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28 28
29*/ 29*/
30 30
31#ifndef OTABWIDGET_H 31#ifndef OTABWIDGET_H
32#define OTABWIDGET_H 32#define OTABWIDGET_H
33 33
34/* OPIE */ 34/* OPIE */
35#include <opie2/otabinfo.h> 35#include <opie2/otabinfo.h>
36 36
37/* QT */ 37/* QT */
38#include <qwidget.h> 38#include <qwidget.h>
39#include <qlist.h> 39#include <qlist.h>
40 40
41using namespace Opie;
42 41
43class QComboBox; 42class QComboBox;
44class QPixmap; 43class QPixmap;
45class QTabBar; 44class QTabBar;
46class QWidgetStack; 45class QWidgetStack;
47 46
48namespace Opie 47namespace Opie {
49{ 48namespace Ui {
50 49
51class OTabBar; 50class OTabBar;
52 51
53/** 52/**
54 * @class OTabWidget 53 * @class OTabWidget
55 * @brief The OTabWidget class provides a stack of widgets. 54 * @brief The OTabWidget class provides a stack of widgets.
56 * 55 *
57 * OTabWidget is a derivation of TrollTech's QTabWidget which provides 56 * OTabWidget is a derivation of TrollTech's QTabWidget which provides
58 * a stack of widgets. Widgets can be selected using either a tab bar or 57 * a stack of widgets. Widgets can be selected using either a tab bar or
59 * drop down list box. 58 * drop down list box.
60 * 59 *
61 * The normal way to use OTabWidget is to do the following in the 60 * The normal way to use OTabWidget is to do the following in the
62 * constructor: 61 * constructor:
63 * - Create a OTabWidget. 62 * - Create a OTabWidget.
64 * - Create a QWidget for each of the pages in the control, insert 63 * - Create a QWidget for each of the pages in the control, insert
65 * children into it, set up geometry management for it, and use addTab() 64 * children into it, set up geometry management for it, and use addTab()
66 * to add the widget. 65 * to add the widget.
67 */ 66 */
68class OTabWidget : public QWidget 67class OTabWidget : public QWidget
69{ 68{
70 Q_OBJECT 69 Q_OBJECT
71 70
72 public: 71 public:
73/** 72/**
@@ -266,27 +265,28 @@ private:
266 * 265 *
267 * @param widget Pointer to new current widget. 266 * @param widget Pointer to new current widget.
268 */ 267 */
269 void currentChanged( QWidget * ); 268 void currentChanged( QWidget * );
270 269
271 private slots: 270 private slots:
272 271
273/** 272/**
274 * @fn slotTabBarSelected( int id ) 273 * @fn slotTabBarSelected( int id )
275 * @brief Slot which is called when a tab is selected. 274 * @brief Slot which is called when a tab is selected.
276 * 275 *
277 * @param id ID of widget selected. 276 * @param id ID of widget selected.
278 */ 277 */
279 void slotTabBarSelected( int ); 278 void slotTabBarSelected( int );
280 279
281/** 280/**
282 * @fn slotTabListSelected( int index ) 281 * @fn slotTabListSelected( int index )
283 * @brief Slot which is called when a drop down selection is made. 282 * @brief Slot which is called when a drop down selection is made.
284 * 283 *
285 * @param id Index of widget selected. 284 * @param id Index of widget selected.
286 */ 285 */
287 void slotTabListSelected( int ); 286 void slotTabListSelected( int );
288}; 287};
289 288
290}; 289}
290}
291 291
292#endif 292#endif
diff --git a/libopie2/opieui/otaskbarapplet.cpp b/libopie2/opieui/otaskbarapplet.cpp
index a67356d..b5268f0 100644
--- a/libopie2/opieui/otaskbarapplet.cpp
+++ b/libopie2/opieui/otaskbarapplet.cpp
@@ -7,26 +7,76 @@
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#include <opie2/otaskbarapplet.h>
32
33#include <qpe/qpeapplication.h>
34#include <qframe.h>
35
36using namespace Opie::Ui;
37
38
39/**
40 * \todo no example yet!!!
41 * If you want to implement an Applet for the Opie Taskbar
42 * use this interface.
43 * The only specail thing about applets is that you need to build
44 * it as plugin/library and do EXPORT_OPIE_APPLET_v1( YourApplet )
45 * at the bottom of your application. This takes care of
46 * the activation and implementing the TaskbarAppletInterface.
47 * You also need to add a static int position() functions to your
48 * application.
49 * \code
50 * class MyApplet : public OTaskBarApplet {
51 * public:
52 * static int position() { return 3: }
53 * void doStuff() {
54 * popup( myWidget );
55 * }
56 * };
57 * EXPORT_OPIE_APPLET_v1( MyApplet )
58 * \endcode
59 *
60 * @author Michael Lauer
61 * @version 0.5
62 * @see TaskbarAppletInterface
63 */
64OTaskbarApplet::OTaskbarApplet( QWidget* parent, const char* name )
65 :QWidget( parent, name ){
66 setFixedHeight( 18 );
67 setFixedWidth( 14 );
68}
69
70OTaskbarApplet::~OTaskbarApplet(){
71}
72
73void OTaskbarApplet::popup( QWidget* widget ){
74 QPoint curPos = mapToGlobal( QPoint( 0, 0 ) );
75 int w = widget->sizeHint().width();
76 int x = curPos.x() - (w/2 );
77 if ( (x+w) > QPEApplication::desktop()->width() )
78 x = QPEApplication::desktop()->width()-w;
79 widget->move( x, curPos.y()-widget->sizeHint().height() );
80 widget->show();
81}
31 82
32// Empty on purpose until we shipped Opie 1.0 (see otaskbarapplet.h for explanation)
diff --git a/libopie2/opieui/otaskbarapplet.h b/libopie2/opieui/otaskbarapplet.h
index 074367f..0c85ee7 100644
--- a/libopie2/opieui/otaskbarapplet.h
+++ b/libopie2/opieui/otaskbarapplet.h
@@ -12,119 +12,118 @@
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#ifndef OTASKBARAPPLET_H 32#ifndef OTASKBARAPPLET_H
33#define OTASKBARAPPLET_H 33#define OTASKBARAPPLET_H
34 34
35#include <qpe/taskbarappletinterface.h> 35#include <qpe/taskbarappletinterface.h>
36#include <qpe/qcom.h>
36 37
38#include <qwidget.h>
39
40class QMouseEvent;
41
42namespace Opie {
43namespace Ui {
44namespace Private {
37/*====================================================================================== 45/*======================================================================================
38 * OTaskbarAppletWrapper 46 * OTaskbarAppletWrapper
39 *======================================================================================*/ 47 *======================================================================================*/
40 48
49class OTaskbarAppletWrapperPrivate;
41template<class T> class OTaskbarAppletWrapper : public TaskbarAppletInterface 50template<class T> class OTaskbarAppletWrapper : public TaskbarAppletInterface
42{ 51{
43 public: 52 public:
44 OTaskbarAppletWrapper():_applet( 0 ) 53 OTaskbarAppletWrapper():_applet( 0 )
45 { 54 {
46 } 55 }
47 56
48 virtual ~OTaskbarAppletWrapper() 57 virtual ~OTaskbarAppletWrapper()
49 { 58 {
50 delete _applet; 59 delete _applet;
51 } 60 }
52 61
53 QRESULT queryInterface( const QUuid& uuid, QUnknownInterface** iface ) 62 QRESULT queryInterface( const QUuid& uuid, QUnknownInterface** iface )
54 { 63 {
55 qDebug( "OTaskbarAppletWrapper::queryInterface()" ); 64 qDebug( "OTaskbarAppletWrapper::queryInterface()" );
56 *iface = 0; 65 *iface = 0;
57 if ( uuid == IID_QUnknown ) 66 if ( uuid == IID_QUnknown )
58 *iface = this; 67 *iface = this;
59 else if ( uuid == IID_TaskbarApplet ) 68 else if ( uuid == IID_TaskbarApplet )
60 *iface = this; 69 *iface = this;
61 else 70 else
62 return QS_FALSE; 71 return QS_FALSE;
63 72
64 if ( *iface ) (*iface)->addRef(); 73 if ( *iface ) (*iface)->addRef();
65 return QS_OK; 74 return QS_OK;
66 } 75 }
67 76
68 Q_REFCOUNT 77 Q_REFCOUNT
69 78
70 virtual T* applet( QWidget* parent ) 79 virtual T* applet( QWidget* parent )
71 { 80 {
72 if ( !_applet ) _applet = new T( parent ); 81 if ( !_applet ) _applet = new T( parent );
73 return _applet; 82 return _applet;
74 } 83 }
75 84
76 virtual int position() const 85 virtual int position() const
77 { 86 {
78 return T::position(); 87 return T::position();
79 } 88 }
80 89
81 private: 90 private:
82 T* _applet; 91 T* _applet;
92 OTaskbarAppletWrapperPrivate *d;
83}; 93};
84 94
85#include <qframe.h> 95}
86#include <qwidget.h>
87#include <qpe/qpeapplication.h>
88
89class QMouseEvent;
90
91/*====================================================================================== 96/*======================================================================================
92 * OTaskbarApplet 97 * OTaskbarApplet
93 *======================================================================================*/ 98 *======================================================================================*/
94 99
95// Must be inline until after we shipped Opie 1.0 100// Must be inline until after we shipped Opie 1.0
96 101
97// Having OTaskBarApplet reside in libopieui2 is not possible 102// Having OTaskBarApplet reside in libopieui2 is not possible
98// until we link the launcher binary against libopieui2 - 103// until we link the launcher binary against libopieui2 -
99// otherwise the necessary symbols are not present, when 104// otherwise the necessary symbols are not present, when
100// the dynamic loader [dlopen] tries to resolve an applet which 105// the dynamic loader [dlopen] tries to resolve an applet which
101// inherits OTaskbarApplet 106// inherits OTaskbarApplet
102 107
103class OTaskbarApplet : public QWidget 108class OTaskbarApplet : public QWidget
104{ 109{
105 public: 110 public:
106 OTaskbarApplet( QWidget* parent, const char* name = 0 ):QWidget( parent, name ) 111 OTaskbarApplet( QWidget* parent, const char* name = 0 );
107 { 112 virtual ~OTaskbarApplet();
108 setFixedHeight( 18 );
109 setFixedWidth( 14 );
110 }
111
112 virtual ~OTaskbarApplet()
113 {
114 }
115 113
116 protected: 114 protected:
117 virtual void popup( QWidget* widget ) 115 virtual void popup( QWidget* widget );
118 { 116private:
119 QPoint curPos = mapToGlobal( QPoint( 0, 0 ) ); 117 class Private;
120 int w = widget->sizeHint().width(); 118 Private *d;
121 int x = curPos.x() - (w/2 );
122 if ( (x+w) > QPEApplication::desktop()->width() )
123 x = QPEApplication::desktop()->width()-w;
124 widget->move( x, curPos.y()-widget->sizeHint().height() );
125 widget->show();
126 }
127}; 119};
120}
121}
122
123#define EXPORT_OPIE_APPLET_v1( AppLet ) \
124 Q_EXPORT_INTERFACE() { \
125 Q_CREATE_INSTANCE( Opie::Ui::Private::OTaskbarAppletWrapper<AppLet> ) \
126 }
128 127
129#endif 128#endif
130 129
diff --git a/libopie2/opieui/otimepicker.cpp b/libopie2/opieui/otimepicker.cpp
index 66f9ce0..7de0fd3 100644
--- a/libopie2/opieui/otimepicker.cpp
+++ b/libopie2/opieui/otimepicker.cpp
@@ -6,56 +6,60 @@
6           .>+-= 6           .>+-=
7 _;:,     .>    :=|. This program is free software; you can 7 _;:,     .>    :=|. This program 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 Library General Public 9:`=1 )Y*s>-.--   : the terms of the GNU Library 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 program is distributed in the hope that 14    .i_,=:_.      -<s. This program 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 18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.=       =       ; Library General Public License for more 19..}^=.=       =       ; Library General Public License for more
20++=   -.     .`     .: details. 20++=   -.     .`     .: details.
21 :     =  ...= . :.=- 21 :     =  ...= . :.=-
22 -.   .:....=;==+<; You should have received a copy of the GNU 22 -.   .:....=;==+<; You should have received a copy of the GNU
23  -_. . .   )=.  = Library General Public License along with 23  -_. . .   )=.  = Library General Public License along with
24    --        :-=` this library; see the file COPYING.LIB. 24    --        :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28*/ 28*/
29 29
30/* OPIE */
31#include <opie2/otimepicker.h>
32
30/* QT */ 33/* QT */
34#include <qgroupbox.h>
31#include <qlayout.h> 35#include <qlayout.h>
32#include <qlineedit.h> 36#include <qlineedit.h>
33 37
34/* OPIE */
35#include <opie2/otimepicker.h>
36 38
37using namespace Opie; 39
40namespace Opie {
41namespace Ui {
38 42
39/** 43/**
40 * Constructs the widget 44 * Constructs the widget
41 * @param parent The parent of the OTimePicker 45 * @param parent The parent of the OTimePicker
42 * @param name The name of the object 46 * @param name The name of the object
43 * @param fl Window Flags 47 * @param fl Window Flags
44 */ 48 */
45OTimePicker::OTimePicker(QWidget* parent, const char* name, Qt::WFlags fl) 49OTimePicker::OTimePicker(QWidget* parent, const char* name, Qt::WFlags fl)
46 :QWidget(parent,name,fl) 50 :QWidget(parent,name,fl)
47{ 51{
48 QVBoxLayout *vbox=new QVBoxLayout(this); 52 QVBoxLayout *vbox=new QVBoxLayout(this);
49 53
50 OClickableLabel *r; 54 OClickableLabel *r;
51 QString s; 55 QString s;
52 56
53 // Hour Row 57 // Hour Row
54 QWidget *row=new QWidget(this); 58 QWidget *row=new QWidget(this);
55 QHBoxLayout *l=new QHBoxLayout(row); 59 QHBoxLayout *l=new QHBoxLayout(row);
56 vbox->addWidget(row); 60 vbox->addWidget(row);
57 61
58 for (int i=0; i<24; i++) 62 for (int i=0; i<24; i++)
59 { 63 {
60 r=new OClickableLabel(row); 64 r=new OClickableLabel(row);
61 hourLst.append(r); 65 hourLst.append(r);
@@ -199,48 +203,50 @@ void OTimePicker::setHour(int h)
199 203
200 QString hour; 204 QString hour;
201 hour.sprintf("%.2d",h); 205 hour.sprintf("%.2d",h);
202 206
203 QValueListIterator<OClickableLabel *> it; 207 QValueListIterator<OClickableLabel *> it;
204 for (it=hourLst.begin(); it!=hourLst.end(); it++) 208 for (it=hourLst.begin(); it!=hourLst.end(); it++)
205 { 209 {
206 if ((*it)->text() == hour) (*it)->setOn(true); 210 if ((*it)->text() == hour) (*it)->setOn(true);
207 else (*it)->setOn(false); 211 else (*it)->setOn(false);
208 } 212 }
209 tm.setHMS(h,tm.minute(),0); 213 tm.setHMS(h,tm.minute(),0);
210} 214}
211 215
212 216
213/** 217/**
214 * This is a modal Dialog. 218 * This is a modal Dialog.
215 * 219 *
216 * @param parent The parent widget 220 * @param parent The parent widget
217 * @param name The name of the object 221 * @param name The name of the object
218 * @param fl Possible window flags 222 * @param fl Possible window flags
219 */ 223 */
220OTimePickerDialog::OTimePickerDialog ( QWidget* parent, const char* name, WFlags fl ) 224OTimePickerDialog::OTimePickerDialog ( QWidget* parent, const char* name, WFlags fl )
221 : OTimePickerDialogBase (parent , name, true , fl) 225 : OTimePickerDialogBase (parent , name, true , fl)
222{ 226{
227 m_timePicker = new OTimePicker( GroupBox1, "m_timePicker" );
228 GroupBox1Layout->addWidget( m_timePicker, 0, 0 );
223 229
224 connect ( m_timePicker, SIGNAL( timeChanged(const QTime&) ), 230 connect ( m_timePicker, SIGNAL( timeChanged(const QTime&) ),
225 this, SLOT( setTime(const QTime&) ) ); 231 this, SLOT( setTime(const QTime&) ) );
226 connect ( minuteField, SIGNAL( textChanged(const QString&) ), 232 connect ( minuteField, SIGNAL( textChanged(const QString&) ),
227 this, SLOT ( setMinute(const QString&) ) ); 233 this, SLOT ( setMinute(const QString&) ) );
228 connect ( hourField, SIGNAL( textChanged(const QString&) ), 234 connect ( hourField, SIGNAL( textChanged(const QString&) ),
229 this, SLOT ( setHour(const QString&) ) ); 235 this, SLOT ( setHour(const QString&) ) );
230 236
231} 237}
232 238
233/** 239/**
234 * @return the time 240 * @return the time
235 */ 241 */
236QTime OTimePickerDialog::time()const 242QTime OTimePickerDialog::time()const
237{ 243{
238 return m_time; 244 return m_time;
239} 245}
240 246
241/** 247/**
242 * Set the time to time 248 * Set the time to time
243 * @param time The time to be set 249 * @param time The time to be set
244 */ 250 */
245void OTimePickerDialog::setTime( const QTime& time ) 251void OTimePickerDialog::setTime( const QTime& time )
246{ 252{
@@ -269,24 +275,27 @@ void OTimePickerDialog::setTime( const QTime& time )
269 */ 275 */
270void OTimePickerDialog::setHour ( const QString& hour ) 276void OTimePickerDialog::setHour ( const QString& hour )
271{ 277{
272 if ( QTime::isValid ( hour.toInt(), m_time.minute() , 00 ) ) 278 if ( QTime::isValid ( hour.toInt(), m_time.minute() , 00 ) )
273 { 279 {
274 m_time.setHMS ( hour.toInt(), m_time.minute() , 00 ); 280 m_time.setHMS ( hour.toInt(), m_time.minute() , 00 );
275 setTime ( m_time ); 281 setTime ( m_time );
276 } 282 }
277 283
278} 284}
279 285
280/** 286/**
281 * Method to set a new minute. It tries to convert the string to int and 287 * Method to set a new minute. It tries to convert the string to int and
282 * if the resulting date is valid a new date is set. 288 * if the resulting date is valid a new date is set.
283 * @see setHour 289 * @see setHour
284 */ 290 */
285void OTimePickerDialog::setMinute ( const QString& minute ) 291void OTimePickerDialog::setMinute ( const QString& minute )
286{ 292{
287 if ( QTime::isValid ( m_time.hour(), minute.toInt(), 00 ) ) 293 if ( QTime::isValid ( m_time.hour(), minute.toInt(), 00 ) )
288 { 294 {
289 m_time.setHMS ( m_time.hour(), minute.toInt(), 00 ); 295 m_time.setHMS ( m_time.hour(), minute.toInt(), 00 );
290 setTime ( m_time ); 296 setTime ( m_time );
291 } 297 }
292} 298}
299
300}
301}
diff --git a/libopie2/opieui/otimepicker.h b/libopie2/opieui/otimepicker.h
index 2da7773..01bb557 100644
--- a/libopie2/opieui/otimepicker.h
+++ b/libopie2/opieui/otimepicker.h
@@ -11,73 +11,72 @@
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 program is distributed in the hope that 14    .i_,=:_.      -<s. This program 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 18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.=       =       ; Library General Public License for more 19..}^=.=       =       ; Library General Public License for more
20++=   -.     .`     .: details. 20++=   -.     .`     .: details.
21 :     =  ...= . :.=- 21 :     =  ...= . :.=-
22 -.   .:....=;==+<; You should have received a copy of the GNU 22 -.   .:....=;==+<; You should have received a copy of the GNU
23  -_. . .   )=.  = Library General Public License along with 23  -_. . .   )=.  = Library General Public License along with
24    --        :-=` this library; see the file COPYING.LIB. 24    --        :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28*/ 28*/
29 29
30#ifndef OTIMEPICKER_H 30#ifndef OTIMEPICKER_H
31#define OTIMEPICKER_H 31#define OTIMEPICKER_H
32 32
33/* OPIE */ 33/* OPIE */
34#include <opie2/oclickablelabel.h> 34#include <opie2/oclickablelabel.h>
35#include "otimepickerbase.h" 35#include <opie2/otimepickerbase.h>
36 36
37/* QT */ 37/* QT */
38#include <qwidget.h> 38#include <qwidget.h>
39#include <qvaluelist.h> 39#include <qvaluelist.h>
40#include <qdatetime.h> 40#include <qdatetime.h>
41#include <qdialog.h> 41#include <qdialog.h>
42 42
43using namespace Opie;
44 43
45// namespace Opie 44namespace Opie {
46// { 45namespace Ui {
47 46
48/** 47/**
49 * A class to pick time. It uses clickable labels 48 * A class to pick time. It uses clickable labels
50 * internally to allow a quick selection of a time. 49 * internally to allow a quick selection of a time.
51 * A time can be selected by two clicks of a user 50 * A time can be selected by two clicks of a user
52 * 51 *
53 * @short A widget to quickly pick a QTime 52 * @short A widget to quickly pick a QTime
54 * @version 1.0 53 * @version 1.0
55 * @see QWidget 54 * @see QWidget
56 * @see QTime 55 * @see QTime
57 * @author Hakan Ardo, Stefan Eilers 56 * @author Hakan Ardo, Stefan Eilers
58 */ 57 */
59class OTimePicker: public QWidget 58class OTimePicker : public QWidget
60{ 59{
61 Q_OBJECT 60 Q_OBJECT
62 61
63public: 62public:
64 OTimePicker(QWidget* parent = 0, const char* name = 0, WFlags fl = 0); 63 OTimePicker(QWidget* parent = 0, const char* name = 0, WFlags fl = 0);
65 64
66public slots: 65public slots:
67 void setHour(int h); 66 void setHour(int h);
68 void setMinute(int m); 67 void setMinute(int m);
69 void setTime( const QTime& ); 68 void setTime( const QTime& );
70 void setTime( int h, int m ); 69 void setTime( int h, int m );
71 70
72public: 71public:
73 QTime time()const; 72 QTime time()const;
74 73
75private: 74private:
76 QValueList<OClickableLabel *> hourLst; 75 QValueList<OClickableLabel *> hourLst;
77 QValueList<OClickableLabel *> minuteLst; 76 QValueList<OClickableLabel *> minuteLst;
78 QTime tm; 77 QTime tm;
79 struct Private; 78 struct Private;
80 Private *d; 79 Private *d;
81 80
82private slots: 81private slots:
83 void slotHour(bool b); 82 void slotHour(bool b);
@@ -93,33 +92,41 @@ signals:
93/** 92/**
94 * 93 *
95 * @short A small dialog to pick a time 94 * @short A small dialog to pick a time
96 * @version 1.0 95 * @version 1.0
97 * @author Stefan Eilers 96 * @author Stefan Eilers
98 * 97 *
99 **/ 98 **/
100 99
101class OTimePickerDialog: public OTimePickerDialogBase 100class OTimePickerDialog: public OTimePickerDialogBase
102{ 101{
103 Q_OBJECT 102 Q_OBJECT
104 103
105public: 104public:
106 OTimePickerDialog ( QWidget* parent = 0, const char* name = NULL, WFlags fl = 0 ); 105 OTimePickerDialog ( QWidget* parent = 0, const char* name = NULL, WFlags fl = 0 );
107 ~OTimePickerDialog() { }; 106 ~OTimePickerDialog() { };
108 107
109 QTime time()const; 108 QTime time()const;
110 109
111public slots: 110public slots:
112 void setTime( const QTime& time ); 111 void setTime( const QTime& time );
113 void setHour( const QString& hour ); 112 void setHour( const QString& hour );
114 void setMinute( const QString& minute ); 113 void setMinute( const QString& minute );
115 114
116private: 115private:
116 OTimePicker *m_timePicker;
117 QTime m_time; 117 QTime m_time;
118 class Private; 118 class Private;
119 Private* d; 119 Private* d;
120}; 120};
121 121
122// }; 122}
123}
123 124
125/* for Qt2 */
126#if ( QT_VERSION-0 >= 0x030000 )
127#error "Fix the UI File to use namespaces"
128#else
129typedef Opie::Ui::OTimePicker OUIOTimePicker;
130#endif
124#endif 131#endif
125 132
diff --git a/libopie2/opieui/otimepickerbase.ui b/libopie2/opieui/otimepickerbase.ui
index 3e7f2fb..c2eb7c5 100644
--- a/libopie2/opieui/otimepickerbase.ui
+++ b/libopie2/opieui/otimepickerbase.ui
@@ -1,38 +1,38 @@
1<!DOCTYPE UI><UI> 1<!DOCTYPE UI><UI>
2<class>OTimePickerDialogBase</class> 2<class>OTimePickerDialogBase</class>
3<widget> 3<widget>
4 <class>QDialog</class> 4 <class>QDialog</class>
5 <property stdset="1"> 5 <property stdset="1">
6 <name>name</name> 6 <name>name</name>
7 <cstring>OTimePickerDialogBase</cstring> 7 <cstring>OTimePickerDialogBase</cstring>
8 </property> 8 </property>
9 <property stdset="1"> 9 <property stdset="1">
10 <name>geometry</name> 10 <name>geometry</name>
11 <rect> 11 <rect>
12 <x>0</x> 12 <x>0</x>
13 <y>0</y> 13 <y>0</y>
14 <width>210</width> 14 <width>182</width>
15 <height>137</height> 15 <height>137</height>
16 </rect> 16 </rect>
17 </property> 17 </property>
18 <property stdset="1"> 18 <property stdset="1">
19 <name>sizePolicy</name> 19 <name>sizePolicy</name>
20 <sizepolicy> 20 <sizepolicy>
21 <hsizetype>3</hsizetype> 21 <hsizetype>3</hsizetype>
22 <vsizetype>1</vsizetype> 22 <vsizetype>1</vsizetype>
23 </sizepolicy> 23 </sizepolicy>
24 </property> 24 </property>
25 <property stdset="1"> 25 <property stdset="1">
26 <name>caption</name> 26 <name>caption</name>
27 <string>OTimePickerDialogBase</string> 27 <string>OTimePickerDialogBase</string>
28 </property> 28 </property>
29 <property> 29 <property>
30 <name>layoutMargin</name> 30 <name>layoutMargin</name>
31 </property> 31 </property>
32 <property> 32 <property>
33 <name>layoutSpacing</name> 33 <name>layoutSpacing</name>
34 </property> 34 </property>
35 <vbox> 35 <vbox>
36 <property stdset="1"> 36 <property stdset="1">
37 <name>margin</name> 37 <name>margin</name>
38 <number>5</number> 38 <number>5</number>
@@ -228,65 +228,29 @@
228 <property stdset="1"> 228 <property stdset="1">
229 <name>sizePolicy</name> 229 <name>sizePolicy</name>
230 <sizepolicy> 230 <sizepolicy>
231 <hsizetype>3</hsizetype> 231 <hsizetype>3</hsizetype>
232 <vsizetype>3</vsizetype> 232 <vsizetype>3</vsizetype>
233 </sizepolicy> 233 </sizepolicy>
234 </property> 234 </property>
235 <property stdset="1"> 235 <property stdset="1">
236 <name>margin</name> 236 <name>margin</name>
237 <number>0</number> 237 <number>0</number>
238 </property> 238 </property>
239 <property stdset="1"> 239 <property stdset="1">
240 <name>title</name> 240 <name>title</name>
241 <string>Pick Time:</string> 241 <string>Pick Time:</string>
242 </property> 242 </property>
243 <grid> 243 <grid>
244 <property stdset="1"> 244 <property stdset="1">
245 <name>margin</name> 245 <name>margin</name>
246 <number>11</number> 246 <number>11</number>
247 </property> 247 </property>
248 <property stdset="1"> 248 <property stdset="1">
249 <name>spacing</name> 249 <name>spacing</name>
250 <number>6</number> 250 <number>6</number>
251 </property> 251 </property>
252 <widget row="0" column="0" >
253 <class>OTimePicker</class>
254 <property stdset="1">
255 <name>name</name>
256 <cstring>m_timePicker</cstring>
257 </property>
258 <property stdset="1">
259 <name>sizePolicy</name>
260 <sizepolicy>
261 <hsizetype>3</hsizetype>
262 <vsizetype>3</vsizetype>
263 </sizepolicy>
264 </property>
265 </widget>
266 </grid> 252 </grid>
267 </widget> 253 </widget>
268 </vbox> 254 </vbox>
269</widget> 255</widget>
270<customwidgets>
271 <customwidget>
272 <class>OTimePicker</class>
273 <header location="local">otimepicker.h</header>
274 <sizehint>
275 <width>-1</width>
276 <height>-1</height>
277 </sizehint>
278 <container>0</container>
279 <sizepolicy>
280 <hordata>7</hordata>
281 <verdata>1</verdata>
282 </sizepolicy>
283 <pixmap>image0</pixmap>
284 </customwidget>
285</customwidgets>
286<images>
287 <image>
288 <name>image0</name>
289 <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1ddec44f503c0ae2a154410f53d0ed20e2bf6bdb656dd6861dd23d9a66591b0587fd1654235ebded6f0edcd53e419d87ae7b1f4f9b8f906d0bfe012317426a70b07bdc2f3ec77f8ed6b89559061a0343d06a124cc105596482585094bc0ae599b04646c9018926491b2205e140c485cace25755c175d0a967b622ff900b8cc9c7d29af594ea722d589167f813aa852ba07d94b9dce296e883fe7bb163f23896753</data>
290 </image>
291</images>
292</UI> 256</UI>
diff --git a/libopie2/opieui/oversatileview.cpp b/libopie2/opieui/oversatileview.cpp
index 78154b7..f6c6410 100644
--- a/libopie2/opieui/oversatileview.cpp
+++ b/libopie2/opieui/oversatileview.cpp
@@ -19,48 +19,51 @@
19..}^=.=       =       ; Library General Public License for more 19..}^=.=       =       ; Library General Public License for more
20++=   -.     .`     .: details. 20++=   -.     .`     .: details.
21 :     =  ...= . :.=- 21 :     =  ...= . :.=-
22 -.   .:....=;==+<; You should have received a copy of the GNU 22 -.   .:....=;==+<; You should have received a copy of the GNU
23  -_. . .   )=.  = Library General Public License along with 23  -_. . .   )=.  = Library General Public License along with
24    --        :-=` this library; see the file COPYING.LIB. 24    --        :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28 28
29*/ 29*/
30 30
31/* OPIE */ 31/* OPIE */
32 32
33#include <opie2/odebug.h> 33#include <opie2/odebug.h>
34#include <opie2/oversatileview.h> 34#include <opie2/oversatileview.h>
35#include <opie2/oversatileviewitem.h> 35#include <opie2/oversatileviewitem.h>
36#include <opie2/olistview.h> 36#include <opie2/olistview.h>
37 37
38/* QT */ 38/* QT */
39 39
40#include <qaction.h> 40#include <qaction.h>
41#include <qpopupmenu.h> 41#include <qpopupmenu.h>
42 42
43using namespace Opie::Core;
44using namespace Opie::Ui;
45
43/* XPM */ 46/* XPM */
44static const char * view_icon_xpm[] = { 47static const char * view_icon_xpm[] = {
45"16 16 16 1", 48"16 16 16 1",
46 " c None", 49 " c None",
47 ".c #87BD88", 50 ".c #87BD88",
48 "+c #8BBE8B", 51 "+c #8BBE8B",
49 "@c #81BA81", 52 "@c #81BA81",
50 "#c #6DAF6D", 53 "#c #6DAF6D",
51 "$c #87BD87", 54 "$c #87BD87",
52 "%c #FCFDFC", 55 "%c #FCFDFC",
53 "&c #AED0AE", 56 "&c #AED0AE",
54 "*c #4E9C4C", 57 "*c #4E9C4C",
55 "=c #91BD91", 58 "=c #91BD91",
56 "-c #72B172", 59 "-c #72B172",
57 ";c #448643", 60 ";c #448643",
58 ">c #519F50", 61 ">c #519F50",
59 ",c #499247", 62 ",c #499247",
60 "'c #356A35", 63 "'c #356A35",
61 ")c #686868", 64 ")c #686868",
62" ", 65" ",
63" .+@# .+@# ", 66" .+@# .+@# ",
64" $%&* $%&* ", 67" $%&* $%&* ",
65" @=-; @=-; ", 68" @=-; @=-; ",
66" #>,' #>,' ", 69" #>,' #>,' ",
@@ -111,135 +114,135 @@ static const char * view_tree_xpm[] = {
111" $')! ", 114" $')! ",
112" ", 115" ",
113" ", 116" ",
114" "}; 117" "};
115 118
116OVersatileView::OVersatileView( QWidget* parent, const char* name, int mode ) 119OVersatileView::OVersatileView( QWidget* parent, const char* name, int mode )
117 :QWidgetStack( parent, name ), 120 :QWidgetStack( parent, name ),
118 _viewmode( mode ), _warningpolicy( None ), 121 _viewmode( mode ), _warningpolicy( None ),
119 _treeleaf(), _treeopened(), _treeclosed(), 122 _treeleaf(), _treeopened(), _treeclosed(),
120 _iconleaf(), _iconopened(), _iconclosed() 123 _iconleaf(), _iconopened(), _iconclosed()
121{ 124{
122 // 125 //
123 // Create child widgets and set some reasonable default styles 126 // Create child widgets and set some reasonable default styles
124 // 127 //
125 128
126 _listview = new OListView( this, "oversatileview embedded listview" ); 129 _listview = new OListView( this, "oversatileview embedded listview" );
127 _iconview = new QIconView( this, "oversatileview embedded iconview" ); 130 _iconview = new QIconView( this, "oversatileview embedded iconview" );
128 131
129 _listview->setAllColumnsShowFocus( true ); 132 _listview->setAllColumnsShowFocus( true );
130 _listview->setRootIsDecorated( true ); 133 _listview->setRootIsDecorated( true );
131 _listview->setShowSortIndicator( true ); 134 _listview->setShowSortIndicator( true );
132 _iconview->setGridX( 90 ); 135 _iconview->setGridX( 90 );
133 _iconview->setGridY( 42 ); 136 _iconview->setGridY( 42 );
134 _iconview->setAutoArrange( true ); 137 _iconview->setAutoArrange( true );
135 138
136 #ifdef QWS // TODO: Let this depend on current geometry (rotation) 139 #ifdef QWS // TODO: Let this depend on current geometry (rotation)
137 _iconview->setArrangement( QIconView::TopToBottom ); 140 _iconview->setArrangement( QIconView::TopToBottom );
138 #else 141 #else
139 _iconview->setArrangement( QIconView::LeftToRight ); 142 _iconview->setArrangement( QIconView::LeftToRight );
140 #endif 143 #endif
141 144
142 _iconview->setResizeMode( QIconView::Adjust ); 145 _iconview->setResizeMode( QIconView::Adjust );
143 146
144 // qt-embedded: map stylus right on hold to right button press 147 // qt-embedded: map stylus right on hold to right button press
145 148
146 #ifdef QWS 149 #ifdef QWS
147 ( (QPEApplication*) qApp)->setStylusOperation( _iconview->viewport(), QPEApplication::RightOnHold ); 150 ( (QPEApplication*) qApp)->setStylusOperation( _iconview->viewport(), QPEApplication::RightOnHold );
148 ( (QPEApplication*) qApp)->setStylusOperation( _listview->viewport(), QPEApplication::RightOnHold ); 151 ( (QPEApplication*) qApp)->setStylusOperation( _listview->viewport(), QPEApplication::RightOnHold );
149 #endif 152 #endif
150 153
151 setViewMode( mode ); // TODO: Read last style from config 154 setViewMode( mode ); // TODO: Read last style from config
152 // setSynchronization( true ); // TODO: Implement this 155 // setSynchronization( true ); // TODO: Implement this
153 156
154 // create context menu allowing to switch between the views 157 // create context menu allowing to switch between the views
155 158
156 _contextmenu = new QPopupMenu( 0, "oversatileview contextmenu" ); 159 _contextmenu = new QPopupMenu( 0, "oversatileview contextmenu" );
157 _contextmenu->setCaption( "Style" ); 160 _contextmenu->setCaption( "Style" );
158 _contextmenu->setCheckable( true ); 161 _contextmenu->setCheckable( true );
159 QActionGroup* ag = new QActionGroup( _contextmenu, "style option group" ); 162 QActionGroup* ag = new QActionGroup( _contextmenu, "style option group" );
160 QAction* a1 = new QAction( "View Items in Icon Style", QIconSet( QPixmap( view_icon_xpm ) ), 163 QAction* a1 = new QAction( "View Items in Icon Style", QIconSet( QPixmap( view_icon_xpm ) ),
161 "View Icons", 0, ag, "viewicon action", true ); 164 "View Icons", 0, ag, "viewicon action", true );
162 QAction* a2 = new QAction( "View Items in Tree Style", QIconSet( QPixmap( view_tree_xpm ) ), 165 QAction* a2 = new QAction( "View Items in Tree Style", QIconSet( QPixmap( view_tree_xpm ) ),
163 "View Tree", 0, ag, "viewtree action", true ); 166 "View Tree", 0, ag, "viewtree action", true );
164 ag->addTo( _contextmenu ); 167 ag->addTo( _contextmenu );
165 if ( mode == Icons ) 168 if ( mode == Icons )
166 a1->setOn( true ); 169 a1->setOn( true );
167 else if ( mode == Tree ) 170 else if ( mode == Tree )
168 a2->setOn( true ); 171 a2->setOn( true );
169 connect( a1, SIGNAL( activated() ), this, SLOT( setIconViewMode() ) ); 172 connect( a1, SIGNAL( activated() ), this, SLOT( setIconViewMode() ) );
170 connect( a2, SIGNAL( activated() ), this, SLOT( setTreeViewMode() ) ); 173 connect( a2, SIGNAL( activated() ), this, SLOT( setTreeViewMode() ) );
171 174
172 #if (QT_VERSION >= 0x030000) 175 #if (QT_VERSION >= 0x030000)
173 connect( _listview, SIGNAL( contextMenuRequested(QListViewItem*,const QPoint&,int) ), this, SLOT( contextMenuRequested(QListViewItem*,const QPoint&,int) ) ); 176 connect( _listview, SIGNAL( contextMenuRequested(QListViewItem*,const QPoint&,int) ), this, SLOT( contextMenuRequested(QListViewItem*,const QPoint&,int) ) );
174 connect( _iconview, SIGNAL( contextMenuRequested(QIconViewItem*,const QPoint&) ), this, SLOT( contextMenuRequested(QIconViewItem*,const QPoint&) ) ); 177 connect( _iconview, SIGNAL( contextMenuRequested(QIconViewItem*,const QPoint&) ), this, SLOT( contextMenuRequested(QIconViewItem*,const QPoint&) ) );
175 #else 178 #else
176 connect( _listview, SIGNAL( rightButtonPressed(QListViewItem*,const QPoint&,int) ), this, SLOT( contextMenuRequested(QListViewItem*,const QPoint&,int) ) ); 179 connect( _listview, SIGNAL( rightButtonPressed(QListViewItem*,const QPoint&,int) ), this, SLOT( contextMenuRequested(QListViewItem*,const QPoint&,int) ) );
177 connect( _iconview, SIGNAL( rightButtonPressed(QIconViewItem*,const QPoint&) ), this, SLOT( contextMenuRequested(QIconViewItem*,const QPoint&) ) ); 180 connect( _iconview, SIGNAL( rightButtonPressed(QIconViewItem*,const QPoint&) ), this, SLOT( contextMenuRequested(QIconViewItem*,const QPoint&) ) );
178 #endif 181 #endif
179 182
180 // 183 //
181 // signal forwarders 184 // signal forwarders
182 // 185 //
183 // unfortunately we can't short-circuit all the QListView and QIconView signals 186 // unfortunately we can't short-circuit all the QListView and QIconView signals
184 // to OVersatileView signals, because the signal/slot mechanism doesn't allow 187 // to OVersatileView signals, because the signal/slot mechanism doesn't allow
185 // type-conversion :-( 188 // type-conversion :-(
186 189
187 // common signals for listview 190 // common signals for listview
188 191
189 connect( _listview, SIGNAL( selectionChanged() ), this, SIGNAL( selectionChanged() ) ); 192 connect( _listview, SIGNAL( selectionChanged() ), this, SIGNAL( selectionChanged() ) );
190 connect( _listview, SIGNAL( selectionChanged(QListViewItem*) ), this, SLOT( selectionChanged(QListViewItem*) ) ); 193 connect( _listview, SIGNAL( selectionChanged(QListViewItem*) ), this, SLOT( selectionChanged(QListViewItem*) ) );
191 connect( _listview, SIGNAL( currentChanged(QListViewItem*) ), this, SLOT( currentChanged(QListViewItem*) ) ); 194 connect( _listview, SIGNAL( currentChanged(QListViewItem*) ), this, SLOT( currentChanged(QListViewItem*) ) );
192 connect( _listview, SIGNAL( clicked(QListViewItem*) ), this, SLOT( clicked(QListViewItem*) ) ); 195 connect( _listview, SIGNAL( clicked(QListViewItem*) ), this, SLOT( clicked(QListViewItem*) ) );
193 connect( _listview, SIGNAL( pressed(QListViewItem*) ), this, SLOT( pressed(QListViewItem*) ) ); 196 connect( _listview, SIGNAL( pressed(QListViewItem*) ), this, SLOT( pressed(QListViewItem*) ) );
194 197
195 connect( _listview, SIGNAL( doubleClicked(QListViewItem*) ), this, SLOT( doubleClicked(QListViewItem*) ) ); 198 connect( _listview, SIGNAL( doubleClicked(QListViewItem*) ), this, SLOT( doubleClicked(QListViewItem*) ) );
196 connect( _listview, SIGNAL( returnPressed(QListViewItem*) ), this, SLOT( returnPressed(QListViewItem*) ) ); 199 connect( _listview, SIGNAL( returnPressed(QListViewItem*) ), this, SLOT( returnPressed(QListViewItem*) ) );
197 200
198 connect( _listview, SIGNAL( onItem(QListViewItem*) ), this, SLOT( onItem(QListViewItem*) ) ); 201 connect( _listview, SIGNAL( onItem(QListViewItem*) ), this, SLOT( onItem(QListViewItem*) ) );
199 connect( _listview, SIGNAL( onViewport() ), this, SIGNAL( onViewport() ) ); 202 connect( _listview, SIGNAL( onViewport() ), this, SIGNAL( onViewport() ) );
200 203
201 // common signals for iconview 204 // common signals for iconview
202 205
203 connect( _iconview, SIGNAL( selectionChanged() ), this, SIGNAL( selectionChanged() ) ); 206 connect( _iconview, SIGNAL( selectionChanged() ), this, SIGNAL( selectionChanged() ) );
204 connect( _iconview, SIGNAL( selectionChanged(QIconViewItem*) ), this, SLOT( selectionChanged(QIconViewItem*) ) ); 207 connect( _iconview, SIGNAL( selectionChanged(QIconViewItem*) ), this, SLOT( selectionChanged(QIconViewItem*) ) );
205 connect( _iconview, SIGNAL( currentChanged(QIconViewItem*) ), this, SLOT( currentChanged(QIconViewItem*) ) ); 208 connect( _iconview, SIGNAL( currentChanged(QIconViewItem*) ), this, SLOT( currentChanged(QIconViewItem*) ) );
206 connect( _iconview, SIGNAL( clicked(QIconViewItem*) ), this, SLOT( clicked(QIconViewItem*) ) ); 209 connect( _iconview, SIGNAL( clicked(QIconViewItem*) ), this, SLOT( clicked(QIconViewItem*) ) );
207 connect( _iconview, SIGNAL( pressed(QIconViewItem*) ), this, SLOT( pressed(QIconViewItem*) ) ); 210 connect( _iconview, SIGNAL( pressed(QIconViewItem*) ), this, SLOT( pressed(QIconViewItem*) ) );
208 211
209 connect( _iconview, SIGNAL( doubleClicked(QIconViewItem*) ), this, SLOT( doubleClicked(QIconViewItem*) ) ); 212 connect( _iconview, SIGNAL( doubleClicked(QIconViewItem*) ), this, SLOT( doubleClicked(QIconViewItem*) ) );
210 connect( _iconview, SIGNAL( returnPressed(QIconViewItem*) ), this, SLOT( returnPressed(QIconViewItem*) ) ); 213 connect( _iconview, SIGNAL( returnPressed(QIconViewItem*) ), this, SLOT( returnPressed(QIconViewItem*) ) );
211 214
212 connect( _iconview, SIGNAL( onItem(QIconViewItem*) ), this, SLOT( onItem(QIconViewItem*) ) ); 215 connect( _iconview, SIGNAL( onItem(QIconViewItem*) ), this, SLOT( onItem(QIconViewItem*) ) );
213 connect( _iconview, SIGNAL( onViewport() ), this, SIGNAL( onViewport() ) ); 216 connect( _iconview, SIGNAL( onViewport() ), this, SIGNAL( onViewport() ) );
214 217
215 // listview only signals 218 // listview only signals
216 219
217 connect( _listview, SIGNAL( expanded(QListViewItem*) ), this, SLOT( expanded(QListViewItem*) ) ); 220 connect( _listview, SIGNAL( expanded(QListViewItem*) ), this, SLOT( expanded(QListViewItem*) ) );
218 connect( _listview, SIGNAL( collapsed(QListViewItem*) ), this, SLOT( collapsed(QListViewItem*) ) ); 221 connect( _listview, SIGNAL( collapsed(QListViewItem*) ), this, SLOT( collapsed(QListViewItem*) ) );
219 222
220 // iconview only signals 223 // iconview only signals
221 224
222 connect( _iconview, SIGNAL( moved() ), this, SIGNAL( moved() ) ); 225 connect( _iconview, SIGNAL( moved() ), this, SIGNAL( moved() ) );
223} 226}
224 227
225OVersatileView::~OVersatileView() 228OVersatileView::~OVersatileView()
226{ 229{
227} 230}
228 231
229QPopupMenu* OVersatileView::contextMenu() const 232QPopupMenu* OVersatileView::contextMenu() const
230{ 233{
231 return _contextmenu; 234 return _contextmenu;
232} 235}
233 236
234void OVersatileView::contextMenuRequested( QListViewItem* item, const QPoint& pos, int col ) 237void OVersatileView::contextMenuRequested( QListViewItem* item, const QPoint& pos, int col )
235{ 238{
236 // can't use QObject::inherits here, because ListViewItems, beit Q, O or K, 239 // can't use QObject::inherits here, because ListViewItems, beit Q, O or K,
237 // do not inherit from QObject - assuming here the programmer is 240 // do not inherit from QObject - assuming here the programmer is
238 // disciplined enough to only add OVersatileViewItems to an OVersatileView 241 // disciplined enough to only add OVersatileViewItems to an OVersatileView
239 popupContextMenu( static_cast<OVersatileViewItem*>( item ), pos, col ); 242 popupContextMenu( static_cast<OVersatileViewItem*>( item ), pos, col );
240} 243}
241 244
242void OVersatileView::contextMenuRequested( QIconViewItem* item, const QPoint& pos ) 245void OVersatileView::contextMenuRequested( QIconViewItem* item, const QPoint& pos )
243{ 246{
244 // see above 247 // see above
245 popupContextMenu( static_cast<OVersatileViewItem*>( item ), pos, -1 ); 248 popupContextMenu( static_cast<OVersatileViewItem*>( item ), pos, -1 );
@@ -399,82 +402,82 @@ void OVersatileView::clicked( QIconViewItem * item )
399void OVersatileView::pressed( QListViewItem * item ) 402void OVersatileView::pressed( QListViewItem * item )
400{ 403{
401 emit( pressed( static_cast<OVersatileViewItem*>( item ) ) ); 404 emit( pressed( static_cast<OVersatileViewItem*>( item ) ) );
402} 405}
403 406
404void OVersatileView::pressed( QIconViewItem * item ) 407void OVersatileView::pressed( QIconViewItem * item )
405{ 408{
406 emit( pressed( static_cast<OVersatileViewItem*>( item ) ) ); 409 emit( pressed( static_cast<OVersatileViewItem*>( item ) ) );
407} 410}
408 411
409void OVersatileView::doubleClicked( QListViewItem * item ) 412void OVersatileView::doubleClicked( QListViewItem * item )
410{ 413{
411 emit( doubleClicked( static_cast<OVersatileViewItem*>( item ) ) ); 414 emit( doubleClicked( static_cast<OVersatileViewItem*>( item ) ) );
412} 415}
413 416
414void OVersatileView::doubleClicked( QIconViewItem * item ) 417void OVersatileView::doubleClicked( QIconViewItem * item )
415{ 418{
416 emit( doubleClicked( static_cast<OVersatileViewItem*>( item ) ) ); 419 emit( doubleClicked( static_cast<OVersatileViewItem*>( item ) ) );
417} 420}
418 421
419void OVersatileView::returnPressed( QListViewItem * item ) 422void OVersatileView::returnPressed( QListViewItem * item )
420{ 423{
421 emit( returnPressed( static_cast<OVersatileViewItem*>( item ) ) ); 424 emit( returnPressed( static_cast<OVersatileViewItem*>( item ) ) );
422} 425}
423 426
424void OVersatileView::returnPressed( QIconViewItem * item ) 427void OVersatileView::returnPressed( QIconViewItem * item )
425{ 428{
426 emit( returnPressed( static_cast<OVersatileViewItem*>( item ) ) ); 429 emit( returnPressed( static_cast<OVersatileViewItem*>( item ) ) );
427} 430}
428 431
429void OVersatileView::onItem( QListViewItem * item ) 432void OVersatileView::onItem( QListViewItem * item )
430{ 433{
431 emit( onItem( static_cast<OVersatileViewItem*>( item ) ) ); 434 emit( onItem( static_cast<OVersatileViewItem*>( item ) ) );
432} 435}
433 436
434void OVersatileView::onItem( QIconViewItem * item ) 437void OVersatileView::onItem( QIconViewItem * item )
435{ 438{
436 emit( onItem( static_cast<OVersatileViewItem*>( item ) ) ); 439 emit( onItem( static_cast<OVersatileViewItem*>( item ) ) );
437} 440}
438 441
439void OVersatileView::expanded( QListViewItem *item ) // QListView 442void OVersatileView::expanded( QListViewItem *item ) // QListView
440{ 443{
441 //odebug << "OVersatileView::expanded(): opening tree..." << oendl; 444 //odebug << "OVersatileView::expanded(): opening tree..." << oendl;
442 if ( !_treeopened.isNull() ) 445 if ( !_treeopened.isNull() )
443 item->setPixmap( 0, _treeopened ); 446 item->setPixmap( 0, _treeopened );
444 emit( expanded( static_cast<OVersatileViewItem*>( item ) ) ); 447 emit( expanded( static_cast<OVersatileViewItem*>( item ) ) );
445} 448}
446void OVersatileView::collapsed( QListViewItem *item ) // QListView 449void OVersatileView::collapsed( QListViewItem *item ) // QListView
447{ 450{
448 if ( !_treeclosed.isNull() ) 451 if ( !_treeclosed.isNull() )
449 item->setPixmap( 0, _treeclosed ); 452 item->setPixmap( 0, _treeclosed );
450 emit( collapsed( static_cast<OVersatileViewItem*>( item ) ) ); 453 emit( collapsed( static_cast<OVersatileViewItem*>( item ) ) );
451} 454}
452 455
453//=============================================================================================// 456//=============================================================================================//
454// OVersatileView Case I - API only existing in QListView or QIconView but not in both! 457// OVersatileView Case I - API only existing in QListView or QIconView but not in both!
455//==============================================================================================// 458//==============================================================================================//
456 459
457int OVersatileView::treeStepSize() const // QListView 460int OVersatileView::treeStepSize() const // QListView
458{ 461{
459 if ( !isValidViewMode( Tree ) ) 462 if ( !isValidViewMode( Tree ) )
460 { 463 {
461 return -1; 464 return -1;
462 } 465 }
463 return _listview->treeStepSize(); 466 return _listview->treeStepSize();
464} 467}
465 void OVersatileView::setTreeStepSize( int size ) // QListView 468 void OVersatileView::setTreeStepSize( int size ) // QListView
466{ 469{
467 if ( !isValidViewMode( Tree ) ) 470 if ( !isValidViewMode( Tree ) )
468 { 471 {
469 return; 472 return;
470 } 473 }
471 _listview->setTreeStepSize( size ); 474 _listview->setTreeStepSize( size );
472} 475}
473 476
474QHeader * OVersatileView::header() const // QListView 477QHeader * OVersatileView::header() const // QListView
475{ 478{
476 if ( !isValidViewMode( Tree ) ) 479 if ( !isValidViewMode( Tree ) )
477 { 480 {
478 return 0; 481 return 0;
479 } 482 }
480 return _listview->header(); 483 return _listview->header();
@@ -724,49 +727,49 @@ void OVersatileView::setShowSortIndicator( bool show ) // QListView
724 } 727 }
725 _listview->setShowSortIndicator( show ); 728 _listview->setShowSortIndicator( show );
726} 729}
727bool OVersatileView::showSortIndicator() const // QListView 730bool OVersatileView::showSortIndicator() const // QListView
728{ 731{
729 if ( !isValidViewMode( Tree ) ) 732 if ( !isValidViewMode( Tree ) )
730 { 733 {
731 return false; 734 return false;
732 } 735 }
733 return _listview->showSortIndicator(); 736 return _listview->showSortIndicator();
734} 737}
735 738
736void OVersatileView::triggerUpdate() // QListView 739void OVersatileView::triggerUpdate() // QListView
737{ 740{
738 if ( !isValidViewMode( Tree ) ) 741 if ( !isValidViewMode( Tree ) )
739 { 742 {
740 return; 743 return;
741 } 744 }
742 _listview->triggerUpdate(); 745 _listview->triggerUpdate();
743} 746}
744 747
745// 748//
746// only in QIconView 749// only in QIconView
747// 750//
748 751
749uint OVersatileView::count() const // QIconView 752uint OVersatileView::count() const // QIconView
750{ 753{
751 if ( !isValidViewMode( Icons ) ) 754 if ( !isValidViewMode( Icons ) )
752 { 755 {
753 return 0; 756 return 0;
754 } 757 }
755 return _iconview->count(); 758 return _iconview->count();
756} 759}
757 760
758int OVersatileView::index( const OVersatileViewItem *item ) const // QIconView 761int OVersatileView::index( const OVersatileViewItem *item ) const // QIconView
759{ 762{
760 if ( !isValidViewMode( Icons ) ) 763 if ( !isValidViewMode( Icons ) )
761 { 764 {
762 return -1; 765 return -1;
763 } 766 }
764 return _iconview->index( item ); 767 return _iconview->index( item );
765} 768}
766 769
767OVersatileViewItem* OVersatileView::firstItem() const // QIconView 770OVersatileViewItem* OVersatileView::firstItem() const // QIconView
768{ 771{
769 if ( !isValidViewMode( Icons ) ) 772 if ( !isValidViewMode( Icons ) )
770 { 773 {
771 return 0; 774 return 0;
772 } 775 }
diff --git a/libopie2/opieui/oversatileview.h b/libopie2/opieui/oversatileview.h
index 8af21dc..61b61db 100644
--- a/libopie2/opieui/oversatileview.h
+++ b/libopie2/opieui/oversatileview.h
@@ -24,371 +24,376 @@
24    --        :-=` this library; see the file COPYING.LIB. 24    --        :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28 28
29*/ 29*/
30 30
31#ifndef OVERSATILEVIEW_H 31#ifndef OVERSATILEVIEW_H
32#define OVERSATILEVIEW_H 32#define OVERSATILEVIEW_H
33 33
34/* QT */ 34/* QT */
35 35
36#include <qwidgetstack.h> 36#include <qwidgetstack.h>
37#include <qiconview.h> 37#include <qiconview.h>
38 38
39/* OPIE */ 39/* OPIE */
40 40
41#include <opie2/oapplication.h> 41#include <opie2/oapplication.h>
42 42
43/* FORWARDS */ 43/* FORWARDS */
44 44
45class QHeader; 45class QHeader;
46class QIconSet; 46class QIconSet;
47class QIconViewItem; 47class QIconViewItem;
48class OListView;
49class QListViewItem; 48class QListViewItem;
50class QPopupMenu; 49class QPopupMenu;
51class QString; 50class QString;
52 51
53#ifndef QT_NO_DRAGANDDROP 52#ifndef QT_NO_DRAGANDDROP
54class QIconDragItem; 53class QIconDragItem;
55#endif 54#endif
56 55
56namespace Opie {
57namespace Ui {
58class OListView;
59
57class OVersatileView : public QWidgetStack 60class OVersatileView : public QWidgetStack
58{ 61{
59 Q_OBJECT 62 Q_OBJECT
60 63
61 friend class OVersatileViewItem; 64 friend class OVersatileViewItem;
62 65
63 //==============================================================================================// 66 //==============================================================================================//
64 // OVersatileView High Level API 67 // OVersatileView High Level API
65 //==============================================================================================// 68 //==============================================================================================//
66 69
67 public: 70 public:
68 OVersatileView( QWidget* parent = 0, const char* name = 0, int mode = 0 ); 71 OVersatileView( QWidget* parent = 0, const char* name = 0, int mode = 0 );
69 ~OVersatileView(); 72 ~OVersatileView();
70 73
71 QPopupMenu* contextMenu() const; 74 QPopupMenu* contextMenu() const;
72 75
73 void setSynchronization( bool sync ); 76 void setSynchronization( bool sync );
74 bool synchronization(); 77 bool synchronization();
75 78
76 enum ViewMode { Tree = 0, Icons }; 79 enum ViewMode { Tree = 0, Icons };
77 int viewMode(); 80 int viewMode();
78 81
79 QIconView* iconView() const; 82 QIconView* iconView() const;
80 OListView* listView() const; 83 OListView* listView() const;
81 84
82 enum WarningPolicy { None = 0, Warn, WarnReturn }; 85 enum WarningPolicy { None = 0, Warn, WarnReturn };
83 86
84 void setWarningPolicy( int ) const; // warn, if calling a method which doesn't apply to the current viewmode 87 void setWarningPolicy( int ) const; // warn, if calling a method which doesn't apply to the current viewmode
85 bool warningPolicy() const; 88 bool warningPolicy() const;
86 89
87 void setDefaultPixmaps( int mode, QPixmap& leaf, QPixmap& opened, QPixmap& closed ); 90 void setDefaultPixmaps( int mode, QPixmap& leaf, QPixmap& opened, QPixmap& closed );
88 91
89 public slots: 92 public slots:
90 void setViewMode( int mode ); 93 void setViewMode( int mode );
91 void setIconViewMode(); 94 void setIconViewMode();
92 void setTreeViewMode(); 95 void setTreeViewMode();
93 96
94 protected: 97 protected:
95 virtual bool isValidViewMode( int mode ) const; 98 virtual bool isValidViewMode( int mode ) const;
96 virtual void popupContextMenu( OVersatileViewItem* item, const QPoint& pos, int col = 0 ); 99 virtual void popupContextMenu( OVersatileViewItem* item, const QPoint& pos, int col = 0 );
97 100
98 private: 101 private:
99 int _viewmode; 102 int _viewmode;
100 bool _synchronization; 103 bool _synchronization;
101 mutable int _warningpolicy; 104 mutable int _warningpolicy;
102 105
103 OListView* _listview; 106 OListView* _listview;
104 QIconView* _iconview; 107 QIconView* _iconview;
105 108
106 QPixmap _treeleaf; 109 QPixmap _treeleaf;
107 QPixmap _treeopened; 110 QPixmap _treeopened;
108 QPixmap _treeclosed; 111 QPixmap _treeclosed;
109 112
110 QPixmap _iconleaf; 113 QPixmap _iconleaf;
111 QPixmap _iconopened; 114 QPixmap _iconopened;
112 QPixmap _iconclosed; 115 QPixmap _iconclosed;
113 116
114 QPopupMenu* _contextmenu; 117 QPopupMenu* _contextmenu;
115 118
116 int _iconstyle; 119 int _iconstyle;
117 int _treestyle; 120 int _treestyle;
118 121
119 private slots: 122 private slots:
120 123
121 void contextMenuRequested( QListViewItem*, const QPoint&, int ); 124 void contextMenuRequested( QListViewItem*, const QPoint&, int );
122 void contextMenuRequested( QIconViewItem*, const QPoint& ); 125 void contextMenuRequested( QIconViewItem*, const QPoint& );
123 126
124 // type converting signal forwarders 127 // type converting signal forwarders
125 128
126 void selectionChanged( QListViewItem * ); 129 void selectionChanged( QListViewItem * );
127 void currentChanged( QListViewItem * ); 130 void currentChanged( QListViewItem * );
128 void clicked( QListViewItem * ); 131 void clicked( QListViewItem * );
129 void pressed( QListViewItem * ); 132 void pressed( QListViewItem * );
130 void doubleClicked( QListViewItem * ); 133 void doubleClicked( QListViewItem * );
131 void returnPressed( QListViewItem * ); 134 void returnPressed( QListViewItem * );
132 void onItem( QListViewItem * ); 135 void onItem( QListViewItem * );
133 136
134 void selectionChanged( QIconViewItem * ); 137 void selectionChanged( QIconViewItem * );
135 void currentChanged( QIconViewItem * ); 138 void currentChanged( QIconViewItem * );
136 void clicked( QIconViewItem * ); 139 void clicked( QIconViewItem * );
137 void pressed( QIconViewItem * ); 140 void pressed( QIconViewItem * );
138 void doubleClicked( QIconViewItem * ); 141 void doubleClicked( QIconViewItem * );
139 void returnPressed( QIconViewItem * ); 142 void returnPressed( QIconViewItem * );
140 void onItem( QIconViewItem * ); 143 void onItem( QIconViewItem * );
141 144
142 void expanded( QListViewItem * item ); // QListView 145 void expanded( QListViewItem * item ); // QListView
143 void collapsed( QListViewItem * item ); // QListView 146 void collapsed( QListViewItem * item ); // QListView
144 147
145 signals: 148 signals:
146 149
147 void contextMenuRequested( OVersatileViewItem * item, const QPoint& pos, int col ); 150 void contextMenuRequested( OVersatileViewItem * item, const QPoint& pos, int col );
148 151
149 /*#ifndef QT_NO_DRAGANDDROP 152 /*#ifndef QT_NO_DRAGANDDROP
150 void dropped( QDropEvent *e, const QValueList<QIconDragItem> &lst ); // QIconView 153 void dropped( QDropEvent *e, const QValueList<QIconDragItem> &lst ); // QIconView
151 #endif 154 #endif
152 void itemRenamed( OVersatileViewItem *item, const QString & ); // QIconView 155 void itemRenamed( OVersatileViewItem *item, const QString & ); // QIconView
153 void itemRenamed( OVersatileViewItem *item ); // QIconView 156 void itemRenamed( OVersatileViewItem *item ); // QIconView
154 */ 157 */
155 158
156 //==============================================================================================// 159 //==============================================================================================//
157 // "Derived" API - Case 1: Methods existing either only in QListView or only in QIconView 160 // "Derived" API - Case 1: Methods existing either only in QListView or only in QIconView
158 //==============================================================================================// 161 //==============================================================================================//
159 162
160public: 163public:
161 164
162 /* 165 /*
163 enum Arrangement { // QIconView 166 enum Arrangement { // QIconView
164 LeftToRight = 0, 167 LeftToRight = 0,
165 TopToBottom 168 TopToBottom
166 }; 169 };
167 enum ResizeMode { // QIconView 170 enum ResizeMode { // QIconView
168 Fixed = 0, 171 Fixed = 0,
169 Adjust 172 Adjust
170 }; 173 };
171 enum ItemTextPos { // QIconView 174 enum ItemTextPos { // QIconView
172 Bottom = 0, 175 Bottom = 0,
173 Right 176 Right
174 }; 177 };
175 */ 178 */
176 179
177 // 180 //
178 // only in QListView 181 // only in QListView
179 // 182 //
180 183
181 int treeStepSize() const; // QListView 184 int treeStepSize() const; // QListView
182 virtual void setTreeStepSize( int ); // QListView 185 virtual void setTreeStepSize( int ); // QListView
183 186
184 QHeader * header() const; // QListView 187 QHeader * header() const; // QListView
185 188
186 virtual int addColumn( const QString &label, int size = -1); // QListView 189 virtual int addColumn( const QString &label, int size = -1); // QListView
187 virtual int addColumn( const QIconSet& iconset, const QString &label, int size = -1); // QListView 190 virtual int addColumn( const QIconSet& iconset, const QString &label, int size = -1); // QListView
188 void removeColumn( int index ); // #### make virtual in next major release! // QListView 191 void removeColumn( int index ); // #### make virtual in next major release! // QListView
189 virtual void setColumnText( int column, const QString &label ); // QListView 192 virtual void setColumnText( int column, const QString &label ); // QListView
190 virtual void setColumnText( int column, const QIconSet& iconset, const QString &label ); // QListView 193 virtual void setColumnText( int column, const QIconSet& iconset, const QString &label ); // QListView
191 QString columnText( int column ) const; // QListView 194 QString columnText( int column ) const; // QListView
192 virtual void setColumnWidth( int column, int width ); // QListView 195 virtual void setColumnWidth( int column, int width ); // QListView
193 int columnWidth( int column ) const; // QListView 196 int columnWidth( int column ) const; // QListView
194 enum WidthMode { Manual, Maximum }; // QListView 197 enum WidthMode { Manual, Maximum }; // QListView
195 virtual void setColumnWidthMode( int column, WidthMode ); // QListView 198 virtual void setColumnWidthMode( int column, WidthMode ); // QListView
196 WidthMode columnWidthMode( int column ) const; // QListView 199 WidthMode columnWidthMode( int column ) const; // QListView
197 int columns() const; // QListView 200 int columns() const; // QListView
198 201
199 virtual void setColumnAlignment( int, int ); // QListView 202 virtual void setColumnAlignment( int, int ); // QListView
200 int columnAlignment( int ) const; // QListView 203 int columnAlignment( int ) const; // QListView
201 204
202 OVersatileViewItem * itemAt( const QPoint & screenPos ) const; // QListView 205 OVersatileViewItem * itemAt( const QPoint & screenPos ) const; // QListView
203 QRect itemRect( const OVersatileViewItem * ) const; // QListView 206 QRect itemRect( const OVersatileViewItem * ) const; // QListView
204 int itemPos( const OVersatileViewItem * ); // QListView 207 int itemPos( const OVersatileViewItem * ); // QListView
205 208
206 bool isSelected( const OVersatileViewItem * ) const; // QListView // also in QIconViewItem but not in QIconView *shrug* 209 bool isSelected( const OVersatileViewItem * ) const; // QListView // also in QIconViewItem but not in QIconView *shrug*
207 210
208 virtual void setMultiSelection( bool enable ); // QListView 211 virtual void setMultiSelection( bool enable ); // QListView
209 bool isMultiSelection() const; // QListView 212 bool isMultiSelection() const; // QListView
210 213
211 OVersatileViewItem * selectedItem() const; // QListView 214 OVersatileViewItem * selectedItem() const; // QListView
212 virtual void setOpen( OVersatileViewItem *, bool ); // QListView 215 virtual void setOpen( OVersatileViewItem *, bool ); // QListView
213 bool isOpen( const OVersatileViewItem * ) const; // QListView 216 bool isOpen( const OVersatileViewItem * ) const; // QListView
214 217
215 OVersatileViewItem * firstChild() const; // QListView 218 OVersatileViewItem * firstChild() const; // QListView
216 int childCount() const; // QListView 219 int childCount() const; // QListView
217 220
218 virtual void setAllColumnsShowFocus( bool ); // QListView 221 virtual void setAllColumnsShowFocus( bool ); // QListView
219 bool allColumnsShowFocus() const; // QListView 222 bool allColumnsShowFocus() const; // QListView
220 223
221 virtual void setItemMargin( int ); // QListView 224 virtual void setItemMargin( int ); // QListView
222 int itemMargin() const; // QListView 225 int itemMargin() const; // QListView
223 226
224 virtual void setRootIsDecorated( bool ); // QListView 227 virtual void setRootIsDecorated( bool ); // QListView
225 bool rootIsDecorated() const; // QListView 228 bool rootIsDecorated() const; // QListView
226 229
227 void setShowSortIndicator( bool show ); // QListView 230 void setShowSortIndicator( bool show ); // QListView
228 bool showSortIndicator() const; // QListView 231 bool showSortIndicator() const; // QListView
229 232
230 int index( const OVersatileViewItem *item ) const; // QIconView 233 int index( const OVersatileViewItem *item ) const; // QIconView
231 234
232 public slots: 235 public slots:
233 void triggerUpdate(); // QListView 236 void triggerUpdate(); // QListView
234 237
235 signals: 238 signals:
236 void expanded( OVersatileViewItem *item ); // QListView 239 void expanded( OVersatileViewItem *item ); // QListView
237 void collapsed( OVersatileViewItem *item ); // QListView 240 void collapsed( OVersatileViewItem *item ); // QListView
238 241
239 // 242 //
240 // only in QIconView 243 // only in QIconView
241 // 244 //
242 245
243 public: 246 public:
244 uint count() const; // QIconView 247 uint count() const; // QIconView
245 248
246 OVersatileViewItem *firstItem() const; // QIconView 249 OVersatileViewItem *firstItem() const; // QIconView
247 OVersatileViewItem *lastItem() const; // QIconView 250 OVersatileViewItem *lastItem() const; // QIconView
248 251
249 OVersatileViewItem *findItem( const QPoint &pos ) const; // QIconView 252 OVersatileViewItem *findItem( const QPoint &pos ) const; // QIconView
250 OVersatileViewItem *findItem( const QString &text ) const; // QIconView 253 OVersatileViewItem *findItem( const QString &text ) const; // QIconView
251 254
252 OVersatileViewItem* findFirstVisibleItem( const QRect &r ) const; // QIconView 255 OVersatileViewItem* findFirstVisibleItem( const QRect &r ) const; // QIconView
253 OVersatileViewItem* findLastVisibleItem( const QRect &r ) const; // QIconView 256 OVersatileViewItem* findLastVisibleItem( const QRect &r ) const; // QIconView
254 257
255 virtual void setGridX( int rx ); // QIconView 258 virtual void setGridX( int rx ); // QIconView
256 virtual void setGridY( int ry ); // QIconView 259 virtual void setGridY( int ry ); // QIconView
257 int gridX() const; // QIconView 260 int gridX() const; // QIconView
258 int gridY() const; // QIconView 261 int gridY() const; // QIconView
259 virtual void setSpacing( int sp ); // QIconView 262 virtual void setSpacing( int sp ); // QIconView
260 int spacing() const; // QIconView 263 int spacing() const; // QIconView
261 virtual void setItemTextPos( QIconView::ItemTextPos pos ); // QIconView 264 virtual void setItemTextPos( QIconView::ItemTextPos pos ); // QIconView
262 QIconView::ItemTextPos itemTextPos() const; // QIconView 265 QIconView::ItemTextPos itemTextPos() const; // QIconView
263 virtual void setItemTextBackground( const QBrush &b ); // QIconView 266 virtual void setItemTextBackground( const QBrush &b ); // QIconView
264 QBrush itemTextBackground() const; // QIconView 267 QBrush itemTextBackground() const; // QIconView
265 virtual void setArrangement( QIconView::Arrangement am ); // QIconView 268 virtual void setArrangement( QIconView::Arrangement am ); // QIconView
266 QIconView::Arrangement arrangement() const; // QIconView 269 QIconView::Arrangement arrangement() const; // QIconView
267 virtual void setResizeMode( QIconView::ResizeMode am ); // QIconView 270 virtual void setResizeMode( QIconView::ResizeMode am ); // QIconView
268 QIconView::ResizeMode resizeMode() const; // QIconView 271 QIconView::ResizeMode resizeMode() const; // QIconView
269 virtual void setMaxItemWidth( int w ); // QIconView 272 virtual void setMaxItemWidth( int w ); // QIconView
270 int maxItemWidth() const; // QIconView 273 int maxItemWidth() const; // QIconView
271 virtual void setMaxItemTextLength( int w ); // QIconView 274 virtual void setMaxItemTextLength( int w ); // QIconView
272 int maxItemTextLength() const; // QIconView 275 int maxItemTextLength() const; // QIconView
273 virtual void setAutoArrange( bool b ); // QIconView 276 virtual void setAutoArrange( bool b ); // QIconView
274 bool autoArrange() const; // QIconView 277 bool autoArrange() const; // QIconView
275 virtual void setShowToolTips( bool b ); // QIconView 278 virtual void setShowToolTips( bool b ); // QIconView
276 bool showToolTips() const; // QIconView 279 bool showToolTips() const; // QIconView
277 280
278 bool sorting() const; // QIconView 281 bool sorting() const; // QIconView
279 bool sortDirection() const; // QIconView 282 bool sortDirection() const; // QIconView
280 283
281 virtual void setItemsMovable( bool b ); // QIconView 284 virtual void setItemsMovable( bool b ); // QIconView
282 bool itemsMovable() const; // QIconView 285 bool itemsMovable() const; // QIconView
283 virtual void setWordWrapIconText( bool b ); // QIconView 286 virtual void setWordWrapIconText( bool b ); // QIconView
284 bool wordWrapIconText() const; // QIconView 287 bool wordWrapIconText() const; // QIconView
285 288
286 public slots: 289 public slots:
287 virtual void arrangeItemsInGrid( const QSize &grid, bool update = TRUE ); // QIconView 290 virtual void arrangeItemsInGrid( const QSize &grid, bool update = TRUE ); // QIconView
288 virtual void arrangeItemsInGrid( bool update = TRUE ); // QIconView 291 virtual void arrangeItemsInGrid( bool update = TRUE ); // QIconView
289 virtual void updateContents(); // QIconView 292 virtual void updateContents(); // QIconView
290 293
291 signals: 294 signals:
292 /*#ifndef QT_NO_DRAGANDDROP 295 /*#ifndef QT_NO_DRAGANDDROP
293 void dropped( QDropEvent *e, const QValueList<QIconDragItem> &lst ); // QIconView 296 void dropped( QDropEvent *e, const QValueList<QIconDragItem> &lst ); // QIconView
294 #endif 297 #endif
295 */ 298 */
296 void moved(); // QIconView 299 void moved(); // QIconView
297 void itemRenamed( OVersatileViewItem *item, const QString & ); // QIconView 300 void itemRenamed( OVersatileViewItem *item, const QString & ); // QIconView
298 void itemRenamed( OVersatileViewItem *item ); // QIconView 301 void itemRenamed( OVersatileViewItem *item ); // QIconView
299 302
300 //==============================================================================================// 303 //==============================================================================================//
301 // "Derived" API - Case 2: Methods existing in QListView and QIconView with the same signatures 304 // "Derived" API - Case 2: Methods existing in QListView and QIconView with the same signatures
302 //==============================================================================================// 305 //==============================================================================================//
303 306
304 public: 307 public:
305 enum SelectionMode { 308 enum SelectionMode {
306 Single = 0, 309 Single = 0,
307 Multi, 310 Multi,
308 Extended, 311 Extended,
309 NoSelection 312 NoSelection
310 }; 313 };
311 314
312 virtual void clear(); 315 virtual void clear();
313 316
314 virtual void setFont( const QFont & ); 317 virtual void setFont( const QFont & );
315 virtual void setPalette( const QPalette & ); 318 virtual void setPalette( const QPalette & );
316 319
317 virtual void takeItem( OVersatileViewItem * ); 320 virtual void takeItem( OVersatileViewItem * );
318 321
319 void setSelectionMode( SelectionMode mode ); 322 void setSelectionMode( SelectionMode mode );
320 SelectionMode selectionMode() const; 323 SelectionMode selectionMode() const;
321 324
322 virtual void selectAll( bool select ); 325 virtual void selectAll( bool select );
323 virtual void clearSelection(); 326 virtual void clearSelection();
324 virtual void invertSelection(); 327 virtual void invertSelection();
325 328
326 void ensureItemVisible( const OVersatileViewItem * ); 329 void ensureItemVisible( const OVersatileViewItem * );
327 virtual void repaintItem( const OVersatileViewItem * ) const; 330 virtual void repaintItem( const OVersatileViewItem * ) const;
328 331
329 virtual void setCurrentItem( OVersatileViewItem * ); 332 virtual void setCurrentItem( OVersatileViewItem * );
330 OVersatileViewItem * currentItem() const; 333 OVersatileViewItem * currentItem() const;
331 334
332 // bool eventFilter( QObject * o, QEvent * ); // use QWidgetStack implementation 335 // bool eventFilter( QObject * o, QEvent * ); // use QWidgetStack implementation
333 336
334 // QSize minimumSizeHint() const; // use QWidgetStack implementation 337 // QSize minimumSizeHint() const; // use QWidgetStack implementation
335 // QSizePolicy sizePolicy() const; // use QWidgetStack implementation 338 // QSizePolicy sizePolicy() const; // use QWidgetStack implementation
336 // QSize sizeHint() const; // use QWidgetStack implementation 339 // QSize sizeHint() const; // use QWidgetStack implementation
337 340
338 signals: 341 signals:
339 void selectionChanged(); 342 void selectionChanged();
340 void selectionChanged( OVersatileViewItem * ); 343 void selectionChanged( OVersatileViewItem * );
341 void currentChanged( OVersatileViewItem * ); 344 void currentChanged( OVersatileViewItem * );
342 void clicked( OVersatileViewItem * ); 345 void clicked( OVersatileViewItem * );
343 void pressed( OVersatileViewItem * ); 346 void pressed( OVersatileViewItem * );
344 347
345 void doubleClicked( OVersatileViewItem * ); 348 void doubleClicked( OVersatileViewItem * );
346 void returnPressed( OVersatileViewItem * ); 349 void returnPressed( OVersatileViewItem * );
347 350
348 void onItem( OVersatileViewItem * ); 351 void onItem( OVersatileViewItem * );
349 void onViewport(); 352 void onViewport();
350 353
351 //==============================================================================================// 354 //==============================================================================================//
352 // "Derived" API - Case 2: Methods existing in QListView and QIconView with differing signatures 355 // "Derived" API - Case 2: Methods existing in QListView and QIconView with differing signatures
353 //==============================================================================================// 356 //==============================================================================================//
354 357
355 /* 358 /*
356 359
357 public: 360 public:
358 virtual void insertItem( OVersatileViewItem * ); // QListView 361 virtual void insertItem( OVersatileViewItem * ); // QListView
359 virtual void insertItem( OVersatileViewItem *item, OVersatileViewItem *after = 0L ); // QIconView 362 virtual void insertItem( OVersatileViewItem *item, OVersatileViewItem *after = 0L ); // QIconView
360 363
361 virtual void setSelected( OVersatileViewItem *, bool ); // QListView 364 virtual void setSelected( OVersatileViewItem *, bool ); // QListView
362 virtual void setSelected( OVersatileViewItem *item, bool s, bool cb = FALSE ); // QIconView 365 virtual void setSelected( OVersatileViewItem *item, bool s, bool cb = FALSE ); // QIconView
363 366
364 virtual void setSorting( int column, bool increasing = TRUE ); // QListView 367 virtual void setSorting( int column, bool increasing = TRUE ); // QListView
365 void setSorting( bool sort, bool ascending = TRUE ); // QIconView 368 void setSorting( bool sort, bool ascending = TRUE ); // QIconView
366 369
367 void sort(); // #### make virtual in next major release // QListView 370 void sort(); // #### make virtual in next major release // QListView
368 virtual void sort( bool ascending = TRUE ); // QIconView 371 virtual void sort( bool ascending = TRUE ); // QIconView
369 372
370 */ 373 */
371 374
372 signals: 375 signals:
373 void clicked( OVersatileViewItem *, const QPoint &, int ); // QListView 376 void clicked( OVersatileViewItem *, const QPoint &, int ); // QListView
374 void clicked( OVersatileViewItem *, const QPoint & ); // QIconView 377 void clicked( OVersatileViewItem *, const QPoint & ); // QIconView
375 378
376 void pressed( OVersatileViewItem *, const QPoint &, int ); // QListView 379 void pressed( OVersatileViewItem *, const QPoint &, int ); // QListView
377 void pressed( OVersatileViewItem *, const QPoint & ); // QIconView 380 void pressed( OVersatileViewItem *, const QPoint & ); // QIconView
378 381
379 void rightButtonClicked( OVersatileViewItem* item, const QPoint& pos ); // QIconView 382 void rightButtonClicked( OVersatileViewItem* item, const QPoint& pos ); // QIconView
380 void rightButtonClicked( OVersatileViewItem *, const QPoint&, int ); // QListView 383 void rightButtonClicked( OVersatileViewItem *, const QPoint&, int ); // QListView
381 384
382 void rightButtonPressed( OVersatileViewItem* item, const QPoint& pos ); // QIconView 385 void rightButtonPressed( OVersatileViewItem* item, const QPoint& pos ); // QIconView
383 void rightButtonPressed( OVersatileViewItem *, const QPoint&, int ); // QListView 386 void rightButtonPressed( OVersatileViewItem *, const QPoint&, int ); // QListView
384 387
385 void mouseButtonPressed( int, OVersatileViewItem *, const QPoint& , int ); // QListView 388 void mouseButtonPressed( int, OVersatileViewItem *, const QPoint& , int ); // QListView
386 void mouseButtonPressed( int button, OVersatileViewItem* item, const QPoint& pos ); // QIconView 389 void mouseButtonPressed( int button, OVersatileViewItem* item, const QPoint& pos ); // QIconView
387 390
388 void mouseButtonClicked( int, OVersatileViewItem *, const QPoint&, int ); // QListView 391 void mouseButtonClicked( int, OVersatileViewItem *, const QPoint&, int ); // QListView
389 void mouseButtonClicked( int button, OVersatileViewItem* item, const QPoint& pos ); // QIconView 392 void mouseButtonClicked( int button, OVersatileViewItem* item, const QPoint& pos ); // QIconView
390 393
391}; 394};
392 395
396}
397}
393#endif 398#endif
394 399
diff --git a/libopie2/opieui/oversatileviewitem.cpp b/libopie2/opieui/oversatileviewitem.cpp
index 66de8eb..03c6738 100644
--- a/libopie2/opieui/oversatileviewitem.cpp
+++ b/libopie2/opieui/oversatileviewitem.cpp
@@ -10,48 +10,50 @@
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 program is distributed in the hope that 14    .i_,=:_.      -<s. This program 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 18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.=       =       ; Library General Public License for more 19..}^=.=       =       ; Library General Public License for more
20++=   -.     .`     .: details. 20++=   -.     .`     .: details.
21 :     =  ...= . :.=- 21 :     =  ...= . :.=-
22 -.   .:....=;==+<; You should have received a copy of the GNU 22 -.   .:....=;==+<; You should have received a copy of the GNU
23  -_. . .   )=.  = Library General Public License along with 23  -_. . .   )=.  = Library General Public License along with
24    --        :-=` this library; see the file COPYING.LIB. 24    --        :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28 28
29*/ 29*/
30 30
31#include <opie2/oversatileviewitem.h> 31#include <opie2/oversatileviewitem.h>
32#include <opie2/oversatileview.h> 32#include <opie2/oversatileview.h>
33 33
34using namespace Opie::Ui;
35
34OVersatileViewItem::OVersatileViewItem( OVersatileView * parent ) 36OVersatileViewItem::OVersatileViewItem( OVersatileView * parent )
35 :OListViewItem( parent->_listview ), QIconViewItem( parent->_iconview ), 37 :OListViewItem( parent->_listview ), QIconViewItem( parent->_iconview ),
36 _versatileview( parent ) 38 _versatileview( parent )
37{ 39{
38 init(); 40 init();
39} 41}
40 42
41OVersatileViewItem::OVersatileViewItem( OVersatileView * parent, OVersatileViewItem * after ) 43OVersatileViewItem::OVersatileViewItem( OVersatileView * parent, OVersatileViewItem * after )
42 :OListViewItem( parent->_listview, after ), QIconViewItem( parent->_iconview, after ), 44 :OListViewItem( parent->_listview, after ), QIconViewItem( parent->_iconview, after ),
43 _versatileview( parent ) 45 _versatileview( parent )
44{ 46{
45 init(); 47 init();
46} 48}
47 49
48OVersatileViewItem::OVersatileViewItem( OVersatileView * parent, 50OVersatileViewItem::OVersatileViewItem( OVersatileView * parent,
49 QString a, QString b, QString c, QString d, 51 QString a, QString b, QString c, QString d,
50 QString e, QString f, QString g, QString h ) 52 QString e, QString f, QString g, QString h )
51 :OListViewItem( parent->_listview, a, b, c, d, e, f, g, h ), 53 :OListViewItem( parent->_listview, a, b, c, d, e, f, g, h ),
52 QIconViewItem( parent->_iconview, a ), 54 QIconViewItem( parent->_iconview, a ),
53 _versatileview( parent ) 55 _versatileview( parent )
54{ 56{
55 init(); 57 init();
56} 58}
57 59
diff --git a/libopie2/opieui/oversatileviewitem.h b/libopie2/opieui/oversatileviewitem.h
index ee8ee20..c4977af 100644
--- a/libopie2/opieui/oversatileviewitem.h
+++ b/libopie2/opieui/oversatileviewitem.h
@@ -19,48 +19,51 @@
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#ifndef OVERSATILEVIEWITEM_H 32#ifndef OVERSATILEVIEWITEM_H
33#define OVERSATILEVIEWITEM_H 33#define OVERSATILEVIEWITEM_H
34 34
35/* QT */ 35/* QT */
36 36
37#include <qiconview.h> 37#include <qiconview.h>
38 38
39/* OPIE */ 39/* OPIE */
40 40
41#include <opie2/olistview.h> 41#include <opie2/olistview.h>
42 42
43namespace Opie {
44namespace Ui {
45
43class OVersatileView; 46class OVersatileView;
44 47
45class OVersatileViewItem : public OListViewItem, public QIconViewItem 48class OVersatileViewItem : public OListViewItem, public QIconViewItem
46{ 49{
47 public: 50 public:
48 OVersatileViewItem( OVersatileView * parent ); 51 OVersatileViewItem( OVersatileView * parent );
49 52
50 OVersatileViewItem( OVersatileView * parent, OVersatileViewItem * after ); 53 OVersatileViewItem( OVersatileView * parent, OVersatileViewItem * after );
51 54
52 OVersatileViewItem( OVersatileViewItem * parent, OVersatileViewItem * after ); 55 OVersatileViewItem( OVersatileViewItem * parent, OVersatileViewItem * after );
53 56
54 OVersatileViewItem( OVersatileView * parent, QString, 57 OVersatileViewItem( OVersatileView * parent, QString,
55 QString = QString::null, QString = QString::null, 58 QString = QString::null, QString = QString::null,
56 QString = QString::null, QString = QString::null, 59 QString = QString::null, QString = QString::null,
57 QString = QString::null, QString = QString::null, 60 QString = QString::null, QString = QString::null,
58 QString = QString::null ); 61 QString = QString::null );
59 62
60 OVersatileViewItem( OVersatileViewItem * parent, QString, 63 OVersatileViewItem( OVersatileViewItem * parent, QString,
61 QString = QString::null, QString = QString::null, 64 QString = QString::null, QString = QString::null,
62 QString = QString::null, QString = QString::null, 65 QString = QString::null, QString = QString::null,
63 QString = QString::null, QString = QString::null, 66 QString = QString::null, QString = QString::null,
64 QString = QString::null ); 67 QString = QString::null );
65 68
66 OVersatileViewItem( OVersatileView * parent, OVersatileViewItem * after, QString, 69 OVersatileViewItem( OVersatileView * parent, OVersatileViewItem * after, QString,
@@ -76,25 +79,27 @@ class OVersatileViewItem : public OListViewItem, public QIconViewItem
76 QString = QString::null ); 79 QString = QString::null );
77 80
78 virtual ~OVersatileViewItem(); 81 virtual ~OVersatileViewItem();
79 82
80 OVersatileView* versatileView() const; 83 OVersatileView* versatileView() const;
81 84
82 // TODO: Implement the remaining constructors from QIconView 85 // TODO: Implement the remaining constructors from QIconView
83 86
84 /* OIconViewItem( QIconView *parent, const QString &text, const QPixmap &icon ); 87 /* OIconViewItem( QIconView *parent, const QString &text, const QPixmap &icon );
85 OIconViewItem( QIconView *parent, QIconViewItem *after, const QString &text, const QPixmap &icon ); 88 OIconViewItem( QIconView *parent, QIconViewItem *after, const QString &text, const QPixmap &icon );
86 */ 89 */
87 90
88 virtual void setRenameEnabled( bool ); 91 virtual void setRenameEnabled( bool );
89 92
90 // TODO: Implement the remaining method multiplexers 93 // TODO: Implement the remaining method multiplexers
91 94
92 private: 95 private:
93 OVersatileView* _versatileview; 96 OVersatileView* _versatileview;
94 97
95 private: 98 private:
96 void init(); 99 void init();
97 100
98}; 101};
99 102
103}
104}
100#endif 105#endif
diff --git a/libopie2/opieui/owait.cpp b/libopie2/opieui/owait.cpp
index 8bb4ed6..9519888 100644
--- a/libopie2/opieui/owait.cpp
+++ b/libopie2/opieui/owait.cpp
@@ -17,48 +17,50 @@
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.=       =       ; Library General Public License for more 19..}^=.=       =       ; Library General Public License for more
20++=   -.     .`     .: details. 20++=   -.     .`     .: details.
21 :     =  ...= . :.=- 21 :     =  ...= . :.=-
22 -.   .:....=;==+<; You should have received a copy of the GNU 22 -.   .:....=;==+<; You should have received a copy of the GNU
23  -_. . .   )=.  = Library General Public License along with 23  -_. . .   )=.  = Library General Public License along with
24    --        :-=` this library; see the file COPYING.LIB. 24    --        :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28 28
29*/ 29*/
30 30
31#include "owait.h" 31#include "owait.h"
32 32
33/* OPIE */ 33/* OPIE */
34#include <qpe/qpeapplication.h> 34#include <qpe/qpeapplication.h>
35#include <qpe/resource.h> 35#include <qpe/resource.h>
36 36
37/* QT */ 37/* QT */
38#include <qlayout.h> 38#include <qlayout.h>
39#include <qpainter.h> 39#include <qpainter.h>
40 40
41using namespace Opie::Ui;
42
41static int frame = 0; 43static int frame = 0;
42 44
43/** 45/**
44 * This will construct a modal dialog. 46 * This will construct a modal dialog.
45 * 47 *
46 * The default timer length is 10. 48 * The default timer length is 10.
47 * 49 *
48 * @param parent The parent of the widget 50 * @param parent The parent of the widget
49 * @param msg The name of the object 51 * @param msg The name of the object
50 * @param dispIcon Display Icon? 52 * @param dispIcon Display Icon?
51 */ 53 */
52OWait::OWait( QWidget *parent, const char* msg, bool dispIcon ) 54OWait::OWait( QWidget *parent, const char* msg, bool dispIcon )
53 :QDialog( parent, msg, TRUE, WStyle_Customize ) 55 :QDialog( parent, msg, TRUE, WStyle_Customize )
54{ 56{
55 57
56 58
57 QHBoxLayout * hbox = new QHBoxLayout( this ); 59 QHBoxLayout * hbox = new QHBoxLayout( this );
58 60
59 m_lb = new QLabel( this ); 61 m_lb = new QLabel( this );
60 m_lb->setBackgroundMode ( NoBackground ); 62 m_lb->setBackgroundMode ( NoBackground );
61 63
62 hbox->addWidget( m_lb ); 64 hbox->addWidget( m_lb );
63 hbox->activate(); 65 hbox->activate();
64 66
diff --git a/libopie2/opieui/owait.h b/libopie2/opieui/owait.h
index 3267064..03c33e4 100644
--- a/libopie2/opieui/owait.h
+++ b/libopie2/opieui/owait.h
@@ -16,71 +16,75 @@
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 18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.=       =       ; Library General Public License for more 19..}^=.=       =       ; Library General Public License for more
20++=   -.     .`     .: details. 20++=   -.     .`     .: details.
21 :     =  ...= . :.=- 21 :     =  ...= . :.=-
22 -.   .:....=;==+<; You should have received a copy of the GNU 22 -.   .:....=;==+<; You should have received a copy of the GNU
23  -_. . .   )=.  = Library General Public License along with 23  -_. . .   )=.  = Library General Public License along with
24    --        :-=` this library; see the file COPYING.LIB. 24    --        :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28 28
29*/ 29*/
30 30
31#ifndef OWAIT_H 31#ifndef OWAIT_H
32#define OWAIT_H 32#define OWAIT_H
33 33
34/* QT */ 34/* QT */
35#include <qdialog.h> 35#include <qdialog.h>
36#include <qlabel.h> 36#include <qlabel.h>
37#include <qpixmap.h> 37#include <qpixmap.h>
38#include <qtimer.h> 38#include <qtimer.h>
39 39
40
41namespace Opie {
42namespace Ui {
40/** 43/**
41 * This class displays a animated waiting icon in the middle of the screen. 44 * This class displays a animated waiting icon in the middle of the screen.
42 * 45 *
43 * @short modal hour glass dialog 46 * @short modal hour glass dialog
44 * @see QDialog 47 * @see QDialog
45 * @author Maximilian Reiß 48 * @author Maximilian Reiß
46 */ 49 */
47class OWait : public QDialog 50class OWait : public QDialog
48{ 51{
49 Q_OBJECT 52 Q_OBJECT
50 53
51 public: 54 public:
52 OWait( QWidget *parent = 0, const char* name = 0, bool dispIcon = TRUE ); 55 OWait( QWidget *parent = 0, const char* name = 0, bool dispIcon = TRUE );
53 ~OWait(); 56 ~OWait();
54 57
55 /** 58 /**
56 * reimplemented for control reasons 59 * reimplemented for control reasons
57 */ 60 */
58 void show(); 61 void show();
59 62
60 /** 63 /**
61 * Set the time before the icon will be automaticly hidden 64 * Set the time before the icon will be automaticly hidden
62 * The timer will be started once the widget will be shown. 65 * The timer will be started once the widget will be shown.
63 * @param length - time in seconds 66 * @param length - time in seconds
64 */ 67 */
65 void setTimerLength( int length ); 68 void setTimerLength( int length );
66 69
67 public slots: 70 public slots:
68 /** 71 /**
69 * reimplemented for control reasons 72 * reimplemented for control reasons
70 */ 73 */
71 void hide(); 74 void hide();
72 75
73 private: 76 private:
74 void timerEvent( QTimerEvent * ); 77 void timerEvent( QTimerEvent * );
75 void paintEvent( QPaintEvent * ); 78 void paintEvent( QPaintEvent * );
76 79
77 QPixmap m_pix; 80 QPixmap m_pix;
78 QLabel *m_lb; 81 QLabel *m_lb;
79 QTimer *m_waitTimer; 82 QTimer *m_waitTimer;
80 int m_timerLength; 83 int m_timerLength;
81 int m_aniSize; 84 int m_aniSize;
82 class Private; 85 class Private;
83 Private *d; 86 Private *d;
84}; 87};
85 88}
89}
86#endif 90#endif