[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Re: KMail
From: Alexey Arzamasov <AArzamasov () kkb ! kz>
Date: 2003-08-07 12:10:44
[Download RAW message or body]
On Wednesday 06 August 2003 22:59, Dr Tony Young wrote:
> Is is possible to produce and retain an alphabetical sort of the email
> Address list that appears in the small pop-up window which opens when you
> press the ".." button at the end of the To: line on the main email form ?
yes, i think so. Here the patch against KMail I just made.
People, I'm totally new to this list and to KDE development too :)
So, I just get this issue as example to learn KDE and QT development.
Writing the patch, I read the manuals on every QT class and methods I use :)
So, the main thing I worried about writing the patch is too learn and check if
I on the right way. Please, comment. Comment everything that you want - code
style, efficitives of QT classes uses etc.
Thanx
--
Arzamasov Alexey
AArzamasov <at> kkb.kz
["kmail-sortaddrbook-patch" (text/x-diff)]
diff ./old/kmaddrbookdlg.cpp ./new/kmaddrbookdlg.cpp
80a81
> QStringList list;
85c86
< mListBox->insertStringList(addresses);
---
> list += addresses;
87d87
< mListBox->sort();
90c90,93
< mListBox->insertStringList( KMRecentAddresses::self()->addresses(), 0 );
---
> list += KMRecentAddresses::self()->addresses();
>
> list = sortEmailList(list);
> mListBox->insertStringList(list , 0 );
118a122,153
> }
>
>
> //-----------------------------------------------------------------------------
> QString KMAddrBookSelDlg::clearEMail(QString email)
> {
> QRegExp rx ("\"(.*)\"");
> if (rx.search(email) >= 0) email = rx.cap(1);
>
> QRegExp rx1("<(.*)>");
> if (rx1.search(email) >= 0) email = rx1.cap(1);
>
> email = email.upper();
> return email;
> }
>
> QStringList KMAddrBookSelDlg::sortEmailList(QStringList list)
> {
> QStringList result;
>
> typedef QMap<QString, QString> EMailMap;
> EMailMap emap;
> for (unsigned long i = 0; i < list.count(); i++) {
> emap[clearEMail( list[ i ] )] = list[i];
> }
>
> EMailMap::Iterator it;
> for (it = emap.begin(); it != emap.end(); ++it){
> result.append(it.data());
> }
>
> return result;
diff ./old/kmaddrbookdlg.h ./new/kmaddrbookdlg.h
44a45,46
> QString KMAddrBookSelDlg::clearEMail(QString email);
> QStringList KMAddrBookSelDlg::sortEmailList(QStringList list);
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic