sessionuiproxy.h 1.3 KB
Newer Older
1
/*
2
    SPDX-FileCopyrightText: 2009 Andras Mantia <amantia@kde.org>
3

4
    SPDX-License-Identifier: LGPL-2.0-or-later
5
6
7
8
9
10
11
12
13
14
15
16
17
*/

#ifndef KSMTP_SESSIONUIPROXY_H
#define KSMTP_SESSIONUIPROXY_H

#include "ksmtp_export.h"

#include "job.h"

#include <QSharedPointer>

class KSslErrorUiData;

Laurent Montel's avatar
Laurent Montel committed
18
namespace KSmtp {
19
20
21
22
/** @short Interface to display communication errors and wait for user feedback. */
class KSMTP_EXPORT SessionUiProxy
{
public:
Laurent Montel's avatar
Laurent Montel committed
23
    using Ptr = QSharedPointer<SessionUiProxy>;
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53

    virtual ~SessionUiProxy();
    /**
     * Show an SSL error and ask the user whether it should be ignored or not.
     * The recommended KDE UI is the following:
     * @code
     * #include <kio/ksslui.h>
     * class UiProxy: public SessionUiProxy {
     *   public:
     *     bool ignoreSslError(const KSslErrorUiData& errorData) {
     *       if (KIO::SslUi::askIgnoreSslErrors(errorData)) {
     *         return true;
     *       } else {
     *        return false;
     *       }
     *     }
     * };
     * [...]
     * Session session(server, port);
     * UiProxy *proxy = new UiProxy();
     * session.setUiProxy(proxy);
     * @endcode
     * @param errorData contains details about the error.
     * @return true if the error can be ignored
     */
    virtual bool ignoreSslError(const KSslErrorUiData &errorData) = 0;
};
}

#endif