File indexing completed on 2024-04-21 04:55:26
0001 /* 0002 This file is part of Choqok, the KDE micro-blogging client 0003 0004 SPDX-FileCopyrightText: 2010-2012 Mehrdad Momeny <mehrdad.momeny@gmail.com> 0005 SPDX-FileCopyrightText: 2010-2011 Emanuele Bigiarini <pulmro@gmail.com> 0006 0007 SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0008 */ 0009 0010 #ifndef DBUSHANDLER_H 0011 #define DBUSHANDLER_H 0012 0013 #include <QObject> 0014 #include <QString> 0015 #include <QTextDocument> 0016 #include <KJob> 0017 0018 #include "choqok_export.h" 0019 0020 namespace Choqok 0021 { 0022 class DbusHandler; 0023 0024 CHOQOK_EXPORT Choqok::DbusHandler *ChoqokDbus(); 0025 0026 class CHOQOK_EXPORT DbusHandler : public QObject 0027 { 0028 Q_OBJECT 0029 Q_CLASSINFO("D-Bus Interface", "org.kde.choqok") 0030 0031 /** 0032 * Retrieve the DBus handler instance if it exists or build up a new one 0033 */ 0034 friend Choqok::DbusHandler *ChoqokDbus(); 0035 0036 public: 0037 DbusHandler(); 0038 ~DbusHandler(); 0039 0040 public Q_SLOTS: 0041 /** Methods exported by the D-Bus interface org.choqok.kde: 0042 * shareUrl: if you want to share an url with the html page title set bool title true; 0043 * getShortening: return a bool for the active configuration of ShortenOnPaste option; 0044 * setShortening: Control ShortenOnPaste option; 0045 */ 0046 0047 void shareUrl(const QString &url, bool title = false); 0048 void uploadFile(const QString &filename); 0049 void postText(const QString &text); 0050 void updateTimelines(); 0051 void setShortening(bool flag); 0052 bool getShortening(); 0053 0054 private: 0055 static DbusHandler *m_self; 0056 QString m_textToPost; 0057 QTextDocument m_doc; 0058 0059 QString prepareUrl(const QString &url); 0060 0061 private Q_SLOTS: 0062 void slotcreatedQuickPost(); 0063 void slotTitleUrl(KJob *job); 0064 0065 }; 0066 0067 } 0068 0069 #endif // DBUSHANDLER_H