korganizer

journalentry.h
1/*
2 This file is part of KOrganizer.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com>
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19
20 As a special exception, permission is given to link this program
21 with any edition of TQt, and distribute the resulting executable,
22 without including the source code for TQt in the source distribution.
23*/
24#ifndef JOURNALENTRY_H
25#define JOURNALENTRY_H
26//
27// Widget showing one Journal entry
28
29#include <libkcal/resourcecalendar.h>
30#include <tqvbox.h>
31
32class TQLabel;
33class KActiveLabel;
34class TQCheckBox;
35class TQGridLayout;
36class KLineEdit;
37class KTextEdit;
38class KTimeEdit;
39class TQButton;
40namespace KOrg {
41class IncidenceChangerBase;
42}
43using namespace KOrg;
44namespace KCal {
45 class Calendar;
46 class Journal;
47}
48using namespace KCal;
49
50class JournalEntry : public TQWidget {
51 TQ_OBJECT
52
53 public:
54 typedef ListBase<JournalEntry> List;
55
56 JournalEntry( Journal* j, TQWidget *parent );
57 virtual ~JournalEntry();
58
59 void setJournal(Journal *);
60 Journal *journal() const { return mJournal; }
61
62 TQDate date() const { return mDate; }
63
64 void clear();
65 void readJournal( Journal *j );
66
67 bool isReadOnly() const { return mReadOnly; }
68 void setReadOnly( bool readonly );
69
70 protected slots:
71 void setDirty();
72 void deleteItem();
73 void editItem();
74 void printItem();
75 void timeCheckBoxToggled(bool on);
76 public slots:
77 void setIncidenceChanger( IncidenceChangerBase *changer ) { mChanger = changer; }
78 void setDate(const TQDate &);
79 void flushEntry();
80
81 signals:
82 void deleteIncidence( Incidence * );
83 void editIncidence( Incidence *, const TQDate& );
84
85 protected:
86 void clearFields();
87 bool eventFilter( TQObject *o, TQEvent *e );
88
89 void writeJournal();
90
91 private:
92 void writeJournalPrivate( Journal *j );
93
94 Journal *mJournal;
95 TQDate mDate;
96 bool mReadOnly;
97
98 TQLabel *mTitleLabel;
99 KLineEdit *mTitleEdit;
100 KTextEdit *mEditor;
101 TQCheckBox *mTimeCheck;
102 KTimeEdit *mTimeEdit;
103 TQButton *mDeleteButton;
104 TQButton *mEditButton;
105 TQButton *mPrintButton;
106
107 TQGridLayout *mLayout;
108
109 bool mDirty;
110 bool mWriteInProgress;
111 IncidenceChangerBase *mChanger;
112};
113
114
115class JournalDateEntry : public TQVBox {
116 TQ_OBJECT
117
118 public:
119 typedef ListBase<JournalDateEntry> List;
120
121 JournalDateEntry( Calendar *, TQWidget *parent );
122 virtual ~JournalDateEntry();
123
124 void addJournal( Journal * );
125 Journal::List journals() const;
126
127 void setDate( const TQDate & );
128 TQDate date() const { return mDate; }
129
130 void clear();
131
132
133 signals:
134 void setIncidenceChangerSignal( IncidenceChangerBase *changer );
135 void setDateSignal( const TQDate & );
136 void flushEntries();
137 void editIncidence( Incidence *, const TQDate& );
138 void deleteIncidence( Incidence * );
139 void newJournal( ResourceCalendar *, const TQString &, const TQDate & );
140
141 public slots:
142 void emitNewJournal();
143 void setIncidenceChanger( IncidenceChangerBase *changer );
144 void journalEdited( Journal* );
145 void journalDeleted( Journal* );
146
147 private:
148 Calendar *mCalendar;
149 TQDate mDate;
150 TQMap<Journal*,JournalEntry*> mEntries;
151
152 KActiveLabel *mTitle;
153 TQWidget *mAddBar;
154 IncidenceChangerBase *mChanger;
155};
156
157
158#endif