00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
#ifndef _KMAIL_IDENTITYMANAGER_H_
00032
#define _KMAIL_IDENTITYMANAGER_H_
00033
00034
#include "configmanager.h"
00035
00036
#include <qvaluelist.h>
00037
00038
class KMKernel;
00039
class QStringList;
00040
class KMIdentity;
00041
00046 class IdentityManager :
public ConfigManager {
00047 Q_OBJECT
00048
#ifndef KMAIL_TESTING
00049
protected:
00050
friend class KMKernel;
00051
#else
00052
public:
00053
#endif // KMAIL_TESTING
00054
00055
IdentityManager( QObject * parent=0,
const char * name=0 );
00056
virtual ~
IdentityManager();
00057
00058
public:
00059
typedef QValueList<KMIdentity>::Iterator Iterator;
00060
typedef QValueList<KMIdentity>::ConstIterator ConstIterator;
00061
00063
void commit();
00065
void rollback();
00066
00068
bool hasPendingChanges()
const;
00069
00071 QStringList
identities()
const;
00072
00078 QStringList
shadowIdentities()
const;
00079
00084
void sort();
00085
00089
const KMIdentity &
identityForAddress(
const QString & addresses )
const;
00090
00095
bool thatIsMe(
const QString & addressList )
const;
00096
00101
const KMIdentity &
identityForName(
const QString & identityName )
const;
00102
00106
const KMIdentity &
identityForUoid( uint uoid )
const;
00107
00114
const KMIdentity &
identityForNameOrDefault(
const QString & identityName )
const;
00115
00121
const KMIdentity &
identityForUoidOrDefault( uint uoid )
const;
00122
00124
const KMIdentity &
defaultIdentity()
const;
00125
00132
bool setAsDefault(
const QString & identityName );
00133
00140
bool setAsDefault( uint uoid );
00141
00146
KMIdentity & identityForName(
const QString & identityName );
00147
00152
KMIdentity & identityForUoid( uint uoid );
00153
00155
bool removeIdentity(
const QString & identityName );
00156
00157 ConstIterator begin()
const;
00158 ConstIterator end()
const;
00159 Iterator begin();
00160 Iterator end();
00161
00162
KMIdentity & newFromScratch(
const QString & name );
00163
KMIdentity & newFromControlCenter(
const QString & name );
00164
KMIdentity & newFromExisting(
const KMIdentity & other,
00165
const QString & name=QString::null );
00166
00167 signals:
00172
void changed( uint uoid );
00176
void changed(
const KMIdentity & ident );
00180
void deleted( uint uoid );
00182
void added(
const KMIdentity & ident );
00183
00184
protected:
00186 QValueList<KMIdentity>
mIdentities;
00188 QValueList<KMIdentity>
mShadowIdentities;
00189
00190
private:
00191
void writeConfig() const;
00192
void readConfig();
00193 QStringList groupList() const;
00194
void createDefaultIdentity();
00195
00196
00197
int newUoid();
00198 };
00199
00200 #endif