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 printItem();
00073     void timeCheckBoxToggled(bool on);
00074   public slots:
00075     void setIncidenceChanger( IncidenceChangerBase *changer ) { mChanger = changer; }
00076     void setDate(const QDate &);
00077     void flushEntry();
00078 
00079   signals:
00080     void deleteIncidence( Incidence * );
00081     void editIncidence( Incidence * );
00082 
00083   protected:
00084     void clearFields();
00085     bool eventFilter( QObject *o, QEvent *e );
00086 
00087     void writeJournal();
00088 
00089   private:
00090     void writeJournalPrivate( Journal *j );
00091 
00092     Journal *mJournal;
00093     QDate mDate;
00094     bool mReadOnly;
00095 
00096     QLabel *mTitleLabel;
00097     KLineEdit *mTitleEdit;
00098     KTextEdit *mEditor;
00099     QCheckBox *mTimeCheck;
00100     KTimeEdit *mTimeEdit;
00101     QButton *mDeleteButton;
00102     QButton *mEditButton;
00103     QButton *mPrintButton;
00104 
00105     QGridLayout *mLayout;
00106 
00107     bool mDirty;
00108     bool mWriteInProgress;
00109     IncidenceChangerBase *mChanger;
00110 };
00111 
00112 
00113 class JournalDateEntry : public QVBox {
00114     Q_OBJECT
00115   public:
00116     typedef ListBase<JournalDateEntry> List;
00117 
00118     JournalDateEntry( Calendar *, QWidget *parent );
00119     virtual ~JournalDateEntry();
00120 
00121     void addJournal( Journal * );
00122     Journal::List journals() const;
00123 
00124     void setDate( const QDate & );
00125     QDate date() const { return mDate; }
00126 
00127     void clear();
00128 
00129 
00130   signals:
00131     void setIncidenceChangerSignal( IncidenceChangerBase *changer );
00132     void setDateSignal( const QDate & );
00133     void flushEntries();
00134     void editIncidence( Incidence * );
00135     void deleteIncidence( Incidence * );
00136     void newJournal( const QDate & );
00137 
00138   public slots:
00139     void emitNewJournal();
00140     void setIncidenceChanger( IncidenceChangerBase *changer );
00141     void journalEdited( Journal* );
00142     void journalDeleted( Journal* );
00143 
00144   private:
00145     Calendar *mCalendar;
00146     QDate mDate;
00147     QMap<Journal*,JournalEntry*> mEntries;
00148 
00149     KActiveLabel *mTitle;
00150     QWidget *mAddBar;
00151     IncidenceChangerBase *mChanger;
00152 };
00153 
00154 
00155 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys