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 <libkcal/resourcecalendar.h>
00030 #include <qvbox.h>
00031 
00032 class QLabel;
00033 class KActiveLabel;
00034 class QCheckBox;
00035 class QGridLayout;
00036 class KLineEdit;
00037 class KTextEdit;
00038 class KTimeEdit;
00039 class QButton;
00040 namespace KOrg {
00041 class IncidenceChangerBase;
00042 }
00043 using namespace KOrg;
00044 namespace KCal {
00045   class Calendar;
00046   class Journal;
00047 }
00048 using namespace KCal;
00049 
00050 class JournalEntry : public QWidget {
00051     Q_OBJECT
00052   public:
00053     typedef ListBase<JournalEntry> List;
00054 
00055     JournalEntry( Journal* j, QWidget *parent );
00056     virtual ~JournalEntry();
00057 
00058     void setJournal(Journal *);
00059     Journal *journal() const { return mJournal; }
00060 
00061     QDate date() const { return mDate; }
00062 
00063     void clear();
00064     void readJournal( Journal *j );
00065 
00066     bool isReadOnly() const { return mReadOnly; }
00067     void setReadOnly( bool readonly );
00068 
00069   protected slots:
00070     void setDirty();
00071     void deleteItem();
00072     void editItem();
00073     void printItem();
00074     void timeCheckBoxToggled(bool on);
00075   public slots:
00076     void setIncidenceChanger( IncidenceChangerBase *changer ) { mChanger = changer; }
00077     void setDate(const QDate &);
00078     void flushEntry();
00079 
00080   signals:
00081     void deleteIncidence( Incidence * );
00082     void editIncidence( Incidence * );
00083 
00084   protected:
00085     void clearFields();
00086     bool eventFilter( QObject *o, QEvent *e );
00087 
00088     void writeJournal();
00089 
00090   private:
00091     void writeJournalPrivate( Journal *j );
00092 
00093     Journal *mJournal;
00094     QDate mDate;
00095     bool mReadOnly;
00096 
00097     QLabel *mTitleLabel;
00098     KLineEdit *mTitleEdit;
00099     KTextEdit *mEditor;
00100     QCheckBox *mTimeCheck;
00101     KTimeEdit *mTimeEdit;
00102     QButton *mDeleteButton;
00103     QButton *mEditButton;
00104     QButton *mPrintButton;
00105 
00106     QGridLayout *mLayout;
00107 
00108     bool mDirty;
00109     bool mWriteInProgress;
00110     IncidenceChangerBase *mChanger;
00111 };
00112 
00113 
00114 class JournalDateEntry : public QVBox {
00115     Q_OBJECT
00116   public:
00117     typedef ListBase<JournalDateEntry> List;
00118 
00119     JournalDateEntry( Calendar *, QWidget *parent );
00120     virtual ~JournalDateEntry();
00121 
00122     void addJournal( Journal * );
00123     Journal::List journals() const;
00124 
00125     void setDate( const QDate & );
00126     QDate date() const { return mDate; }
00127 
00128     void clear();
00129 
00130 
00131   signals:
00132     void setIncidenceChangerSignal( IncidenceChangerBase *changer );
00133     void setDateSignal( const QDate & );
00134     void flushEntries();
00135     void editIncidence( Incidence * );
00136     void deleteIncidence( Incidence * );
00137     void newJournal( ResourceCalendar *, const QString &, const QDate & );
00138 
00139   public slots:
00140     void emitNewJournal();
00141     void setIncidenceChanger( IncidenceChangerBase *changer );
00142     void journalEdited( Journal* );
00143     void journalDeleted( Journal* );
00144 
00145   private:
00146     Calendar *mCalendar;
00147     QDate mDate;
00148     QMap<Journal*,JournalEntry*> mEntries;
00149 
00150     KActiveLabel *mTitle;
00151     QWidget *mAddBar;
00152     IncidenceChangerBase *mChanger;
00153 };
00154 
00155 
00156 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys