File indexing completed on 2025-01-05 04:49:28
0001 /* 0002 SPDX-FileCopyrightText: 2015-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include "shorturl_export.h" 0010 #include <QNetworkReply> 0011 #include <QObject> 0012 #include <QTextCursor> 0013 class QNetworkAccessManager; 0014 class ShortUrlEnginePlugin; 0015 class SHORTURL_EXPORT ShortUrlEngineInterface : public QObject 0016 { 0017 Q_OBJECT 0018 public: 0019 explicit ShortUrlEngineInterface(ShortUrlEnginePlugin *plugin, QObject *parent = nullptr); 0020 ~ShortUrlEngineInterface() override; 0021 0022 void setShortUrl(const QString &url); 0023 virtual void generateShortUrl() = 0; 0024 virtual QString engineName() const = 0; 0025 QString pluginName() const; 0026 0027 void setTextCursor(const QTextCursor &cursor); 0028 protected Q_SLOTS: 0029 void slotErrorFound(QNetworkReply::NetworkError error); 0030 0031 Q_SIGNALS: 0032 void shortUrlFailed(const QString &error); 0033 0034 protected: 0035 QString mOriginalUrl; 0036 QTextCursor mTextCursor; 0037 bool mErrorFound = false; 0038 QNetworkAccessManager *const mNetworkAccessManager; 0039 ShortUrlEnginePlugin *const mEnginePlugin; 0040 };