1 /* Copyright (C) 2006 - 2014 Jan Kundrát <jkt@flaska.net>
2 
3    This file is part of the Trojita Qt IMAP e-mail client,
4    http://trojita.flaska.net/
5 
6    This program is free software; you can redistribute it and/or
7    modify it under the terms of the GNU General Public License as
8    published by the Free Software Foundation; either version 2 of
9    the License or (at your option) version 3 or any later version
10    accepted by the membership of KDE e.V. (or its successor approved
11    by the membership of KDE e.V.), which shall act as a proxy
12    defined in Section 14 of version 3 of the license.
13 
14    This program is distributed in the hope that it will be useful,
15    but WITHOUT ANY WARRANTY; without even the implied warranty of
16    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17    GNU General Public License for more details.
18 
19    You should have received a copy of the GNU General Public License
20    along with this program.  If not, see <http://www.gnu.org/licenses/>.
21 */
22 
23 #include <QObject>
24 #include "ConnectionState.h"
25 
26 namespace Imap
27 {
28 
connectionStateToString(const ConnectionState state)29 QString connectionStateToString(const ConnectionState state)
30 {
31     switch (state) {
32     case CONN_STATE_NONE:
33         return QString();
34     case CONN_STATE_HOST_LOOKUP:
35         return QObject::tr("Resolving hostname...");
36     case CONN_STATE_CONNECTING:
37         return QObject::tr("Connecting to the IMAP server...");
38     case CONN_STATE_SSL_HANDSHAKE:
39         return QObject::tr("Starting encryption (SSL)...");
40     case CONN_STATE_SSL_VERIFYING:
41         return QObject::tr("Checking certificates (SSL)...");
42     case CONN_STATE_CONNECTED_PRETLS_PRECAPS:
43         return QObject::tr("Checking capabilities...");
44     case CONN_STATE_CONNECTED_PRETLS:
45         return QObject::tr("Waiting for encryption...");
46     case CONN_STATE_STARTTLS_ISSUED:
47         return QObject::tr("Asking for encryption...");
48     case CONN_STATE_STARTTLS_HANDSHAKE:
49         return QObject::tr("Starting encryption (STARTTLS)...");
50     case CONN_STATE_STARTTLS_VERIFYING:
51         return QObject::tr("Checking certificates (STARTTLS)...");
52     case CONN_STATE_ESTABLISHED_PRECAPS:
53         return QObject::tr("Checking capabilities (after STARTTLS)...");
54     case CONN_STATE_LOGIN:
55         return QObject::tr("Logging in...");
56     case CONN_STATE_POSTAUTH_PRECAPS:
57         return QObject::tr("Checking capabilities (after login)...");
58     case CONN_STATE_COMPRESS_DEFLATE:
59         return QObject::tr("Activating compression...");
60     case CONN_STATE_AUTHENTICATED:
61         return QObject::tr("Logged in.");
62     case CONN_STATE_SELECTING_WAIT_FOR_CLOSE:
63         return QObject::tr("Waiting for another mailbox...");
64     case CONN_STATE_SELECTING:
65         return QObject::tr("Opening mailbox...");
66     case CONN_STATE_SYNCING:
67         return QObject::tr("Synchronizing mailbox...");
68     case CONN_STATE_SELECTED:
69         return QObject::tr("Mailbox opened.");
70     case CONN_STATE_FETCHING_PART:
71         return QObject::tr("Downloading message...");
72     case CONN_STATE_FETCHING_MSG_METADATA:
73         return QObject::tr("Downloading message structure...");
74     case CONN_STATE_LOGOUT:
75         return QObject::tr("Logged out.");
76     }
77     Q_ASSERT(false);
78     return QString();
79 }
80 
81 }
82