summaryrefslogtreecommitdiffstats
path: root/kcron/ktapp.h
blob: 37a830b632b85afe860287ccc72a2fe958b2a00c (plain)
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
262
263
264
265
266
267
/***************************************************************************
 *   KT application header.                                                *
 *   --------------------------------------------------------------------  *
 *   Copyright (C) 1999, Gary Meyer <gary@meyer.net>                       *
 *   --------------------------------------------------------------------  *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   * 
 ***************************************************************************/

#ifndef KTAPP_H
#define KTAPP_H
 
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include <kmainwindow.h>

class KAction;
class QString;
class KTView;
class CTHost;

/**
  * Application that sets up the main window, reads the config file,
  * sets up the menu bar, toolbar, and status bar.  Obtains the document
  * (here the crontab entries) and give it to the view for display.
  *
  * Provides main window handling, session management and keyboard
  * acceleration.
  */
class KTApp : public KMainWindow
{
  Q_OBJECT

  friend class KTView;

public:

  // Menu constants
  enum editEntries
  { 
    menuEditNew=4,
    menuEditModify,
    menuEditDelete,
    menuEditEnabled=8,
    menuEditRunNow=10
  };
  
  enum settingsEntries
  {
    menuSettingsShowToolBar,
    menuSettingsShowStatusBar
  };
  
  static const int statusMessage;
  
/**
  * Initialize the application.
  */
  KTApp();

/**
  * Quit the application..
  */
  ~KTApp();

/**
 * Additional init
 */
 bool init();

/**
  * Returns a reference to the document.
  */	
  const CTHost& getCTHost() const; 	

protected:

/** Called on window close event.  Asks the document if it is dirty
  * and if so, prompts the user for saving before exiting..
  */
  virtual bool queryClose();

/** Called when the last window of the application is going to be
  * closed.  Saves options.
  */
  virtual bool queryExit();

public slots:

/**
  * Switch argument for status ar help entries on slot selection. Add your
  * ID's help here for toolbars and menubar entries. This
  * function is only for the edit menu
  */
  void statusEditCallback(int id_);

/**
  * Switch argument for status ar help entries on slot selection. Add your
  * ID's help here for toolbars and menubar entries. This
  * function is only for the settings menu
  */
  void statusSettingsCallback(int id_);

/**
  * Save document.
  */
  void slotFileSave();

/**
  * Print document.
  */
  void slotFilePrint();

/**
  * Close all open windows then quits the application.  If queryClose()
  * returns false because the user canceled the saveModified() dialog, the
  * closing breaks.
  */
  void slotFileQuit();

/**
  * Pop up an edit menu.
  */
  void slotEdit(const TQPoint& qp);

/**
  * Put the marked objects on the clipboard and remove it from the
  * document.
  */
  void slotEditCut();

/**
  * Put the marked objects on the clipboard.
  */
  void slotEditCopy();

/**
  * Paste the object on clipboard into the document
  */
  void slotEditPaste();

/**
  * New.
  */
  void slotEditNew();

/**
  * Modify.
  */
  void slotEditModify();

/**
  * Delete.
  */
  void slotEditDelete();

/**
  * Toggle enabled.
  */
  void slotEditEnable();

/**
  * Run program now.
  */
  void slotEditRunNow();

/**
  * Toggle the toolbar being visible.
  */
  void slotViewToolBar();

/**
  * Toggles the status bar being visible.
  */
  void slotViewStatusBar();

/**
  * Changes the status bar contents for the standard label permanently;
  * used to indicate current actions.
  */
  void slotStatusMsg(const TQString & text);

/**
  * Changes the status message of the whole status bar for two seconds,
  * then restores the last status. This is used to display status bar
  * messages that give information about actions for toolbar icons and
  * menu entries.
  */
  void slotStatusHelpMsg(const TQString & text);

/** Enables/disables modification buttons
  */
  void slotEnableModificationButtons(bool);

/** Enables/disables paste button
  */
  void slotEnablePaste(bool);

/** Enables/disables "Run now"
  */
   void slotEnableRunNow(bool);

/** Enables/disables "Activated"
  */
  void slotEnableEnabled(bool);

private:

/**
  * Disabled copy constructor.
  */
  KTApp(const KTApp& source);

/**
  * Disabled assignment operator.
  */
  void operator = (const KTApp& source);

/**
  * Get application caption.
  */
  TQString caption();

/**
  * Initialize actions.
  */
  void setupActions();

/**
  * Initialize status bar.
  */
  void initStatusBar();

/**
  * Read general options again and initialize all variables like the
  * geometry.
  */
  void readOptions();

/**
  * Save general options like all bar positions and status as well as the
  * geometry to the configuration file.
  */ 	
  void saveOptions();

/**
  * Configuration object of the application.
  */
  KConfig* config;

/**
  * Main GUI view/working area.
  */
  KTView* view;

/**
  * Document object, here crotab enries.
  */
  CTHost* cthost;

};

#endif // KTAPP_H