mailtransport
transportmanager.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef MAILTRANSPORT_TRANSPORTMANAGER_H
00021 #define MAILTRANSPORT_TRANSPORTMANAGER_H
00022
00023 #include <mailtransport/mailtransport_export.h>
00024
00025 #include <QtCore/QList>
00026 #include <QtCore/QObject>
00027
00028 class KJob;
00029
00030 namespace KWallet {
00031 class Wallet;
00032 }
00033
00034 namespace MailTransport {
00035
00036 class Transport;
00037 class TransportJob;
00038
00043 class MAILTRANSPORT_EXPORT TransportManager : public QObject
00044 {
00045 Q_OBJECT
00046 Q_CLASSINFO( "D-Bus Interface", "org.kde.pim.TransportManager" )
00047
00048 friend class Transport;
00049 friend class Private;
00050
00051 public:
00052 class Private;
00053
00057 virtual ~TransportManager();
00058
00062 static TransportManager *self();
00063
00069 void loadPasswordsAsync();
00070
00080 Transport *transportById( int id, bool def = true ) const;
00081
00090 Transport *transportByName( const QString &name, bool def = true ) const;
00091
00097 QList<Transport *>transports() const;
00098
00104 Transport *createTransport() const;
00105
00111 void addTransport( Transport *transport );
00112
00118 TransportJob *createTransportJob( int transportId );
00119
00126 TransportJob *createTransportJob( const QString &transport );
00127
00134 void schedule( TransportJob *job );
00135
00140 void createDefaultTransport();
00141
00142 public Q_SLOTS:
00146 Q_SCRIPTABLE bool isEmpty() const;
00147
00151 Q_SCRIPTABLE QList<int> transportIds() const;
00152
00156 Q_SCRIPTABLE QStringList transportNames() const;
00157
00161 Q_SCRIPTABLE QString defaultTransportName() const;
00162
00167 Q_SCRIPTABLE int defaultTransportId() const;
00168
00173 Q_SCRIPTABLE void setDefaultTransport( int id );
00174
00179 Q_SCRIPTABLE void removeTransport( int id );
00180
00181 Q_SIGNALS:
00186 Q_SCRIPTABLE void transportsChanged();
00187
00193 Q_SCRIPTABLE void changesCommitted();
00194
00200 void passwordsChanged();
00201
00207 void transportRemoved( int id, const QString &name );
00208
00215 void transportRenamed( int id, const QString &oldName, const QString &newName );
00216
00217 protected:
00222 KWallet::Wallet *wallet();
00223
00227 void loadPasswords();
00228
00229 TransportManager();
00230
00231 private:
00232 void readConfig();
00233 void writeConfig();
00234 void emitChangesCommitted();
00235 int createId() const;
00236 void prepareWallet();
00237 void validateDefault();
00238 void migrateToWallet();
00239
00240 private Q_SLOTS:
00241 void slotTransportsChanged();
00242 void slotWalletOpened( bool success );
00243 void dbusServiceOwnerChanged( const QString &service,
00244 const QString &oldOwner,
00245 const QString &newOwner );
00246 void jobResult( KJob *job );
00247
00248 private:
00249 Private *const d;
00250 };
00251
00252 }
00253
00254 #endif