summaryrefslogtreecommitdiffstats
path: root/kdirstat/kdirstatapp.h
blob: 25bd40d5fbc39b87f2cdbf9afb7ecf09c55cb506 (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
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
/*
 *   File name:	kdirstatapp.h
 *   Summary:	The KDirStat application - menu bar, tool bar, ...
 *   License:	GPL - See file COPYING for details.
 *
 *   Author:	Stefan Hundhammer <sh@suse.de>
 *		Parts auto-generated by KDevelop
 *
 *   Updated:	2004-12-06
 */


#ifndef KDirStatApp_h
#define KDirStatApp_h


#ifdef HAVE_CONFIG_H
#   include <config.h>
#endif

#include <kapp.h>
#include <tdemainwindow.h>
#include "kdirtree.h"


// Forward declarations
class TQPopupMenu;
class TQSplitter;

class TDEAction;
class KActivityTracker;
class KFeedbackDialog;
class KFeedbackDialog;
class KFeedbackQuestion;
class KPacMan;
class KPacMan;
class TDERecentFilesAction;
class TDEToggleAction;

namespace KDirStat
{
    class KCleanupCollection;
    class KDirTreeView;
    class KDirTreeViewItem;
    class KFileInfo;
    class KSettingsDialog;
    class KTreemapView;
    class KTreemapTile;
}

using namespace KDirStat;


/**
  * The base class for KDirStat application windows. It sets up the main window
  * and reads the config file as well as providing a menubar, toolbar and
  * statusbar. An instance of KDirStatView creates your center view, which is
  * connected to the window's Doc object.  KDirStatApp reimplements the methods
  * that TDEMainWindow provides for main window handling and supports full
  * session management as well as using TDEActions.
  *
  * @see TDEMainWindow
  * @see TDEApplication
  * @see TDEConfig
  *
  * @author Source Framework Automatically Generated by KDevelop,
  *	    (c) The KDevelop Team.
  *
  * @version KDevelop version 1.2 code generation
  **/
class KDirStatApp : public TDEMainWindow
{
    TQ_OBJECT
  

public:

    /**
     * Construtor of KDirStatApp, calls all init functions to create the
     * application.
     **/
    KDirStatApp( TQWidget* parent=0, const char* name=0 );

    /**
     * Destructor.
     **/
    virtual ~KDirStatApp();

    /**
     * Open an URL specified by command line argument.
     **/
    void openURL( const KURL & url );

    /**
     * Return the main window's @ref KDirTreeView.
     **/
    KDirTreeView * treeView() const { return _treeView; }

    /**
     * Returns the main window's @ref KTreemapView or 0 if there is none.
     *
     * Caution: Do not try to cache this value. The treemap view is destroyed
     * and re-created frequently!
     **/
    KTreemapView * treemapView() const { return _treemapView; }


public slots:

    /**
     * Open a directory tree.
     **/
    void fileAskOpenDir();

    /**
     * Open a (possibly remote) directory tree.
     **/
    void fileAskOpenUrl();

    /**
     * Refresh the entire directory tree, i.e. re-read everything from disk.
     **/
    void refreshAll();

    /**
     * Refresh the selected subtree, i.e. re-read it from disk.
     **/
    void refreshSelected();

    /**
     * Refresh the entire directory tree, i.e. re-read everything from disk.
     **/
    void stopReading();

    /**
     * Open a directory tree from the "recent" menu.
     **/
    void fileOpenRecent( const KURL& url );

    /**
     * asks for saving if the file is modified, then closes the current file
     * and window
     **/
    void fileCloseDir();

    /**
     * put the marked text/object into the clipboard
     **/
    void editCopy();

    /**
     * Notification that the view's selection has changed.
     * Enable/disable user actions as appropriate.
     **/
    void selectionChanged( KFileInfo *selection );

    /**
     * Ask user what application to open a file or directory with
     **/
    void cleanupOpenWith();

    /**
     * Toggle tool bar
     **/
    void toggleToolBar();

    /**
     * Toggle status bar
     **/
    void toggleStatusBar();

    /**
     * Toggle treemap view
     **/
    void toggleTreemapView();

    /**
     * Zoom in the treemap at the currently selected tile.
     **/
    void treemapZoomIn();

    /**
     * Zoom out the treemap after zooming in.
     **/
    void treemapZoomOut();

    /**
     * Select the parent of the currently selected treemap tile.
     **/
    void treemapSelectParent();

    /**
     * Rebuild the treemap.
     **/
    void treemapRebuild();

    /**
     * Invoke online help about treemaps.
     **/
    void treemapHelp();

    /**
     * Open settings dialog
     **/
    void preferences();

    /**
     * Changes the statusbar contents for the standard label permanently, used
     * to indicate current actions.
     *
     * @param text the text that is displayed in the statusbar
     **/
    void statusMsg( const TQString &text );

    /**
     * Opens a context menu for tree view items.
     **/
    void contextMenu( KDirTreeViewItem * item, const TQPoint &pos );

    /**
     * Opens a context menu for treemap tiles.
     **/
    void contextMenu( KTreemapTile * tile, const TQPoint &pos );

    /**
     * Create a treemap view. This makes only sense after a directory tree is
     * completely read.
     **/
    void createTreemapView();

    /**
     * Delete an existing treemap view if there is one.
     **/
    void deleteTreemapView();

    /**
     * Sends a user feedback mail.
     **/
    void sendFeedbackMail();

    /**
     * Read configuration for the main window.
     **/
    void readMainWinConfig();

    /**
     * Save the main window's configuration.
     **/
    void saveMainWinConfig();

    /**
     * Revert all cleanups to default values.
     **/
    void revertCleanupsToDefaults();

    /**
     * For the settings dialog only: Return the internal cleanup collection.
     **/
    KCleanupCollection * cleanupCollection() { return _cleanupCollection; }

    /**
     * Initialize @ref KPacMan animation in the tool bar.
     **/
    void initPacMan( bool enablePacMan = true );

    /**
     * Returns true if the pacman animation in the tool bar is enabled, false
     * otherwise.
     **/
    bool pacManEnabled() const { return _pacMan != 0; }

    /**
     * Ask user if he wouldn't like to rate this program.
     **/
    void askForFeedback();

    /**
     * Notification that a feedback mail has been sent, thus don't remind
     * the user any more.
     **/
    void feedbackMailSent();

    /**
     * Update enabled/disabled state of the user actions.
     **/
    void updateActions();


signals:

    /**
     * Emitted when the configuration is to be read - other than at program
     * startup / object creation where each object is responsible for reading
     * its configuraton at an appropriate time.
     **/
    void readConfig();

    /**
     * Emitted when the configuration is to be saved.
     **/
    void saveConfig();


protected:

    /**
     * Initialize the TDEActions of the application.
     **/
    void initActions();

    /**
     * Initialize @ref KCleanup actions.
     **/
    void initCleanups();

    /**
     * Set up status bar for the main window by initializing a status label.
     **/
    void initStatusBar();

    /**
     * Set up the activity tracker.
     **/
    void initActivityTracker();

    /**
     * Called when a main window is to be closed.
     *
     * Returns "true" when closing this window is OK, "false" to abort closing.
     **/
    virtual bool queryClose();

    /**
     * Called when the application is to be shut down alltogether, i.e. when
     * all windows are to be closed.
     *
     * Returns "true" when exiting is OK, "false" otherwise.
     **/
    virtual bool queryExit();

    /**
     * Save the window properties for each open window during session end to
     * the session config file, including saving the currently opened file by a
     * temporary filename provided by TDEApplication.
     *
     * @see KTMainWindow#saveProperties
     **/
    virtual void saveProperties( TDEConfig * config );

    /**
     * Reads session config file and restore application state including the
     * last opened files and documents by reading the temporary files saved by
     * saveProperties().
     *
     * @see KTMainWindow#readProperties
     **/
    virtual void readProperties( TDEConfig * config );


    /**
     * Add a list of features of this program to a feedback question
     **/
    void addFeatureList( KFeedbackQuestion * question );

    /**
     * Check if the user should be reminded to submit feedback.
     **/
    bool doFeedbackReminder();


    //
    // Data members
    //

    // Widgets

    TQSplitter *			_splitter;
    KDirTreeView *		    _treeView;
    KTreemapView *		    _treemapView;
    KPacMan *			_pacMan;
    TQWidget *			_pacManDelimiter;
    TQPopupMenu *		_treeViewContextMenu;
    TQPopupMenu *		_treemapContextMenu;
    KDirStat::KSettingsDialog *	_settingsDialog;
    KFeedbackDialog *		_feedbackDialog;
    KActivityTracker *		_activityTracker;


    // Actions

    TDEAction * 			_fileAskOpenDir;
    TDEAction * 			_fileAskOpenUrl;
    TDERecentFilesAction *	_fileOpenRecent;
    TDEAction * 			_fileCloseDir;
    TDEAction * 			_fileRefreshAll;
    TDEAction *			_fileRefreshSelected;
    TDEAction *			_fileContinueReadingAtMountPoint;
    TDEAction *			_fileStopReading;
    TDEAction * 			_fileQuit;
    TDEAction * 			_editCopy;
    TDEAction * 			_cleanupOpenWith;
    TDEAction *	 		_treemapZoomIn;
    TDEAction *			_treemapZoomOut;
    TDEAction *			_treemapSelectParent;
    TDEAction * 			_treemapRebuild;

    TDEAction *			_reportMailToOwner;
    TDEAction *			_helpSendFeedbackMail;
    TDEToggleAction * 		_showToolBar;
    TDEToggleAction * 		_showStatusBar;
    TDEToggleAction * 		_showTreemapView;

    KCleanupCollection *	_cleanupCollection;


    // Misc

    int				_treemapViewHeight;
};


#endif // KDirStatApp_h