-rw-r--r-- | libopie2/opieui/olistview.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/libopie2/opieui/olistview.cpp b/libopie2/opieui/olistview.cpp index ec503dd..38f3fe2 100644 --- a/libopie2/opieui/olistview.cpp +++ b/libopie2/opieui/olistview.cpp | |||
@@ -1,16 +1,15 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | 3 | =. (C) 2003 Michael 'Mickey' Lauer <mickey@Vanille.de> | |
4 | =. (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> | ||
5 | .=l. | 4 | .=l. |
6 | .>+-= | 5 | .>+-= |
7 | _;:, .> :=|. This program is free software; you can | 6 | _;:, .> :=|. This program is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 7 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 8 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 9 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 10 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | ._= =} : or (at your option) any later version. | 11 | ._= =} : or (at your option) any later version. |
13 | .%`+i> _;_. | 12 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This program is distributed in the hope that | 13 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 15 | : .. .:, . . . without even the implied warranty of |
@@ -28,24 +27,25 @@ | |||
28 | 27 | ||
29 | */ | 28 | */ |
30 | 29 | ||
31 | /* QT */ | 30 | /* QT */ |
32 | 31 | ||
33 | #include <qcolor.h> | 32 | #include <qcolor.h> |
34 | #include <qheader.h> | 33 | #include <qheader.h> |
35 | #include <qpainter.h> | 34 | #include <qpainter.h> |
36 | #include <qpixmap.h> | 35 | #include <qpixmap.h> |
37 | 36 | ||
38 | /* OPIE */ | 37 | /* OPIE */ |
39 | 38 | ||
39 | #include <opie2/odebug.h> | ||
40 | #include <opie2/olistview.h> | 40 | #include <opie2/olistview.h> |
41 | 41 | ||
42 | /*====================================================================================== | 42 | /*====================================================================================== |
43 | * OListView | 43 | * OListView |
44 | *======================================================================================*/ | 44 | *======================================================================================*/ |
45 | 45 | ||
46 | OListView::OListView( QWidget *parent, const char *name ) | 46 | OListView::OListView( QWidget *parent, const char *name ) |
47 | :QListView( parent, name ) | 47 | :QListView( parent, name ) |
48 | { | 48 | { |
49 | //FIXME: get from global settings and calculate ==> see oglobalsettings.* | 49 | //FIXME: get from global settings and calculate ==> see oglobalsettings.* |
50 | 50 | ||
51 | m_alternateBackground = QColor( 238, 246, 255 ); | 51 | m_alternateBackground = QColor( 238, 246, 255 ); |
@@ -133,56 +133,56 @@ void OListView::expand(QListViewItem *item) | |||
133 | ((OListViewItem*)item)->expand(); | 133 | ((OListViewItem*)item)->expand(); |
134 | } | 134 | } |
135 | 135 | ||
136 | OListViewItem* OListView::childFactory() | 136 | OListViewItem* OListView::childFactory() |
137 | { | 137 | { |
138 | return new OListViewItem( this ); | 138 | return new OListViewItem( this ); |
139 | } | 139 | } |
140 | 140 | ||
141 | #ifndef QT_NO_DATASTREAM | 141 | #ifndef QT_NO_DATASTREAM |
142 | void OListView::serializeTo( QDataStream& s ) const | 142 | void OListView::serializeTo( QDataStream& s ) const |
143 | { | 143 | { |
144 | #warning Caution... the binary format is still under construction... | 144 | #warning Caution... the binary format is still under construction... |
145 | qDebug( "storing OListView..." ); | 145 | odebug << "storing OListView..." << oendl; |
146 | 146 | ||
147 | // store number of columns and the labels | 147 | // store number of columns and the labels |
148 | s << columns(); | 148 | s << columns(); |
149 | for ( int i = 0; i < columns(); ++i ) | 149 | for ( int i = 0; i < columns(); ++i ) |
150 | s << columnText( i ); | 150 | s << columnText( i ); |
151 | 151 | ||
152 | // calculate the number of top-level items to serialize | 152 | // calculate the number of top-level items to serialize |
153 | int items = 0; | 153 | int items = 0; |
154 | QListViewItem* item = firstChild(); | 154 | QListViewItem* item = firstChild(); |
155 | while ( item ) | 155 | while ( item ) |
156 | { | 156 | { |
157 | item = item->nextSibling(); | 157 | item = item->nextSibling(); |
158 | items++; | 158 | items++; |
159 | } | 159 | } |
160 | 160 | ||
161 | // store number of items and the items itself | 161 | // store number of items and the items itself |
162 | s << items; | 162 | s << items; |
163 | item = firstChild(); | 163 | item = firstChild(); |
164 | for ( int i = 0; i < items; ++i ) | 164 | for ( int i = 0; i < items; ++i ) |
165 | { | 165 | { |
166 | s << *static_cast<OListViewItem*>( item ); | 166 | s << *static_cast<OListViewItem*>( item ); |
167 | item = item->nextSibling(); | 167 | item = item->nextSibling(); |
168 | } | 168 | } |
169 | 169 | ||
170 | qDebug( "OListview stored." ); | 170 | odebug << "OListview stored." << oendl; |
171 | } | 171 | } |
172 | 172 | ||
173 | void OListView::serializeFrom( QDataStream& s ) | 173 | void OListView::serializeFrom( QDataStream& s ) |
174 | { | 174 | { |
175 | #warning Caution... the binary format is still under construction... | 175 | #warning Caution... the binary format is still under construction... |
176 | qDebug( "loading OListView..." ); | 176 | odebug << "loading OListView..." << oendl; |
177 | 177 | ||
178 | int cols; | 178 | int cols; |
179 | s >> cols; | 179 | s >> cols; |
180 | qDebug( "read number of columns = %d", cols ); | 180 | qDebug( "read number of columns = %d", cols ); |
181 | 181 | ||
182 | while ( columns() < cols ) addColumn( QString::null ); | 182 | while ( columns() < cols ) addColumn( QString::null ); |
183 | 183 | ||
184 | for ( int i = 0; i < cols; ++i ) | 184 | for ( int i = 0; i < cols; ++i ) |
185 | { | 185 | { |
186 | QString coltext; | 186 | QString coltext; |
187 | s >> coltext; | 187 | s >> coltext; |
188 | qDebug( "read text '%s' for column %d", (const char*) coltext, i ); | 188 | qDebug( "read text '%s' for column %d", (const char*) coltext, i ); |
@@ -190,25 +190,25 @@ void OListView::serializeFrom( QDataStream& s ) | |||
190 | } | 190 | } |
191 | 191 | ||
192 | int items; | 192 | int items; |
193 | s >> items; | 193 | s >> items; |
194 | qDebug( "read number of items = %d", items ); | 194 | qDebug( "read number of items = %d", items ); |
195 | 195 | ||
196 | for ( int i = 0; i < items; ++i ) | 196 | for ( int i = 0; i < items; ++i ) |
197 | { | 197 | { |
198 | OListViewItem* item = childFactory(); | 198 | OListViewItem* item = childFactory(); |
199 | s >> *item; | 199 | s >> *item; |
200 | } | 200 | } |
201 | 201 | ||
202 | qDebug( "OListView loaded." ); | 202 | odebug << "OListView loaded." << oendl; |
203 | 203 | ||
204 | } | 204 | } |
205 | 205 | ||
206 | QDataStream& operator<<( QDataStream& s, const OListView& lv ) | 206 | QDataStream& operator<<( QDataStream& s, const OListView& lv ) |
207 | { | 207 | { |
208 | lv.serializeTo( s ); | 208 | lv.serializeTo( s ); |
209 | } | 209 | } |
210 | 210 | ||
211 | QDataStream& operator>>( QDataStream& s, OListView& lv ) | 211 | QDataStream& operator>>( QDataStream& s, OListView& lv ) |
212 | { | 212 | { |
213 | lv.serializeFrom( s ); | 213 | lv.serializeFrom( s ); |
214 | } | 214 | } |
@@ -368,25 +368,25 @@ void OListViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, in | |||
368 | 368 | ||
369 | 369 | ||
370 | OListViewItem* OListViewItem::childFactory() | 370 | OListViewItem* OListViewItem::childFactory() |
371 | { | 371 | { |
372 | return new OListViewItem( this ); | 372 | return new OListViewItem( this ); |
373 | } | 373 | } |
374 | 374 | ||
375 | 375 | ||
376 | #ifndef QT_NO_DATASTREAM | 376 | #ifndef QT_NO_DATASTREAM |
377 | void OListViewItem::serializeTo( QDataStream& s ) const | 377 | void OListViewItem::serializeTo( QDataStream& s ) const |
378 | { | 378 | { |
379 | #warning Caution... the binary format is still under construction... | 379 | #warning Caution... the binary format is still under construction... |
380 | qDebug( "storing OListViewItem..." ); | 380 | odebug << "storing OListViewItem..." << oendl; |
381 | 381 | ||
382 | // store item text | 382 | // store item text |
383 | for ( int i = 0; i < listView()->columns(); ++i ) | 383 | for ( int i = 0; i < listView()->columns(); ++i ) |
384 | { | 384 | { |
385 | s << text( i ); | 385 | s << text( i ); |
386 | } | 386 | } |
387 | 387 | ||
388 | // calculate the number of children to serialize | 388 | // calculate the number of children to serialize |
389 | int items = 0; | 389 | int items = 0; |
390 | QListViewItem* item = firstChild(); | 390 | QListViewItem* item = firstChild(); |
391 | while ( item ) | 391 | while ( item ) |
392 | { | 392 | { |
@@ -394,52 +394,52 @@ void OListViewItem::serializeTo( QDataStream& s ) const | |||
394 | items++; | 394 | items++; |
395 | } | 395 | } |
396 | 396 | ||
397 | // store number of items and the items itself | 397 | // store number of items and the items itself |
398 | s << items; | 398 | s << items; |
399 | item = firstChild(); | 399 | item = firstChild(); |
400 | for ( int i = 0; i < items; ++i ) | 400 | for ( int i = 0; i < items; ++i ) |
401 | { | 401 | { |
402 | s << *static_cast<OListViewItem*>( item ); | 402 | s << *static_cast<OListViewItem*>( item ); |
403 | item = item->nextSibling(); | 403 | item = item->nextSibling(); |
404 | } | 404 | } |
405 | 405 | ||
406 | qDebug( "OListviewItem stored." ); | 406 | odebug << "OListviewItem stored." << oendl; |
407 | } | 407 | } |
408 | 408 | ||
409 | 409 | ||
410 | void OListViewItem::serializeFrom( QDataStream& s ) | 410 | void OListViewItem::serializeFrom( QDataStream& s ) |
411 | { | 411 | { |
412 | #warning Caution... the binary format is still under construction... | 412 | #warning Caution... the binary format is still under construction... |
413 | qDebug( "loading OListViewItem..." ); | 413 | odebug << "loading OListViewItem..." << oendl; |
414 | 414 | ||
415 | for ( int i = 0; i < listView()->columns(); ++i ) | 415 | for ( int i = 0; i < listView()->columns(); ++i ) |
416 | { | 416 | { |
417 | QString coltext; | 417 | QString coltext; |
418 | s >> coltext; | 418 | s >> coltext; |
419 | qDebug( "read text '%s' for column %d", (const char*) coltext, i ); | 419 | qDebug( "read text '%s' for column %d", (const char*) coltext, i ); |
420 | setText( i, coltext ); | 420 | setText( i, coltext ); |
421 | } | 421 | } |
422 | 422 | ||
423 | int items; | 423 | int items; |
424 | s >> items; | 424 | s >> items; |
425 | qDebug( "read number of items = %d", items ); | 425 | qDebug( "read number of items = %d", items ); |
426 | 426 | ||
427 | for ( int i = 0; i < items; ++i ) | 427 | for ( int i = 0; i < items; ++i ) |
428 | { | 428 | { |
429 | OListViewItem* item = childFactory(); | 429 | OListViewItem* item = childFactory(); |
430 | s >> (*item); | 430 | s >> (*item); |
431 | } | 431 | } |
432 | 432 | ||
433 | qDebug( "OListViewItem loaded." ); | 433 | odebug << "OListViewItem loaded." << oendl; |
434 | } | 434 | } |
435 | 435 | ||
436 | 436 | ||
437 | QDataStream& operator<<( QDataStream& s, const OListViewItem& lvi ) | 437 | QDataStream& operator<<( QDataStream& s, const OListViewItem& lvi ) |
438 | { | 438 | { |
439 | lvi.serializeTo( s ); | 439 | lvi.serializeTo( s ); |
440 | } | 440 | } |
441 | 441 | ||
442 | 442 | ||
443 | QDataStream& operator>>( QDataStream& s, OListViewItem& lvi ) | 443 | QDataStream& operator>>( QDataStream& s, OListViewItem& lvi ) |
444 | { | 444 | { |
445 | lvi.serializeFrom( s ); | 445 | lvi.serializeFrom( s ); |