File indexing completed on 2024-05-12 05:17:17

0001 /*
0002     SPDX-FileCopyrightText: 2009 Andras Mantia <amantia@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "kimap_export.h"
0010 
0011 #include "job.h"
0012 
0013 #include <QSharedPointer>
0014 
0015 class KSslErrorUiData;
0016 
0017 namespace KIMAP
0018 {
0019 /** @short Interface to display communication errors and wait for user feedback. */
0020 class KIMAP_EXPORT SessionUiProxy
0021 {
0022 public:
0023     using Ptr = QSharedPointer<SessionUiProxy>;
0024 
0025     virtual ~SessionUiProxy();
0026     /**
0027      * Show an SSL error and ask the user whether it should be ignored or not.
0028      * The recommended KDE UI is the following:
0029      * @code
0030      * #include <kio/ksslui.h>
0031      * class UiProxy: public SessionUiProxy {
0032      *   public:
0033      *     bool ignoreSslError(const KSslErrorUiData& errorData) {
0034      *       if (KIO::SslUi::askIgnoreSslErrors(errorData)) {
0035      *         return true;
0036      *       } else {
0037      *        return false;
0038      *       }
0039      *     }
0040      * };
0041      * [...]
0042      * Session session(server, port);
0043      * UiProxy *proxy = new UiProxy();
0044      * session.setUiProxy(proxy);
0045      * @endcode
0046      * @param errorData contains details about the error.
0047      * @return true if the error can be ignored
0048      */
0049     virtual bool ignoreSslError(const KSslErrorUiData &errorData) = 0;
0050 };
0051 
0052 }