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

List:       kde-pim
Subject:    Re: [Kde-pim] Kontact 3.4
From:       Lutz Rogowski <Lutz () Rogowski ! info>
Date:       2005-03-30 10:19:29
Message-ID: 424A7D31.3080009 () Rogowski ! info
[Download RAW message or body]

Reinhold Kainhofer wrote:
> Am Mittwoch, 30. März 2005 01:40 schrieb Dave Smith:
> 
>>Basically, the order in which the contacts are presented seems to be almost
>>random. They are certainly not in alphabetical order and I can't at the
>>moment see any consistency.
> 
> 
> I guess you are using the card view? I can confirm this with CVS from a few 
> days ago. I told Tobias twice ages ago, but he keeps insisting that the cards 
> are sorted by the display name, which is just not true... (Tobias, I can send 
> you a screenshot in private. If you're able to explain the sorting of these 
> cards, I owe you a beer ;-)  )
> 
> Large chunks seem to be in alphabetical order, but then lots of cards are not. 
> E.g. its about a quarter of the cards (from a to z) in alphabetical order, 
> then some cards randomly, then again ten or fifteen cards alphabetically 
> (spanning almost the whole a-z range), etc.
> 
> Cheers,
> Reinhold
> 

I verified that I have the same problem and I had just a quick look at the code.

May I guess that all items are sorted properly if they have expicitely the 
"formatted name" set?

In kaddressbookcardview.cpp we have:

class AddresseeCardViewItem : public CardViewItem
{
   public:
     AddresseeCardViewItem(const KABC::Field::List &fields,
                           bool showEmptyFields,
                           KABC::AddressBook *doc, const KABC::Addressee &a,
                           CardView *parent)
       : CardViewItem(parent, a.formattedName()), //<- AAAAAAAAAA
         mFields( fields ), mShowEmptyFields(showEmptyFields),
         mDocument(doc), mAddressee(a)
       {
           if ( mFields.isEmpty() ) {
             mFields = KABC::Field::defaultFields();
           }
           refresh();
       }

     const KABC::Addressee &addressee() const { return mAddressee; }

     void refresh()
     {
         // Update our addressee, since it may have changed elsewhere
         mAddressee = mDocument->findByUid(mAddressee.uid());

         if (!mAddressee.isEmpty())
         {
           clearFields();

           // Try all the selected fields until we find one with text.
           // This will limit the number of unlabeled icons in the view
           KABC::Field::List::ConstIterator iter;
           for (iter = mFields.begin(); iter != mFields.end(); ++iter)
           {
             // insert empty fields or not? not doing so saves a bit of memory 
and CPU
             // (during geometry calculations), but prevents having equally
             // wide label columns in all cards, unless CardViewItem/CardView search
             // globally for the widest label. (anders)
             //if (mShowEmptyFields || !(*iter)->value( mAddressee ).isEmpty())
               insertField((*iter)->label(), (*iter)->value( mAddressee ));
           }

           // We might want to make this the first field. hmm... -mpilone
           setCaption( mAddressee.realName() ); // <- BBBBBBBBBBBBBB
         }
     }


AAAAAAAAAA:
An Item is created with  a.formattedName().
Then it is put in the list, sorting after the formattedName().

BBBBBBBBBBBBBB:
Later the empty caption is set to some value.

Changing AAAAAAAAAAA: to
  : CardViewItem(parent, a.realName())

fixes the sorting problem for me.

Tobias, can you fix this?

Lutz


-- 
Lutz@Rogowski.info
Phone / Fax: +49 700 ROGOWSKI
Mobile Phone: +49 17 ROGOWSKI

_______________________________________________
kde-pim mailing list
kde-pim@kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
kde-pim home page at http://pim.kde.org/

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

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