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.
 
 
 
 
 
 

172 lines
4.5 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 KNOTESAPP_H
  17. #define KNOTESAPP_H
  18. #include <tqstring.h>
  19. #include <tqdict.h>
  20. #include <tqptrlist.h>
  21. #include <tqlabel.h>
  22. #include <tqdom.h>
  23. #include <tdeapplication.h>
  24. #include <kxmlguiclient.h>
  25. #include "KNotesAppIface.h"
  26. class KFind;
  27. class KNote;
  28. class TDEPopupMenu;
  29. class TDEAction;
  30. class TDEActionMenu;
  31. class TDEGlobalAccel;
  32. class KXMLGUIFactory;
  33. class KXMLGUIBuilder;
  34. class KNotesAlarm;
  35. class KNotesResourceManager;
  36. namespace KCal {
  37. class Journal;
  38. }
  39. namespace KNetwork {
  40. class TDEServerSocket;
  41. }
  42. class KNotesApp : public TQLabel, public KSessionManaged, virtual public KXMLGUIClient,
  43. virtual public KNotesAppIface
  44. {
  45. Q_OBJECT
  46. public:
  47. KNotesApp();
  48. ~KNotesApp();
  49. void showNote( const TQString& id ) const;
  50. void hideNote( const TQString& id ) const;
  51. void killNote( const TQString& id );
  52. void killNote( const TQString& id, bool force );
  53. TQString name( const TQString& id ) const;
  54. TQString text( const TQString& id ) const;
  55. void setName( const TQString& id, const TQString& newName );
  56. void setText( const TQString& id, const TQString& newText );
  57. TQString fgColor( const TQString& id ) const;
  58. TQString bgColor( const TQString& id ) const;
  59. void setColor( const TQString& id, const TQString& fgColor,
  60. const TQString& bgColor );
  61. TQMap<TQString,TQString> notes() const;
  62. int width( const TQString& noteId ) const;
  63. int height( const TQString& noteId ) const;
  64. void move( const TQString& noteId, int x, int y ) const;
  65. void resize( const TQString& noteId, int width, int height ) const;
  66. void sync( const TQString& app );
  67. bool isNew( const TQString& app, const TQString& id ) const;
  68. bool isModified( const TQString& app, const TQString& id ) const;
  69. TQDateTime getLastModified( const TQString& noteId ) const;
  70. bool commitData( TQSessionManager& );
  71. public slots:
  72. TQString newNote( const TQString& name = TQString(),
  73. const TQString& text = TQString() );
  74. TQString newNoteFromClipboard( const TQString& name = TQString() );
  75. void hideAllNotes() const;
  76. void showAllNotes() const;
  77. protected:
  78. void mousePressEvent( TQMouseEvent* );
  79. void resizeEvent ( TQResizeEvent * );
  80. void showEvent ( TQShowEvent * );
  81. protected slots:
  82. void slotShowNote();
  83. void slotWalkThroughNotes();
  84. void slotOpenFindDialog();
  85. void slotFindNext();
  86. void slotPreferences();
  87. void slotConfigureAccels();
  88. void slotNoteKilled( KCal::Journal *journal );
  89. void slotQuit();
  90. private:
  91. void showNote( KNote *note ) const;
  92. void saveConfigs();
  93. void resizeTrayIcon();
  94. private slots:
  95. void acceptConnection();
  96. void saveNotes();
  97. void saveNotes( const TQString & uid );
  98. void updateNoteActions();
  99. void updateGlobalAccels();
  100. void updateNetworkListener();
  101. void updateStyle();
  102. void createNote( KCal::Journal *journal );
  103. void killNote( KCal::Journal *journal );
  104. private:
  105. class KNoteActionList : public TQPtrList<TDEAction>
  106. {
  107. public:
  108. virtual int compareItems( TQPtrCollection::Item s1, TQPtrCollection::Item s2 );
  109. };
  110. KNotesResourceManager *m_manager;
  111. KNotesAlarm *m_alarm;
  112. KNetwork::TDEServerSocket *m_listener;
  113. TQDict<KNote> m_noteList;
  114. KNoteActionList m_noteActions;
  115. KFind *m_find;
  116. TQDictIterator<KNote> *m_findPos;
  117. TDEPopupMenu *m_note_menu;
  118. TDEPopupMenu *m_context_menu;
  119. TDEGlobalAccel *m_globalAccel;
  120. KXMLGUIFactory *m_guiFactory;
  121. KXMLGUIBuilder *m_guiBuilder;
  122. TQDomDocument m_noteGUI;
  123. TDEAction *m_findAction;
  124. TQString m_noteUidModify;
  125. };
  126. #endif