summaryrefslogtreecommitdiff
path: root/libopie2/opieui
authorzecke <zecke>2004-03-13 19:51:45 (UTC)
committer zecke <zecke>2004-03-13 19:51:45 (UTC)
commit6d08277737e22b7a1527124623f3571969073ddf (patch) (unidiff)
tree4129e674e21df767b31299e873dd44e33a308e1b /libopie2/opieui
parent8e28911f7199f4450ac5eef09482069f9b9caea2 (diff)
downloadopie-6d08277737e22b7a1527124623f3571969073ddf.zip
opie-6d08277737e22b7a1527124623f3571969073ddf.tar.gz
opie-6d08277737e22b7a1527124623f3571969073ddf.tar.bz2
Move XML class to internal PIM
Add namespaces!!! Opie::Core and Opie::Core::Private Opie::Net and Opie::Net::Private Opie::Ui and Opie::Ui::Private Opie::MM and Opie::MM::Private Opie::DB and Opie::DB::Private PIM classes are not yet converted because we will do other work on it as well
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
@@ -1,86 +1,87 @@
1/* 1/*
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#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;
63 m_hbox = 0; 64 m_hbox = 0;
64 m_size_policy = 330; 65 m_size_policy = 330;
65 setFontPropagation( AllChildren ); 66 setFontPropagation( AllChildren );
66 setPalettePropagation( AllChildren ); 67 setPalettePropagation( AllChildren );
67 68
68 /* start by default with the tab widget */ 69 /* start by default with the tab widget */
69 m_tabWidget = 0; 70 m_tabWidget = 0;
70 m_parentTab = 0; 71 m_parentTab = 0;
71 changeTab(); 72 changeTab();
72 73
73} 74}
74 75
75 76
76/** 77/**
77 * Destructor destructs this object and cleans up. All child 78 * Destructor destructs this object and cleans up. All child
78 * widgets will be deleted 79 * widgets will be deleted
79 * @see addWidget 80 * @see addWidget
80 */ 81 */
81OSplitter::~OSplitter() 82OSplitter::~OSplitter()
82{ 83{
83 qWarning("Deleted Splitter"); 84 qWarning("Deleted Splitter");
84 m_splitter.setAutoDelete( true ); 85 m_splitter.setAutoDelete( true );
85 m_splitter.clear(); 86 m_splitter.clear();
86 87
@@ -123,142 +124,142 @@ QString OSplitter::iconName()const
123} 124}
124 125
125/** 126/**
126 * returns the label set with setLabel 127 * returns the label set with setLabel
127 * @see setLabel 128 * @see setLabel
128 */ 129 */
129QString OSplitter::label()const 130QString OSplitter::label()const
130{ 131{
131 return m_name; 132 return m_name;
132} 133}
133 134
134/** 135/**
135 * This function sets the size change policy of the splitter. 136 * This function sets the size change policy of the splitter.
136 * If this size marked is crossed the splitter will relayout. 137 * If this size marked is crossed the splitter will relayout.
137 * Note: that depending on the set Orientation it'll either look 138 * Note: that depending on the set Orientation it'll either look
138 * at the width or height. 139 * at the width or height.
139 * Note: If you want to from side to side view to tabbed view you need 140 * Note: If you want to from side to side view to tabbed view you need
140 * to make sure that the size you supply is not smaller than the minimum 141 * to make sure that the size you supply is not smaller than the minimum
141 * size of your added widgets. Note that if you use widgets like QComboBoxes 142 * size of your added widgets. Note that if you use widgets like QComboBoxes
142 * you need to teach them to accept smaller sizes as well @see QWidget::setSizePolicy 143 * you need to teach them to accept smaller sizes as well @see QWidget::setSizePolicy
143 * 144 *
144 * @param width_height The mark that will be watched. Interpreted depending on the Orientation of the Splitter. 145 * @param width_height The mark that will be watched. Interpreted depending on the Orientation of the Splitter.
145 * @return void 146 * @return void
146 */ 147 */
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
241 * will be reparented i tto 0. 242 * will be reparented i tto 0.
242 * The widget will not be deleted. 243 * The widget will not be deleted.
243 * 244 *
244 * @param w The widget to be removed 245 * @param w The widget to be removed
245 */ 246 */
246void OSplitter::removeWidget( QWidget* w) 247void OSplitter::removeWidget( QWidget* w)
247{ 248{
248 ContainerList::Iterator it; 249 ContainerList::Iterator it;
249 for ( it = m_container.begin(); it != m_container.end(); ++it ) 250 for ( it = m_container.begin(); it != m_container.end(); ++it )
250 if ( (*it).widget == w ) 251 if ( (*it).widget == w )
251 break; 252 break;
252 253
253 if (it == m_container.end() ) 254 if (it == m_container.end() )
254 return; 255 return;
255 256
256 257
257 /* only tab needs to be removed.. box recognizes it */ 258 /* only tab needs to be removed.. box recognizes it */
258 if ( !m_hbox ) 259 if ( !m_hbox )
259 removeFromTab( w ); 260 removeFromTab( w );
260 261
261 262
262 /* Find reparent it and remove it from our list */ 263 /* Find reparent it and remove it from our list */
263 264
264 w->reparent( 0, 0, QPoint(0, 0)); 265 w->reparent( 0, 0, QPoint(0, 0));
@@ -351,111 +352,111 @@ QSize OSplitter::minimumSizeHint()const
351 return QFrame::minimumSizeHint(); 352 return QFrame::minimumSizeHint();
352 if (m_hbox) 353 if (m_hbox)
353 return m_hbox->sizeHint(); 354 return m_hbox->sizeHint();
354 else 355 else
355 return m_tabWidget->sizeHint(); 356 return m_tabWidget->sizeHint();
356} 357}
357#endif 358#endif
358 359
359/** 360/**
360 * @reimplemented for internal reasons 361 * @reimplemented for internal reasons
361 */ 362 */
362void OSplitter::resizeEvent( QResizeEvent* res ) 363void OSplitter::resizeEvent( QResizeEvent* res )
363{ 364{
364 QFrame::resizeEvent( res ); 365 QFrame::resizeEvent( res );
365 /* 366 /*
366 * 367 *
367 */ 368 */
368 // qWarning("Old size was width = %d height = %d", res->oldSize().width(), res->oldSize().height() ); 369 // qWarning("Old size was width = %d height = %d", res->oldSize().width(), res->oldSize().height() );
369 bool mode = true; 370 bool mode = true;
370 qWarning("New size is width = %d height = %d %s", res->size().width(), res->size().height(), name() ); 371 qWarning("New size is width = %d height = %d %s", res->size().width(), res->size().height(), name() );
371 if ( res->size().width() > m_size_policy && 372 if ( res->size().width() > m_size_policy &&
372 m_orient == Horizontal ) 373 m_orient == Horizontal )
373 { 374 {
374 changeHBox(); 375 changeHBox();
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 */
438 if (m_tabWidget ) 439 if (m_tabWidget )
439 { 440 {
440 raise(); 441 raise();
441 show(); 442 show();
442 m_tabWidget->setGeometry( frameRect() ); 443 m_tabWidget->setGeometry( frameRect() );
443 return; 444 return;
444 } 445 }
445 446
446 qWarning(" New Tab Widget %s", name() ); 447 qWarning(" New Tab Widget %s", name() );
447 /* 448 /*
448 * and add all widgets this will reparent them 449 * and add all widgets this will reparent them
449 * delete m_hbox set it to 0 450 * delete m_hbox set it to 0
450 * 451 *
451 */ 452 */
452 OTabWidget *tab; 453 OTabWidget *tab;
453 if ( m_parentTab ) 454 if ( m_parentTab )
454 { 455 {
455 hide(); 456 hide();
456 tab = m_parentTab; 457 tab = m_parentTab;
457 /* expensive but needed cause we're called from setTabWidget and resizeEvent*/ 458 /* expensive but needed cause we're called from setTabWidget and resizeEvent*/
458 if (!m_container.isEmpty() ) 459 if (!m_container.isEmpty() )
459 { 460 {
460 ContainerList::Iterator it = m_container.begin(); 461 ContainerList::Iterator it = m_container.begin();
461 for (; it != m_container.end(); ++it ) 462 for (; it != m_container.end(); ++it )
@@ -500,97 +501,97 @@ void OSplitter::changeHBox()
500 if (m_hbox ) 501 if (m_hbox )
501 { 502 {
502 m_hbox->setGeometry( frameRect() ); 503 m_hbox->setGeometry( frameRect() );
503 return; 504 return;
504 } 505 }
505 506
506 qWarning("new HBox %s", name() ); 507 qWarning("new HBox %s", name() );
507 m_hbox = new QHBox( this ); 508 m_hbox = new QHBox( this );
508 commonChangeBox(); 509 commonChangeBox();
509} 510}
510 511
511void OSplitter::changeVBox() 512void OSplitter::changeVBox()
512{ 513{
513 if (m_hbox ) 514 if (m_hbox )
514 { 515 {
515 m_hbox->setGeometry( frameRect() ); 516 m_hbox->setGeometry( frameRect() );
516 return; 517 return;
517 } 518 }
518 519
519 qWarning("New VBOX %s", name() ); 520 qWarning("New VBOX %s", name() );
520 m_hbox = new QVBox( this ); 521 m_hbox = new QVBox( this );
521 522
522 commonChangeBox(); 523 commonChangeBox();
523 524
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 */
573void OSplitter::setTabWidget( OTabWidget* wid) 574void OSplitter::setTabWidget( OTabWidget* wid)
574{ 575{
575 /* clean up cause m_parentTab will not be available for us */ 576 /* clean up cause m_parentTab will not be available for us */
576 if ( m_parentTab ) 577 if ( m_parentTab )
577 { 578 {
578 if (m_hbox ) 579 if (m_hbox )
579 m_parentTab->removePage( m_hbox ); 580 m_parentTab->removePage( m_hbox );
580 else if (!m_container.isEmpty() ) 581 else if (!m_container.isEmpty() )
581 { 582 {
582 ContainerList::Iterator it = m_container.begin(); 583 ContainerList::Iterator it = m_container.begin();
583 for ( ; it != m_container.end(); ++it ) 584 for ( ; it != m_container.end(); ++it )
584 m_parentTab->removePage( (*it).widget ); 585 m_parentTab->removePage( (*it).widget );
585 } 586 }
586 } 587 }
587 /* the parent Splitter changed so either make us indepent or dep */ 588 /* the parent Splitter changed so either make us indepent or dep */
588 589
589 m_parentTab = wid; 590 m_parentTab = wid;
590 591
591 QWidget *tab = m_tabWidget; 592 QWidget *tab = m_tabWidget;
592 QWidget *box = m_hbox; 593 QWidget *box = m_hbox;
593 m_hbox = 0; m_tabWidget = 0; 594 m_hbox = 0; m_tabWidget = 0;
594 595
595 if ( layoutMode() ) 596 if ( layoutMode() )
596 changeTab(); 597 changeTab();
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
@@ -1,150 +1,151 @@
1/* 1/*
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 /**
101 * Emitted if in tab and comes directly from the tab widget 101 * Emitted if in tab and comes directly from the tab widget
102 * 102 *
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
@@ -1,87 +1,87 @@
1/* 1/*
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#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 */
64 m_stack = 0; 64 m_stack = 0;
65 switchStack(); 65 switchStack();
66} 66}
67 67
68/** 68/**
69 * The destructor. It deletes also all added widgets. 69 * The destructor. It deletes also all added widgets.
70 * 70 *
71 */ 71 */
72OWidgetStack::~OWidgetStack() { 72OWidgetStack::~OWidgetStack() {
73 if (m_mode == BigScreen && !m_list.isEmpty() ) { 73 if (m_mode == BigScreen && !m_list.isEmpty() ) {
74 QMap<int, QWidget*>::Iterator it = m_list.begin(); 74 QMap<int, QWidget*>::Iterator it = m_list.begin();
75 for ( ; it != m_list.end(); ++it ) 75 for ( ; it != m_list.end(); ++it )
76 delete it.data(); 76 delete it.data();
77 } 77 }
78 m_list.clear(); 78 m_list.clear();
79 79
80} 80}
81 81
82/** 82/**
83 * return the mode of the desktop. There are currently two modes. SmallScreen 83 * return the mode of the desktop. There are currently two modes. SmallScreen
84 * with a normal PDA resolution and BigScreen with resolutions greater than 84 * with a normal PDA resolution and BigScreen with resolutions greater than
85 * 330 for width and height. 85 * 330 for width and height.
86 * You can also force the mode this widget is in with forceMode() 86 * You can also force the mode this widget is in with forceMode()
87 * Note that NoForce will be never returned from here 87 * Note that NoForce will be never returned from here
@@ -388,48 +388,51 @@ void OWidgetStack::switchStack() {
388 m_stack = new QWidgetStack(this); 388 m_stack = new QWidgetStack(this);
389 389
390 connect(m_stack, SIGNAL(aboutToShow(QWidget*) ), 390 connect(m_stack, SIGNAL(aboutToShow(QWidget*) ),
391 this, SIGNAL(aboutToShow(QWidget*) ) ); 391 this, SIGNAL(aboutToShow(QWidget*) ) );
392 connect(m_stack, SIGNAL(aboutToShow(int) ), 392 connect(m_stack, SIGNAL(aboutToShow(int) ),
393 this, SIGNAL(aboutToShow(int) ) ); 393 this, SIGNAL(aboutToShow(int) ) );
394 394
395 /* now reparent the widgets... luckily QWidgetSatck does most of the work */ 395 /* now reparent the widgets... luckily QWidgetSatck does most of the work */
396 if (m_list.isEmpty() ) 396 if (m_list.isEmpty() )
397 return; 397 return;
398 398
399 QMap<int, QWidget*>::Iterator it = m_list.begin(); 399 QMap<int, QWidget*>::Iterator it = m_list.begin();
400 for ( ; it != m_list.end(); ++it ) 400 for ( ; it != m_list.end(); ++it )
401 m_stack->addWidget( it.data(), it.key() ); 401 m_stack->addWidget( it.data(), it.key() );
402 402
403 403
404} 404}
405 405
406/* 406/*
407 * we will switch to top level mode 407 * we will switch to top level mode
408 * reparent the list of widgets and then delete the stack 408 * reparent the list of widgets and then delete the stack
409 */ 409 */
410void OWidgetStack::switchTop() { 410void OWidgetStack::switchTop() {
411 m_mode = BigScreen; 411 m_mode = BigScreen;
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
@@ -1,132 +1,133 @@
1/* 1/*
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 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 );
64 ~OWidgetStack(); 64 ~OWidgetStack();
65 65
66 enum Mode mode()const; 66 enum Mode mode()const;
67 void forceMode( enum Mode ); 67 void forceMode( enum Mode );
68 68
69 void addWidget( QWidget* , int ); 69 void addWidget( QWidget* , int );
70 void removeWidget( QWidget* ); 70 void removeWidget( QWidget* );
71 71
72// QSizeHint sizeHint()const; 72// QSizeHint sizeHint()const;
73// QSizeHint minimumSizeHint()const; 73// QSizeHint minimumSizeHint()const;
74 74
75 QWidget *widget( int )const; 75 QWidget *widget( int )const;
76 int id( QWidget* )const; 76 int id( QWidget* )const;
77 77
78 78
79 79
80 QWidget* visibleWidget() const; 80 QWidget* visibleWidget() const;
81 81
82 bool eventFilter( QObject*, QEvent* ); 82 bool eventFilter( QObject*, QEvent* );
83signals: 83signals:
84 /** 84 /**
85 * OWidgetStack monitors the Desktop Widget for 85 * OWidgetStack monitors the Desktop Widget for
86 * size changes if it recignizes a change size it'll 86 * size changes if it recignizes a change size it'll
87 * send a signal and adjust its mode. After the signal 87 * send a signal and adjust its mode. After the signal
88 * was emitted. During the signal a call to mode() the 88 * was emitted. During the signal a call to mode() the
89 * old mode will be returned. Note that if a size change happens 89 * old mode will be returned. Note that if a size change happens
90 * but no modeChange no signal will be emitted 90 * but no modeChange no signal will be emitted
91 * 91 *
92 * 92 *
93 * @param mode The new mode of the desktop 93 * @param mode The new mode of the desktop
94 */ 94 */
95 void modeChanged( enum Mode mode); 95 void modeChanged( enum Mode mode);
96 96
97 /** 97 /**
98 * These two signals are emitted whenever we're about to 98 * These two signals are emitted whenever we're about to
99 * show one of the widgets 99 * show one of the widgets
100 */ 100 */
101 void aboutToShow( QWidget* ); 101 void aboutToShow( QWidget* );
102 void aboutToShow( int ); 102 void aboutToShow( int );
103 103
104public slots: 104public slots:
105 void raiseWidget( int ); 105 void raiseWidget( int );
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
@@ -1,90 +1,90 @@
1/* 1/*
2               =. This file is part of the OPIE Project 2               =. This file is part of the OPIE Project
3             .=l. Copyright (C) Holger Freyther <zecke@handhelds.org> 3             .=l. Copyright (C) Holger Freyther <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 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{
67 if ( qApp->argc() < 1 ) 67 if ( qApp->argc() < 1 )
68 return; 68 return;
69 69
70 Config cfg( QFileInfo(qApp->argv()[0]).fileName() ); 70 Config cfg( QFileInfo(qApp->argv()[0]).fileName() );
71 cfg.setGroup( key ); 71 cfg.setGroup( key );
72 QFileInfo inf( file ); 72 QFileInfo inf( file );
73 cfg.writeEntry("LastDir", inf.dirPath( true ) ); 73 cfg.writeEntry("LastDir", inf.dirPath( true ) );
74} 74}
75}; 75};
76 76
77/** 77/**
78 * This constructs a modal dialog 78 * This constructs a modal dialog
79 * 79 *
80 * @param caption The caption of the dialog 80 * @param caption The caption of the dialog
81 * @param wid The parent widget 81 * @param wid The parent widget
82 * @param mode The mode of the OFileSelector @see OFileSelector 82 * @param mode The mode of the OFileSelector @see OFileSelector
83 * @param selector The selector of the OFileSelector 83 * @param selector The selector of the OFileSelector
84 * @param dirName the dir or resource to start from 84 * @param dirName the dir or resource to start from
85 * @param fileName a proposed or existing filename 85 * @param fileName a proposed or existing filename
86 * @param mimetypes The mimeTypes 86 * @param mimetypes The mimeTypes
87 */ 87 */
88OFileDialog::OFileDialog(const QString &caption, 88OFileDialog::OFileDialog(const QString &caption,
89 QWidget *wid, int mode, int selector, 89 QWidget *wid, int mode, int selector,
90 const QString &dirName, 90 const QString &dirName,
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
@@ -1,109 +1,110 @@
1/* 1/*
2               =. This file is part of the OPIE Project 2               =. This file is part of the OPIE Project
3             .=l. Copyright (c) 2002 zecke <zecke@handhelds.org> 3             .=l. Copyright (c) 2002 zecke <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 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 */
64class OFileDialog : public QDialog 64class OFileDialog : public QDialog
65{ 65{
66 Q_OBJECT 66 Q_OBJECT
67public: 67public:
68 OFileDialog(const QString &caption, 68 OFileDialog(const QString &caption,
69 QWidget *, int mode, int selector, 69 QWidget *, int mode, int selector,
70 const QString &dirName, 70 const QString &dirName,
71 const QString &fileName = QString::null, 71 const QString &fileName = QString::null,
72 const MimeTypes &mimetypes = MimeTypes() ); 72 const MimeTypes &mimetypes = MimeTypes() );
73 QString mimetype() const; 73 QString mimetype() const;
74 QString fileName() const; 74 QString fileName() const;
75 DocLnk selectedDocument()const; 75 DocLnk selectedDocument()const;
76 76
77 // static methods 77 // static methods
78 static QString getOpenFileName(int selector, 78 static QString getOpenFileName(int selector,
79 const QString& startDir = QString::null, 79 const QString& startDir = QString::null,
80 const QString &fileName = QString::null, 80 const QString &fileName = QString::null,
81 const MimeTypes& mime = MimeTypes(), 81 const MimeTypes& mime = MimeTypes(),
82 QWidget *wid = 0, 82 QWidget *wid = 0,
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
@@ -10,98 +10,101 @@
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/* hacky but we need to get FileSelector::filter */ 29/* hacky but we need to get FileSelector::filter */
30#define private public 30#define private public
31#include <qpe/fileselector.h> 31#include <qpe/fileselector.h>
32#undef private 32#undef private
33 33
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{
84 return DocLnk( selectedName() ); 87 return DocLnk( selectedName() );
85} 88}
86 89
87bool OFileViewInterface::showNew()const 90bool OFileViewInterface::showNew()const
88{ 91{
89 return selector()->showNew(); 92 return selector()->showNew();
90} 93}
91 94
92bool OFileViewInterface::showClose()const 95bool OFileViewInterface::showClose()const
93{ 96{
94 return selector()->showClose(); 97 return selector()->showClose();
95} 98}
96 99
97MimeTypes OFileViewInterface::mimeTypes()const 100MimeTypes OFileViewInterface::mimeTypes()const
98{ 101{
99 return selector()->mimeTypes(); 102 return selector()->mimeTypes();
100} 103}
101 104
102QStringList OFileViewInterface::currentMimeType()const 105QStringList OFileViewInterface::currentMimeType()const
103{ 106{
104 return selector()->currentMimeType(); 107 return selector()->currentMimeType();
105} 108}
106 109
107void OFileViewInterface::activate( const QString& ) 110void OFileViewInterface::activate( const QString& )
@@ -765,96 +768,98 @@ QString OFileViewFileSystem::selectedName()const
765} 768}
766 769
767QString OFileViewFileSystem::selectedPath()const 770QString OFileViewFileSystem::selectedPath()const
768{ 771{
769 return QString::null; 772 return QString::null;
770} 773}
771 774
772QString OFileViewFileSystem::directory()const 775QString OFileViewFileSystem::directory()const
773{ 776{
774 if (!m_view) 777 if (!m_view)
775 return QString::null; 778 return QString::null;
776 779
777 OFileSelectorItem* item = m_view->currentItem(); 780 OFileSelectorItem* item = m_view->currentItem();
778 if (!item ) 781 if (!item )
779 return QString::null; 782 return QString::null;
780 783
781 return QDir(item->directory() ).absPath(); 784 return QDir(item->directory() ).absPath();
782} 785}
783 786
784void OFileViewFileSystem::reread() 787void OFileViewFileSystem::reread()
785{ 788{
786 if (!m_view) 789 if (!m_view)
787 return; 790 return;
788 791
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
837 * @param fileName The fileName placed in the fileselector lineedit 842 * @param fileName The fileName placed in the fileselector lineedit
838 * @param mimetypes The MimeType map of used mimetypes 843 * @param mimetypes The MimeType map of used mimetypes
839 * @param showNew Show a New Button. Most likely to be used in the FileSelector view. 844 * @param showNew Show a New Button. Most likely to be used in the FileSelector view.
840 * @param showClose Show a Close Button. Most likely to be used in FileSelector view. 845 * @param showClose Show a Close Button. Most likely to be used in FileSelector view.
841 * 846 *
842 */ 847 */
843OFileSelector::OFileSelector( QWidget* parent, int mode, int sel, 848OFileSelector::OFileSelector( QWidget* parent, int mode, int sel,
844 const QString& dirName, const QString& fileName, 849 const QString& dirName, const QString& fileName,
845 const MimeTypes& mimetypes, 850 const MimeTypes& mimetypes,
846 bool showNew, bool showClose) 851 bool showNew, bool showClose)
847 :QWidget( parent, "OFileSelector" ) 852 :QWidget( parent, "OFileSelector" )
848{ 853{
849 m_current = 0; 854 m_current = 0;
850 m_shNew = showNew; 855 m_shNew = showNew;
851 m_shClose = showClose; 856 m_shClose = showClose;
852 m_mimeType = mimetypes; 857 m_mimeType = mimetypes;
853 m_startDir = dirName; 858 m_startDir = dirName;
854 859
855 m_mode = mode; 860 m_mode = mode;
856 m_selector = sel; 861 m_selector = sel;
857 862
858 initUI(); 863 initUI();
859 m_lneEdit->setText( fileName ); 864 m_lneEdit->setText( fileName );
860 initMime(); 865 initMime();
@@ -1119,48 +1124,50 @@ void OFileSelector::slotDocLnkBridge( const DocLnk& lnk)
1119 1124
1120void OFileSelector::slotFileBridge( const QString& str) 1125void OFileSelector::slotFileBridge( const QString& str)
1121{ 1126{
1122 DocLnk lnk( str ); 1127 DocLnk lnk( str );
1123 emit fileSelected( lnk ); 1128 emit fileSelected( lnk );
1124} 1129}
1125 1130
1126void OFileSelector::slotViewChange( const QString& view ) 1131void OFileSelector::slotViewChange( const QString& view )
1127{ 1132{
1128 OFileViewInterface* interface = m_views[view]; 1133 OFileViewInterface* interface = m_views[view];
1129 if (!interface) 1134 if (!interface)
1130 return; 1135 return;
1131 1136
1132 interface->activate( view ); 1137 interface->activate( view );
1133 if (m_current) 1138 if (m_current)
1134 m_stack->removeWidget( m_current->widget( m_stack ) ); 1139 m_stack->removeWidget( m_current->widget( m_stack ) );
1135 1140
1136 static int id = 1; 1141 static int id = 1;
1137 1142
1138 m_stack->addWidget( interface->widget(m_stack), id ); 1143 m_stack->addWidget( interface->widget(m_stack), id );
1139 m_stack->raiseWidget( id ); 1144 m_stack->raiseWidget( id );
1140 1145
1141 interface->reread(); 1146 interface->reread();
1142 m_current = interface; 1147 m_current = interface;
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
@@ -7,119 +7,121 @@
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/* 29/*
30 This is based on code and ideas of 30 This is based on code and ideas of
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 );
102 104
103 OFileSelector(const QString& mimeFilter, QWidget* parent, 105 OFileSelector(const QString& mimeFilter, QWidget* parent,
104 const char* name = 0, bool newVisible = TRUE, bool closeVisible = FALSE ); 106 const char* name = 0, bool newVisible = TRUE, bool closeVisible = FALSE );
105 ~OFileSelector(); 107 ~OFileSelector();
106 108
107 const DocLnk* selected(); 109 const DocLnk* selected();
108 110
109 QString selectedName()const; 111 QString selectedName()const;
110 QString selectedPath()const; 112 QString selectedPath()const;
111 QString directory()const; 113 QString directory()const;
112 114
113 DocLnk selectedDocument()const; 115 DocLnk selectedDocument()const;
114 116
115 int fileCount()const; 117 int fileCount()const;
116 void reread(); 118 void reread();
117 119
118 int mode()const; 120 int mode()const;
119 int selector()const; 121 int selector()const;
120 122
121 /** 123 /**
122 * Set the Icon visible 124 * Set the Icon visible
123 * @param b Show or Hide the New Button 125 * @param b Show or Hide the New Button
124 */ 126 */
125 void setNewVisible( bool b ); 127 void setNewVisible( bool b );
@@ -140,80 +142,81 @@ signals:
140 */ 142 */
141 void dirSelected( const QString& ); 143 void dirSelected( const QString& );
142 144
143 /** 145 /**
144 * fileSelected is emitted when a file is selected 146 * fileSelected is emitted when a file is selected
145 * it uses a DocLnk as parameter 147 * it uses a DocLnk as parameter
146 */ 148 */
147 void fileSelected( const DocLnk& ); 149 void fileSelected( const DocLnk& );
148 150
149 /** 151 /**
150 * fileSelected is emitted when a file is selected 152 * fileSelected is emitted when a file is selected
151 * the complete path is a parameter 153 * the complete path is a parameter
152 */ 154 */
153 void fileSelected( const QString& ); 155 void fileSelected( const QString& );
154 156
155 /** 157 /**
156 * Create a new File with a DocLnk 158 * Create a new File with a DocLnk
157 */ 159 */
158 void newSelected( const DocLnk& ); 160 void newSelected( const DocLnk& );
159 161
160 void closeMe(); 162 void closeMe();
161 163
162 /** 164 /**
163 * Ok is emitted on a Qt::Key_Return or Q::Key_Enter 165 * Ok is emitted on a Qt::Key_Return or Q::Key_Enter
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
@@ -11,100 +11,100 @@
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 OFILESELECTOR_PRIVATE_H 29#ifndef OFILESELECTOR_PRIVATE_H
30#define OFILESELECTOR_PRIVATE_H 30#define OFILESELECTOR_PRIVATE_H
31 31
32/* OPIE */ 32/* OPIE */
33#include <qpe/applnk.h> 33#include <qpe/applnk.h>
34#include <qpe/fileselector.h> 34#include <qpe/fileselector.h>
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:
87 void ok(); 87 void ok();
88 void cancel(); 88 void cancel();
89 void closeMe(); 89 void closeMe();
90 void fileSelected( const QString& ); 90 void fileSelected( const QString& );
91 void fileSelected( const DocLnk& ); 91 void fileSelected( const DocLnk& );
92 void setCurrentFileName( const QString& ); 92 void setCurrentFileName( const QString& );
93 QString currentFileName()const; 93 QString currentFileName()const;
94 94
95private: 95private:
96 QString m_name; 96 QString m_name;
97 OFileSelector* m_selector; 97 OFileSelector* m_selector;
98}; 98};
99 99
100 100
101/* THE Document View hosting a FileSelector*/ 101/* THE Document View hosting a FileSelector*/
102class ODocumentFileView : public OFileViewInterface 102class ODocumentFileView : public OFileViewInterface
103{ 103{
104public: 104public:
105 ODocumentFileView( OFileSelector* selector ); 105 ODocumentFileView( OFileSelector* selector );
106 ~ODocumentFileView(); 106 ~ODocumentFileView();
107 107
108 QString selectedName() const; 108 QString selectedName() const;
109 QString selectedPath() const; 109 QString selectedPath() const;
110 110
@@ -141,51 +141,53 @@ private:
141 QString m_dir; 141 QString m_dir;
142}; 142};
143 143
144class OFileViewFileListView : public QWidget 144class OFileViewFileListView : public QWidget
145{ 145{
146 Q_OBJECT 146 Q_OBJECT
147public: 147public:
148 OFileViewFileListView( QWidget* parent, const QString& dir, OFileSelector* selector ); 148 OFileViewFileListView( QWidget* parent, const QString& dir, OFileSelector* selector );
149 ~OFileViewFileListView(); 149 ~OFileViewFileListView();
150 150
151 OFileSelectorItem* currentItem()const; 151 OFileSelectorItem* currentItem()const;
152 void reread( bool all = false ); 152 void reread( bool all = false );
153 int fileCount()const; 153 int fileCount()const;
154 QString currentDir()const; 154 QString currentDir()const;
155protected: 155protected:
156 bool eventFilter (QObject *o, QEvent *e); 156 bool eventFilter (QObject *o, QEvent *e);
157private slots: 157private slots:
158 void slotNew(); // will emit newSelected 158 void slotNew(); // will emit newSelected
159 void cdUP(); 159 void cdUP();
160 void cdHome(); 160 void cdHome();
161 void cdDoc(); 161 void cdDoc();
162 void changeDir( const QString& ); 162 void changeDir( const QString& );
163 void slotCurrentChanged( QListViewItem* ); 163 void slotCurrentChanged( QListViewItem* );
164 void slotClicked(int, QListViewItem*, const QPoint&, int ); 164 void slotClicked(int, QListViewItem*, const QPoint&, int );
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
@@ -1,95 +1,98 @@
1/* 1/*
2               =. This file is part of the OPIE Project 2               =. This file is part of the OPIE Project
3             .=l. Copyright (C) 2002 Holger Freyther <zecke@handhelds.org> 3             .=l. Copyright (C) 2002 Holger Freyther <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 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,
66 bool isSymlink = FALSE ) = 0; 67 bool isSymlink = FALSE ) = 0;
67 68
68 virtual void addSymlink(const QString &mime, 69 virtual void addSymlink(const QString &mime,
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
@@ -1,80 +1,80 @@
1/* 1/*
2 This file is part of the Opie Project 2 This file is part of the Opie Project
3 Copyright (C) Maximillian Reiß <harlekin@handhelds.org> 3 Copyright (C) Maximillian Reiß <harlekin@handhelds.org>
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org> 4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l. 5 .=l.
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#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)
57{ 57{
58 isToggle=t; 58 isToggle=t;
59} 59}
60 60
61/** 61/**
62 * @internal 62 * @internal
63 */ 63 */
64void OClickableLabel::mousePressEvent( QMouseEvent * /*e*/ ) 64void OClickableLabel::mousePressEvent( QMouseEvent * /*e*/ )
65{ 65{
66 if (isToggle && isDown) 66 if (isToggle && isDown)
67 { 67 {
68 showState(false); 68 showState(false);
69 } 69 }
70 else 70 else
71 { 71 {
72 showState(true); 72 showState(true);
73 } 73 }
74} 74}
75 75
76/** 76/**
77 * @internal 77 * @internal
78 */ 78 */
79void OClickableLabel::mouseReleaseEvent( QMouseEvent *e ) 79void OClickableLabel::mouseReleaseEvent( QMouseEvent *e )
80{ 80{
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
@@ -1,103 +1,104 @@
1/* 1/*
2 This file is part of the Opie Project 2 This file is part of the Opie Project
3 Copyright (C) Maximillian Reiß <harlekin@handhelds.org> 3 Copyright (C) Maximillian Reiß <harlekin@handhelds.org>
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org> 4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l. 5 .=l.
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#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
62public: 62public:
63 OClickableLabel(QWidget* parent = 0, const char* name = 0, 63 OClickableLabel(QWidget* parent = 0, const char* name = 0,
64 WFlags fl = 0); 64 WFlags fl = 0);
65 void setToggleButton(bool t); 65 void setToggleButton(bool t);
66 66
67protected: 67protected:
68 /** @internal */ 68 /** @internal */
69 void mousePressEvent( QMouseEvent *e ); 69 void mousePressEvent( QMouseEvent *e );
70 /** @internal */ 70 /** @internal */
71 void mouseReleaseEvent( QMouseEvent *e ); 71 void mouseReleaseEvent( QMouseEvent *e );
72 /** @internal */ 72 /** @internal */
73 void mouseMoveEvent( QMouseEvent *e ); 73 void mouseMoveEvent( QMouseEvent *e );
74 74
75public slots: 75public slots:
76 void setOn(bool on); 76 void setOn(bool on);
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
@@ -1,55 +1,57 @@
1/* 1/*
2                 This file is part of the Opie Project 2                 This file is part of the Opie Project
3              Copyright (C) 2003 Michael 'Mickey' Lauer <mickey@Vanille.de> 3              Copyright (C) 2003 Michael 'Mickey' Lauer <mickey@Vanille.de>
4 =. 4 =.
5 .=l. 5 .=l.
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 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
@@ -10,82 +10,87 @@
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#ifndef ODIALOG_H 31#ifndef ODIALOG_H
32#define ODIALOG_H 32#define ODIALOG_H
33 33
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
@@ -1,158 +1,158 @@
1/* 1/*
2 This file is part of the Opie Project 2 This file is part of the Opie Project
3 Copyright (C) Robert Griebl <sandman@handhelds.org> 3 Copyright (C) Robert Griebl <sandman@handhelds.org>
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org> 4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l. 5 .=l.
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 */ 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 );
135 connect( d->m_font_family_list, SIGNAL( highlighted(int) ), this, SLOT( fontFamilyClicked(int) ) ); 135 connect( d->m_font_family_list, SIGNAL( highlighted(int) ), this, SLOT( fontFamilyClicked(int) ) );
136 136
137 QLabel *label = new QLabel( tr( "Style" ), this ); 137 QLabel *label = new QLabel( tr( "Style" ), this );
138 gridLayout->addWidget( label, 0, 1 ); 138 gridLayout->addWidget( label, 0, 1 );
139 139
140 d->m_font_style_list = new QComboBox( this, "StyleListBox" ); 140 d->m_font_style_list = new QComboBox( this, "StyleListBox" );
141 connect( d->m_font_style_list, SIGNAL( activated(int) ), this, SLOT( fontStyleClicked(int) ) ); 141 connect( d->m_font_style_list, SIGNAL( activated(int) ), this, SLOT( fontStyleClicked(int) ) );
142 gridLayout->addWidget( d->m_font_style_list, 1, 1 ); 142 gridLayout->addWidget( d->m_font_style_list, 1, 1 );
143 143
144 label = new QLabel( tr( "Size" ), this ); 144 label = new QLabel( tr( "Size" ), this );
145 gridLayout->addWidget( label, 2, 1 ); 145 gridLayout->addWidget( label, 2, 1 );
146 146
147 d->m_font_size_list = new QComboBox( this, "SizeListBox" ); 147 d->m_font_size_list = new QComboBox( this, "SizeListBox" );
148 connect( d->m_font_size_list, SIGNAL( activated(int) ), 148 connect( d->m_font_size_list, SIGNAL( activated(int) ),
149 this, SLOT( fontSizeClicked(int) ) ); 149 this, SLOT( fontSizeClicked(int) ) );
150 gridLayout->addWidget( d->m_font_size_list, 3, 1 ); 150 gridLayout->addWidget( d->m_font_size_list, 3, 1 );
151 151
152 d->m_pointbug = ( qt_version() <= 233 ); 152 d->m_pointbug = ( qt_version() <= 233 );
153 153
154 if ( withpreview ) 154 if ( withpreview )
155 { 155 {
156 d->m_preview = new QMultiLineEdit ( this, "Preview" ); 156 d->m_preview = new QMultiLineEdit ( this, "Preview" );
157 d->m_preview->setAlignment ( AlignCenter ); 157 d->m_preview->setAlignment ( AlignCenter );
158 d->m_preview->setWordWrap ( QMultiLineEdit::WidgetWidth ); 158 d->m_preview->setWordWrap ( QMultiLineEdit::WidgetWidth );
@@ -381,48 +381,49 @@ void OFontSelector::fontSizeClicked ( int /*index*/ )
381} 381}
382 382
383void OFontSelector::changeFont() 383void OFontSelector::changeFont()
384{ 384{
385 QFont f = selectedFont(); 385 QFont f = selectedFont();
386 386
387 if ( d->m_preview ) 387 if ( d->m_preview )
388 d->m_preview->setFont ( f ); 388 d->m_preview->setFont ( f );
389 389
390 emit fontSelected ( f ); 390 emit fontSelected ( f );
391} 391}
392 392
393/** 393/**
394 * Return the selected font 394 * Return the selected font
395 */ 395 */
396QFont OFontSelector::selectedFont() 396QFont OFontSelector::selectedFont()
397{ 397{
398 int ffa = d->m_font_family_list->currentItem(); 398 int ffa = d->m_font_family_list->currentItem();
399 int fst = d->m_font_style_list->currentItem(); 399 int fst = d->m_font_style_list->currentItem();
400 int fsi = d->m_font_size_list->currentItem(); 400 int fsi = d->m_font_size_list->currentItem();
401 401
402 FontListItem *fli = (FontListItem *) d->m_font_family_list->item ( ffa ); 402 FontListItem *fli = (FontListItem *) d->m_font_family_list->item ( ffa );
403 403
404 if ( fli ) 404 if ( fli )
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
@@ -1,104 +1,106 @@
1/* 1/*
2 This file is part of the Opie Project 2 This file is part of the Opie Project
3 Copyright (C) Robert Griebl <sandman@handhelds.org> 3 Copyright (C) Robert Griebl <sandman@handhelds.org>
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org> 4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l. 5 .=l.
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#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 ( );
66 67
67 bool setSelectedFont ( const QFont & ); 68 bool setSelectedFont ( const QFont & );
68 bool setSelectedFont ( const QString &family, const QString &style, int size, const QString &charset = 0 ); 69 bool setSelectedFont ( const QString &family, const QString &style, int size, const QString &charset = 0 );
69 70
70 QString fontFamily ( ) const; 71 QString fontFamily ( ) const;
71 QString fontStyle ( ) const; 72 QString fontStyle ( ) const;
72 int fontSize ( ) const; 73 int fontSize ( ) const;
73 QString fontCharSet ( ) const; 74 QString fontCharSet ( ) const;
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
@@ -1,91 +1,95 @@
1/* This file is part of the KDE libraries 1/* This file is part of the KDE libraries
2 Copyright (C) 1998, 1999, 2001, 2002 Daniel M. Duley <mosfet@kde.org> 2 Copyright (C) 1998, 1999, 2001, 2002 Daniel M. Duley <mosfet@kde.org>
3 (C) 1998, 1999 Christian Tibirna <ctibirna@total.net> 3 (C) 1998, 1999 Christian Tibirna <ctibirna@total.net>
4 (C) 1998, 1999 Dirk A. Mueller <mueller@kde.org> 4 (C) 1998, 1999 Dirk A. Mueller <mueller@kde.org>
5 (C) 2000 Josef Weidendorfer <weidendo@in.tum.de> 5 (C) 2000 Josef Weidendorfer <weidendo@in.tum.de>
6 6
7Redistribution and use in source and binary forms, with or without 7Redistribution and use in source and binary forms, with or without
8modification, are permitted provided that the following conditions 8modification, are permitted provided that the following conditions
9are met: 9are met:
10 10
111. Redistributions of source code must retain the above copyright 111. Redistributions of source code must retain the above copyright
12 notice, this list of conditions and the following disclaimer. 12 notice, this list of conditions and the following disclaimer.
132. Redistributions in binary form must reproduce the above copyright 132. Redistributions in binary form must reproduce the above copyright
14 notice, this list of conditions and the following disclaimer in the 14 notice, this list of conditions and the following disclaimer in the
15 documentation and/or other materials provided with the distribution. 15 documentation and/or other materials provided with the distribution.
16 16
17THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19OF 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;
68 return image; 72 return image;
69 } 73 }
70 74
71 register int x, y; 75 register int x, y;
72 76
73 rDiff = (rcb = cb.red()) - (rca = ca.red()); 77 rDiff = (rcb = cb.red()) - (rca = ca.red());
74 gDiff = (gcb = cb.green()) - (gca = ca.green()); 78 gDiff = (gcb = cb.green()) - (gca = ca.green());
75 bDiff = (bcb = cb.blue()) - (bca = ca.blue()); 79 bDiff = (bcb = cb.blue()) - (bca = ca.blue());
76 80
77 if( eff == VerticalGradient || eff == HorizontalGradient ){ 81 if( eff == VerticalGradient || eff == HorizontalGradient ){
78 82
79 uint *p; 83 uint *p;
80 uint rgb; 84 uint rgb;
81 85
82 register int rl = rca << 16; 86 register int rl = rca << 16;
83 register int gl = gca << 16; 87 register int gl = gca << 16;
84 register int bl = bca << 16; 88 register int bl = bca << 16;
85 89
86 if( eff == VerticalGradient ) { 90 if( eff == VerticalGradient ) {
87 91
88 int rcdelta = ((1<<16) / size.height()) * rDiff; 92 int rcdelta = ((1<<16) / size.height()) * rDiff;
89 int gcdelta = ((1<<16) / size.height()) * gDiff; 93 int gcdelta = ((1<<16) / size.height()) * gDiff;
90 int bcdelta = ((1<<16) / size.height()) * bDiff; 94 int bcdelta = ((1<<16) / size.height()) * bDiff;
91 95
@@ -3720,49 +3724,50 @@ QImage OImageEffect::blur(QImage &src, double factor)
3720 *q++=(*(cTable+(*p))); 3724 *q++=(*(cTable+(*p)));
3721 } 3725 }
3722 } 3726 }
3723 return(dest); 3727 return(dest);
3724} 3728}
3725 3729
3726// High quality, expensive HSV contrast. You can do a faster one by just 3730// High quality, expensive HSV contrast. You can do a faster one by just
3727// taking a grayscale threshold (ie: 128) and incrementing RGB color 3731// taking a grayscale threshold (ie: 128) and incrementing RGB color
3728// channels above it and decrementing those below it, but this gives much 3732// channels above it and decrementing those below it, but this gives much
3729// better results. (mosfet 12/28/01) 3733// better results. (mosfet 12/28/01)
3730void OImageEffect::contrastHSV(QImage &img, bool sharpen) 3734void OImageEffect::contrastHSV(QImage &img, bool sharpen)
3731{ 3735{
3732 int i, sign; 3736 int i, sign;
3733 unsigned int *data; 3737 unsigned int *data;
3734 int count; 3738 int count;
3735 double brightness, scale, theta; 3739 double brightness, scale, theta;
3736 QColor c; 3740 QColor c;
3737 int h, s, v; 3741 int h, s, v;
3738 3742
3739 sign = sharpen ? 1 : -1; 3743 sign = sharpen ? 1 : -1;
3740 scale=0.5000000000000001; 3744 scale=0.5000000000000001;
3741 if(img.depth() > 8){ 3745 if(img.depth() > 8){
3742 count = img.width()*img.height(); 3746 count = img.width()*img.height();
3743 data = (unsigned int *)img.bits(); 3747 data = (unsigned int *)img.bits();
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
@@ -1,89 +1,91 @@
1//FIXME: Revise for Opie - do we really need such fancy stuff on PDA's? 1//FIXME: Revise for Opie - do we really need such fancy stuff on PDA's?
2//FIXME: Maybe not on SL5xxx, but surely on C700 :)) 2//FIXME: Maybe not on SL5xxx, but surely on C700 :))
3//FIXME: I think we don#t need that -zecke 3//FIXME: I think we don#t need that -zecke
4 4
5/* This file is part of the KDE libraries 5/* This file is part of the KDE libraries
6 Copyright (C) 1998, 1999, 2001, 2002 Daniel M. Duley <mosfet@interaccess.com> 6 Copyright (C) 1998, 1999, 2001, 2002 Daniel M. Duley <mosfet@interaccess.com>
7 (C) 1998, 1999 Christian Tibirna <ctibirna@total.net> 7 (C) 1998, 1999 Christian Tibirna <ctibirna@total.net>
8 (C) 1998, 1999 Dirk A. Mueller <mueller@kde.org> 8 (C) 1998, 1999 Dirk A. Mueller <mueller@kde.org>
9 9
10Redistribution and use in source and binary forms, with or without 10Redistribution and use in source and binary forms, with or without
11modification, are permitted provided that the following conditions 11modification, are permitted provided that the following conditions
12are met: 12are met:
13 13
141. Redistributions of source code must retain the above copyright 141. Redistributions of source code must retain the above copyright
15 notice, this list of conditions and the following disclaimer. 15 notice, this list of conditions and the following disclaimer.
162. Redistributions in binary form must reproduce the above copyright 162. Redistributions in binary form must reproduce the above copyright
17 notice, this list of conditions and the following disclaimer in the 17 notice, this list of conditions and the following disclaimer in the
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,
66 ImpulseNoise, LaplacianNoise, PoissonNoise}; 68 ImpulseNoise, LaplacianNoise, PoissonNoise};
67 69
68 enum RotateDirection{ Rotate90, Rotate180, Rotate270 }; 70 enum RotateDirection{ Rotate90, Rotate180, Rotate270 };
69 71
70 /** 72 /**
71 * Create a gradient from color a to color b of the specified type. 73 * Create a gradient from color a to color b of the specified type.
72 * 74 *
73 * @param size The desired size of the gradient. 75 * @param size The desired size of the gradient.
74 * @param ca Color a 76 * @param ca Color a
75 * @param cb Color b 77 * @param cb Color b
76 * @param type The type of gradient. 78 * @param type The type of gradient.
77 * @param ncols The number of colors to use when not running on a 79 * @param ncols The number of colors to use when not running on a
78 * truecolor display. The gradient will be dithered to this number of 80 * truecolor display. The gradient will be dithered to this number of
79 * colors. Pass 0 to prevent dithering. 81 * colors. Pass 0 to prevent dithering.
80 */ 82 */
81 static QImage gradient(const QSize &size, const QColor &ca, 83 static QImage gradient(const QSize &size, const QColor &ca,
82 const QColor &cb, GradientType type, int ncols=3); 84 const QColor &cb, GradientType type, int ncols=3);
83 85
84 /** 86 /**
85 * Create an unbalanced gradient. 87 * Create an unbalanced gradient.
86 88
87 * An unbalanced gradient is a gradient where the transition from 89 * An unbalanced gradient is a gradient where the transition from
88 * color a to color b is not linear, but in this case, exponential. 90 * color a to color b is not linear, but in this case, exponential.
89 * 91 *
@@ -511,49 +513,52 @@ public:
511 double elevation=30.0); 513 double elevation=30.0);
512 /** 514 /**
513 * Swirls the image by a specified amount 515 * Swirls the image by a specified amount
514 * 516 *
515 * @author Daniel M. Duley (mosfet) 517 * @author Daniel M. Duley (mosfet)
516 * @param src The QImage to process. 518 * @param src The QImage to process.
517 * @param degrees The tightness of the swirl. 519 * @param degrees The tightness of the swirl.
518 * @param background An RGBA value to use for the background. After the 520 * @param background An RGBA value to use for the background. After the
519 * effect some pixels may be "empty". This value is used for those pixels. 521 * effect some pixels may be "empty". This value is used for those pixels.
520 * @return The swirled image. The original is not changed. 522 * @return The swirled image. The original is not changed.
521 */ 523 */
522 static QImage swirl(QImage &src, double degrees=50.0, unsigned int background = 524 static QImage swirl(QImage &src, double degrees=50.0, unsigned int background =
523 0xFFFFFFFF); 525 0xFFFFFFFF);
524 526
525 /** 527 /**
526 * Modifies the pixels along a sine wave. 528 * Modifies the pixels along a sine wave.
527 * 529 *
528 * @author Daniel M. Duley (mosfet) 530 * @author Daniel M. Duley (mosfet)
529 * @param src The QImage to process. 531 * @param src The QImage to process.
530 * @param amplitude The amplitude of the sine wave. 532 * @param amplitude The amplitude of the sine wave.
531 * @param wavelength The frequency of the sine wave. 533 * @param wavelength The frequency of the sine wave.
532 * @return The new image. The original is not changed. 534 * @return The new image. The original is not changed.
533 */ 535 */
534 static QImage wave(QImage &src, double amplitude=25.0, double frequency=150.0, 536 static QImage wave(QImage &src, double amplitude=25.0, double frequency=150.0,
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
@@ -1,86 +1,91 @@
1/* 1/*
2                 This file is part of the Opie Project 2                 This file is part of the Opie Project
3 =. (C) 2003-2004 Michael 'Mickey' Lauer <mickey@Vanille.de> 3 =. (C) 2003-2004 Michael 'Mickey' Lauer <mickey@Vanille.de>
4 .=l. 4 .=l.
5           .>+-= 5           .>+-=
6 _;:,     .>    :=|. This program is free software; you can 6 _;:,     .>    :=|. This program is free software; you can
7.> <`_,   >  .   <= redistribute it and/or modify it under 7.> <`_,   >  .   <= redistribute it and/or modify it under
8:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 8:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
9.="- .-=="i,     .._ License as published by the Free Software 9.="- .-=="i,     .._ License as published by the Free Software
10 - .   .-<_>     .<> Foundation; either version 2 of the License, 10 - .   .-<_>     .<> Foundation; either version 2 of the License,
11     ._= =}       : or (at your option) any later version. 11     ._= =}       : or (at your option) any later version.
12    .%`+i>       _;_. 12    .%`+i>       _;_.
13    .i_,=:_.      -<s. This program is distributed in the hope that 13    .i_,=:_.      -<s. This program is distributed in the hope that
14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
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 );
63 #endif 68 #endif
64} 69}
65 70
66bool OListView::fullWidth() const 71bool OListView::fullWidth() const
67{ 72{
68 return m_fullWidth; 73 return m_fullWidth;
69} 74}
70 75
71int OListView::addColumn( const QString& label, int width ) 76int OListView::addColumn( const QString& label, int width )
72{ 77{
73 int result = QListView::addColumn( label, width ); 78 int result = QListView::addColumn( label, width );
74 #if QT_VERSION > 290 79 #if QT_VERSION > 290
75 if (m_fullWidth) { 80 if (m_fullWidth) {
76 header()->setStretchEnabled( false, columns()-2 ); 81 header()->setStretchEnabled( false, columns()-2 );
77 header()->setStretchEnabled( true, columns()-1 ); 82 header()->setStretchEnabled( true, columns()-1 );
78 } 83 }
79 #endif 84 #endif
80 return result; 85 return result;
81} 86}
82 87
83int OListView::addColumn( const QIconSet& iconset, const QString& label, int width ) 88int OListView::addColumn( const QIconSet& iconset, const QString& label, int width )
84{ 89{
85 int result = QListView::addColumn( iconset, label, width ); 90 int result = QListView::addColumn( iconset, label, width );
86 #if QT_VERSION > 290 91 #if QT_VERSION > 290
@@ -710,48 +715,50 @@ ONamedListViewItem::ONamedListViewItem( QListViewItem* parent, QListViewItem* af
710} 715}
711 716
712 717
713ONamedListViewItem::~ONamedListViewItem() 718ONamedListViewItem::~ONamedListViewItem()
714{ 719{
715} 720}
716 721
717 722
718void ONamedListViewItem::setText( const QStringList& texts ) 723void ONamedListViewItem::setText( const QStringList& texts )
719{ 724{
720 int col = 0; 725 int col = 0;
721 for ( QStringList::ConstIterator it = texts.begin(); it != texts.end(); ++it ) 726 for ( QStringList::ConstIterator it = texts.begin(); it != texts.end(); ++it )
722 { 727 {
723 qDebug( "setting column %d = text %s", col, (const char*) *it ); 728 qDebug( "setting column %d = text %s", col, (const char*) *it );
724 OListViewItem::setText( col++, *it ); 729 OListViewItem::setText( col++, *it );
725 } 730 }
726 731
727} 732}
728 733
729 734
730void ONamedListViewItem::setText( const QString& column, const QString& text ) 735void ONamedListViewItem::setText( const QString& column, const QString& text )
731{ 736{
732 //FIXME: If used excessively, this will slow down performance of updates 737 //FIXME: If used excessively, this will slow down performance of updates
733 //FIXME: because of the linear search over all column texts. 738 //FIXME: because of the linear search over all column texts.
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
@@ -1,191 +1,197 @@
1/* 1/*
2                 This file is part of the Opie Project 2                 This file is part of the Opie Project
3 =. (C) 2003-2004 Michael 'Mickey' Lauer <mickey@vanille.de> 3 =. (C) 2003-2004 Michael 'Mickey' Lauer <mickey@vanille.de>
4 .=l. 4 .=l.
5           .>+-= 5           .>+-=
6 _;:,     .>    :=|. This program is free software; you can 6 _;:,     .>    :=|. This program is free software; you can
7.> <`_,   >  .   <= redistribute it and/or modify it under 7.> <`_,   >  .   <= redistribute it and/or modify it under
8:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 8:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
9.="- .-=="i,     .._ License as published by the Free Software 9.="- .-=="i,     .._ License as published by the Free Software
10 - .   .-<_>     .<> Foundation; either version 2 of the License, 10 - .   .-<_>     .<> Foundation; either version 2 of the License,
11     ._= =}       : or (at your option) any later version. 11     ._= =}       : or (at your option) any later version.
12    .%`+i>       _;_. 12    .%`+i>       _;_.
13    .i_,=:_.      -<s. This program is distributed in the hope that 13    .i_,=:_.      -<s. This program is distributed in the hope that
14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
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 );
81 /** 85 /**
82 * Reimplemented for full width support 86 * Reimplemented for full width support
83 */ 87 */
84 virtual int addColumn( const QIconSet& iconset, const QString& label, int width = -1 ); 88 virtual int addColumn( const QIconSet& iconset, const QString& label, int width = -1 );
85 /** 89 /**
86 * Reimplemented for full width support 90 * Reimplemented for full width support
87 */ 91 */
88 virtual void removeColumn(int index); 92 virtual void removeColumn(int index);
89 /** 93 /**
90 * Set the alternate background background @a color. 94 * Set the alternate background background @a color.
91 * Set to an invalid color to disable alternate colors. 95 * Set to an invalid color to disable alternate colors.
92 * This only has an effect if the items are OListViewItems 96 * This only has an effect if the items are OListViewItems
93 */ 97 */
94 void setAlternateBackground( const QColor& color ); 98 void setAlternateBackground( const QColor& color );
95 /** 99 /**
96 * Sets the column separator @a pen. 100 * Sets the column separator @a pen.
97 */ 101 */
98 void setColumnSeparator( const QPen& pen ); 102 void setColumnSeparator( const QPen& pen );
99 103
100 /** 104 /**
101 * @returns the alternate background color 105 * @returns the alternate background color
102 */ 106 */
103 const QColor& alternateBackground() const; 107 const QColor& alternateBackground() const;
104 /** 108 /**
105 * @return the column separator pen 109 * @return the column separator pen
106 */ 110 */
107 const QPen& columnSeparator() const; 111 const QPen& columnSeparator() const;
108 /** 112 /**
109 * Create a list view item as child of this object 113 * Create a list view item as child of this object
110 * @returns the new object 114 * @returns the new object
111 */ 115 */
112 virtual OListViewItem* childFactory(); 116 virtual OListViewItem* childFactory();
113#ifndef QT_NO_DATASTREAM 117#ifndef QT_NO_DATASTREAM
114 /** 118 /**
115 * Serialize this object to @ref QDataStream @a stream 119 * Serialize this object to @ref QDataStream @a stream
116 */ 120 */
117 virtual void serializeTo( QDataStream& stream ) const; 121 virtual void serializeTo( QDataStream& stream ) const;
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 /**
168 * Constructors. 174 * Constructors.
169 */ 175 */
170 OListViewItem( QListView * parent ); 176 OListViewItem( QListView * parent );
171 OListViewItem( QListViewItem * parent ); 177 OListViewItem( QListViewItem * parent );
172 OListViewItem( QListView * parent, QListViewItem * after ); 178 OListViewItem( QListView * parent, QListViewItem * after );
173 OListViewItem( QListViewItem * parent, QListViewItem * after ); 179 OListViewItem( QListViewItem * parent, QListViewItem * after );
174 180
175 OListViewItem( QListView * parent, 181 OListViewItem( QListView * parent,
176 QString, QString = QString::null, 182 QString, QString = QString::null,
177 QString = QString::null, QString = QString::null, 183 QString = QString::null, QString = QString::null,
178 QString = QString::null, QString = QString::null, 184 QString = QString::null, QString = QString::null,
179 QString = QString::null, QString = QString::null ); 185 QString = QString::null, QString = QString::null );
180 186
181 OListViewItem( QListViewItem * parent, 187 OListViewItem( QListViewItem * parent,
182 QString, QString = QString::null, 188 QString, QString = QString::null,
183 QString = QString::null, QString = QString::null, 189 QString = QString::null, QString = QString::null,
184 QString = QString::null, QString = QString::null, 190 QString = QString::null, QString = QString::null,
185 QString = QString::null, QString = QString::null ); 191 QString = QString::null, QString = QString::null );
186 192
187 OListViewItem( QListView * parent, QListViewItem * after, 193 OListViewItem( QListView * parent, QListViewItem * after,
188 QString, QString = QString::null, 194 QString, QString = QString::null,
189 QString = QString::null, QString = QString::null, 195 QString = QString::null, QString = QString::null,
190 QString = QString::null, QString = QString::null, 196 QString = QString::null, QString = QString::null,
191 QString = QString::null, QString = QString::null ); 197 QString = QString::null, QString = QString::null );
@@ -197,98 +203,100 @@ class OListViewItem: public QListViewItem
197 QString = QString::null, QString = QString::null ); 203 QString = QString::null, QString = QString::null );
198 /** 204 /**
199 * Destructor. 205 * Destructor.
200 */ 206 */
201 virtual ~OListViewItem(); 207 virtual ~OListViewItem();
202 /** 208 /**
203 * @returns the background color of the list item. 209 * @returns the background color of the list item.
204 */ 210 */
205 const QColor& backgroundColor(); 211 const QColor& backgroundColor();
206 /** 212 /**
207 * @returns true, if the item is at an odd position and 213 * @returns true, if the item is at an odd position and
208 * thus have to be painted with the alternate background color. 214 * thus have to be painted with the alternate background color.
209 */ 215 */
210 bool isAlternate(); 216 bool isAlternate();
211 /** 217 /**
212 * @note: Reimplemented for internal purposes - the API is not affected 218 * @note: Reimplemented for internal purposes - the API is not affected
213 * 219 *
214 */ 220 */
215 void paintCell( QPainter *p, const QColorGroup &cg, int column, int width, int alignment ); 221 void paintCell( QPainter *p, const QColorGroup &cg, int column, int width, int alignment );
216 /** 222 /**
217 * Perform object initialization. 223 * Perform object initialization.
218 */ 224 */
219 void init(); 225 void init();
220 /** 226 /**
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:
271 279
272 OCheckListItem( QCheckListItem *parent, const QString &text, 280 OCheckListItem( QCheckListItem *parent, const QString &text,
273 Type = Controller ); 281 Type = Controller );
274 OCheckListItem( QListViewItem *parent, const QString &text, 282 OCheckListItem( QListViewItem *parent, const QString &text,
275 Type = Controller ); 283 Type = Controller );
276 OCheckListItem( QListView *parent, const QString &text, 284 OCheckListItem( QListView *parent, const QString &text,
277 Type = Controller ); 285 Type = Controller );
278 OCheckListItem( QListViewItem *parent, const QString &text, 286 OCheckListItem( QListViewItem *parent, const QString &text,
279 const QPixmap & ); 287 const QPixmap & );
280 OCheckListItem( QListView *parent, const QString &text, 288 OCheckListItem( QListView *parent, const QString &text,
281 const QPixmap & ); 289 const QPixmap & );
282 ~OCheckListItem(); 290 ~OCheckListItem();
283 /** 291 /**
284 * @returns the background color of the list item. 292 * @returns the background color of the list item.
285 */ 293 */
286 const QColor& backgroundColor(); 294 const QColor& backgroundColor();
287 /** 295 /**
288 * @returns true, if the item is at an odd position and 296 * @returns true, if the item is at an odd position and
289 * thus have to be painted with the alternate background color. 297 * thus have to be painted with the alternate background color.
290 */ 298 */
291 bool isAlternate(); 299 bool isAlternate();
292 /** 300 /**
293 * @note: Reimplemented for internal purposes - the API is not affected 301 * @note: Reimplemented for internal purposes - the API is not affected
294 * 302 *
@@ -309,101 +317,110 @@ class OCheckListItem : public QCheckListItem
309 * ONamedListView 317 * ONamedListView
310 *======================================================================================*/ 318 *======================================================================================*/
311 319
312class ONamedListViewItem; 320class ONamedListViewItem;
313 321
314/** 322/**
315 * @brief An OListView variant with named columns. 323 * @brief An OListView variant with named columns.
316 * 324 *
317 * This class provides a higher-level interface to an OListView. 325 * This class provides a higher-level interface to an OListView.
318 * 326 *
319 * @author Michael 'Mickey' Lauer <mickey@vanille.de> 327 * @author Michael 'Mickey' Lauer <mickey@vanille.de>
320 */ 328 */
321class ONamedListView: public OListView 329class ONamedListView: public OListView
322{ 330{
323 public: 331 public:
324 /** 332 /**
325 * Constructor. 333 * Constructor.
326 * 334 *
327 * The parameters @a parent and @a name are handled by 335 * The parameters @a parent and @a name are handled by
328 * @ref OListView, as usual. 336 * @ref OListView, as usual.
329 */ 337 */
330 ONamedListView( QWidget* parent = 0, const char* name = 0 ); 338 ONamedListView( QWidget* parent = 0, const char* name = 0 );
331 /** 339 /**
332 * Destructor. 340 * Destructor.
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 );
381 /** 392 /**
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,66 +1,63 @@
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
59!contains( platform, x11 ) { 56!contains( platform, x11 ) {
60 include ( $(OPIEDIR)/include.pro ) 57 include ( $(OPIEDIR)/include.pro )
61} 58}
62 59
63contains( platform, x11 ) { 60contains( platform, x11 ) {
64 LIBS += -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib 61 LIBS += -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib
65} 62}
66 63
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,67 +1,69 @@
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;
44 register int bl = bca << 16; 46 register int bl = bca << 16;
45 47
46 int rcdelta = ((1<<16) / (eff == VerticalGradient ? pixmap.height() : pixmap.width())) * rDiff; 48 int rcdelta = ((1<<16) / (eff == VerticalGradient ? pixmap.height() : pixmap.width())) * rDiff;
47 int gcdelta = ((1<<16) / (eff == VerticalGradient ? pixmap.height() : pixmap.width())) * gDiff; 49 int gcdelta = ((1<<16) / (eff == VerticalGradient ? pixmap.height() : pixmap.width())) * gDiff;
48 int bcdelta = ((1<<16) / (eff == VerticalGradient ? pixmap.height() : pixmap.width())) * bDiff; 50 int bcdelta = ((1<<16) / (eff == VerticalGradient ? pixmap.height() : pixmap.width())) * bDiff;
49 51
50 QPainter p(&pixmap); 52 QPainter p(&pixmap);
51 53
52 // these for-loops could be merged, but the if's in the inner loop 54 // these for-loops could be merged, but the if's in the inner loop
53 // would make it slow 55 // would make it slow
54 switch(eff) { 56 switch(eff) {
55 case VerticalGradient: 57 case VerticalGradient:
56 for ( y = 0; y < pixmap.height(); y++ ) { 58 for ( y = 0; y < pixmap.height(); y++ ) {
57 rl += rcdelta; 59 rl += rcdelta;
58 gl += gcdelta; 60 gl += gcdelta;
59 bl += bcdelta; 61 bl += bcdelta;
60 62
61 p.setPen(QColor(rl>>16, gl>>16, bl>>16)); 63 p.setPen(QColor(rl>>16, gl>>16, bl>>16));
62 p.drawLine(0, y, pixmap.width()-1, y); 64 p.drawLine(0, y, pixmap.width()-1, y);
63 } 65 }
64 break; 66 break;
65 case HorizontalGradient: 67 case HorizontalGradient:
66 for( x = 0; x < pixmap.width(); x++) { 68 for( x = 0; x < pixmap.width(); x++) {
67 rl += rcdelta; 69 rl += rcdelta;
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,65 +1,68 @@
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.
42 * @param ca Color a. 45 * @param ca Color a.
43 * @param cb Color b. 46 * @param cb Color b.
44 * @param type The type of gradient. 47 * @param type The type of gradient.
45 * @param ncols The number of colors to use when not running on a 48 * @param ncols The number of colors to use when not running on a
46 * truecolor display. The gradient will be dithered to this number of 49 * truecolor display. The gradient will be dithered to this number of
47 * colors. Pass 0 to prevent dithering. 50 * colors. Pass 0 to prevent dithering.
48 * @return Returns the generated pixmap, for convenience. 51 * @return Returns the generated pixmap, for convenience.
49 */ 52 */
50 static OPixmap& gradient(OPixmap& pixmap, const QColor &ca, const QColor &cb, 53 static OPixmap& gradient(OPixmap& pixmap, const QColor &ca, const QColor &cb,
51 GradientType type, int ncols=3); 54 GradientType type, int ncols=3);
52 55
53 /** 56 /**
54 * Creates an unbalanced gradient. 57 * Creates an unbalanced gradient.
55 * 58 *
56 * An unbalanced gradient is a gradient where the transition from 59 * An unbalanced gradient is a gradient where the transition from
57 * color a to color b is not linear, but in this case, exponential. 60 * color a to color b is not linear, but in this case, exponential.
58 * 61 *
59 * @param pixmap The pixmap that should be written. 62 * @param pixmap The pixmap that should be written.
60 * @param ca Color a. 63 * @param ca Color a.
61 * @param cb Color b. 64 * @param cb Color b.
62 * @param type The type of gradient. 65 * @param type The type of gradient.
63 * @param xfactor The x decay length. Use a value between -200 and 200. 66 * @param xfactor The x decay length. Use a value between -200 and 200.
64 * @param yfactor The y decay length. 67 * @param yfactor The y decay length.
65 * @param ncols The number of colors. See #gradient. 68 * @param ncols The number of colors. See #gradient.
@@ -165,51 +168,52 @@ public:
165 168
166 /** 169 /**
167 * Converts a pixmap to grayscale. 170 * Converts a pixmap to grayscale.
168 * 171 *
169 * @param pixmap The pixmap to process. 172 * @param pixmap The pixmap to process.
170 * @param fast Set to @p true in order to use a faster but non-photographic 173 * @param fast Set to @p true in order to use a faster but non-photographic
171 * quality algorithm. Appropriate for things such as toolbar icons. 174 * quality algorithm. Appropriate for things such as toolbar icons.
172 * @return Returns the @ref pixmap(), provided for convenience. 175 * @return Returns the @ref pixmap(), provided for convenience.
173 */ 176 */
174 static OPixmap& toGray(OPixmap& pixmap, bool fast=false); 177 static OPixmap& toGray(OPixmap& pixmap, bool fast=false);
175 178
176 /** 179 /**
177 * Desaturates a pixmap. 180 * Desaturates a pixmap.
178 * 181 *
179 * @param pixmap The pixmap to process. 182 * @param pixmap The pixmap to process.
180 * @param desat A value between 0 and 1 setting the degree of desaturation 183 * @param desat A value between 0 and 1 setting the degree of desaturation
181 * @return Returns The @ref pixmap(), provided for convenience. 184 * @return Returns The @ref pixmap(), provided for convenience.
182 */ 185 */
183 static OPixmap& desaturate(OPixmap& pixmap, float desat = 0.3); 186 static OPixmap& desaturate(OPixmap& pixmap, float desat = 0.3);
184 187
185 /** 188 /**
186 * Modifies the contrast of a pixmap. 189 * Modifies the contrast of a pixmap.
187 * 190 *
188 * @param pixmap The pixmap to process. 191 * @param pixmap The pixmap to process.
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
@@ -1,54 +1,62 @@
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#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
@@ -1,77 +1,80 @@
1/* This file is part of the KDE libraries 1/* This file is part of the KDE libraries
2 Copyright (C) 2000 Daniel M. Duley <mosfet@kde.org> 2 Copyright (C) 2000 Daniel M. Duley <mosfet@kde.org>
3 Copyright (C) 2002 Hamish Rodda <meddie@yoyo.its.monash.edu.au> 3 Copyright (C) 2002 Hamish Rodda <meddie@yoyo.its.monash.edu.au>
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 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{
54 titleStr = text; 57 titleStr = text;
55 if (icon) 58 if (icon)
56 miniicon = *icon; 59 miniicon = *icon;
57 else 60 else
58 miniicon.resize(0, 0); 61 miniicon.resize(0, 0);
59 62
60 int w = miniicon.width()+fontMetrics().width(titleStr); 63 int w = miniicon.width()+fontMetrics().width(titleStr);
61 int h = QMAX( fontMetrics().height(), miniicon.height() ); 64 int h = QMAX( fontMetrics().height(), miniicon.height() );
62 setMinimumSize( w+16, h+8 ); 65 setMinimumSize( w+16, h+8 );
63} 66}
64 67
65void OPopupTitle::setText( const QString &text ) 68void OPopupTitle::setText( const QString &text )
66{ 69{
67 titleStr = text; 70 titleStr = text;
68 int w = miniicon.width()+fontMetrics().width(titleStr); 71 int w = miniicon.width()+fontMetrics().width(titleStr);
69 int h = QMAX( fontMetrics().height(), miniicon.height() ); 72 int h = QMAX( fontMetrics().height(), miniicon.height() );
70 setMinimumSize( w+16, h+8 ); 73 setMinimumSize( w+16, h+8 );
71} 74}
72 75
73void OPopupTitle::setIcon( const QPixmap &pix ) 76void OPopupTitle::setIcon( const QPixmap &pix )
74{ 77{
75 miniicon = pix; 78 miniicon = pix;
76 int w = miniicon.width()+fontMetrics().width(titleStr); 79 int w = miniicon.width()+fontMetrics().width(titleStr);
77 int h = QMAX( fontMetrics().height(), miniicon.height() ); 80 int h = QMAX( fontMetrics().height(), miniicon.height() );
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
@@ -1,81 +1,83 @@
1//FIXME what is ODE? ODE Desktop Environemt? -zecke 1//FIXME what is ODE? ODE Desktop Environemt? -zecke
2//FIXME do we need titles? space is limited that is only eyecandy? -zecke 2//FIXME do we need titles? space is limited that is only eyecandy? -zecke
3//FIXME keyboard navigation is also not that popular on a PDA might be with a keyboard (tuxphone) -zecke 3//FIXME keyboard navigation is also not that popular on a PDA might be with a keyboard (tuxphone) -zecke
4/* This file is part of the ODE libraries 4/* This file is part of the ODE libraries
5 Copyright (C) 2000 Daniel M. Duley <mosfet@kde.org> 5 Copyright (C) 2000 Daniel M. Duley <mosfet@kde.org>
6 6
7 This library is free software; you can redistribute it and/or 7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public 8 modify it under the terms of the GNU Library General Public
9 License version 2 as published by the Free Software Foundation. 9 License version 2 as published by the Free Software Foundation.
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 */
58 OPopupTitle(OPixmapEffect::GradientType gradient, const QColor &color, 60 OPopupTitle(OPixmapEffect::GradientType gradient, const QColor &color,
59 const QColor &textColor, QWidget *parent=0, 61 const QColor &textColor, QWidget *parent=0,
60 const char *name=0); 62 const char *name=0);
61 /** 63 /**
62 * @deprecated 64 * @deprecated
63 * Constructs a title widget with the specified pixmap and colors. 65 * Constructs a title widget with the specified pixmap and colors.
64 */ 66 */
65 OPopupTitle(const OPixmap &background, const QColor &color, 67 OPopupTitle(const OPixmap &background, const QColor &color,
66 const QColor &textColor, QWidget *parent=0, 68 const QColor &textColor, QWidget *parent=0,
67 const char *name=0); 69 const char *name=0);
68 /** 70 /**
69 * Sets the title string and optional icon for the title widget. 71 * Sets the title string and optional icon for the title widget.
70 * 72 *
71 * You will want to call this before inserting into a menu. 73 * You will want to call this before inserting into a menu.
72 */ 74 */
73 void setTitle(const QString &text, const QPixmap *icon=NULL); 75 void setTitle(const QString &text, const QPixmap *icon=NULL);
74 /** 76 /**
75 * Returns the current title. 77 * Returns the current title.
76 */ 78 */
77 QString title() const { return(titleStr); } 79 QString title() const { return(titleStr); }
78 /** 80 /**
79 * Returns the current icon. 81 * Returns the current icon.
80 */ 82 */
81 QPixmap icon() const { return(miniicon); } 83 QPixmap icon() const { return(miniicon); }
@@ -211,49 +213,52 @@ public:
211 * @since 3.2 213 * @since 3.2
212 */ 214 */
213 void cancelContextMenuShow(); 215 void cancelContextMenuShow();
214 216
215 /** 217 /**
216 * Returns the OPopupMenu associated with the current context menu 218 * Returns the OPopupMenu associated with the current context menu
217 * @since 3.2 219 * @since 3.2
218 */ 220 */
219 static OPopupMenu* contextMenuFocus(); 221 static OPopupMenu* contextMenuFocus();
220 222
221 /** 223 /**
222 * returns the ID of the menuitem associated with the current context menu 224 * returns the ID of the menuitem associated with the current context menu
223 * @since 3.2 225 * @since 3.2
224 */ 226 */
225 static int contextMenuFocusItem(); 227 static int contextMenuFocusItem();
226 228
227signals: 229signals:
228 /** 230 /**
229 * connect to this signal to be notified when a context menu is about to be shown 231 * connect to this signal to be notified when a context menu is about to be shown
230 * @param menu The menu that the context menu is about to be shown for 232 * @param menu The menu that the context menu is about to be shown for
231 * @param menuItem The menu item that the context menu is currently on 233 * @param menuItem The menu item that the context menu is currently on
232 * @param ctxMenu The context menu itself 234 * @param ctxMenu The context menu itself
233 * @since 3.2 235 * @since 3.2
234 */ 236 */
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
@@ -1,124 +1,126 @@
1/* This file is part of the KDE libraries 1/* This file is part of the KDE libraries
2 Copyright (C) 1997 Martin Jones (mjones@kde.org) 2 Copyright (C) 1997 Martin Jones (mjones@kde.org)
3 3
4 This library is free software; you can redistribute it and/or 4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public 5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either 6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version. 7 version 2 of the License, or (at your option) any later version.
8 8
9 This library is distributed in the hope that it will be useful, 9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of 10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details. 12 Library General Public License for more details.
13 13
14 You should have received a copy of the GNU Library General Public License 14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to 15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 16 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, USA. 17 Boston, MA 02111-1307, USA.
18*/ 18*/
19 19
20/* 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
101 QBrush brush; 103 QBrush brush;
102 qDrawShadePanel( &painter, 0, 0, width(), height(), colorGroup(), 104 qDrawShadePanel( &painter, 0, 0, width(), height(), colorGroup(),
103 TRUE, 2, &brush ); 105 TRUE, 2, &brush );
104 106
105 drawContents( &painter ); 107 drawContents( &painter );
106 if (paintRect.contains(cursorRect)) 108 if (paintRect.contains(cursorRect))
107 { 109 {
108 bitBlt( &store, 0, 0, this, px - STORE_W, py - STORE_W, 110 bitBlt( &store, 0, 0, this, px - STORE_W, py - STORE_W,
109 STORE_W2, STORE_W2, CopyROP ); 111 STORE_W2, STORE_W2, CopyROP );
110 drawCursor( &painter, px, py ); 112 drawCursor( &painter, px, py );
111 } 113 }
112 else if (paintRect.intersects(cursorRect)) 114 else if (paintRect.intersects(cursorRect))
113 { 115 {
114 repaint( cursorRect, false); 116 repaint( cursorRect, false);
115 } 117 }
116 118
117 painter.end(); 119 painter.end();
118} 120}
119 121
120void OXYSelector::mousePressEvent( QMouseEvent *e ) 122void OXYSelector::mousePressEvent( QMouseEvent *e )
121{ 123{
122 int xVal, yVal; 124 int xVal, yVal;
123 valuesFromPosition( e->pos().x() - 2, e->pos().y() - 2, xVal, yVal ); 125 valuesFromPosition( e->pos().x() - 2, e->pos().y() - 2, xVal, yVal );
124 setValues( xVal, yVal ); 126 setValues( xVal, yVal );
@@ -213,311 +215,311 @@ void OXYSelector::drawCursor( QPainter *p, int xp, int yp )
213OSelector::OSelector( QWidget *parent, const char *name ) 215OSelector::OSelector( QWidget *parent, const char *name )
214 : QWidget( parent, name ), QRangeControl() 216 : QWidget( parent, name ), QRangeControl()
215{ 217{
216 _orientation = Horizontal; 218 _orientation = Horizontal;
217 _indent = TRUE; 219 _indent = TRUE;
218} 220}
219 221
220OSelector::OSelector( Orientation o, QWidget *parent, const char *name ) 222OSelector::OSelector( Orientation o, QWidget *parent, const char *name )
221 : QWidget( parent, name ), QRangeControl() 223 : QWidget( parent, name ), QRangeControl()
222{ 224{
223 _orientation = o; 225 _orientation = o;
224 _indent = TRUE; 226 _indent = TRUE;
225} 227}
226 228
227 229
228OSelector::~OSelector() 230OSelector::~OSelector()
229{} 231{}
230 232
231 233
232QRect OSelector::contentsRect() const 234QRect OSelector::contentsRect() const
233{ 235{
234 if ( orientation() == Vertical ) 236 if ( orientation() == Vertical )
235 return QRect( 2, 5, width()-9, height()-10 ); 237 return QRect( 2, 5, width()-9, height()-10 );
236 else 238 else
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
319QPoint OSelector::calcArrowPos( int val ) 321QPoint OSelector::calcArrowPos( int val )
320{ 322{
321 QPoint p; 323 QPoint p;
322 324
323 if ( orientation() == Vertical ) 325 if ( orientation() == Vertical )
324 { 326 {
325 p.setY( height() - ( (height()-10) * val 327 p.setY( height() - ( (height()-10) * val
326 / ( maxValue() - minValue() ) + 5 ) ); 328 / ( maxValue() - minValue() ) + 5 ) );
327 p.setX( width() - 5 ); 329 p.setX( width() - 5 );
328 } 330 }
329 else 331 else
330 { 332 {
331 p.setX( width() - ( (width()-10) * val 333 p.setX( width() - ( (width()-10) * val
332 / ( maxValue() - minValue() ) + 5 ) ); 334 / ( maxValue() - minValue() ) + 5 ) );
333 p.setY( height() - 5 ); 335 p.setY( height() - 5 );
334 } 336 }
335 337
336 return p; 338 return p;
337} 339}
338 340
339void OSelector::drawContents( QPainter * ) 341void 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
428 unsigned int *p = (uint *) image.scanLine( y ); 430 unsigned int *p = (uint *) image.scanLine( y );
429 for ( int x = 0; x < image.width(); x++ ) 431 for ( int x = 0; x < image.width(); x++ )
430 *p++ = col.rgb(); 432 *p++ = col.rgb();
431 } 433 }
432 } 434 }
433 else 435 else
434 { 436 {
435 unsigned int *p = (uint *) image.scanLine( 0 ); 437 unsigned int *p = (uint *) image.scanLine( 0 );
436 438
437 for ( int x = 0; x < image.width(); x++ ) 439 for ( int x = 0; x < image.width(); x++ )
438 { 440 {
439 scale = 1.0 * x / image.width(); 441 scale = 1.0 * x / image.width();
440 col.setRgb( color1.red() + int(redDiff*scale), 442 col.setRgb( color1.red() + int(redDiff*scale),
441 color1.green() + int(greenDiff*scale), 443 color1.green() + int(greenDiff*scale),
442 color1.blue() + int(blueDiff*scale) ); 444 color1.blue() + int(blueDiff*scale) );
443 *p++ = col.rgb(); 445 *p++ = col.rgb();
444 } 446 }
445 447
446 for ( int y = 1; y < image.height(); y++ ) 448 for ( int y = 1; y < image.height(); y++ )
447 memcpy( image.scanLine( y ), image.scanLine( y - 1), 449 memcpy( image.scanLine( y ), image.scanLine( y - 1),
448 sizeof( unsigned int ) * image.width() ); 450 sizeof( unsigned int ) * image.width() );
449 } 451 }
450 452
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
500#define STANDARD_PAL_SIZE 17 502#define STANDARD_PAL_SIZE 17
501 503
502OColor::OColor() 504OColor::OColor()
503: QColor() 505: QColor()
504{ 506{
505 r = 0; g = 0; b = 0; h = 0; s = 0; v = 0; 507 r = 0; g = 0; b = 0; h = 0; s = 0; v = 0;
506}; 508};
507 509
508OColor::OColor( const OColor &col) 510OColor::OColor( const OColor &col)
509: QColor( col ) 511: QColor( col )
510{ 512{
511 h = col.h; s = col.s; v = col.v; 513 h = col.h; s = col.s; v = col.v;
512 r = col.r; g = col.g; b = col.b; 514 r = col.r; g = col.g; b = col.b;
513}; 515};
514 516
515OColor::OColor( const QColor &col) 517OColor::OColor( const QColor &col)
516: QColor( col ) 518: QColor( col )
517{ 519{
518 QColor::rgb(&r, &g, &b); 520 QColor::rgb(&r, &g, &b);
519 QColor::hsv(&h, &s, &v); 521 QColor::hsv(&h, &s, &v);
520}; 522};
521 523
522bool OColor::operator==(const OColor& col) const 524bool OColor::operator==(const OColor& col) const
523{ 525{
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
@@ -1,77 +1,80 @@
1/* This file is part of the KDE libraries 1/* This file is part of the KDE libraries
2 Copyright (C) 1997 Martin Jones (mjones@kde.org) 2 Copyright (C) 1997 Martin Jones (mjones@kde.org)
3 3
4 This library is free software; you can redistribute it and/or 4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public 5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either 6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version. 7 version 2 of the License, or (at your option) any later version.
8 8
9 This library is distributed in the hope that it will be useful, 9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of 10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details. 12 Library General Public License for more details.
13 13
14 You should have received a copy of the GNU Library General Public License 14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to 15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 16 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, USA. 17 Boston, MA 02111-1307, USA.
18*/ 18*/
19//----------------------------------------------------------------------------- 19//-----------------------------------------------------------------------------
20// 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 */
54 ~OXYSelector(); 57 ~OXYSelector();
55 58
56 /** 59 /**
57 * Sets the current values in horizontal and 60 * Sets the current values in horizontal and
58 * vertical direction. 61 * vertical direction.
59 */ 62 */
60 void setValues( int xPos, int yPos ); 63 void setValues( int xPos, int yPos );
61 /** 64 /**
62 * Sets the range of possible values. 65 * Sets the range of possible values.
63 */ 66 */
64 void setRange( int minX, int minY, int maxX, int maxY ); 67 void setRange( int minX, int minY, int maxX, int maxY );
65 68
66 /** 69 /**
67 * @return the current value in horizontal direction. 70 * @return the current value in horizontal direction.
68 */ 71 */
69 int xValue() const {return xPos; } 72 int xValue() const {return xPos; }
70 /** 73 /**
71 * @return the current value in vertical direction. 74 * @return the current value in vertical direction.
72 */ 75 */
73 int yValue() const {return yPos; } 76 int yValue() const {return yPos; }
74 77
75 /** 78 /**
76 * @return the rectangle on which subclasses should draw. 79 * @return the rectangle on which subclasses should draw.
77 */ 80 */
@@ -467,52 +470,54 @@ protected:
467 virtual void resizeEvent( QResizeEvent * ); 470 virtual void resizeEvent( QResizeEvent * );
468 /** 471 /**
469 * Reimplemented from OSelector. The drawing is 472 * Reimplemented from OSelector. The drawing is
470 * buffered in a pixmap here. As real drawing 473 * buffered in a pixmap here. As real drawing
471 * routine, drawPalette() is used. 474 * routine, drawPalette() is used.
472 */ 475 */
473 virtual void drawContents( QPainter *painter ); 476 virtual void drawContents( QPainter *painter );
474 477
475private: 478private:
476 int _hue; 479 int _hue;
477 int _sat; 480 int _sat;
478 QPixmap pixmap; 481 QPixmap pixmap;
479 482
480private: 483private:
481 class OValueSelectorPrivate; 484 class OValueSelectorPrivate;
482 OValueSelectorPrivate *d; 485 OValueSelectorPrivate *d;
483}; 486};
484 487
485 488
486class OColor : public QColor 489class OColor : public QColor
487{ 490{
488public: 491public:
489 OColor(); 492 OColor();
490 OColor( const OColor &col); 493 OColor( const OColor &col);
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
@@ -1,86 +1,88 @@
1/* 1/*
2                 This file is part of the Opie Project 2                 This file is part of the Opie Project
3              Copyright (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> 3              Copyright (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de>
4 Copyright (C) 1997 Michael Roth <mroth@wirlweb.de> 4 Copyright (C) 1997 Michael Roth <mroth@wirlweb.de>
5 =. 5 =.
6 .=l. 6 .=l.
7           .>+-= 7           .>+-=
8 _;:,     .>    :=|. This program is free software; you can 8 _;:,     .>    :=|. This program is free software; you can
9.> <`_,   >  .   <= redistribute it and/or modify it under 9.> <`_,   >  .   <= redistribute it and/or modify it under
10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11.="- .-=="i,     .._ License as published by the Free Software 11.="- .-=="i,     .._ License as published by the Free Software
12 - .   .-<_>     .<> Foundation; either version 2 of the License, 12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13     ._= =}       : or (at your option) any later version. 13     ._= =}       : or (at your option) any later version.
14    .%`+i>       _;_. 14    .%`+i>       _;_.
15    .i_,=:_.      -<s. This program is distributed in the hope that 15    .i_,=:_.      -<s. This program is distributed in the hope that
16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17    : ..    .:,     . . . without even the implied warranty of 17    : ..    .:,     . . . without even the implied warranty of
18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20..}^=.=       =       ; Library General Public License for more 20..}^=.=       =       ; Library General Public License for more
21++=   -.     .`     .: details. 21++=   -.     .`     .: details.
22 :     =  ...= . :.=- 22 :     =  ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU 23 -.   .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with 24  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB. 25    --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation, 26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330, 27 Inc., 59 Temple Place - Suite 330,
28 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
29 29
30*/ 30*/
31 31
32/* OPIE */ 32/* OPIE */
33 33
34#include <opie2/odebug.h> 34#include <opie2/odebug.h>
35#include <opie2/oseparator.h> 35#include <opie2/oseparator.h>
36 36
37/* QT */ 37/* QT */
38 38
39using namespace Opie::Core;
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)
63 { 65 {
64 case Vertical: 66 case Vertical:
65 case VLine: 67 case VLine:
66 setFrameStyle( QFrame::VLine | QFrame::Sunken ); 68 setFrameStyle( QFrame::VLine | QFrame::Sunken );
67 setMinimumSize(2, 0); 69 setMinimumSize(2, 0);
68 break; 70 break;
69 71
70 default: 72 default:
71 owarn << "OSeparator::setOrientation(): invalid orientation, using default orientation HLine" << oendl; 73 owarn << "OSeparator::setOrientation(): invalid orientation, using default orientation HLine" << oendl;
72 74
73 case Horizontal: 75 case Horizontal:
74 case HLine: 76 case HLine:
75 setFrameStyle( QFrame::HLine | QFrame::Sunken ); 77 setFrameStyle( QFrame::HLine | QFrame::Sunken );
76 setMinimumSize(0, 2); 78 setMinimumSize(0, 2);
77 break; 79 break;
78 } 80 }
79} 81}
80 82
81 83
82 84
83int OSeparator::orientation() const 85int OSeparator::orientation() const
84{ 86{
85 if ( frameStyle() & VLine ) 87 if ( frameStyle() & VLine )
86 return VLine; 88 return VLine;
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
@@ -1,90 +1,95 @@
1/* 1/*
2                 This file is part of the Opie Project 2                 This file is part of the Opie Project
3 3
4              Copyright (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> 4              Copyright (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de>
5 Copyright (C) 1997 Michael Roth <mroth@wirlweb.de> 5 Copyright (C) 1997 Michael Roth <mroth@wirlweb.de>
6 =. 6 =.
7 .=l. 7 .=l.
8           .>+-= 8           .>+-=
9 _;:,     .>    :=|. This program is free software; you can 9 _;:,     .>    :=|. This program is free software; you can
10.> <`_,   >  .   <= redistribute it and/or modify it under 10.> <`_,   >  .   <= redistribute it and/or modify it under
11:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 11:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
12.="- .-=="i,     .._ License as published by the Free Software 12.="- .-=="i,     .._ License as published by the Free Software
13 - .   .-<_>     .<> Foundation; either version 2 of the License, 13 - .   .-<_>     .<> Foundation; either version 2 of the License,
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);
62 65
63 /** 66 /**
64 * Returns the orientation of the separator. 67 * Returns the orientation of the separator.
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
@@ -1,82 +1,82 @@
1/* 1/*
2                This file is part of the Opie Project 2                This file is part of the Opie Project
3 3
4              Copyright (c) 2002 Dan Williams <williamsdr@acm.org> 4              Copyright (c) 2002 Dan Williams <williamsdr@acm.org>
5 =. 5 =.
6 .=l. 6 .=l.
7           .>+-= 7           .>+-=
8 _;:,     .>    :=|. This program is free software; you can 8 _;:,     .>    :=|. This program is free software; you can
9.> <`_,   >  .   <= redistribute it and/or modify it under 9.> <`_,   >  .   <= redistribute it and/or modify it under
10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11.="- .-=="i,     .._ License as published by the Free Software 11.="- .-=="i,     .._ License as published by the Free Software
12 - .   .-<_>     .<> Foundation; either version 2 of the License, 12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13     ._= =}       : or (at your option) any later version. 13     ._= =}       : or (at your option) any later version.
14    .%`+i>       _;_. 14    .%`+i>       _;_.
15    .i_,=:_.      -<s. This program is distributed in the hope that 15    .i_,=:_.      -<s. This program is distributed in the hope that
16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17    : ..    .:,     . . . without even the implied warranty of 17    : ..    .:,     . . . without even the implied warranty of
18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20..}^=.=       =       ; Library General Public License for more 20..}^=.=       =       ; Library General Public License for more
21++=   -.     .`     .: details. 21++=   -.     .`     .: details.
22 :     =  ...= . :.=- 22 :     =  ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU 23 -.   .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with 24  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB. 25    --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation, 26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330, 27 Inc., 59 Temple Place - Suite 330,
28 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
29 29
30*/ 30*/
31 31
32#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;
59 if ( t->id == currentTab() ) 59 if ( t->id == currentTab() )
60 { 60 {
61 tr.setBottom( tr.bottom() - style().defaultFrameWidth() ); 61 tr.setBottom( tr.bottom() - style().defaultFrameWidth() );
62 } 62 }
63 63
64 if ( t->enabled && isEnabled() ) 64 if ( t->enabled && isEnabled() )
65 { 65 {
66 p->setPen( colorGroup().foreground() ); 66 p->setPen( colorGroup().foreground() );
67 p->drawText( tr, AlignCenter | ShowPrefix, t->label ); 67 p->drawText( tr, AlignCenter | ShowPrefix, t->label );
68 } 68 }
69 else if ( style() == MotifStyle ) 69 else if ( style() == MotifStyle )
70 { 70 {
71 p->setPen( palette().disabled().foreground() ); 71 p->setPen( palette().disabled().foreground() );
72 p->drawText( tr, AlignCenter | ShowPrefix, t->label ); 72 p->drawText( tr, AlignCenter | ShowPrefix, t->label );
73 } 73 }
74 else 74 else
75 { 75 {
76 p->setPen( colorGroup().light() ); 76 p->setPen( colorGroup().light() );
77 QRect wr = tr; 77 QRect wr = tr;
78 wr.moveBy( 1, 1 ); 78 wr.moveBy( 1, 1 );
79 p->drawText( wr, AlignCenter | ShowPrefix, t->label ); 79 p->drawText( wr, AlignCenter | ShowPrefix, t->label );
80 p->setPen( palette().disabled().foreground() ); 80 p->setPen( palette().disabled().foreground() );
81 p->drawText( tr, AlignCenter | ShowPrefix, t->label ); 81 p->drawText( tr, AlignCenter | ShowPrefix, t->label );
82 } 82 }
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
@@ -1,85 +1,86 @@
1/* 1/*
2                This file is part of the Opie Project 2                This file is part of the Opie Project
3 3
4              Copyright (c) 2002 Dan Williams <williamsdr@acm.org> 4              Copyright (c) 2002 Dan Williams <williamsdr@acm.org>
5 =. 5 =.
6 .=l. 6 .=l.
7           .>+-= 7           .>+-=
8 _;:,     .>    :=|. This program is free software; you can 8 _;:,     .>    :=|. This program is free software; you can
9.> <`_,   >  .   <= redistribute it and/or modify it under 9.> <`_,   >  .   <= redistribute it and/or modify it under
10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11.="- .-=="i,     .._ License as published by the Free Software 11.="- .-=="i,     .._ License as published by the Free Software
12 - .   .-<_>     .<> Foundation; either version 2 of the License, 12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13     ._= =}       : or (at your option) any later version. 13     ._= =}       : or (at your option) any later version.
14    .%`+i>       _;_. 14    .%`+i>       _;_.
15    .i_,=:_.      -<s. This program is distributed in the hope that 15    .i_,=:_.      -<s. This program is distributed in the hope that
16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17    : ..    .:,     . . . without even the implied warranty of 17    : ..    .:,     . . . without even the implied warranty of
18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20..}^=.=       =       ; Library General Public License for more 20..}^=.=       =       ; Library General Public License for more
21++=   -.     .`     .: details. 21++=   -.     .`     .: details.
22 :     =  ...= . :.=- 22 :     =  ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU 23 -.   .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with 24  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB. 25    --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation, 26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330, 27 Inc., 59 Temple Place - Suite 330,
28 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
29 29
30*/ 30*/
31 31
32#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
@@ -1,140 +1,141 @@
1/* 1/*
2                This file is part of the Opie Project 2                This file is part of the Opie Project
3 3
4              Copyright (c) 2002 Dan Williams <williamsdr@acm.org> 4              Copyright (c) 2002 Dan Williams <williamsdr@acm.org>
5 =. 5 =.
6 .=l. 6 .=l.
7           .>+-= 7           .>+-=
8 _;:,     .>    :=|. This program is free software; you can 8 _;:,     .>    :=|. This program is free software; you can
9.> <`_,   >  .   <= redistribute it and/or modify it under 9.> <`_,   >  .   <= redistribute it and/or modify it under
10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11.="- .-=="i,     .._ License as published by the Free Software 11.="- .-=="i,     .._ License as published by the Free Software
12 - .   .-<_>     .<> Foundation; either version 2 of the License, 12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13     ._= =}       : or (at your option) any later version. 13     ._= =}       : or (at your option) any later version.
14    .%`+i>       _;_. 14    .%`+i>       _;_.
15    .i_,=:_.      -<s. This program is distributed in the hope that 15    .i_,=:_.      -<s. This program is distributed in the hope that
16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17    : ..    .:,     . . . without even the implied warranty of 17    : ..    .:,     . . . without even the implied warranty of
18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20..}^=.=       =       ; Library General Public License for more 20..}^=.=       =       ; Library General Public License for more
21++=   -.     .`     .: details. 21++=   -.     .`     .: details.
22 :     =  ...= . :.=- 22 :     =  ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU 23 -.   .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with 24  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB. 25    --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation, 26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330, 27 Inc., 59 Temple Place - Suite 330,
28 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
29 29
30*/ 30*/
31 31
32#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.
67 * @param p Position of the widget selection control. 67 * @param p Position of the widget selection control.
68 */ 68 */
69 OTabInfo() : i( -1 ), c( 0 ), p( 0 ), l( QString::null ) {} 69 OTabInfo() : i( -1 ), c( 0 ), p( 0 ), l( QString::null ) {}
70 70
71 /** 71 /**
72 * @fn OTabInfo( int id, QWidget *control, const QString &icon, const QString &label ) 72 * @fn OTabInfo( int id, QWidget *control, const QString &icon, const QString &label )
73 * @brief Object constructor. 73 * @brief Object constructor.
74 * 74 *
75 * @param id TabBar identifier for widget. 75 * @param id TabBar identifier for widget.
76 * @param control QWidget pointer to widget. 76 * @param control QWidget pointer to widget.
77 * @param icon QString name of icon file. 77 * @param icon QString name of icon file.
78 * @param label QString text label for OTabWidget selection control. 78 * @param label QString text label for OTabWidget selection control.
79 */ 79 */
80 OTabInfo( int id, QWidget *control, const QString &icon, const QString &label ) 80 OTabInfo( int id, QWidget *control, const QString &icon, const QString &label )
81 : i( id ), c( control ), p( icon ), l( label ) {} 81 : i( id ), c( control ), p( icon ), l( label ) {}
82 82
83 /** 83 /**
84 * @fn id()const 84 * @fn id()const
85 * @brief Returns TabBar ID. 85 * @brief Returns TabBar ID.
86 */ 86 */
87 int id() const { return i; } 87 int id() const { return i; }
88 88
89 /** 89 /**
90 * @fn label()const 90 * @fn label()const
91 * @brief Returns text label for widget. 91 * @brief Returns text label for widget.
92 */ 92 */
93 const QString &label() const { return l; } 93 const QString &label() const { return l; }
94 94
95 /** 95 /**
96 * @fn setLabel( const QString &label ) 96 * @fn setLabel( const QString &label )
97 * @brief Set label for tab. 97 * @brief Set label for tab.
98 * 98 *
99 * @param label QString text label for OTabWidget selection control. 99 * @param label QString text label for OTabWidget selection control.
100 */ 100 */
101 void setLabel( const QString &label ) { l = label; } 101 void setLabel( const QString &label ) { l = label; }
102 102
103 /** 103 /**
104 * @fn control()const 104 * @fn control()const
105 * @brief Returns pointer to widget. 105 * @brief Returns pointer to widget.
106 */ 106 */
107 QWidget *control() const { return c; } 107 QWidget *control() const { return c; }
108 108
109 /** 109 /**
110 * @fn icon()const 110 * @fn icon()const
111 * @brief Returns name of icon file. 111 * @brief Returns name of icon file.
112 */ 112 */
113 const QString &icon() const { return p; } 113 const QString &icon() const { return p; }
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
@@ -1,92 +1,92 @@
1/* 1/*
2                This file is part of the Opie Project 2                This file is part of the Opie Project
3 3
4              Copyright (c) 2002 Dan Williams <williamsdr@acm.org> 4              Copyright (c) 2002 Dan Williams <williamsdr@acm.org>
5 =. 5 =.
6 .=l. 6 .=l.
7           .>+-= 7           .>+-=
8 _;:,     .>    :=|. This program is free software; you can 8 _;:,     .>    :=|. This program is free software; you can
9.> <`_,   >  .   <= redistribute it and/or modify it under 9.> <`_,   >  .   <= redistribute it and/or modify it under
10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11.="- .-=="i,     .._ License as published by the Free Software 11.="- .-=="i,     .._ License as published by the Free Software
12 - .   .-<_>     .<> Foundation; either version 2 of the License, 12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13     ._= =}       : or (at your option) any later version. 13     ._= =}       : or (at your option) any later version.
14    .%`+i>       _;_. 14    .%`+i>       _;_.
15    .i_,=:_.      -<s. This program is distributed in the hope that 15    .i_,=:_.      -<s. This program is distributed in the hope that
16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17    : ..    .:,     . . . without even the implied warranty of 17    : ..    .:,     . . . without even the implied warranty of
18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20..}^=.=       =       ; Library General Public License for more 20..}^=.=       =       ; Library General Public License for more
21++=   -.     .`     .: details. 21++=   -.     .`     .: details.
22 :     =  ...= . :.=- 22 :     =  ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU 23 -.   .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with 24  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB. 25    --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation, 26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330, 27 Inc., 59 Temple Place - Suite 330,
28 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
29 29
30*/ 30*/
31 31
32#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
69 widgetStack = new QWidgetStack( this, "widgetstack" ); 69 widgetStack = new QWidgetStack( this, "widgetstack" );
70 widgetStack->setFrameStyle( QFrame::NoFrame ); 70 widgetStack->setFrameStyle( QFrame::NoFrame );
71 widgetStack->setLineWidth( style().defaultFrameWidth() ); 71 widgetStack->setLineWidth( style().defaultFrameWidth() );
72 72
73 tabBarStack = new QWidgetStack( this, "tabbarstack" ); 73 tabBarStack = new QWidgetStack( this, "tabbarstack" );
74 74
75 tabBar = new OTabBar( tabBarStack, "tabbar" ); 75 tabBar = new OTabBar( tabBarStack, "tabbar" );
76 tabBarStack->addWidget( tabBar, 0 ); 76 tabBarStack->addWidget( tabBar, 0 );
77 connect( tabBar, SIGNAL( selected(int) ), this, SLOT( slotTabBarSelected(int) ) ); 77 connect( tabBar, SIGNAL( selected(int) ), this, SLOT( slotTabBarSelected(int) ) );
78 78
79 tabList = new QComboBox( false, tabBarStack, "tablist" ); 79 tabList = new QComboBox( false, tabBarStack, "tablist" );
80 tabBarStack->addWidget( tabList, 1 ); 80 tabBarStack->addWidget( tabList, 1 );
81 connect( tabList, SIGNAL( activated(int) ), this, SLOT( slotTabListSelected(int) ) ); 81 connect( tabList, SIGNAL( activated(int) ), this, SLOT( slotTabListSelected(int) ) );
82 82
83 tabBarPosition = p; 83 tabBarPosition = p;
84 setTabStyle( s ); 84 setTabStyle( s );
85 setTabPosition( p ); 85 setTabPosition( p );
86 86
87 currTab= 0x0; 87 currTab= 0x0;
88} 88}
89 89
90OTabWidget::~OTabWidget() 90OTabWidget::~OTabWidget()
91{} 91{}
92 92
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
@@ -1,97 +1,96 @@
1/* 1/*
2                 This file is part of the Opie Project 2                 This file is part of the Opie Project
3              Copyright (C) 2002 Dan Williams <williamsdr@acm.org> 3              Copyright (C) 2002 Dan Williams <williamsdr@acm.org>
4 =. 4 =.
5 .=l. 5 .=l.
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 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/**
74 * @enum TabStyle 73 * @enum TabStyle
75 * @brief Defines how the widget selection control is displayed. 74 * @brief Defines how the widget selection control is displayed.
76 * 75 *
77 * Valid values: 76 * Valid values:
78 * - Global: use globally selected options (qpe.conf - TabStyle & TabPosition) 77 * - Global: use globally selected options (qpe.conf - TabStyle & TabPosition)
79 * - TextTab: Tabbed widget selection with text labels 78 * - TextTab: Tabbed widget selection with text labels
80 * - IconTab: Tabbed widget selection with icon labels, text label for active widget 79 * - IconTab: Tabbed widget selection with icon labels, text label for active widget
81 * (similar to Opie launcher) 80 * (similar to Opie launcher)
82 * - TextList: Drop down list widget selection with text labels 81 * - TextList: Drop down list widget selection with text labels
83 * - IconList: Drop down list widget selection with icon & text labels 82 * - IconList: Drop down list widget selection with icon & text labels
84 */ 83 */
85 enum TabStyle { Global, TextTab, IconTab, TextList, IconList }; 84 enum TabStyle { Global, TextTab, IconTab, TextList, IconList };
86 85
87/** 86/**
88 * @enum TabPosition 87 * @enum TabPosition
89 * @brief Defines where the widget selection control is drawn. 88 * @brief Defines where the widget selection control is drawn.
90 * 89 *
91 * Valid values: 90 * Valid values:
92 * - Top: Widget selection control is drawn above widgets 91 * - Top: Widget selection control is drawn above widgets
93 * - Bottom: Widget selection control is drawn below widgets 92 * - Bottom: Widget selection control is drawn below widgets
94 */ 93 */
95 enum TabPosition { Top, Bottom }; 94 enum TabPosition { Top, Bottom };
96 95
97/** 96/**
@@ -242,51 +241,52 @@ private:
242 * 241 *
243 * @param name Name of icon image file. 242 * @param name Name of icon image file.
244 */ 243 */
245 QPixmap loadSmooth( const QString & ); 244 QPixmap loadSmooth( const QString & );
246 245
247/** 246/**
248 * @fn selectTab( OTabInfo *tab ) 247 * @fn selectTab( OTabInfo *tab )
249 * @brief Internal function to select desired widget. 248 * @brief Internal function to select desired widget.
250 * 249 *
251 * @param tab Pointer to data for widget. 250 * @param tab Pointer to data for widget.
252 */ 251 */
253 void selectTab( OTabInfo * ); 252 void selectTab( OTabInfo * );
254 253
255/** 254/**
256 * @fn setUpLayout() 255 * @fn setUpLayout()
257 * @brief Internal function to adjust layout. 256 * @brief Internal function to adjust layout.
258 */ 257 */
259 void setUpLayout(); 258 void setUpLayout();
260 259
261 260
262 signals: 261 signals:
263/** 262/**
264 * @fn currentChanegd( QWidget *widget ) 263 * @fn currentChanegd( QWidget *widget )
265 * @brief This signal is emitted whenever the widget has changed. 264 * @brief This signal is emitted whenever the widget has changed.
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
@@ -1,32 +1,82 @@
1/* 1/*
2                 This file is part of the Opie Project 2                 This file is part of the Opie Project
3 3
4              Copyright (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> 4              Copyright (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de>
5 =. 5 =.
6 .=l. 6 .=l.
7           .>+-= 7           .>+-=
8 _;:,     .>    :=|. This program is free software; you can 8 _;:,     .>    :=|. This program is free software; you can
9.> <`_,   >  .   <= redistribute it and/or modify it under 9.> <`_,   >  .   <= redistribute it and/or modify it under
10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11.="- .-=="i,     .._ License as published by the Free Software 11.="- .-=="i,     .._ License as published by the Free Software
12 - .   .-<_>     .<> Foundation; either version 2 of the License, 12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13     ._= =}       : or (at your option) any later version. 13     ._= =}       : or (at your option) any later version.
14    .%`+i>       _;_. 14    .%`+i>       _;_.
15    .i_,=:_.      -<s. This program is distributed in the hope that 15    .i_,=:_.      -<s. This program is distributed in the hope that
16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17    : ..    .:,     . . . without even the implied warranty of 17    : ..    .:,     . . . without even the implied warranty of
18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20..}^=.=       =       ; Library General Public License for more 20..}^=.=       =       ; Library General Public License for more
21++=   -.     .`     .: details. 21++=   -.     .`     .: details.
22 :     =  ...= . :.=- 22 :     =  ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU 23 -.   .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with 24  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB. 25    --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation, 26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330, 27 Inc., 59 Temple Place - Suite 330,
28 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
29 29
30*/ 30*/
31#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
@@ -1,130 +1,129 @@
1/* 1/*
2                 This file is part of the Opie Project 2                 This file is part of the Opie Project
3 3
4              Copyright (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> 4              Copyright (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de>
5 =. 5 =.
6 .=l. 6 .=l.
7           .>+-= 7           .>+-=
8 _;:,     .>    :=|. This program is free software; you can 8 _;:,     .>    :=|. This program is free software; you can
9.> <`_,   >  .   <= redistribute it and/or modify it under 9.> <`_,   >  .   <= redistribute it and/or modify it under
10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11.="- .-=="i,     .._ License as published by the Free Software 11.="- .-=="i,     .._ License as published by the Free Software
12 - .   .-<_>     .<> Foundation; either version 2 of the License, 12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13     ._= =}       : or (at your option) any later version. 13     ._= =}       : or (at your option) any later version.
14    .%`+i>       _;_. 14    .%`+i>       _;_.
15    .i_,=:_.      -<s. This program is distributed in the hope that 15    .i_,=:_.      -<s. This program is distributed in the hope that
16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17    : ..    .:,     . . . without even the implied warranty of 17    : ..    .:,     . . . without even the implied warranty of
18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20..}^=.=       =       ; Library General Public License for more 20..}^=.=       =       ; Library General Public License for more
21++=   -.     .`     .: details. 21++=   -.     .`     .: details.
22 :     =  ...= . :.=- 22 :     =  ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU 23 -.   .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with 24  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB. 25    --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation, 26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330, 27 Inc., 59 Temple Place - Suite 330,
28 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
29 29
30*/ 30*/
31 31
32#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
@@ -1,85 +1,89 @@
1/* 1/*
2 This file is part of the Opie Project 2 This file is part of the Opie Project
3 Copyright (C) Stefan Eilers <eilers.stefan@epost.de> 3 Copyright (C) Stefan Eilers <eilers.stefan@epost.de>
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org> 4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l. 5 .=l.
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);
62 s.sprintf("%.2d",i); 66 s.sprintf("%.2d",i);
63 r->setText(s); 67 r->setText(s);
64 r->setToggleButton(true); 68 r->setToggleButton(true);
65 r->setAlignment(AlignHCenter | AlignVCenter); 69 r->setAlignment(AlignHCenter | AlignVCenter);
66 l->addWidget(r); 70 l->addWidget(r);
67 connect(r, SIGNAL(toggled(bool)), 71 connect(r, SIGNAL(toggled(bool)),
68 this, SLOT(slotHour(bool))); 72 this, SLOT(slotHour(bool)));
69 73
70 if (i==11) 74 if (i==11)
71 { // Second row 75 { // Second row
72 row=new QWidget(this); 76 row=new QWidget(this);
73 l=new QHBoxLayout(row); 77 l=new QHBoxLayout(row);
74 vbox->addWidget(row); 78 vbox->addWidget(row);
75 } 79 }
76 } 80 }
77 81
78 // Minute Row 82 // Minute Row
79 row=new QWidget(this); 83 row=new QWidget(this);
80 l=new QHBoxLayout(row); 84 l=new QHBoxLayout(row);
81 vbox->addWidget(row); 85 vbox->addWidget(row);
82 86
83 for (int i=0; i<60; i+=5) 87 for (int i=0; i<60; i+=5)
84 { 88 {
85 r=new OClickableLabel(row); 89 r=new OClickableLabel(row);
@@ -175,118 +179,123 @@ void OTimePicker::setTime( int h, int m )
175 * Method to set the minutes 179 * Method to set the minutes
176 * @param m minutes 180 * @param m minutes
177 */ 181 */
178void OTimePicker::setMinute(int m) 182void OTimePicker::setMinute(int m)
179{ 183{
180 184
181 QString minute; 185 QString minute;
182 minute.sprintf("%.2d",m); 186 minute.sprintf("%.2d",m);
183 187
184 QValueListIterator<OClickableLabel *> it; 188 QValueListIterator<OClickableLabel *> it;
185 for (it=minuteLst.begin(); it!=minuteLst.end(); it++) 189 for (it=minuteLst.begin(); it!=minuteLst.end(); it++)
186 { 190 {
187 if ((*it)->text() == minute) (*it)->setOn(true); 191 if ((*it)->text() == minute) (*it)->setOn(true);
188 else (*it)->setOn(false); 192 else (*it)->setOn(false);
189 } 193 }
190 194
191 tm.setHMS(tm.hour(),m,0); 195 tm.setHMS(tm.hour(),m,0);
192} 196}
193 197
194/** 198/**
195 * Method to set the hour 199 * Method to set the hour
196 */ 200 */
197void OTimePicker::setHour(int h) 201void OTimePicker::setHour(int h)
198{ 202{
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{
247 m_time = time; 253 m_time = time;
248 254
249 m_timePicker->setHour ( time.hour() ); 255 m_timePicker->setHour ( time.hour() );
250 m_timePicker->setMinute( time.minute() ); 256 m_timePicker->setMinute( time.minute() );
251 257
252 // Set Textfields 258 // Set Textfields
253 if ( time.hour() < 10 ) 259 if ( time.hour() < 10 )
254 hourField->setText( "0" + QString::number( time.hour() ) ); 260 hourField->setText( "0" + QString::number( time.hour() ) );
255 else 261 else
256 hourField->setText( QString::number( time.hour() ) ); 262 hourField->setText( QString::number( time.hour() ) );
257 263
258 if ( time.minute() < 10 ) 264 if ( time.minute() < 10 )
259 minuteField->setText( "0" + QString::number( time.minute() ) ); 265 minuteField->setText( "0" + QString::number( time.minute() ) );
260 else 266 else
261 minuteField->setText( QString::number( time.minute() ) ); 267 minuteField->setText( QString::number( time.minute() ) );
262 268
263} 269}
264 270
265/** 271/**
266 * This method takes the current minute and tries to set hour 272 * This method takes the current minute and tries to set hour
267 * to hour. This succeeds if the resulting date is valid 273 * to hour. This succeeds if the resulting date is valid
268 * @param hour The hour as a string 274 * @param hour The hour as a string
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
@@ -1,125 +1,132 @@
1/* 1/*
2 This file is part of the Opie Project 2 This file is part of the Opie Project
3 Copyright (C) Stefan Eilers <eilers.stefan@epost.de> 3 Copyright (C) Stefan Eilers <eilers.stefan@epost.de>
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org> 4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l. 5 .=l.
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#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);
84 void slotMinute(bool b); 83 void slotMinute(bool b);
85 84
86signals: 85signals:
87 /** 86 /**
88 * gets emitted when the time got changed by the user 87 * gets emitted when the time got changed by the user
89 */ 88 */
90 void timeChanged(const QTime &); 89 void timeChanged(const QTime &);
91}; 90};
92 91
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,62 +1,62 @@
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>
39 </property> 39 </property>
40 <property stdset="1"> 40 <property stdset="1">
41 <name>spacing</name> 41 <name>spacing</name>
42 <number>4</number> 42 <number>4</number>
43 </property> 43 </property>
44 <widget> 44 <widget>
45 <class>QFrame</class> 45 <class>QFrame</class>
46 <property stdset="1"> 46 <property stdset="1">
47 <name>name</name> 47 <name>name</name>
48 <cstring>Frame10</cstring> 48 <cstring>Frame10</cstring>
49 </property> 49 </property>
50 <property stdset="1"> 50 <property stdset="1">
51 <name>sizePolicy</name> 51 <name>sizePolicy</name>
52 <sizepolicy> 52 <sizepolicy>
53 <hsizetype>1</hsizetype> 53 <hsizetype>1</hsizetype>
54 <vsizetype>7</vsizetype> 54 <vsizetype>7</vsizetype>
55 </sizepolicy> 55 </sizepolicy>
56 </property> 56 </property>
57 <property stdset="1"> 57 <property stdset="1">
58 <name>frameShape</name> 58 <name>frameShape</name>
59 <enum>NoFrame</enum> 59 <enum>NoFrame</enum>
60 </property> 60 </property>
61 <property stdset="1"> 61 <property stdset="1">
62 <name>frameShadow</name> 62 <name>frameShadow</name>
@@ -204,89 +204,53 @@
204 <property stdset="1"> 204 <property stdset="1">
205 <name>orientation</name> 205 <name>orientation</name>
206 <enum>Horizontal</enum> 206 <enum>Horizontal</enum>
207 </property> 207 </property>
208 <property stdset="1"> 208 <property stdset="1">
209 <name>sizeType</name> 209 <name>sizeType</name>
210 <enum>MinimumExpanding</enum> 210 <enum>MinimumExpanding</enum>
211 </property> 211 </property>
212 <property> 212 <property>
213 <name>sizeHint</name> 213 <name>sizeHint</name>
214 <size> 214 <size>
215 <width>20</width> 215 <width>20</width>
216 <height>20</height> 216 <height>20</height>
217 </size> 217 </size>
218 </property> 218 </property>
219 </spacer> 219 </spacer>
220 </hbox> 220 </hbox>
221 </widget> 221 </widget>
222 <widget> 222 <widget>
223 <class>QGroupBox</class> 223 <class>QGroupBox</class>
224 <property stdset="1"> 224 <property stdset="1">
225 <name>name</name> 225 <name>name</name>
226 <cstring>GroupBox1</cstring> 226 <cstring>GroupBox1</cstring>
227 </property> 227 </property>
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
@@ -1,269 +1,272 @@
1/* 1/*
2                 This file is part of the Opie Project 2                 This file is part of the Opie Project
3 3
4 =. (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> 4 =. (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de>
5 .=l. 5 .=l.
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 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" #>,' #>,' ",
67" ", 70" ",
68" )))))) )))))) ", 71" )))))) )))))) ",
69" ", 72" ",
70" ", 73" ",
71" .+@# .+@# ", 74" .+@# .+@# ",
72" $%&* $%&* ", 75" $%&* $%&* ",
73" @=-; @=-; ", 76" @=-; @=-; ",
74" #>,' #>,' ", 77" #>,' #>,' ",
75" ", 78" ",
76" )))))) )))))) ", 79" )))))) )))))) ",
77" "}; 80" "};
78 81
79/* XPM */ 82/* XPM */
80static const char * view_tree_xpm[] = { 83static const char * view_tree_xpm[] = {
81"16 16 17 1", 84"16 16 17 1",
82 " c None", 85 " c None",
83 ".c #3A3A3A", 86 ".c #3A3A3A",
84 "+c #87BD88", 87 "+c #87BD88",
85 "@c #8BBE8B", 88 "@c #8BBE8B",
86 "#c #81BA81", 89 "#c #81BA81",
87 "$c #6DAF6D", 90 "$c #6DAF6D",
88 "%c #87BD87", 91 "%c #87BD87",
89 "&c #FCFDFC", 92 "&c #FCFDFC",
90 "*c #AED0AE", 93 "*c #AED0AE",
91 "=c #4E9C4C", 94 "=c #4E9C4C",
92 "-c #91BD91", 95 "-c #91BD91",
93 ";c #72B172", 96 ";c #72B172",
94 ">c #448643", 97 ">c #448643",
95 ",c #686868", 98 ",c #686868",
96 "'c #519F50", 99 "'c #519F50",
97 ")c #499247", 100 ")c #499247",
98 "!c #356A35", 101 "!c #356A35",
99" . ", 102" . ",
100" . ", 103" . ",
101" . +@#$ ", 104" . +@#$ ",
102" . %&*= ", 105" . %&*= ",
103" .. #-;> ,, ,,,", 106" .. #-;> ,, ,,,",
104" . $')! ", 107" . $')! ",
105" . ", 108" . ",
106" . ", 109" . ",
107" . ", 110" . ",
108" . +@#$ ", 111" . +@#$ ",
109" . %&*= ", 112" . %&*= ",
110" .. #-;> ,, ,,,", 113" .. #-;> ,, ,,,",
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 );
246} 249}
247 250
248void OVersatileView::popupContextMenu( OVersatileViewItem* item, const QPoint& pos, int col ) 251void OVersatileView::popupContextMenu( OVersatileViewItem* item, const QPoint& pos, int col )
249{ 252{
250 if ( !item ) 253 if ( !item )
251 _contextmenu->exec( pos ); 254 _contextmenu->exec( pos );
252 else 255 else
253 emit( contextMenuRequested( item, pos, col ) ); 256 emit( contextMenuRequested( item, pos, col ) );
254} 257}
255 258
256void OVersatileView::setSynchronization( bool sync ) 259void OVersatileView::setSynchronization( bool sync )
257{ 260{
258 _synchronization = sync; 261 _synchronization = sync;
259} 262}
260 263
261bool OVersatileView::synchronization() 264bool OVersatileView::synchronization()
262{ 265{
263 return _synchronization; 266 return _synchronization;
264} 267}
265 268
266void OVersatileView::setDefaultPixmaps( int mode, QPixmap& leaf, QPixmap& opened, QPixmap& closed ) 269void OVersatileView::setDefaultPixmaps( int mode, QPixmap& leaf, QPixmap& opened, QPixmap& closed )
267{ 270{
268 if ( mode == Tree ) 271 if ( mode == Tree )
269 { 272 {
@@ -375,130 +378,130 @@ void OVersatileView::selectionChanged( QIconViewItem * item )
375{ 378{
376 emit( selectionChanged( static_cast<OVersatileViewItem*>( item ) ) ); 379 emit( selectionChanged( static_cast<OVersatileViewItem*>( item ) ) );
377} 380}
378 381
379void OVersatileView::currentChanged( QListViewItem * item ) 382void OVersatileView::currentChanged( QListViewItem * item )
380{ 383{
381 emit( currentChanged( static_cast<OVersatileViewItem*>( item ) ) ); 384 emit( currentChanged( static_cast<OVersatileViewItem*>( item ) ) );
382} 385}
383 386
384void OVersatileView::currentChanged( QIconViewItem * item ) 387void OVersatileView::currentChanged( QIconViewItem * item )
385{ 388{
386 emit( currentChanged( static_cast<OVersatileViewItem*>( item ) ) ); 389 emit( currentChanged( static_cast<OVersatileViewItem*>( item ) ) );
387} 390}
388 391
389void OVersatileView::clicked( QListViewItem * item ) 392void OVersatileView::clicked( QListViewItem * item )
390{ 393{
391 emit( clicked( static_cast<OVersatileViewItem*>( item ) ) ); 394 emit( clicked( static_cast<OVersatileViewItem*>( item ) ) );
392} 395}
393 396
394void OVersatileView::clicked( QIconViewItem * item ) 397void OVersatileView::clicked( QIconViewItem * item )
395{ 398{
396 emit( clicked( static_cast<OVersatileViewItem*>( item ) ) ); 399 emit( clicked( static_cast<OVersatileViewItem*>( item ) ) );
397} 400}
398 401
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();
481} 484}
482 485
483 int OVersatileView::addColumn( const QString &label, int size ) // QListView 486 int OVersatileView::addColumn( const QString &label, int size ) // QListView
484{ 487{
485 if ( !isValidViewMode( Tree ) ) 488 if ( !isValidViewMode( Tree ) )
486 { 489 {
487 return -1; 490 return -1;
488 } 491 }
489 return _listview->addColumn( label, size ); 492 return _listview->addColumn( label, size );
490} 493}
491 494
492 int OVersatileView::addColumn( const QIconSet& iconset, const QString &label, int size ) // QListView 495 int OVersatileView::addColumn( const QIconSet& iconset, const QString &label, int size ) // QListView
493{ 496{
494 if ( !isValidViewMode( Tree ) ) 497 if ( !isValidViewMode( Tree ) )
495 { 498 {
496 return -1; 499 return -1;
497 } 500 }
498 return _listview->addColumn( iconset, label, size ); 501 return _listview->addColumn( iconset, label, size );
499} 502}
500 503
501void OVersatileView::removeColumn( int index ) // QListView 504void OVersatileView::removeColumn( int index ) // QListView
502{ 505{
503 if ( !isValidViewMode( Tree ) ) 506 if ( !isValidViewMode( Tree ) )
504 { 507 {
@@ -700,97 +703,97 @@ int OVersatileView::itemMargin() const // QListView
700} 703}
701 704
702 void OVersatileView::setRootIsDecorated( bool decorate ) // QListView 705 void OVersatileView::setRootIsDecorated( bool decorate ) // QListView
703{ 706{
704 if ( !isValidViewMode( Tree ) ) 707 if ( !isValidViewMode( Tree ) )
705 { 708 {
706 return; 709 return;
707 } 710 }
708 _listview->setRootIsDecorated( decorate ); 711 _listview->setRootIsDecorated( decorate );
709} 712}
710bool OVersatileView::rootIsDecorated() const // QListView 713bool OVersatileView::rootIsDecorated() const // QListView
711{ 714{
712 if ( !isValidViewMode( Tree ) ) 715 if ( !isValidViewMode( Tree ) )
713 { 716 {
714 return false; 717 return false;
715 } 718 }
716 return _listview->rootIsDecorated(); 719 return _listview->rootIsDecorated();
717} 720}
718 721
719void OVersatileView::setShowSortIndicator( bool show ) // QListView 722void OVersatileView::setShowSortIndicator( bool show ) // QListView
720{ 723{
721 if ( !isValidViewMode( Tree ) ) 724 if ( !isValidViewMode( Tree ) )
722 { 725 {
723 return; 726 return;
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 }
773 return static_cast<OVersatileViewItem*>( _iconview->firstItem() ); 776 return static_cast<OVersatileViewItem*>( _iconview->firstItem() );
774} 777}
775OVersatileViewItem* OVersatileView::lastItem() const // QIconView 778OVersatileViewItem* OVersatileView::lastItem() const // QIconView
776{ 779{
777 if ( !isValidViewMode( Icons ) ) 780 if ( !isValidViewMode( Icons ) )
778 { 781 {
779 return 0; 782 return 0;
780 } 783 }
781 return static_cast<OVersatileViewItem*>( _iconview->lastItem() ); 784 return static_cast<OVersatileViewItem*>( _iconview->lastItem() );
782} 785}
783 786
784OVersatileViewItem* OVersatileView::findItem( const QPoint &pos ) const // QIconView 787OVersatileViewItem* OVersatileView::findItem( const QPoint &pos ) const // QIconView
785{ 788{
786 if ( !isValidViewMode( Icons ) ) 789 if ( !isValidViewMode( Icons ) )
787 { 790 {
788 return 0; 791 return 0;
789 } 792 }
790 return static_cast<OVersatileViewItem*>( _iconview->findItem( pos ) ); 793 return static_cast<OVersatileViewItem*>( _iconview->findItem( pos ) );
791} 794}
792OVersatileViewItem* OVersatileView::findItem( const QString &text ) const // QIconView 795OVersatileViewItem* OVersatileView::findItem( const QString &text ) const // QIconView
793{ 796{
794 if ( !isValidViewMode( Icons ) ) 797 if ( !isValidViewMode( Icons ) )
795 { 798 {
796 return 0; 799 return 0;
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
@@ -1,394 +1,399 @@
1/* 1/*
2                 This file is part of the Opie Project 2                 This file is part of the Opie Project
3 3
4 =. (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> 4 =. (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de>
5 .=l. 5 .=l.
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 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
@@ -1,81 +1,83 @@
1/* 1/*
2                 This file is part of the Opie Project 2                 This file is part of the Opie Project
3 3
4 =. (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> 4 =. (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de>
5 .=l. 5 .=l.
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 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
58OVersatileViewItem::OVersatileViewItem( OVersatileView * parent, OVersatileViewItem* after, 60OVersatileViewItem::OVersatileViewItem( OVersatileView * parent, OVersatileViewItem* after,
59 QString a, QString b, QString c, QString d, 61 QString a, QString b, QString c, QString d,
60 QString e, QString f, QString g, QString h ) 62 QString e, QString f, QString g, QString h )
61 :OListViewItem( parent->_listview, after, a, b, c, d, e, f, g, h ), 63 :OListViewItem( parent->_listview, after, a, b, c, d, e, f, g, h ),
62 QIconViewItem( parent->_iconview, after, a ), 64 QIconViewItem( parent->_iconview, after, a ),
63 _versatileview( parent ) 65 _versatileview( parent )
64{ 66{
65 init(); 67 init();
66} 68}
67 69
68OVersatileViewItem::OVersatileViewItem( OVersatileViewItem * parent, 70OVersatileViewItem::OVersatileViewItem( OVersatileViewItem * parent,
69 QString a, QString b, QString c, QString d, 71 QString a, QString b, QString c, QString d,
70 QString e, QString f, QString g, QString h ) 72 QString e, QString f, QString g, QString h )
71 :OListViewItem( parent, a, b, c, d, e, f, g, h ), 73 :OListViewItem( parent, a, b, c, d, e, f, g, h ),
72 QIconViewItem( parent->_versatileview->_iconview, a ), 74 QIconViewItem( parent->_versatileview->_iconview, a ),
73 _versatileview( parent->_versatileview ) 75 _versatileview( parent->_versatileview )
74{ 76{
75 init(); 77 init();
76} 78}
77 79
78OVersatileViewItem::OVersatileViewItem( OVersatileViewItem * parent, OVersatileViewItem* after, 80OVersatileViewItem::OVersatileViewItem( OVersatileViewItem * parent, OVersatileViewItem* after,
79 QString a, QString b, QString c, QString d, 81 QString a, QString b, QString c, QString d,
80 QString e, QString f, QString g, QString h ) 82 QString e, QString f, QString g, QString h )
81 :OListViewItem( parent, after, a, b, c, d, e, f, g, h ), 83 :OListViewItem( parent, after, a, b, c, d, e, f, g, h ),
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
@@ -1,100 +1,105 @@
1/* 1/*
2                 This file is part of the Opie Project 2                 This file is part of the Opie Project
3 3
4              Copyright (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> 4              Copyright (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de>
5 =. 5 =.
6 .=l. 6 .=l.
7           .>+-= 7           .>+-=
8 _;:,     .>    :=|. This program is free software; you can 8 _;:,     .>    :=|. This program is free software; you can
9.> <`_,   >  .   <= redistribute it and/or modify it under 9.> <`_,   >  .   <= redistribute it and/or modify it under
10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11.="- .-=="i,     .._ License as published by the Free Software 11.="- .-=="i,     .._ License as published by the Free Software
12 - .   .-<_>     .<> Foundation; either version 2 of the License, 12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13     ._= =}       : or (at your option) any later version. 13     ._= =}       : or (at your option) any later version.
14    .%`+i>       _;_. 14    .%`+i>       _;_.
15    .i_,=:_.      -<s. This program is distributed in the hope that 15    .i_,=:_.      -<s. This program is distributed in the hope that
16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17    : ..    .:,     . . . without even the implied warranty of 17    : ..    .:,     . . . without even the implied warranty of
18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20..}^=.=       =       ; Library General Public License for more 20..}^=.=       =       ; Library General Public License for more
21++=   -.     .`     .: details. 21++=   -.     .`     .: details.
22 :     =  ...= . :.=- 22 :     =  ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU 23 -.   .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with 24  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB. 25    --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation, 26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330, 27 Inc., 59 Temple Place - Suite 330,
28 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
29 29
30*/ 30*/
31 31
32#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,
67 QString = QString::null, QString = QString::null, 70 QString = QString::null, QString = QString::null,
68 QString = QString::null, QString = QString::null, 71 QString = QString::null, QString = QString::null,
69 QString = QString::null, QString = QString::null, 72 QString = QString::null, QString = QString::null,
70 QString = QString::null ); 73 QString = QString::null );
71 74
72 OVersatileViewItem( OVersatileViewItem * parent, OVersatileViewItem * after, QString, 75 OVersatileViewItem( OVersatileViewItem * parent, OVersatileViewItem * after, QString,
73 QString = QString::null, QString = QString::null, 76 QString = QString::null, QString = QString::null,
74 QString = QString::null, QString = QString::null, 77 QString = QString::null, QString = QString::null,
75 QString = QString::null, QString = QString::null, 78 QString = QString::null, QString = QString::null,
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
@@ -1,88 +1,90 @@
1/* 1/*
2                This file is part of the Opie Project 2                This file is part of the Opie Project
3              Copyright (C) 2003 Maximilian Reiss <harlekin@handhelds.org> 3              Copyright (C) 2003 Maximilian Reiss <harlekin@handhelds.org>
4 =. 4 =.
5 .=l. 5 .=l.
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 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
65 m_pix = Resource::loadPixmap( "BigBusy" ); 67 m_pix = Resource::loadPixmap( "BigBusy" );
66 m_aniSize = m_pix.height(); 68 m_aniSize = m_pix.height();
67 resize( m_aniSize, m_aniSize ); 69 resize( m_aniSize, m_aniSize );
68 70
69 m_timerLength = 10; 71 m_timerLength = 10;
70 72
71 m_waitTimer = new QTimer( this ); 73 m_waitTimer = new QTimer( this );
72 connect( m_waitTimer, SIGNAL( timeout() ), this, SLOT( hide() ) ); 74 connect( m_waitTimer, SIGNAL( timeout() ), this, SLOT( hide() ) );
73} 75}
74 76
75void OWait::timerEvent( QTimerEvent * ) 77void OWait::timerEvent( QTimerEvent * )
76{ 78{
77 frame = ( ++frame ) % 4; 79 frame = ( ++frame ) % 4;
78 repaint(); 80 repaint();
79} 81}
80 82
81void OWait::paintEvent( QPaintEvent * ) 83void OWait::paintEvent( QPaintEvent * )
82{ 84{
83 QPainter p( m_lb ); 85 QPainter p( m_lb );
84 p.drawPixmap( 0, 0, m_pix, m_aniSize * frame, 0, m_aniSize, m_aniSize ); 86 p.drawPixmap( 0, 0, m_pix, m_aniSize * frame, 0, m_aniSize, m_aniSize );
85} 87}
86 88
87void OWait::show() 89void OWait::show()
88{ 90{
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
@@ -1,86 +1,90 @@
1/* 1/*
2                This file is part of the Opie Project 2                This file is part of the Opie Project
3              Copyright (C) 2003 Maximilian Reiss <harlekin@handhelds.org> 3              Copyright (C) 2003 Maximilian Reiss <harlekin@handhelds.org>
4 =. 4 =.
5 .=l. 5 .=l.
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 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