Diffstat (limited to 'noncore/unsupported/mailit/addresslist.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/unsupported/mailit/addresslist.cpp | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/noncore/unsupported/mailit/addresslist.cpp b/noncore/unsupported/mailit/addresslist.cpp index 1cf2562..43e3830 100644 --- a/noncore/unsupported/mailit/addresslist.cpp +++ b/noncore/unsupported/mailit/addresslist.cpp @@ -10,24 +10,26 @@ ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #include <qfile.h> #include <qtextstream.h> +#include <opie/ocontactaccess.h> +#include <opie/ocontact.h> #include "addresslist.h" AddressList::AddressList(QString file) { addresses.setAutoDelete(TRUE); filename = file; read(); dirty = FALSE; } AddressList::~AddressList() @@ -107,43 +109,55 @@ int AddressList::getNameRef(QString name) pos++; } return -1; } QList<Contact>* AddressList::getContactList() { return &addresses; } void AddressList::read() { - QFile f(filename); + OContactAccess::List::Iterator it; + + //QFile f(filename); QString lineEmail, lineName, email, name; + OContactAccess m_contactdb("mailit"); + OContactAccess::List m_list = m_contactdb.sorted( true, 0, 0, 0 ); + //OContact* oc; + + for ( it = m_list.begin(); it != m_list.end(); ++it ) + { + //oc=(OContact*) it; + if ((*it).defaultEmail().length()!=0) + addContact((*it).defaultEmail(),(*it).fullName()); + } - if (! f.open(IO_ReadOnly) ) + /*if (! f.open(IO_ReadOnly) ) return; QTextStream stream(&f); while (! stream.atEnd() ) { lineEmail = stream.readLine(); if (! stream.atEnd() ) lineName = stream.readLine(); else return; email = getRightString(lineEmail); name = getRightString(lineName); addContact(email, name); } - f.close(); + f.close();*/ } QString AddressList::getRightString(QString in) { QString out = ""; int pos = in.find('='); if (pos != -1) { out = in.mid(pos+1).stripWhiteSpace(); } return out; } |