File indexing completed on 2024-11-24 04:18:33
0001 #pragma once 0002 #include <QObject> 0003 0004 #if (defined Q_OS_LINUX || defined Q_OS_FREEBSD) && !defined Q_OS_ANDROID 0005 class OrgKdeNotaActionsInterface; 0006 0007 namespace AppInstance 0008 { 0009 QVector<QPair<QSharedPointer<OrgKdeNotaActionsInterface>, QStringList>> appInstances(const QString& preferredService); 0010 0011 bool attachToExistingInstance(const QList<QUrl>& inputUrls, bool splitView, const QString& preferredService = QString()); 0012 0013 bool registerService(); 0014 } 0015 #endif 0016 0017 class Server : public QObject 0018 { 0019 Q_OBJECT 0020 Q_CLASSINFO("D-Bus Interface", "org.kde.nota.Actions") 0021 0022 public: 0023 explicit Server(QObject *parent = nullptr); 0024 void setQmlObject(QObject *object); 0025 0026 public slots: 0027 /** 0028 * Tries to raise/activate the Dolphin window. 0029 */ 0030 void activateWindow(); 0031 0032 /** Stores all settings and quits Dolphin. */ 0033 void quit(); 0034 0035 /** 0036 * Opens the directories which contain the files \p files and selects all files. 0037 * If \a splitView is set, 2 directories are collected within one tab. 0038 * \pre \a files must contain at least one url. 0039 * 0040 * @note this is overloaded so that this function is callable via DBus. 0041 */ 0042 void openFiles(const QStringList &urls, bool splitView); 0043 0044 0045 /** 0046 * Opens a new tab in the background showing the URL \a url. 0047 */ 0048 void openNewTab(const QString& url); 0049 /** 0050 * Opens a new empty tab in the background. 0051 */ 0052 void openEmptyTab(); 0053 0054 void focusFile(const QString& url); 0055 0056 /** 0057 * Opens a new tab showing the URL \a url and activate it. 0058 */ 0059 void openNewTabAndActivate(const QString &url); 0060 0061 /** 0062 * Opens a new window showing the URL \a url. 0063 */ 0064 void openNewWindow(const QString &url); 0065 0066 /** 0067 * Determines if a URL is open in any tab. 0068 * @note Use of QString instead of QUrl is required to be callable via DBus. 0069 * 0070 * @param url URL to look for 0071 * @returns true if url is currently open in a tab, false otherwise. 0072 */ 0073 bool isUrlOpen(const QString &url); 0074 0075 0076 private: 0077 QObject* m_qmlObject = nullptr; 0078 QStringList filterFiles(const QStringList &urls); 0079 0080 signals: 0081 0082 }; 0083