1 | /* This file is part of the KDE project |
2 | Copyright (C) 2001 Christoph Cullmann <cullmann@kde.org> |
3 | |
4 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Library General Public |
6 | License version 2 as published by the Free Software Foundation. |
7 | |
8 | This library is distributed in the hope that it will be useful, |
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
11 | Library General Public License for more details. |
12 | |
13 | You should have received a copy of the GNU Library General Public License |
14 | along with this library; see the file COPYING.LIB. If not, write to |
15 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
16 | Boston, MA 02110-1301, USA. |
17 | */ |
18 | |
19 | #ifndef _kateapp_adaptor_h_ |
20 | #define _kateapp_adaptor_h_ |
21 | |
22 | #include <QtDBus/QtDBus> |
23 | |
24 | class KateApp; |
25 | |
26 | class KateAppAdaptor : public QDBusAbstractAdaptor |
27 | { |
28 | Q_OBJECT |
29 | Q_CLASSINFO("D-Bus Interface" , "org.kde.Kate.Application" ) |
30 | Q_PROPERTY(QString activeSession READ activeSession) |
31 | public: |
32 | KateAppAdaptor (KateApp *app); |
33 | |
34 | /** |
35 | * emit the exiting signal |
36 | */ |
37 | void emitExiting (); |
38 | void emitDocumentClosed(const QString& token); |
39 | |
40 | public Q_SLOTS: |
41 | /** |
42 | * open a file with given url and encoding |
43 | * will get view created |
44 | * @param url url of the file |
45 | * @param encoding encoding name |
46 | * @return success |
47 | */ |
48 | bool openUrl (QString url, QString encoding); |
49 | |
50 | /** |
51 | * open a file with given url and encoding |
52 | * will get view created |
53 | * @param url url of the file |
54 | * @param encoding encoding name |
55 | * @return token or ERROR |
56 | */ |
57 | QString tokenOpenUrl (QString url, QString encoding); |
58 | |
59 | /** |
60 | * Like the above, but adds an option to let the documentManager know |
61 | * if the file should be deleted when closed. |
62 | * @p isTempFile should be set to true with the --tempfile option set ONLY, |
63 | * files opened with this set to true will be deleted when closed. |
64 | */ |
65 | bool openUrl(QString url, QString encoding, bool isTempFile); |
66 | |
67 | QString tokenOpenUrl(QString url, QString encoding, bool isTempFile); |
68 | |
69 | /** |
70 | * set cursor of active view in active main window |
71 | * @param line line for cursor |
72 | * @param column column for cursor |
73 | * @return success |
74 | */ |
75 | bool setCursor (int line, int column); |
76 | |
77 | /** |
78 | * helper to handle stdin input |
79 | * open a new document/view, fill it with the text given |
80 | * @param text text to fill in the new doc/view |
81 | * @return success |
82 | */ |
83 | bool openInput (QString text); |
84 | |
85 | /** |
86 | * activate a given session |
87 | * @param session session name |
88 | * @return success |
89 | */ |
90 | bool activateSession (QString session); |
91 | |
92 | /** |
93 | * activate this kate instance |
94 | */ |
95 | void activate (); |
96 | |
97 | Q_SIGNALS: |
98 | /** |
99 | * Notify the world that this kate instance is exiting. |
100 | * All apps should stop using the dbus interface of this instance after this signal got emitted. |
101 | */ |
102 | void exiting (); |
103 | void documentClosed(const QString& token); |
104 | public: |
105 | QString activeSession(); |
106 | private: |
107 | KateApp *m_app; |
108 | }; |
109 | |
110 | #endif |
111 | // kate: space-indent on; indent-width 2; replace-tabs on; |
112 | |
113 | |