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 #include <mailtransport/transporttype.h>
00025
00026 #include <QtCore/QList>
00027 #include <QtCore/QObject>
00028
00029 #include <akonadi/agenttype.h>
00030
00031 class KJob;
00032
00033 namespace KWallet {
00034 class Wallet;
00035 }
00036
00037 namespace MailTransport {
00038
00039 class Transport;
00040 class TransportConfigWidget;
00041 class TransportJob;
00042 class TransportManagerPrivate;
00043
00055 class MAILTRANSPORT_EXPORT TransportManager : public QObject
00056 {
00057 Q_OBJECT
00058 Q_CLASSINFO( "D-Bus Interface", "org.kde.pim.TransportManager" )
00059
00060 friend class Transport;
00061 friend class TransportManagerPrivate;
00062
00063 public:
00064
00068 virtual ~TransportManager();
00069
00073 static TransportManager *self();
00074
00080 void loadPasswordsAsync();
00081
00091 Transport *transportById( int id, bool def = true ) const;
00092
00101 Transport *transportByName( const QString &name, bool def = true ) const;
00102
00108 QList<Transport *>transports() const;
00109
00113 TransportType::List types() const;
00114
00120 Transport *createTransport() const;
00121
00127 void addTransport( Transport *transport );
00128
00137 MAILTRANSPORT_DEPRECATED TransportJob *createTransportJob( int transportId );
00138
00148 MAILTRANSPORT_DEPRECATED TransportJob *createTransportJob( const QString &transport );
00149
00159 MAILTRANSPORT_DEPRECATED void schedule( TransportJob *job );
00160
00165 void createDefaultTransport();
00166
00168 enum ShowCondition {
00169 Always,
00170 IfNoTransportExists
00171
00172 };
00173
00181 bool showTransportCreationDialog( QWidget *parent, ShowCondition showCondition = Always );
00182
00191 bool configureTransport( Transport *transport, QWidget *parent );
00192
00193 public Q_SLOTS:
00197 Q_SCRIPTABLE bool isEmpty() const;
00198
00202 Q_SCRIPTABLE QList<int> transportIds() const;
00203
00207 Q_SCRIPTABLE QStringList transportNames() const;
00208
00212 Q_SCRIPTABLE QString defaultTransportName() const;
00213
00218 Q_SCRIPTABLE int defaultTransportId() const;
00219
00224 Q_SCRIPTABLE void setDefaultTransport( int id );
00225
00230 Q_SCRIPTABLE void removeTransport( int id );
00231
00232 Q_SIGNALS:
00237 Q_SCRIPTABLE void transportsChanged();
00238
00244 Q_SCRIPTABLE void changesCommitted();
00245
00251 void passwordsChanged();
00252
00258 void transportRemoved( int id, const QString &name );
00259
00266 void transportRenamed( int id, const QString &oldName, const QString &newName );
00267
00268 protected:
00273 KWallet::Wallet *wallet();
00274
00278 void loadPasswords();
00279
00283 TransportManager();
00284
00285 private:
00286
00287
00288 void emitChangesCommitted();
00289
00290 private:
00291 TransportManagerPrivate *const d;
00292
00293 Q_PRIVATE_SLOT( d, void slotTransportsChanged() )
00294 Q_PRIVATE_SLOT( d, void slotWalletOpened( bool success ) )
00295 Q_PRIVATE_SLOT( d, void dbusServiceOwnerChanged( const QString &service,
00296 const QString &oldOwner,
00297 const QString &newOwner ) )
00298 Q_PRIVATE_SLOT( d, void agentTypeAdded( const Akonadi::AgentType &atype ) )
00299 Q_PRIVATE_SLOT( d, void agentTypeRemoved( const Akonadi::AgentType &atype ) )
00300 Q_PRIVATE_SLOT( d, void jobResult( KJob *job ) )
00301 };
00302
00303 }
00304
00305 #endif // MAILTRANSPORT_TRANSPORTMANAGER_H