korganizer

journalentry.h

00001 /*
00002     This file is part of KOrganizer.
00003     Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
00004     Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com>
00005 
00006     This program is free software; you can redistribute it and/or modify
00007     it under the terms of the GNU General Public License as published by
00008     the Free Software Foundation; either version 2 of the License, or
00009     (at your option) any later version.
00010 
00011     This program is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00014     GNU General Public License for more details.
00015 
00016     You should have received a copy of the GNU General Public License
00017     along with this program; if not, write to the Free Software
00018     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00019 
00020     As a special exception, permission is given to link this program
00021     with any edition of Qt, and distribute the resulting executable,
00022     without including the source code for Qt in the source distribution.
00023 */
00024 #ifndef JOURNALENTRY_H
00025 #define JOURNALENTRY_H
00026 //
00027 // Widget showing one Journal entry
00028 
00029 #include <qvbox.h>
00030 
00031 class QLabel;
00032 class KActiveLabel;
00033 class QCheckBox;
00034 class QGridLayout;
00035 class KLineEdit;
00036 class KTextEdit;
00037 class KTimeEdit;
00038 class QButton;
00039 namespace KOrg {
00040 class IncidenceChangerBase;
00041 }
00042 using namespace KOrg;
00043 namespace KCal {
00044   class Calendar;
00045   class Journal;
00046 }
00047 using namespace KCal;
00048 
00049 class JournalEntry : public QWidget {
00050     Q_OBJECT
00051   public:
00052     typedef ListBase<JournalEntry> List;
00053 
00054     JournalEntry( Journal* j, QWidget *parent );
00055     virtual ~JournalEntry();
00056 
00057     void setJournal(Journal *);
00058     Journal *journal() const { return mJournal; }
00059 
00060     QDate date() const { return mDate; }
00061 
00062     void clear();
00063     void readJournal( Journal *j );
00064 
00065     bool isReadOnly() const { return mReadOnly; }
00066     void setReadOnly( bool readonly );
00067 
00068   protected slots:
00069     void setDirty();
00070     void deleteItem();
00071     void editItem();
00072     void timeCheckBoxToggled(bool on);
00073   public slots:
00074     void setIncidenceChanger( IncidenceChangerBase *changer ) { mChanger = changer; }
00075     void setDate(const QDate &);
00076     void flushEntry();
00077 
00078   signals:
00079     void deleteIncidence( Incidence * );
00080     void editIncidence( Incidence * );
00081 
00082   protected:
00083     void clearFields();
00084     bool eventFilter( QObject *o, QEvent *e );
00085 
00086     void writeJournal();
00087 
00088   private:
00089     void writeJournalPrivate( Journal *j );
00090 
00091     Journal *mJournal;
00092     QDate mDate;
00093     bool mReadOnly;
00094 
00095     QLabel *mTitleLabel;
00096     KLineEdit *mTitleEdit;
00097     KTextEdit *mEditor;
00098     QCheckBox *mTimeCheck;
00099     KTimeEdit *mTimeEdit;
00100     QButton *mDeleteButton;
00101     QButton *mEditButton;
00102 
00103     QGridLayout *mLayout;
00104 
00105     bool mDirty;
00106     bool mWriteInProgress;
00107     IncidenceChangerBase *mChanger;
00108 };
00109 
00110 
00111 class JournalDateEntry : public QVBox {
00112     Q_OBJECT
00113   public:
00114     typedef ListBase<JournalDateEntry> List;
00115 
00116     JournalDateEntry( Calendar *, QWidget *parent );
00117     virtual ~JournalDateEntry();
00118 
00119     void addJournal( Journal * );
00120     Journal::List journals() const;
00121 
00122     void setDate( const QDate & );
00123     QDate date() const { return mDate; }
00124 
00125     void clear();
00126 
00127 
00128   signals:
00129     void setIncidenceChangerSignal( IncidenceChangerBase *changer );
00130     void setDateSignal( const QDate & );
00131     void flushEntries();
00132     void editIncidence( Incidence * );
00133     void deleteIncidence( Incidence * );
00134     void newJournal( const QDate & );
00135 
00136   public slots:
00137     void emitNewJournal();
00138     void setIncidenceChanger( IncidenceChangerBase *changer );
00139     void journalEdited( Journal* );
00140     void journalDeleted( Journal* );
00141 
00142   private:
00143     Calendar *mCalendar;
00144     QDate mDate;
00145     QMap<Journal*,JournalEntry*> mEntries;
00146 
00147     KActiveLabel *mTitle;
00148     QWidget *mAddBar;
00149     IncidenceChangerBase *mChanger;
00150 };
00151 
00152 
00153 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys