00001 /********************************************************************** 00002 ** Copyright (C) 2001 Trolltech AS. All rights reserved. 00003 ** 00004 ** This file is part of Qt Palmtop Environment. 00005 ** 00006 ** This file may be distributed and/or modified under the terms of the 00007 ** GNU General Public License version 2 as published by the Free Software 00008 ** Foundation and appearing in the file LICENSE.GPL included in the 00009 ** packaging of this file. 00010 ** 00011 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 00012 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 00013 ** 00014 ** See http://www.trolltech.com/gpl/ for GPL licensing information. 00015 ** 00016 ** Contact info@trolltech.com if any conditions of this licensing are 00017 ** not clear to you. 00018 ** 00019 **********************************************************************/ 00020 #ifndef ADDRESSLIST_H 00021 #define ADDRESSLIST_H 00022 00023 #include <qobject.h> 00024 #include <qlist.h> 00025 00026 struct AContact 00027 { 00028 QString email; 00029 QString name; 00030 }; 00031 00032 class AddressList : public QObject 00033 { 00034 Q_OBJECT 00035 00036 public: 00037 AddressList(); 00038 ~AddressList(); 00039 void addContact(const QString &email, const QString &name); 00040 bool containsEmail(const QString &email); 00041 bool containsName(const QString &name); 00042 QString getNameByEmail(const QString &email); 00043 QString getEmailByName(const QString &name); 00044 QList<AContact>* getContactList(); 00045 00046 private: 00047 int getEmailRef(const QString &email); 00048 int getNameRef(const QString &name); 00049 QString getRightString(const QString &in); 00050 void read(); 00051 00052 private: 00053 QList<AContact> addresses; 00054 QString filename; 00055 bool dirty; 00056 }; 00057 00058 #endif
1.4.2