KIMAP::Session Class
Session. More...
| Header: | #include <KIMAP/Session> |
| CMake: | find_package(KPim6IMAP REQUIRED)target_link_libraries(mytarget PRIVATE KPim6::IMAP) |
| Inherits: | QObject |
Public Types
| enum | State { Disconnected, NotAuthenticated, Authenticated, Selected } |
Public Functions
| Session(const QString &hostName, quint16 port, QObject *parent = nullptr) | |
| virtual | ~Session() |
| void | close() |
| QString | hostName() const |
| qsizetype | jobQueueSize() const |
| quint16 | port() const |
| QString | selectedMailBox() const |
| QByteArray | serverGreeting() const |
| void | setTimeout(int timeout) |
| void | setUiProxy(const SessionUiProxy::Ptr &proxy) |
| void | setUseNetworkProxy(bool useProxy) |
| KIMAP::Session::State | state() const |
| int | timeout() const |
| QString | userName() const |
Signals
| void | connectionFailed() |
| void | connectionLost() |
| void | jobQueueSizeChanged(qsizetype queueSize) |
| void | stateChanged(KIMAP::Session::State newState, KIMAP::Session::State oldState) |
Detailed Description
Member Type Documentation
enum Session::State
| Constant | Value |
|---|---|
KIMAP::Session::Disconnected | 0 |
KIMAP::Session::NotAuthenticated | 1 |
KIMAP::Session::Authenticated | 2 |
KIMAP::Session::Selected | 3 |
Member Function Documentation
Session::Session(const QString &hostName, quint16 port, QObject *parent = nullptr)
[virtual noexcept] Session::~Session()
void Session::close()
[signal] void Session::connectionFailed()
Emitted when the Session couldn't connect to the host.
Likely reasons: invalid host address, no internet connectivity, firewall blocking rules, etc...
Pending jobs in the queue will be deleted, and the first job in the queue will be failed. (ie: it will have its result signal emitted with a non-zero error code.)
[signal] void Session::connectionLost()
Emitted when we lose a previously established connection
Likely reasons: server closed the connection, loss of internet connectivity, etc...
QString Session::hostName() const
qsizetype Session::jobQueueSize() const
[signal] void Session::jobQueueSizeChanged(qsizetype queueSize)
quint16 Session::port() const
QString Session::selectedMailBox() const
Returns the currently selected mailbox.
QByteArray Session::serverGreeting() const
void Session::setTimeout(int timeout)
Set the session timeout. The default is 30 seconds.
timeout The socket timeout in seconds, negative values disable the timeout.
See also timeout().
void Session::setUiProxy(const SessionUiProxy::Ptr &proxy)
Sets an ui proxy that displays the error messages and waits for user feedback.
proxy the ui proxy object
void Session::setUseNetworkProxy(bool useProxy)
Sets whether the IMAP network connection should use the system proxy settings.
useProxy true if the proxy is to be used
The default is to not use the proxy.
Note If the session is currently connected to the IMAP server, calling this function will disconnect and reconnect to it with the changed proxy setting.
KIMAP::Session::State Session::state() const
[signal] void Session::stateChanged(KIMAP::Session::State newState, KIMAP::Session::State oldState)
Emitted when the session's state changes.
Not very useful after all... :-)
If you want to receive the stateChanged arguments in your slot, you must register the State enum with Q_DECLARE_METATYPE(KIMAP::Session::State) and qRegisterMetaType<KIMAP::Session::State>();
int Session::timeout() const
Returns the session timeout.
See also setTimeout().
QString Session::userName() const
Returns the name that has been set with LoginJob::setUserName()
The user name is useful to uniquely identify an IMAP resource, in combination with the host name
Note If the Session was pre-authenticated, userName() will return an empty string