-rw-r--r-- | libopie2/opieui/olistview.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/libopie2/opieui/olistview.cpp b/libopie2/opieui/olistview.cpp index d7c92fd..0b3bdea 100644 --- a/libopie2/opieui/olistview.cpp +++ b/libopie2/opieui/olistview.cpp | |||
@@ -178,25 +178,25 @@ void OListView::serializeFrom( QDataStream& s ) | |||
178 | odebug << "loading OListView..." << oendl; | 178 | odebug << "loading OListView..." << oendl; |
179 | 179 | ||
180 | int cols; | 180 | int cols; |
181 | s >> cols; | 181 | s >> cols; |
182 | odebug << "read number of columns = " << cols << oendl; | 182 | odebug << "read number of columns = " << cols << oendl; |
183 | 183 | ||
184 | while ( columns() < cols ) addColumn( QString::null ); | 184 | while ( columns() < cols ) addColumn( QString::null ); |
185 | 185 | ||
186 | for ( int i = 0; i < cols; ++i ) | 186 | for ( int i = 0; i < cols; ++i ) |
187 | { | 187 | { |
188 | QString coltext; | 188 | QString coltext; |
189 | s >> coltext; | 189 | s >> coltext; |
190 | qDebug( "read text '%s' for column %d", (const char*) coltext, i ); | 190 | odebug << "read text '" << coltext << "' for column " << i << "" << oendl; |
191 | setColumnText( i, coltext ); | 191 | setColumnText( i, coltext ); |
192 | } | 192 | } |
193 | 193 | ||
194 | int items; | 194 | int items; |
195 | s >> items; | 195 | s >> items; |
196 | odebug << "read number of items = " << items << oendl; | 196 | odebug << "read number of items = " << items << oendl; |
197 | 197 | ||
198 | for ( int i = 0; i < items; ++i ) | 198 | for ( int i = 0; i < items; ++i ) |
199 | { | 199 | { |
200 | OListViewItem* item = childFactory(); | 200 | OListViewItem* item = childFactory(); |
201 | s >> *item; | 201 | s >> *item; |
202 | } | 202 | } |
@@ -433,31 +433,31 @@ void OListViewItem::serializeTo( QDataStream& s ) const | |||
433 | } | 433 | } |
434 | 434 | ||
435 | 435 | ||
436 | void OListViewItem::serializeFrom( QDataStream& s ) | 436 | void OListViewItem::serializeFrom( QDataStream& s ) |
437 | { | 437 | { |
438 | #warning Caution... the binary format is still under construction... | 438 | #warning Caution... the binary format is still under construction... |
439 | odebug << "loading OListViewItem..." << oendl; | 439 | odebug << "loading OListViewItem..." << oendl; |
440 | 440 | ||
441 | for ( int i = 0; i < listView()->columns(); ++i ) | 441 | for ( int i = 0; i < listView()->columns(); ++i ) |
442 | { | 442 | { |
443 | QString coltext; | 443 | QString coltext; |
444 | s >> coltext; | 444 | s >> coltext; |
445 | qDebug( "read text '%s' for column %d", (const char*) coltext, i ); | 445 | odebug << "read text '" << coltext << "' for column " << i << "" << oendl; |
446 | setText( i, coltext ); | 446 | setText( i, coltext ); |
447 | } | 447 | } |
448 | 448 | ||
449 | int items; | 449 | int items; |
450 | s >> items; | 450 | s >> items; |
451 | qDebug( "read number of items = %d", items ); | 451 | odebug << "read number of items = " << items << "" << oendl; |
452 | 452 | ||
453 | for ( int i = 0; i < items; ++i ) | 453 | for ( int i = 0; i < items; ++i ) |
454 | { | 454 | { |
455 | OListViewItem* item = childFactory(); | 455 | OListViewItem* item = childFactory(); |
456 | s >> (*item); | 456 | s >> (*item); |
457 | } | 457 | } |
458 | 458 | ||
459 | odebug << "OListViewItem loaded." << oendl; | 459 | odebug << "OListViewItem loaded." << oendl; |
460 | } | 460 | } |
461 | 461 | ||
462 | 462 | ||
463 | QDataStream& operator<<( QDataStream& s, const OListViewItem& lvi ) | 463 | QDataStream& operator<<( QDataStream& s, const OListViewItem& lvi ) |
@@ -606,25 +606,25 @@ ONamedListView::ONamedListView( QWidget *parent, const char *name ) | |||
606 | } | 606 | } |
607 | 607 | ||
608 | 608 | ||
609 | ONamedListView::~ONamedListView() | 609 | ONamedListView::~ONamedListView() |
610 | { | 610 | { |
611 | } | 611 | } |
612 | 612 | ||
613 | 613 | ||
614 | void ONamedListView::addColumns( const QStringList& columns ) | 614 | void ONamedListView::addColumns( const QStringList& columns ) |
615 | { | 615 | { |
616 | for ( QStringList::ConstIterator it = columns.begin(); it != columns.end(); ++it ) | 616 | for ( QStringList::ConstIterator it = columns.begin(); it != columns.end(); ++it ) |
617 | { | 617 | { |
618 | qDebug( "adding column %s", (const char*) *it ); | 618 | odebug << "adding column " << *it << "" << oendl; |
619 | addColumn( *it ); | 619 | addColumn( *it ); |
620 | } | 620 | } |
621 | } | 621 | } |
622 | 622 | ||
623 | 623 | ||
624 | int ONamedListView::findColumn( const QString& text ) const | 624 | int ONamedListView::findColumn( const QString& text ) const |
625 | { | 625 | { |
626 | //FIXME: If used excessively, this will slow down performance of updates | 626 | //FIXME: If used excessively, this will slow down performance of updates |
627 | //FIXME: because of the linear search over all column texts. | 627 | //FIXME: because of the linear search over all column texts. |
628 | //FIXME: I will optimize later by using a hash map. | 628 | //FIXME: I will optimize later by using a hash map. |
629 | for ( int i = 0; i < columns(); ++i ) | 629 | for ( int i = 0; i < columns(); ++i ) |
630 | if ( columnText( i ) == text ) | 630 | if ( columnText( i ) == text ) |
@@ -635,29 +635,29 @@ int ONamedListView::findColumn( const QString& text ) const | |||
635 | 635 | ||
636 | ONamedListViewItem* ONamedListView::find( int column, const QString& text, int recurse ) const | 636 | ONamedListViewItem* ONamedListView::find( int column, const QString& text, int recurse ) const |
637 | { | 637 | { |
638 | return find( (ONamedListViewItem*) firstChild(), column, text, recurse ); | 638 | return find( (ONamedListViewItem*) firstChild(), column, text, recurse ); |
639 | } | 639 | } |
640 | 640 | ||
641 | 641 | ||
642 | ONamedListViewItem* ONamedListView::find( ONamedListViewItem* item, int column, const QString& text, int recurse ) const | 642 | ONamedListViewItem* ONamedListView::find( ONamedListViewItem* item, int column, const QString& text, int recurse ) const |
643 | { | 643 | { |
644 | ONamedListViewItem* result; | 644 | ONamedListViewItem* result; |
645 | while ( item && item->text( column ) != text ) | 645 | while ( item && item->text( column ) != text ) |
646 | { | 646 | { |
647 | qDebug( "checked %s", (const char*) item->text( column ) ); | 647 | odebug << "checked " << item->text( column ) << "" << oendl; |
648 | 648 | ||
649 | if ( recurse < 0 || recurse > 0 ) | 649 | if ( recurse < 0 || recurse > 0 ) |
650 | { | 650 | { |
651 | qDebug( "recursion is %d - recursing into...", recurse ); | 651 | odebug << "recursion is " << recurse << " - recursing into..." << oendl; |
652 | result = find( (ONamedListViewItem*) item->firstChild(), column, text, recurse-1 ); | 652 | result = find( (ONamedListViewItem*) item->firstChild(), column, text, recurse-1 ); |
653 | if ( result ) return result; | 653 | if ( result ) return result; |
654 | } | 654 | } |
655 | 655 | ||
656 | 656 | ||
657 | item = (ONamedListViewItem*) item->itemBelow(); | 657 | item = (ONamedListViewItem*) item->itemBelow(); |
658 | } | 658 | } |
659 | if ( item && item->text( column ) == text ) | 659 | if ( item && item->text( column ) == text ) |
660 | return item; | 660 | return item; |
661 | else | 661 | else |
662 | return 0; | 662 | return 0; |
663 | } | 663 | } |
@@ -716,41 +716,41 @@ ONamedListViewItem::ONamedListViewItem( QListViewItem* parent, QListViewItem* af | |||
716 | 716 | ||
717 | 717 | ||
718 | ONamedListViewItem::~ONamedListViewItem() | 718 | ONamedListViewItem::~ONamedListViewItem() |
719 | { | 719 | { |
720 | } | 720 | } |
721 | 721 | ||
722 | 722 | ||
723 | void ONamedListViewItem::setText( const QStringList& texts ) | 723 | void ONamedListViewItem::setText( const QStringList& texts ) |
724 | { | 724 | { |
725 | int col = 0; | 725 | int col = 0; |
726 | for ( QStringList::ConstIterator it = texts.begin(); it != texts.end(); ++it ) | 726 | for ( QStringList::ConstIterator it = texts.begin(); it != texts.end(); ++it ) |
727 | { | 727 | { |
728 | qDebug( "setting column %d = text %s", col, (const char*) *it ); | 728 | odebug << "setting column " << col << " = text " << *it << "" << oendl; |
729 | OListViewItem::setText( col++, *it ); | 729 | OListViewItem::setText( col++, *it ); |
730 | } | 730 | } |
731 | 731 | ||
732 | } | 732 | } |
733 | 733 | ||
734 | 734 | ||
735 | void ONamedListViewItem::setText( const QString& column, const QString& text ) | 735 | void ONamedListViewItem::setText( const QString& column, const QString& text ) |
736 | { | 736 | { |
737 | //FIXME: If used excessively, this will slow down performance of updates | 737 | //FIXME: If used excessively, this will slow down performance of updates |
738 | //FIXME: because of the linear search over all column texts. | 738 | //FIXME: because of the linear search over all column texts. |
739 | //FIXME: I will optimize later by using a hash map. | 739 | //FIXME: I will optimize later by using a hash map. |
740 | int col = ( (ONamedListView*) listView() )->findColumn( column ); | 740 | int col = ( (ONamedListView*) listView() )->findColumn( column ); |
741 | if ( col != -1 ) | 741 | if ( col != -1 ) |
742 | OListViewItem::setText( col, text ); | 742 | OListViewItem::setText( col, text ); |
743 | else | 743 | else |
744 | qWarning( "ONamedListViewItem::setText(): Warning! Columntext '%s' not found.", (const char*) column ); | 744 | owarn << "ONamedListViewItem::setText(): Warning! Columntext '" << column << "' not found." << oendl; |
745 | } | 745 | } |
746 | 746 | ||
747 | 747 | ||
748 | ONamedListViewItem* ONamedListViewItem::find( int column, const QString& text, int recurse ) const | 748 | ONamedListViewItem* ONamedListViewItem::find( int column, const QString& text, int recurse ) const |
749 | { | 749 | { |
750 | return ( (ONamedListView*) listView() )->find( (ONamedListViewItem*) firstChild(), column, text, recurse ); | 750 | return ( (ONamedListView*) listView() )->find( (ONamedListViewItem*) firstChild(), column, text, recurse ); |
751 | } | 751 | } |
752 | 752 | ||
753 | 753 | ||
754 | ONamedListViewItem* ONamedListViewItem::find( const QString& column, const QString& text, int recurse ) const | 754 | ONamedListViewItem* ONamedListViewItem::find( const QString& column, const QString& text, int recurse ) const |
755 | { | 755 | { |
756 | int col = ( (ONamedListView*) listView() )->findColumn( column ); | 756 | int col = ( (ONamedListView*) listView() )->findColumn( column ); |