kpimidentities
identitymanager.h
00001 /* 00002 Copyright (c) 2002 Marc Mutz <mutz@kde.org> 00003 00004 This library is free software; you can redistribute it and/or modify it 00005 under the terms of the GNU Library General Public License as published by 00006 the Free Software Foundation; either version 2 of the License, or (at your 00007 option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, but WITHOUT 00010 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00011 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 00012 License for more details. 00013 00014 You should have received a copy of the GNU Library General Public License 00015 along with this library; see the file COPYING.LIB. If not, write to the 00016 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00017 02110-1301, USA. 00018 */ 00019 00020 #ifndef KPIMIDENTITIES_IDENTITYMANAGER_H 00021 #define KPIMIDENTITIES_IDENTITYMANAGER_H 00022 00023 #include <kpimidentities/kpimidentities_export.h> 00024 #include <kconfiggroup.h> 00025 #include <QtCore/QObject> 00026 00027 class KConfigBase; 00028 class KConfig; 00029 class QStringList; 00030 00031 namespace KPIMIdentities 00032 { 00033 00034 class Identity; 00039 class KPIMIDENTITIES_EXPORT IdentityManager : public QObject 00040 { 00041 Q_OBJECT 00042 public: 00051 explicit IdentityManager( bool readonly = false, QObject *parent=0, 00052 const char *name=0 ); 00053 virtual ~IdentityManager(); 00054 00055 public: 00056 typedef QList<Identity>::Iterator Iterator; 00057 typedef QList<Identity>::ConstIterator ConstIterator; 00058 00062 typedef Iterator iterator; 00063 00067 typedef ConstIterator const_iterator; 00068 00070 QString makeUnique( const QString &name ) const; 00071 00073 bool isUnique( const QString &name ) const; 00074 00076 void commit(); 00077 00079 void rollback(); 00080 00082 bool hasPendingChanges() const; 00083 00085 QStringList identities() const; 00086 00092 QStringList shadowIdentities() const; 00093 00098 void sort(); 00099 00103 const Identity &identityForAddress( const QString &addresses ) const; 00104 00109 bool thatIsMe( const QString &addressList ) const; 00110 00114 const Identity &identityForUoid( uint uoid ) const; 00115 00121 const Identity &identityForUoidOrDefault( uint uoid ) const; 00122 00124 const Identity &defaultIdentity() const; 00125 00132 bool setAsDefault( uint uoid ); 00133 00138 Identity &modifyIdentityForName( const QString &identityName ); 00139 00144 Identity &modifyIdentityForUoid( uint uoid ); 00145 00150 bool removeIdentity( const QString &identityName ); 00151 00161 bool removeIdentityForced( const QString &identityName ); 00162 00163 ConstIterator begin() const; 00164 ConstIterator end() const; 00167 Iterator modifyBegin(); 00168 Iterator modifyEnd(); 00169 00170 Identity &newFromScratch( const QString &name ); 00171 Identity &newFromControlCenter( const QString &name ); 00172 Identity &newFromExisting( const Identity &other, 00173 const QString &name=QString() ); 00174 00177 QStringList allEmails() const; 00178 00179 Q_SIGNALS: 00181 void changed(); 00186 void changed( uint uoid ); 00190 void changed( const KPIMIdentities::Identity &ident ); 00194 void deleted( uint uoid ); 00196 void added( const KPIMIdentities::Identity &ident ); 00197 00198 protected: 00205 virtual void createDefaultIdentity( QString&/*fullName*/, 00206 QString&/*emailAddress*/ ) {} 00207 00208 protected Q_SLOTS: 00209 void slotRollback(); 00210 00211 protected: 00213 QList<Identity> mIdentities; 00215 QList<Identity> mShadowIdentities; 00216 00217 Q_SIGNALS: 00218 void identitiesChanged( const QString &id ); 00219 00220 private Q_SLOTS: 00221 // Connected to the DBus signal 00222 void slotIdentitiesChanged( const QString &id ); 00223 00224 private: 00225 void writeConfig() const; 00226 void readConfig( KConfig *config ); 00227 QStringList groupList( KConfig *config ) const; 00228 void createDefaultIdentity(); 00229 00230 // returns a new Unique Object Identifier 00231 int newUoid(); 00232 00233 private: 00234 KConfig *mConfig; 00235 bool mReadOnly; 00236 }; 00237 00238 } // namespace 00239 00240 #endif // _KMAIL_IDENTITYMANAGER_H_
This file is part of the KDE documentation.
Documentation copyright © 1996-2012 The KDE developers.
Generated on Tue May 8 2012 00:09:57 by doxygen 1.8.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2012 The KDE developers.
Generated on Tue May 8 2012 00:09:57 by doxygen 1.8.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.