From 67d7f0b0fc79377fba216e556785f6c630c437ad Mon Sep 17 00:00:00 2001 From: alwin Date: Thu, 25 Dec 2003 15:13:40 +0000 Subject: uses the opie frontend for the list of addresses displays not just the default email but all emails display is sorted now --- diff --git a/noncore/net/mail/addresspicker.cpp b/noncore/net/mail/addresspicker.cpp index 2c15bb4..581de62 100644 --- a/noncore/net/mail/addresspicker.cpp +++ b/noncore/net/mail/addresspicker.cpp @@ -5,6 +5,9 @@ #include #include +#include +#include + #include @@ -13,81 +16,47 @@ AddressPicker::AddressPicker( QWidget *parent, const char *name, bool modal, WFlags flags ) : AddressPickerUI( parent, name, modal, flags ) { - okButton->setIconSet( Resource::loadPixmap( "enter" ) ); - cancelButton->setIconSet( Resource::loadPixmap( "editdelete" ) ); - - connect(okButton, SIGNAL(clicked()), SLOT(accept())); - connect(cancelButton, SIGNAL(clicked()), SLOT(close())); + okButton->setIconSet( Resource::loadPixmap( "enter" ) ); + cancelButton->setIconSet( Resource::loadPixmap( "editdelete" ) ); - QFile f((QString) getenv("HOME") + "/Applications/" - + "addressbook/addressbook.xml"); + connect(okButton, SIGNAL(clicked()), SLOT(accept())); + connect(cancelButton, SIGNAL(clicked()), SLOT(close())); + OContactAccess::List::Iterator it; - if ( f.open( IO_ReadOnly ) ) { - QTextStream stream( &f ); - stream.setEncoding( QTextStream::UnicodeUTF8 ); - QString content; - while ( !f.atEnd() ) { - content += stream.readLine() + "\n"; + QString lineEmail, lineName, contactLine; + /* what name has to set here???? */ + OContactAccess m_contactdb("addressbook"); + QStringList mails; + QString pre,suf; + OContactAccess::List m_list = m_contactdb.sorted( true, 0, 0, 0 ); + for ( it = m_list.begin(); it != m_list.end(); ++it ) { + if ((*it).defaultEmail().length()!=0) { + mails = (*it).emailList(); + if ((*it).fileAs().length()>0) { + pre = "\""+(*it).fileAs()+"\" <"; + suf = ">"; + } else { + pre = ""; + suf = ""; + } + QStringList::ConstIterator sit = mails.begin(); + for (;sit!=mails.end();++sit) { + contactLine=pre+(*sit)+suf; + addressList->insertItem(contactLine); + } } - QStringList lines = QStringList::split( QRegExp( "\\n" ), content ); - QStringList::Iterator it; - for ( it = lines.begin(); it != lines.end(); it++ ) { - if ( (*it).find( QRegExp( "^"); - } - if ( !email.isEmpty() ) { - addressList->insertItem( tname + temail ); - } - } - } - } + } if ( addressList->count() <= 0 ) { +#if 0 + // makes this realy sense?? addressList->insertItem( tr( "There are no entries in the addressbook." ) ); +#endif addressList->setEnabled( false ); okButton->setEnabled( false ); - } + } else { +// addressList->sort(); + } } void AddressPicker::accept() -- cgit v0.9.0.2