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
00050 public:
00054 virtual ~TransportManager();
00055
00059 static TransportManager* self();
00060
00066 void loadPasswordsAsync();
00067
00077 Transport* transportById( int id, bool def = true ) const;
00078
00087 Transport* transportByName( const QString &name, bool def = true ) const;
00088
00094 QList<Transport*> transports() const;
00095
00101 Transport* createTransport() const;
00102
00108 void addTransport( Transport* transport );
00109
00115 TransportJob* createTransportJob( int transportId );
00116
00123 TransportJob* createTransportJob( const QString &transport );
00124
00131 void schedule( TransportJob* job );
00132
00137 void createDefaultTransport();
00138
00139 public Q_SLOTS:
00143 Q_SCRIPTABLE bool isEmpty() const;
00144
00148 Q_SCRIPTABLE QList<int> transportIds() const;
00149
00153 Q_SCRIPTABLE QStringList transportNames() const;
00154
00158 Q_SCRIPTABLE QString defaultTransportName() const;
00159
00164 Q_SCRIPTABLE int defaultTransportId() const;
00165
00170 Q_SCRIPTABLE void setDefaultTransport( int id );
00171
00176 Q_SCRIPTABLE void removeTransport( int id );
00177
00178 Q_SIGNALS:
00183 Q_SCRIPTABLE void transportsChanged();
00184
00190 Q_SCRIPTABLE void changesCommitted();
00191
00195 void passwordsChanged();
00196
00202 void transportRemoved( int id, const QString &name );
00203
00210 void transportRenamed( int id, const QString &oldName, const QString &newName );
00211
00212 protected:
00217 KWallet::Wallet* wallet();
00218
00222 void loadPasswords();
00223
00224 private:
00225 TransportManager();
00226 void readConfig();
00227 void writeConfig();
00228 void emitChangesCommitted();
00229 int createId() const;
00230 void prepareWallet();
00231 void validateDefault();
00232 void migrateToWallet();
00233
00234 private Q_SLOTS:
00235 void slotTransportsChanged();
00236 void slotWalletOpened( bool success );
00237 void dbusServiceOwnerChanged( const QString &service,
00238 const QString &oldOwner,
00239 const QString &newOwner );
00240 void jobResult( KJob* job );
00241
00242 private:
00243 class Private;
00244 Private *const d;
00245 };
00246
00247 }
00248
00249 #endif