1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
|
/* This file is part of the KDE project
Copyright (C) 2001 Christoph Cullmann <cullmann@kde.org>
Copyright (C) 2002 Joseph Wenninger <jowenn@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef __KATE_APP_H__
#define __KATE_APP_H__
#include "katemain.h"
#include <tdeapplication.h>
#include <tqvaluelist.h>
class KateSessionManager;
class KateAppDCOPIface;
namespace Kate {
class Application;
}
class TDECmdLineArgs;
/**
* Kate Application
* This class represents the core kate application object
*/
class TDE_EXPORT KateApp : public TDEApplication
{
TQ_OBJECT
/**
* constructors & accessor to app object + plugin interface for it
*/
public:
/**
* application constructor
* @param args parsed command line args
*/
KateApp (TDECmdLineArgs *args);
/**
* application destructor
*/
~KateApp ();
/**
* static accessor to avoid casting ;)
* @return app instance
*/
static KateApp *self ();
/**
* accessor to the Kate::Application plugin interface
* @return application plugin interface
*/
Kate::Application *application ();
/**
* Returns the current Kate version (X.Y) or (X.Y.Z)
* @param fullVersion should full version be returned?
* @return Kate version
*/
static TQString kateVersion (bool fullVersion = true);
/**
* kate init
*/
private:
/**
* restore a old kate session
*/
void restoreKate ();
/**
* try to start kate
* @return success, if false, kate should exit
*/
bool startupKate ();
/**
* kate shutdown
*/
public:
/**
* shutdown kate application
* @param win mainwindow which is used for dialogs
*/
void shutdownKate(KateMainWindow *win);
/**
* application should exit
* @return should we exit?
*/
bool shouldExit () { return m_shouldExit; }
/**
* to be called when the application is about to quit
* @return should we exit?
*/
bool query_session_close();
/**
* called after the config dialog has been closed. The application
* can parse the new configuration and take appropriate actions if required
*/
void reparse_config();
signals:
/**
* Emitted when the configuration has or may have been changed
*/
void optionsChanged();
/**
* other accessors for global unique instances
*/
public:
/**
* accessor to plugin manager
* @return plugin manager instance
*/
KatePluginManager *pluginManager();
/**
* accessor to document manager
* @return document manager instance
*/
KateDocManager *documentManager ();
/**
* accessor to session manager
* @return session manager instance
*/
KateSessionManager *sessionManager();
/**
* window management
*/
public:
/**
* create a new main window, use given config if any for restore
* @param sconfig session config object
* @param sgroup session group for this window
* @return new constructed main window
*/
KateMainWindow *newMainWindow (TDEConfig *sconfig = 0, const TQString &sgroup = "");
/**
* removes the mainwindow given, DOES NOT DELETE IT
* @param mainWindow window to remove
*/
void removeMainWindow (KateMainWindow *mainWindow);
/**
* give back current active main window
* can only be 0 at app start or exit
* @return current active main window
*/
KateMainWindow *activeMainWindow ();
/**
* give back number of existing main windows
* @return number of main windows
*/
uint mainWindows () const;
/**
* give back the window you want
* @param n window index
* @return requested main window
*/
KateMainWindow *mainWindow (uint n);
/**
* some stuff for the dcop API
*/
public:
/**
* open url with given encoding
* used by kate if --use given
* @param url filename
* @param encoding encoding name
* @param isTempFile if set to true and the file is a local file, it will be deleted when the document is closed.
* @return success
*/
bool openURL (const KURL &url, const TQString &encoding, bool isTempFile );
/**
* position cursor in current active view
* @param line line to set
* @param column column to set
* @return success
*/
bool setCursor (int line, int column);
/**
* helper to handle stdin input
* open a new document/view, fill it with the text given
* @param text text to fill in the new doc/view
* @return success
*/
bool openInput (const TQString &text);
private:
/**
* kate's command line args
*/
TDECmdLineArgs *m_args;
/**
* plugin interface
*/
Kate::Application *m_application;
/**
* document manager
*/
KateDocManager *m_docManager;
/**
* plugin manager
*/
KatePluginManager *m_pluginManager;
/**
* session manager
*/
KateSessionManager *m_sessionManager;
/**
* known main windows
*/
TQValueList<KateMainWindow*> m_mainWindows;
/**
* dcop interface
*/
KateAppDCOPIface *m_obj;
/**
* should exit flag
*/
bool m_shouldExit;
};
#endif
|