MailTransport::TransportManager Class
class MailTransport::TransportManagerCentral transport management interface. More...
| Header: | #include <MailTransport/TransportManager> |
| CMake: | find_package(KPim6MailTransport REQUIRED)target_link_libraries(mytarget PRIVATE KPim6::MailTransport) |
| Inherits: | QObject |
Public Functions
| virtual | ~TransportManager() override |
| void | addTransport(MailTransport::Transport *transport) |
| bool | configureTransport(const QString &identifier, MailTransport::Transport *transport, QWidget *parent) |
| MailTransport::Transport * | createTransport() const |
| int | defaultTransportId() const |
| QString | defaultTransportName() const |
| bool | isEmpty() const |
| void | loadPasswordsAsync() |
| void | removeTransport(int id) |
| void | setDefaultTransport(int id) |
| bool | showTransportCreationDialog(QWidget *parent, MailTransport::TransportManager::ShowCondition showCondition = Always) |
| MailTransport::Transport * | transportById(Transport::Id id, bool def = true) const |
| MailTransport::Transport * | transportByName(const QString &name, bool def = true) const |
| QList<int> | transportIds() const |
| QStringList | transportNames() const |
| QList<MailTransport::Transport *> | transports() const |
| TransportType::List | types() const |
Signals
| void | changesCommitted() |
| void | passwordsChanged() |
| void | transportRemoved(int id, const QString &name) |
| void | transportRenamed(int id, const QString &oldName, const QString &newName) |
| void | transportsChanged() |
Static Public Members
| MailTransport::TransportManager * | self() |
Protected Functions
| TransportManager() | |
| void | loadPasswords() |
Detailed Description
This class manages the creation, configuration, and removal of mail transports, as well as the loading and storing of mail transport settings.
It also handles the creation of transport jobs, although that behaviour is deprecated and you are encouraged to use Akonadi::MessageQueueJob from akonadi-mime.
Member Function Documentation
[protected] TransportManager::TransportManager()
Singleton class, the only instance resides in the static object sSelf.
[override virtual noexcept] TransportManager::~TransportManager()
Destructor.
void TransportManager::addTransport(MailTransport::Transport *transport)
Adds the given transport. The object ownership is transferred to TransportMananger, ie. you must not delete transport. transport The Transport object to add.
[signal] void TransportManager::changesCommitted()
Internal signal to synchronize all TransportManager instances. This signal is emitted by the instance writing the changes. You probably want to use transportsChanged() instead.
bool TransportManager::configureTransport(const QString &identifier, MailTransport::Transport *transport, QWidget *parent)
Open a configuration dialog for an existing transport. identifier The identifier. transport The transport to configure. It can be a new transport, or one already managed by TransportManager. parent The parent widget for the dialog. Returns True if the user clicked Ok, false if the user cancelled.
MailTransport::Transport *TransportManager::createTransport() const
Creates a new, empty Transport object. The object is owned by the caller. If you want to add the Transport permanently (eg. after configuring it) call addTransport().
int TransportManager::defaultTransportId() const
Returns the default transport identifier. Invalid if there are no transports at all.
QString TransportManager::defaultTransportName() const
Returns the default transport name.
bool TransportManager::isEmpty() const
Returns true if there are no mail transports at all.
[protected] void TransportManager::loadPasswords()
Loads all passwords synchronously.
void TransportManager::loadPasswordsAsync()
Tries to load passwords asynchronously from KWallet if needed. The passwordsChanged() signal is emitted once the passwords have been loaded. Nothing happens if the passwords were already available.
[signal] void TransportManager::passwordsChanged()
Emitted when passwords have been loaded from the wallet. If you made a deep copy of a transport, you should call updatePasswordState() for the cloned transport to ensure its password is updated as well.
void TransportManager::removeTransport(int id)
Deletes the specified transport. id The identifier of the mail transport to remove.
[static] MailTransport::TransportManager *TransportManager::self()
Returns the TransportManager instance.
void TransportManager::setDefaultTransport(int id)
Sets the default transport. The change will be in effect immediately. id The identifier of the new default transport.
bool TransportManager::showTransportCreationDialog(QWidget *parent, MailTransport::TransportManager::ShowCondition showCondition = Always)
Shows a dialog for creating and configuring a new transport. parent Parent widget of the dialog. showCondition the condition under which the dialog is shown at all Returns True if a new transport has been created and configured.
MailTransport::Transport *TransportManager::transportById(Transport::Id id, bool def = true) const
Returns the Transport object with the given id. id The identifier of the Transport. def if set to true, the default transport will be returned if the specified Transport object could not be found, 0 otherwise. Returns A Transport object for immediate use. It might become invalid as soon as the event loop is entered again due to remote changes. If you need to store a Transport object, store the transport identifier instead.
MailTransport::Transport *TransportManager::transportByName(const QString &name, bool def = true) const
Returns the transport object with the given name. name The transport name. def if set to true, the default transport will be returned if the specified Transport object could not be found, 0 otherwise. Returns A Transport object for immediate use, see transportById() for limitations.
QList<int> TransportManager::transportIds() const
Returns a list of transport identifiers.
QStringList TransportManager::transportNames() const
Returns a list of transport names.
[signal] void TransportManager::transportRemoved(int id, const QString &name)
Emitted when a transport is deleted. id The identifier of the deleted transport. name The name of the deleted transport.
[signal] void TransportManager::transportRenamed(int id, const QString &oldName, const QString &newName)
Emitted when a transport has been renamed. id The identifier of the renamed transport. oldName The old name. newName The new name.
QList<MailTransport::Transport *> TransportManager::transports() const
Returns a list of all available transports. Note The Transport objects become invalid as soon as a change occur, so they are only suitable for immediate use.
[signal] void TransportManager::transportsChanged()
Emitted when transport settings have changed (by this or any other TransportManager instance).
TransportType::List TransportManager::types() const
Returns a list of all available transport types.