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
00198 void passwordsChanged();
00199
00205 void transportRemoved( int id, const QString &name );
00206
00213 void transportRenamed( int id, const QString &oldName, const QString &newName );
00214
00215 protected:
00220 KWallet::Wallet *wallet();
00221
00225 void loadPasswords();
00226
00227 TransportManager();
00228
00229 private:
00230 void readConfig();
00231 void writeConfig();
00232 void emitChangesCommitted();
00233 int createId() const;
00234 void prepareWallet();
00235 void validateDefault();
00236 void migrateToWallet();
00237
00238 private Q_SLOTS:
00239 void slotTransportsChanged();
00240 void slotWalletOpened( bool success );
00241 void dbusServiceOwnerChanged( const QString &service,
00242 const QString &oldOwner,
00243 const QString &newOwner );
00244 void jobResult( KJob *job );
00245
00246 private:
00247 Private *const d;
00248 };
00249
00250 }
00251
00252 #endif