File indexing completed on 2025-01-19 03:53:02

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2021-03-20
0007  * Description : a simple web browser dialog based on Qt WebEngine.
0008  *
0009  * SPDX-FileCopyrightText: 2017-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0010  * SPDX-FileCopyrightText: 2021      by Joerg Lohse <joergmlpts at gmail dot com>
0011  *
0012  * SPDX-License-Identifier: GPL-2.0-or-later
0013  *
0014  * ============================================================ */
0015 
0016 #ifndef DIGIKAM_INAT_BROWSER_DLG_H
0017 #define DIGIKAM_INAT_BROWSER_DLG_H
0018 
0019 // Qt include
0020 
0021 #include <QDialog>
0022 #include <QWidget>
0023 #include <QUrl>
0024 #include <QString>
0025 #include <QCloseEvent>
0026 #include <QNetworkCookie>
0027 #include <QDateTime>
0028 
0029 namespace DigikamGenericINatPlugin
0030 {
0031 
0032 class SearchTextSettings;
0033 
0034 class INatBrowserDlg : public QDialog
0035 {
0036     Q_OBJECT
0037 
0038 public:
0039 
0040     INatBrowserDlg(const QString& username, const QList<QNetworkCookie>&,
0041                    QWidget* const parent);
0042     ~INatBrowserDlg() override;
0043 
0044     static bool filterCookie(const QNetworkCookie& cookie,
0045                              bool keepSessionCookies, const QDateTime&);
0046 
0047     /**
0048      * filter out expired cookies and, if requested, session cookies
0049      */
0050     static QList<QNetworkCookie> filterCookies(const QList<QNetworkCookie>&,
0051                                                bool keepSessionCookies = true);
0052 
0053 Q_SIGNALS:
0054 
0055     void signalApiToken(const QString&, const QList<QNetworkCookie>&);
0056     void signalWebText(const QString&);
0057 
0058 private Q_SLOTS:
0059 
0060     void slotLoadingFinished(bool);
0061     void slotTitleChanged(const QString&);
0062     void slotWebText(const QString&);
0063     void slotGoHome();
0064     void slotCookieAdded(const QNetworkCookie&);
0065     void slotCookieRemoved(const QNetworkCookie&);
0066 
0067 protected:
0068 
0069     void closeEvent(QCloseEvent*) override;
0070 
0071 private:
0072 
0073     class Private;
0074     Private* const d;
0075 };
0076 
0077 } // namespace DigikamGenericINatPlugin
0078 
0079 #endif // DIGIKAM_INAT_BROWSER_DLG_H