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