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