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
00064 QString name() const;
00065 QString text() const;
00066 QString plainText() const;
00067
00068 void setName( const QString& name );
00069 void setText( const QString& text );
00070
00071 QColor fgColor() const;
00072 QColor bgColor() const;
00073 void setColor( const QColor& fg, const QColor& bg );
00074
00075 void find( const QString& pattern, long options );
00076
00077 bool isModified() const;
00078
00079 void sync( const QString& app );
00080 bool isNew( const QString& app ) const;
00081 bool isModified( const QString& app ) const;
00082
00083 static void setStyle( int style );
00084
00085 void deleteWhenIdle();
00086
00087 public slots:
00088 void slotKill( bool force = false );
00089
00090 signals:
00091 void sigRequestNewNote();
00092 void sigShowNextNote();
00093 void sigNameChanged();
00094 void sigDataChanged();
00095 void sigColorChanged();
00096 void sigKillNote( KCal::Journal* );
00097
00098 void sigFindFinished();
00099
00100 protected:
00101 virtual void drawFrame( QPainter* );
00102 virtual void showEvent( QShowEvent* );
00103 virtual void resizeEvent( QResizeEvent* );
00104 virtual void closeEvent( QCloseEvent* );
00105 virtual void dropEvent( QDropEvent* );
00106 virtual void dragEnterEvent( QDragEnterEvent* );
00107
00108 virtual bool event( QEvent* );
00109 virtual bool eventFilter( QObject*, QEvent* );
00110
00111 virtual bool focusNextPrevChild( bool );
00112
00114 void aboutToEnterEventLoop();
00115 void eventLoopLeft();
00116
00117 private slots:
00118 void slotRename();
00119 void slotUpdateReadOnly();
00120 void slotClose();
00121
00122 void slotSend();
00123 void slotMail();
00124 void slotPrint();
00125 void slotSaveAs();
00126
00127 void slotInsDate();
00128 void slotSetAlarm();
00129
00130 void slotPreferences();
00131 void slotPopupActionToDesktop( int id );
00132
00133 void slotFindNext();
00134 void slotHighlight( const QString& txt, int idx, int len );
00135
00136 void slotApplyConfig();
00137 void slotUpdateKeepAboveBelow();
00138 void slotUpdateShowInTaskbar();
00139 void slotUpdateDesktopActions();
00140
00141 void slotUpdateViewport( int, int );
00142
00143 private:
00144 void updateFocus();
00145 void updateMask();
00146 void updateLayout();
00147 void updateLabelAlignment();
00148 void updateBackground( int offset = -1 );
00149
00150 void createFold();
00151
00152 void toDesktop( int desktop );
00153
00154 QString toPlainText( const QString& );
00155
00156 private:
00157 QLabel *m_label, *m_pushpin, *m_fold;
00158 KNoteButton *m_button;
00159 KToolBar *m_tool;
00160 KNoteEdit *m_editor;
00161
00162 KNoteConfig *m_config;
00163 KCal::Journal *m_journal;
00164
00165 KFind *m_find;
00166
00167 KPopupMenu *m_menu;
00168 KPopupMenu *m_edit_menu;
00169
00170 KToggleAction *m_readOnly;
00171
00172 KListAction *m_toDesktop;
00173 KToggleAction *m_keepAbove;
00174 KToggleAction *m_keepBelow;
00175
00176 KSharedConfig::Ptr m_kwinConf;
00177
00178 static int s_ppOffset;
00179
00180 int m_busy;
00181 bool m_deleteWhenIdle;
00182 };
00183
00184 #endif
|