[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdepim/kaddressbook/views
From:       Tobias Koenig <tokoe () kde ! org>
Date:       2003-06-11 23:48:20
[Download RAW message or body]

CVS commit by tokoe: 

Use the new sortKey() method from KABC::Field... that makes the code
look a lot better.
Thanks to Cornelius for this hint :)


  M +5 -20     contactlistview.cpp   1.4
  M +0 -1      contactlistview.h   1.3


--- kdepim/kaddressbook/views/contactlistview.cpp  #1.3:1.4
@@ -152,15 +152,6 @@ ContactListViewItem::ContactListViewItem
                                          const KABC::Field::List &fields )
   : KListViewItem(parent), mAddressee(a), mFields( fields ),
-    parentListView( parent ), mDocument(doc), mBirthdayColumn( -1 )
+    parentListView( parent ), mDocument(doc)
 {
-  int counter = 0;
-  KABC::Field::List::ConstIterator it;
-  for ( it = fields.begin(); it != fields.end(); ++it, ++counter ) {
-    if ( (*it)->label() == KABC::Addressee::birthdayLabel() ) {
-      mBirthdayColumn = counter;
-      break;
-    }
-  }
-
   refresh();
 }
@@ -168,15 +159,9 @@ ContactListViewItem::ContactListViewItem
 QString ContactListViewItem::key(int column, bool ascending) const
 {
-  if ( mBirthdayColumn != -1 && mBirthdayColumn == column ) {
-    QDate date = mAddressee.birthday().date();
-    if ( !date.isValid() )
-      return QString( "00-00" );
-
-    QString key;
-    key.sprintf( "%02d-%02d", date.month(), date.day() );
-    return key;
-  }
-
+#if KDE_VERSION >= 319
+  return mFields[ column ]->sortKey( mAddressee );
+#else
   return QListViewItem::key( column, ascending ).lower();
+#endif
 }
 

--- kdepim/kaddressbook/views/contactlistview.h  #1.2:1.3
@@ -51,5 +51,4 @@ private:
   ContactListView *parentListView;
   KABC::AddressBook *mDocument;
-  int mBirthdayColumn;
 };
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic