KnowIt – tool for managing notes
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.

knowit.h 8.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. /***************************************************************************
  2. knowit.h - description
  3. -------------------
  4. begin : czw wrz 26 08:27:40 CEST 2002
  5. copyright : (C) 2002-2004 by Micha³ Rudolf
  6. email : mrudolf@kdewebdev.org
  7. ***************************************************************************/
  8. /***************************************************************************
  9. * *
  10. * This program is free software; you can redistribute it and/or modify *
  11. * it under the terms of the GNU General Public License as published by *
  12. * the Free Software Foundation; either version 2 of the License, or *
  13. * (at your option) any later version. *
  14. * *
  15. ***************************************************************************/
  16. #ifndef KNOWIT_H
  17. #define KNOWIT_H
  18. #ifdef HAVE_CONFIG_H
  19. #include <config.h>
  20. #endif
  21. #include <tqurloperator.h>
  22. #include <keditcl.h>
  23. #include <tdelocale.h>
  24. #include <tdemainwindow.h>
  25. #include <kurl.h>
  26. #include "knowitpref.h"
  27. #include "knowitchooser.h"
  28. #include "knowitedit.h"
  29. #include "knowitlink.h"
  30. #include "notes.h"
  31. class TQSplitter;
  32. class TQTimer;
  33. class TDEAction;
  34. class TDEConfig;
  35. class TDEListBox;
  36. class TDEToggleAction;
  37. class TDERecentFilesAction;
  38. class KnowitTray;
  39. class KnowitEdit;
  40. class KnowitTree;
  41. /** Knowit is the base class of the project */
  42. class Knowit : public TDEMainWindow
  43. {
  44. Q_OBJECT
  45. private:
  46. static const TQString Untitled;
  47. TDEConfig *config;
  48. TQSplitter* Layout;
  49. KnowitTree* Items;
  50. TDEListBox* Links;
  51. KnowitEdit* Edit;
  52. KURL filename;
  53. TQPixmap pixmapFolder, pixmapFolderText, pixmapText, pixmapEmpty;
  54. KEdFind FindDlg;
  55. KnowitOptions Options;
  56. KnowitPreferences PrefDlg;
  57. KnowitChooser ChooserDlg;
  58. KnowitLinkDialog LinkDlg;
  59. KnowitTray* systray;
  60. /* data items */
  61. TNotesCollection Notes;
  62. bool runMinimized;
  63. TQListViewItem* lastSought;
  64. TQString soughtText;
  65. TQTimer* AutosaveTimer;
  66. /* for saving backups */
  67. TQUrlOperator URLOperator;
  68. /* false by default, set to true on queryClose() */
  69. bool shuttingDown;
  70. /* actions */
  71. TDERecentFilesAction *actionRecent;
  72. TDEToggleAction *actionBold, *actionItalic, *actionUnderline,
  73. *actionEditAlignLeft, *actionEditAlignRight, *actionEditAlignCenter,
  74. *actionEditAlignJustify, *actionRawTextMode;
  75. TDEAction *actionCut, *actionCopy, *actionUndo, *actionRedo;
  76. /** Insert/Overwrite status */
  77. enum {StatusText = 1, StatusOvr = 2};
  78. public:
  79. /** Constructor of main window */
  80. Knowit(TQWidget* parent=0, const char *name=0);
  81. /** Standard destructor */
  82. ~Knowit();
  83. /** Opens document */
  84. bool open(const KURL& fname);
  85. /** Saves document */
  86. bool save(const KURL& fname);
  87. /** Removes all data, creante new document */
  88. void reset();
  89. /** Checks if file was changed since last save, if so,
  90. user is prompted to save changes */
  91. virtual bool queryClose();
  92. /** Saves options and exits */
  93. virtual bool queryExit();
  94. /** Reads configuration from disk */
  95. void readOptions();
  96. /** Saves configuration to disk */
  97. void saveOptions();
  98. /** Finds and shows next occurence of currently sought text
  99. - or show message that it couldn't be found */
  100. void find(TQListViewItem* start = 0);
  101. /** Returns true if notes or current text were modified */
  102. bool modified();
  103. /** Reimplemented from TQWidget to prevent from closing when docked */
  104. virtual void closeEvent(TQCloseEvent* e);
  105. /** Apply current configuration */
  106. void applyOptions(const KnowitOptions& O, bool store = true);
  107. /** Returns current note */
  108. TNote* currentNote() const;
  109. public slots:
  110. /** Status bar text has changed - displays it */
  111. void slotStatusMsg(const TQString& text);
  112. /** Shows requested popup menu for notes */
  113. void slotContextMenu(TDEListView*, TQListViewItem*, const TQPoint&);
  114. /** Shows given note */
  115. void slotNoteChanged(TQListViewItem* item);
  116. /** Add same-level note */
  117. void slotNoteAdd();
  118. /** Adds subnote */
  119. void slotNoteAddChild();
  120. /** Changes note's name */
  121. void slotNoteRename();
  122. /** Removes current note */
  123. void slotNoteRemove();
  124. /** Sort subnotes */
  125. void slotNoteSort();
  126. /** Move note up */
  127. void slotNoteMoveUp();
  128. /** Move note down */
  129. void slotNoteMoveDown();
  130. /** Move note at the beginning of current list */
  131. void slotNoteMoveBegin();
  132. /** Move note at the end of current list */
  133. void slotNoteMoveEnd();
  134. /** Move note level up */
  135. void slotNoteMoveLeft();
  136. /** Move note level down */
  137. void slotNoteMoveRight();
  138. /** Current item has changed - updates associated text and shows next */
  139. void slotItemChanged(TQListViewItem*);
  140. /** Resets to a new file */
  141. void slotFileNew();
  142. /** Prompts for a file to open and opens it */
  143. void slotFileOpen();
  144. /** Opens selected of recent files */
  145. void slotFileRecent(const KURL&);
  146. /** Saves file using previous name */
  147. void slotFileSave();
  148. /** Autosaves file using previous name */
  149. void slotFileAutosave();
  150. /** Prompts for filename and saves file */
  151. void slotFileSaveAs();
  152. /** Exports all notes to HTML */
  153. void slotFileExport();
  154. /** Prints current note */
  155. void slotFilePrint();
  156. /** Shows basic file statistics */
  157. void slotFileInfo();
  158. /** Quits KnowIt */
  159. void slotFileQuit();
  160. /** Turns bold in edit window on/off */
  161. void slotEditBold();
  162. /** Turns italic in edit window on/off */
  163. void slotEditItalic();
  164. /** Turns underlining in edit window on/off */
  165. void slotEditUnderline();
  166. /** Changes color of selected/current text */
  167. void slotEditColor();
  168. /** Changes vertical alignment to superscript */
  169. void slotEditSuperscript();
  170. /** Changes vertical alignment to subscript */
  171. void slotEditSubscript();
  172. /** Restores normal vertical alignment */
  173. void slotEditNormal();
  174. /** Prompts for text and shows note containing it */
  175. void slotEditFind();
  176. /** Shows next note with sought text */
  177. void slotEditFindNext();
  178. /** Shows note with given title */
  179. void slotEditGoTo();
  180. /** Aligns text to the left */
  181. void slotEditAlignLeft();
  182. /** Aligns text to the right */
  183. void slotEditAlignRight();
  184. /** Justifies text */
  185. void slotEditAlignJustify();
  186. /** Centers text */
  187. void slotEditAlignCenter();
  188. /** Change selected paragraphs to list. Warning: uses obsolete TQt function */
  189. void slotEditListBullet();
  190. void slotEditListNumber();
  191. void slotEditListUpper();
  192. void slotEditListLower();
  193. void slotEditListNone();
  194. /** Inserts current date */
  195. void slotEditInsertDate();
  196. /** Inserts file into editor */
  197. void slotEditInsertFile();
  198. /** Switches active window (notes/editor) */
  199. void slotEditSwitch();
  200. /** Edited text has changed - update bold/italic/... status */
  201. void slotEditChanged();
  202. /** Cursor position has changed - update bold/italic/... status */
  203. void slotEditCursorChanged(int para, int pos);
  204. /** Shows options dialog */
  205. void slotOptions();
  206. /** Shows shortcut configuration dialog */
  207. void slotOptionsKeys();
  208. /** Shows toolbar configuration dialog */
  209. void slotOptionsToolbar();
  210. /** Removes KnowIt from Applet Tray */
  211. void slotUndock();
  212. /** Shows tip of the day */
  213. void slotHelpTip();
  214. /** Updates available commands */
  215. void slotActionUpdate();
  216. /** Text Insert mode changed, called from statusbar */
  217. void slotOverwriteModeChange(int);
  218. /** Text Insert mode changed, called from Shortcut Key */
  219. void slotOverwriteModeChange();
  220. /** Toggles raw text/rich text edit mode */
  221. void slotRawTextMode();
  222. /** Shows requested popup menu for links */
  223. void slotContextLinksMenu(TQListBoxItem* item, const TQPoint&);
  224. /** show current attachment **/
  225. void slotShowAttachment(TQListBoxItem* i);
  226. /** Add link **/
  227. void slotLinkAdd();
  228. /** Handle dropped link **/
  229. void slotLinkDropped(const TQString& s, int flags);
  230. /** Remove link **/
  231. void slotLinkRemove();
  232. /** Open link **/
  233. void slotLinkOpen();
  234. /** Open link with selected application **/
  235. void slotLinkOpenWith();
  236. /** Modify link **/
  237. void slotLinkModify();
  238. /** Copy link location **/
  239. void slotLinkCopy();
  240. };
  241. #endif