1/*
2 Copyright (c) 2009 Andras Mantia <amantia@kde.org>
3
4 This library is free software; you can redistribute it and/or modify it
5 under the terms of the GNU Library General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or (at your
7 option) any later version.
8
9 This library is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12 License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 02110-1301, USA.
18*/
19
20#ifndef KIMAP_SESSIONUIPROXY_H
21#define KIMAP_SESSIONUIPROXY_H
22
23#include <boost/shared_ptr.hpp>
24
25#include "kimap_export.h"
26
27#include "job.h"
28
29class KSslErrorUiData;
30
31namespace KIMAP {
32
33/** @short Interface to display communication errors and wait for user feedback. */
34class KIMAP_EXPORT SessionUiProxy
35{
36 public:
37 typedef boost::shared_ptr<SessionUiProxy> Ptr;
38
39 virtual ~SessionUiProxy() {};
40 /**
41 * Show an SSL error and ask the user whether it should be ignored or not.
42 * The recommended KDE UI is the following:
43 * @code
44 * #include <kio/ksslui.h>
45 * class UiProxy: public SessionUiProxy {
46 * public:
47 * bool ignoreSslError(const KSslErrorUiData& errorData) {
48 * if (KIO::SslUi::askIgnoreSslErrors(errorData)) {
49 * return true;
50 * } else {
51 * return false;
52 * }
53 * }
54 * };
55 * [...]
56 * Session session(server, port);
57 * UiProxy *proxy = new UiProxy();
58 * session.setUiProxy(proxy);
59 * @endcode
60 * @param errorData contains details about the error.
61 * @return true if the error can be ignored
62 */
63 virtual bool ignoreSslError(const KSslErrorUiData& errorData) = 0;
64};
65
66}
67
68#endif
69