knotes
knote.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef KNOTE_H
00022 #define KNOTE_H
00023
00024 #include <qstring.h>
00025 #include <qevent.h>
00026 #include <qframe.h>
00027 #include <qpoint.h>
00028 #include <qcolor.h>
00029
00030 #include <kconfig.h>
00031 #include <kxmlguiclient.h>
00032
00033 class QLabel;
00034
00035 class KXMLGUIBuilder;
00036
00037 class KFind;
00038 class KPopupMenu;
00039 class KNoteButton;
00040 class KNoteEdit;
00041 class KNoteConfig;
00042 class KToolBar;
00043 class KListAction;
00044 class KToggleAction;
00045
00046 namespace KCal {
00047 class Journal;
00048 }
00049
00050
00051 class KNote : public QFrame, virtual public KXMLGUIClient
00052 {
00053 Q_OBJECT
00054 public:
00055 KNote( QDomDocument buildDoc, KCal::Journal *journal, QWidget *parent = 0,
00056 const char *name = 0 );
00057 ~KNote();
00058
00059 void saveData();
00060 void saveConfig() const;
00061
00062 QString noteId() const;
00063 QString name() const;
00064 QString text() const;
00065 QString plainText() const;
00066
00067 void setName( const QString& name );
00068 void setText( const QString& text );
00069
00070 void find( const QString& pattern, long options );
00071
00072 bool isModified() const;
00073
00074 void sync( const QString& app );
00075 bool isNew( const QString& app ) const;
00076 bool isModified( const QString& app ) const;
00077
00078 static void setStyle( int style );
00079
00080 public slots:
00081 void slotKill( bool force = false );
00082
00083 signals:
00084 void sigRequestNewNote();
00085 void sigShowNextNote();
00086 void sigNameChanged();
00087 void sigDataChanged();
00088 void sigColorChanged();
00089 void sigKillNote( KCal::Journal* );
00090
00091 void sigFindFinished();
00092
00093 protected:
00094 virtual void drawFrame( QPainter* );
00095 virtual void showEvent( QShowEvent* );
00096 virtual void resizeEvent( QResizeEvent* );
00097 virtual void closeEvent( QCloseEvent* );
00098 virtual void dropEvent( QDropEvent* );
00099 virtual void dragEnterEvent( QDragEnterEvent* );
00100
00101 virtual bool event( QEvent* );
00102 virtual bool eventFilter( QObject*, QEvent* );
00103
00104 virtual bool focusNextPrevChild( bool );
00105
00106 private slots:
00107 void slotRename();
00108 void slotUpdateReadOnly();
00109 void slotClose();
00110
00111 void slotSend();
00112 void slotMail();
00113 void slotPrint();
00114 void slotSaveAs();
00115
00116 void slotInsDate();
00117 void slotSetAlarm();
00118
00119 void slotPreferences();
00120 void slotPopupActionToDesktop( int id );
00121
00122 void slotFindNext();
00123 void slotHighlight( const QString& txt, int idx, int len );
00124
00125 void slotApplyConfig();
00126 void slotUpdateKeepAboveBelow();
00127 void slotUpdateShowInTaskbar();
00128 void slotUpdateDesktopActions();
00129
00130 void slotUpdateViewport( int, int );
00131
00132 private:
00133 void updateFocus();
00134 void updateMask();
00135 void updateLayout();
00136 void updateLabelAlignment();
00137 void updateBackground( int offset = -1 );
00138
00139 void setColor( const QColor&, const QColor& );
00140
00141 void createFold();
00142
00143 void toDesktop( int desktop );
00144
00145 QString toPlainText( const QString& );
00146
00147 private:
00148 QLabel *m_label, *m_pushpin, *m_fold;
00149 KNoteButton *m_button;
00150 KToolBar *m_tool;
00151 KNoteEdit *m_editor;
00152
00153 KNoteConfig *m_config;
00154 KCal::Journal *m_journal;
00155
00156 KFind *m_find;
00157
00158 KPopupMenu *m_menu;
00159 KPopupMenu *m_edit_menu;
00160
00161 KToggleAction *m_readOnly;
00162
00163 KListAction *m_toDesktop;
00164 KToggleAction *m_keepAbove;
00165 KToggleAction *m_keepBelow;
00166
00167 KSharedConfig::Ptr m_kwinConf;
00168
00169 static int s_ppOffset;
00170 };
00171
00172 #endif
|