File indexing completed on 2024-11-24 04:53:22

0001 /* Copyright (C) 2006 - 2014 Jan Kundrát <jkt@flaska.net>
0002 
0003    This file is part of the Trojita Qt IMAP e-mail client,
0004    http://trojita.flaska.net/
0005 
0006    This program is free software; you can redistribute it and/or
0007    modify it under the terms of the GNU General Public License as
0008    published by the Free Software Foundation; either version 2 of
0009    the License or (at your option) version 3 or any later version
0010    accepted by the membership of KDE e.V. (or its successor approved
0011    by the membership of KDE e.V.), which shall act as a proxy
0012    defined in Section 14 of version 3 of the license.
0013 
0014    This program is distributed in the hope that it will be useful,
0015    but WITHOUT ANY WARRANTY; without even the implied warranty of
0016    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0017    GNU General Public License for more details.
0018 
0019    You should have received a copy of the GNU General Public License
0020    along with this program.  If not, see <http://www.gnu.org/licenses/>.
0021 */
0022 
0023 #include <QObject>
0024 #include "ConnectionState.h"
0025 
0026 namespace Imap
0027 {
0028 
0029 QString connectionStateToString(const ConnectionState state)
0030 {
0031     switch (state) {
0032     case CONN_STATE_NONE:
0033         return QString();
0034     case CONN_STATE_HOST_LOOKUP:
0035         return QObject::tr("Resolving hostname...");
0036     case CONN_STATE_CONNECTING:
0037         return QObject::tr("Connecting to the IMAP server...");
0038     case CONN_STATE_SSL_HANDSHAKE:
0039         return QObject::tr("Starting encryption (SSL)...");
0040     case CONN_STATE_SSL_VERIFYING:
0041         return QObject::tr("Checking certificates (SSL)...");
0042     case CONN_STATE_CONNECTED_PRETLS_PRECAPS:
0043         return QObject::tr("Checking capabilities...");
0044     case CONN_STATE_CONNECTED_PRETLS:
0045         return QObject::tr("Waiting for encryption...");
0046     case CONN_STATE_STARTTLS_ISSUED:
0047         return QObject::tr("Asking for encryption...");
0048     case CONN_STATE_STARTTLS_HANDSHAKE:
0049         return QObject::tr("Starting encryption (STARTTLS)...");
0050     case CONN_STATE_STARTTLS_VERIFYING:
0051         return QObject::tr("Checking certificates (STARTTLS)...");
0052     case CONN_STATE_ESTABLISHED_PRECAPS:
0053         return QObject::tr("Checking capabilities (after STARTTLS)...");
0054     case CONN_STATE_LOGIN:
0055         return QObject::tr("Logging in...");
0056     case CONN_STATE_POSTAUTH_PRECAPS:
0057         return QObject::tr("Checking capabilities (after login)...");
0058     case CONN_STATE_COMPRESS_DEFLATE:
0059         return QObject::tr("Activating compression...");
0060     case CONN_STATE_AUTHENTICATED:
0061         return QObject::tr("Logged in.");
0062     case CONN_STATE_SELECTING_WAIT_FOR_CLOSE:
0063         return QObject::tr("Waiting for another mailbox...");
0064     case CONN_STATE_SELECTING:
0065         return QObject::tr("Opening mailbox...");
0066     case CONN_STATE_SYNCING:
0067         return QObject::tr("Synchronizing mailbox...");
0068     case CONN_STATE_SELECTED:
0069         return QObject::tr("Mailbox opened.");
0070     case CONN_STATE_FETCHING_PART:
0071         return QObject::tr("Downloading message...");
0072     case CONN_STATE_FETCHING_MSG_METADATA:
0073         return QObject::tr("Downloading message structure...");
0074     case CONN_STATE_LOGOUT:
0075         return QObject::tr("Logged out.");
0076     }
0077     Q_ASSERT(false);
0078     return QString();
0079 }
0080 
0081 }