TDE personal information management applications
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.
 
 
 
 
 
 

190 lines
4.6 KiB

  1. /*******************************************************************
  2. KNotes -- Notes for the KDE project
  3. Copyright (c) 1997-2006, The KNotes Developers
  4. This program is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU General Public License
  6. as published by the Free Software Foundation; either version 2
  7. of the License, or (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, write to the Free Software
  14. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  15. *******************************************************************/
  16. #ifndef KNOTE_H
  17. #define KNOTE_H
  18. #include <tqstring.h>
  19. #include <tqevent.h>
  20. #include <tqframe.h>
  21. #include <tqpoint.h>
  22. #include <tqcolor.h>
  23. #include <tdeconfig.h>
  24. #include <kxmlguiclient.h>
  25. class TQLabel;
  26. class KXMLGUIBuilder;
  27. class KFind;
  28. class TDEPopupMenu;
  29. class KNoteButton;
  30. class KNoteEdit;
  31. class KNoteConfig;
  32. class TDEToolBar;
  33. class TDEListAction;
  34. class TDEToggleAction;
  35. namespace KCal {
  36. class Journal;
  37. }
  38. class KNote : public TQFrame, virtual public KXMLGUIClient
  39. {
  40. Q_OBJECT
  41. public:
  42. KNote( TQDomDocument buildDoc, KCal::Journal *journal, TQWidget *parent = 0,
  43. const char *name = 0 );
  44. ~KNote();
  45. void changeJournal(KCal::Journal *);
  46. void saveData( bool update = true);
  47. void saveConfig() const;
  48. TQString noteId() const;
  49. TQString name() const;
  50. TQString text() const;
  51. TQString plainText() const;
  52. void setName( const TQString& name );
  53. void setText( const TQString& text );
  54. TQColor fgColor() const;
  55. TQColor bgColor() const;
  56. void setColor( const TQColor& fg, const TQColor& bg );
  57. void find( const TQString& pattern, long options );
  58. bool isModified() const;
  59. TQDateTime getLastModified() const;
  60. void sync( const TQString& app );
  61. bool isNew( const TQString& app ) const;
  62. bool isModified( const TQString& app ) const;
  63. static void setStyle( int style );
  64. void deleteWhenIdle();
  65. void blockEmitDataChanged( bool _b ) { m_blockEmitDataChanged = _b;}
  66. public slots:
  67. void slotKill( bool force = false );
  68. signals:
  69. void sigRequestNewNote();
  70. void sigShowNextNote();
  71. void sigNameChanged();
  72. void sigDataChanged(const TQString &);
  73. void sigColorChanged();
  74. void sigKillNote( KCal::Journal* );
  75. void sigFindFinished();
  76. protected:
  77. virtual void drawFrame( TQPainter* );
  78. virtual void showEvent( TQShowEvent* );
  79. virtual void resizeEvent( TQResizeEvent* );
  80. virtual void closeEvent( TQCloseEvent* );
  81. virtual void dropEvent( TQDropEvent* );
  82. virtual void dragEnterEvent( TQDragEnterEvent* );
  83. virtual bool event( TQEvent* );
  84. virtual bool eventFilter( TQObject*, TQEvent* );
  85. virtual bool focusNextPrevChild( bool );
  86. /// Protect against deletion while we are running a sub-eventloop
  87. void aboutToEnterEventLoop();
  88. void eventLoopLeft();
  89. private slots:
  90. void slotRename();
  91. void slotUpdateReadOnly();
  92. void slotClose();
  93. void slotSend();
  94. void slotMail();
  95. void slotPrint();
  96. void slotSaveAs();
  97. void slotInsDate();
  98. void slotSetAlarm();
  99. void slotPreferences();
  100. void slotPopupActionToDesktop( int id );
  101. void slotFindNext();
  102. void slotHighlight( const TQString& txt, int idx, int len );
  103. void slotApplyConfig();
  104. void slotUpdateKeepAboveBelow();
  105. void slotUpdateShowInTaskbar();
  106. void slotUpdateDesktopActions();
  107. void slotUpdateViewport( int, int );
  108. void slotRequestNewNote();
  109. void slotSaveData();
  110. private:
  111. void updateFocus();
  112. void updateMask();
  113. void updateLayout();
  114. void updateLabelAlignment();
  115. void updateBackground( int offset = -1 );
  116. void createFold();
  117. void toDesktop( int desktop );
  118. TQString toPlainText( const TQString& );
  119. private:
  120. TQLabel *m_label, *m_pushpin, *m_fold;
  121. KNoteButton *m_button;
  122. TDEToolBar *m_tool;
  123. KNoteEdit *m_editor;
  124. KNoteConfig *m_config;
  125. KCal::Journal *m_journal;
  126. KFind *m_find;
  127. TDEPopupMenu *m_menu;
  128. TDEPopupMenu *m_edit_menu;
  129. TDEToggleAction *m_readOnly;
  130. TDEListAction *m_toDesktop;
  131. TDEToggleAction *m_keepAbove;
  132. TDEToggleAction *m_keepBelow;
  133. TDESharedConfig::Ptr m_twinConf;
  134. static int s_ppOffset;
  135. int m_busy;
  136. bool m_deleteWhenIdle;
  137. bool m_blockEmitDataChanged;
  138. };
  139. #endif