KDirStat – a graphical disk usage utility
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

kdirstatapp.h 9.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422
  1. /*
  2. * File name: kdirstatapp.h
  3. * Summary: The KDirStat application - menu bar, tool bar, ...
  4. * License: GPL - See file COPYING for details.
  5. *
  6. * Author: Stefan Hundhammer <sh@suse.de>
  7. * Parts auto-generated by KDevelop
  8. *
  9. * Updated: 2004-12-06
  10. */
  11. #ifndef KDirStatApp_h
  12. #define KDirStatApp_h
  13. #ifdef HAVE_CONFIG_H
  14. # include <config.h>
  15. #endif
  16. #include <kapp.h>
  17. #include <tdemainwindow.h>
  18. #include "kdirtree.h"
  19. // Forward declarations
  20. class TQPopupMenu;
  21. class TQSplitter;
  22. class TDEAction;
  23. class KActivityTracker;
  24. class KFeedbackDialog;
  25. class KFeedbackDialog;
  26. class KFeedbackQuestion;
  27. class KPacMan;
  28. class KPacMan;
  29. class TDERecentFilesAction;
  30. class TDEToggleAction;
  31. namespace KDirStat
  32. {
  33. class KCleanupCollection;
  34. class KDirTreeView;
  35. class KDirTreeViewItem;
  36. class KFileInfo;
  37. class KSettingsDialog;
  38. class KTreemapView;
  39. class KTreemapTile;
  40. }
  41. using namespace KDirStat;
  42. /**
  43. * The base class for KDirStat application windows. It sets up the main window
  44. * and reads the config file as well as providing a menubar, toolbar and
  45. * statusbar. An instance of KDirStatView creates your center view, which is
  46. * connected to the window's Doc object. KDirStatApp reimplements the methods
  47. * that TDEMainWindow provides for main window handling and supports full
  48. * session management as well as using TDEActions.
  49. *
  50. * @see TDEMainWindow
  51. * @see TDEApplication
  52. * @see TDEConfig
  53. *
  54. * @author Source Framework Automatically Generated by KDevelop,
  55. * (c) The KDevelop Team.
  56. *
  57. * @version KDevelop version 1.2 code generation
  58. **/
  59. class KDirStatApp : public TDEMainWindow
  60. {
  61. Q_OBJECT
  62. public:
  63. /**
  64. * Construtor of KDirStatApp, calls all init functions to create the
  65. * application.
  66. **/
  67. KDirStatApp( TQWidget* parent=0, const char* name=0 );
  68. /**
  69. * Destructor.
  70. **/
  71. virtual ~KDirStatApp();
  72. /**
  73. * Open an URL specified by command line argument.
  74. **/
  75. void openURL( const KURL & url );
  76. /**
  77. * Return the main window's @ref KDirTreeView.
  78. **/
  79. KDirTreeView * treeView() const { return _treeView; }
  80. /**
  81. * Returns the main window's @ref KTreemapView or 0 if there is none.
  82. *
  83. * Caution: Do not try to cache this value. The treemap view is destroyed
  84. * and re-created frequently!
  85. **/
  86. KTreemapView * treemapView() const { return _treemapView; }
  87. public slots:
  88. /**
  89. * Open a directory tree.
  90. **/
  91. void fileAskOpenDir();
  92. /**
  93. * Open a (possibly remote) directory tree.
  94. **/
  95. void fileAskOpenUrl();
  96. /**
  97. * Refresh the entire directory tree, i.e. re-read everything from disk.
  98. **/
  99. void refreshAll();
  100. /**
  101. * Refresh the selected subtree, i.e. re-read it from disk.
  102. **/
  103. void refreshSelected();
  104. /**
  105. * Refresh the entire directory tree, i.e. re-read everything from disk.
  106. **/
  107. void stopReading();
  108. /**
  109. * Open a directory tree from the "recent" menu.
  110. **/
  111. void fileOpenRecent( const KURL& url );
  112. /**
  113. * asks for saving if the file is modified, then closes the current file
  114. * and window
  115. **/
  116. void fileCloseDir();
  117. /**
  118. * put the marked text/object into the clipboard
  119. **/
  120. void editCopy();
  121. /**
  122. * Notification that the view's selection has changed.
  123. * Enable/disable user actions as appropriate.
  124. **/
  125. void selectionChanged( KFileInfo *selection );
  126. /**
  127. * Ask user what application to open a file or directory with
  128. **/
  129. void cleanupOpenWith();
  130. /**
  131. * Toggle tool bar
  132. **/
  133. void toggleToolBar();
  134. /**
  135. * Toggle status bar
  136. **/
  137. void toggleStatusBar();
  138. /**
  139. * Toggle treemap view
  140. **/
  141. void toggleTreemapView();
  142. /**
  143. * Zoom in the treemap at the currently selected tile.
  144. **/
  145. void treemapZoomIn();
  146. /**
  147. * Zoom out the treemap after zooming in.
  148. **/
  149. void treemapZoomOut();
  150. /**
  151. * Select the parent of the currently selected treemap tile.
  152. **/
  153. void treemapSelectParent();
  154. /**
  155. * Rebuild the treemap.
  156. **/
  157. void treemapRebuild();
  158. /**
  159. * Invoke online help about treemaps.
  160. **/
  161. void treemapHelp();
  162. /**
  163. * Open settings dialog
  164. **/
  165. void preferences();
  166. /**
  167. * Changes the statusbar contents for the standard label permanently, used
  168. * to indicate current actions.
  169. *
  170. * @param text the text that is displayed in the statusbar
  171. **/
  172. void statusMsg( const TQString &text );
  173. /**
  174. * Opens a context menu for tree view items.
  175. **/
  176. void contextMenu( KDirTreeViewItem * item, const TQPoint &pos );
  177. /**
  178. * Opens a context menu for treemap tiles.
  179. **/
  180. void contextMenu( KTreemapTile * tile, const TQPoint &pos );
  181. /**
  182. * Create a treemap view. This makes only sense after a directory tree is
  183. * completely read.
  184. **/
  185. void createTreemapView();
  186. /**
  187. * Delete an existing treemap view if there is one.
  188. **/
  189. void deleteTreemapView();
  190. /**
  191. * Sends a user feedback mail.
  192. **/
  193. void sendFeedbackMail();
  194. /**
  195. * Read configuration for the main window.
  196. **/
  197. void readMainWinConfig();
  198. /**
  199. * Save the main window's configuration.
  200. **/
  201. void saveMainWinConfig();
  202. /**
  203. * Revert all cleanups to default values.
  204. **/
  205. void revertCleanupsToDefaults();
  206. /**
  207. * For the settings dialog only: Return the internal cleanup collection.
  208. **/
  209. KCleanupCollection * cleanupCollection() { return _cleanupCollection; }
  210. /**
  211. * Initialize @ref KPacMan animation in the tool bar.
  212. **/
  213. void initPacMan( bool enablePacMan = true );
  214. /**
  215. * Returns true if the pacman animation in the tool bar is enabled, false
  216. * otherwise.
  217. **/
  218. bool pacManEnabled() const { return _pacMan != 0; }
  219. /**
  220. * Ask user if he wouldn't like to rate this program.
  221. **/
  222. void askForFeedback();
  223. /**
  224. * Notification that a feedback mail has been sent, thus don't remind
  225. * the user any more.
  226. **/
  227. void feedbackMailSent();
  228. /**
  229. * Update enabled/disabled state of the user actions.
  230. **/
  231. void updateActions();
  232. signals:
  233. /**
  234. * Emitted when the configuration is to be read - other than at program
  235. * startup / object creation where each object is responsible for reading
  236. * its configuraton at an appropriate time.
  237. **/
  238. void readConfig();
  239. /**
  240. * Emitted when the configuration is to be saved.
  241. **/
  242. void saveConfig();
  243. protected:
  244. /**
  245. * Initialize the TDEActions of the application.
  246. **/
  247. void initActions();
  248. /**
  249. * Initialize @ref KCleanup actions.
  250. **/
  251. void initCleanups();
  252. /**
  253. * Set up status bar for the main window by initializing a status label.
  254. **/
  255. void initStatusBar();
  256. /**
  257. * Set up the activity tracker.
  258. **/
  259. void initActivityTracker();
  260. /**
  261. * Called when a main window is to be closed.
  262. *
  263. * Returns "true" when closing this window is OK, "false" to abort closing.
  264. **/
  265. virtual bool queryClose();
  266. /**
  267. * Called when the application is to be shut down alltogether, i.e. when
  268. * all windows are to be closed.
  269. *
  270. * Returns "true" when exiting is OK, "false" otherwise.
  271. **/
  272. virtual bool queryExit();
  273. /**
  274. * Save the window properties for each open window during session end to
  275. * the session config file, including saving the currently opened file by a
  276. * temporary filename provided by TDEApplication.
  277. *
  278. * @see KTMainWindow#saveProperties
  279. **/
  280. virtual void saveProperties( TDEConfig * config );
  281. /**
  282. * Reads session config file and restore application state including the
  283. * last opened files and documents by reading the temporary files saved by
  284. * saveProperties().
  285. *
  286. * @see KTMainWindow#readProperties
  287. **/
  288. virtual void readProperties( TDEConfig * config );
  289. /**
  290. * Add a list of features of this program to a feedback question
  291. **/
  292. void addFeatureList( KFeedbackQuestion * question );
  293. /**
  294. * Check if the user should be reminded to submit feedback.
  295. **/
  296. bool doFeedbackReminder();
  297. //
  298. // Data members
  299. //
  300. // Widgets
  301. TQSplitter * _splitter;
  302. KDirTreeView * _treeView;
  303. KTreemapView * _treemapView;
  304. KPacMan * _pacMan;
  305. TQWidget * _pacManDelimiter;
  306. TQPopupMenu * _treeViewContextMenu;
  307. TQPopupMenu * _treemapContextMenu;
  308. KDirStat::KSettingsDialog * _settingsDialog;
  309. KFeedbackDialog * _feedbackDialog;
  310. KActivityTracker * _activityTracker;
  311. // Actions
  312. TDEAction * _fileAskOpenDir;
  313. TDEAction * _fileAskOpenUrl;
  314. TDERecentFilesAction * _fileOpenRecent;
  315. TDEAction * _fileCloseDir;
  316. TDEAction * _fileRefreshAll;
  317. TDEAction * _fileRefreshSelected;
  318. TDEAction * _fileContinueReadingAtMountPoint;
  319. TDEAction * _fileStopReading;
  320. TDEAction * _fileQuit;
  321. TDEAction * _editCopy;
  322. TDEAction * _cleanupOpenWith;
  323. TDEAction * _treemapZoomIn;
  324. TDEAction * _treemapZoomOut;
  325. TDEAction * _treemapSelectParent;
  326. TDEAction * _treemapRebuild;
  327. TDEAction * _reportMailToOwner;
  328. TDEAction * _helpSendFeedbackMail;
  329. TDEToggleAction * _showToolBar;
  330. TDEToggleAction * _showStatusBar;
  331. TDEToggleAction * _showTreemapView;
  332. KCleanupCollection * _cleanupCollection;
  333. // Misc
  334. int _treemapViewHeight;
  335. };
  336. #endif // KDirStatApp_h