summaryrefslogtreecommitdiffabout
path: root/korganizer/komonthview.h
Unidiff
Diffstat (limited to 'korganizer/komonthview.h') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/komonthview.h14
1 files changed, 10 insertions, 4 deletions
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h
index 89912e0..b997c1a 100644
--- a/korganizer/komonthview.h
+++ b/korganizer/komonthview.h
@@ -1,303 +1,309 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18*/ 18*/
19 19
20#ifndef _KOMONTHVIEW_H 20#ifndef _KOMONTHVIEW_H
21#define _KOMONTHVIEW_H 21#define _KOMONTHVIEW_H
22 22
23#include <qlabel.h> 23#include <qlabel.h>
24#include <qframe.h> 24#include <qframe.h>
25#include <qdatetime.h> 25#include <qdatetime.h>
26#include <qlistbox.h> 26#include <qlistbox.h>
27#include <qpoint.h> 27#include <qpoint.h>
28#include <qwidgetstack.h> 28#include <qwidgetstack.h>
29#include <qlayout.h> 29#include <qlayout.h>
30#include <qtimer.h> 30#include <qtimer.h>
31#include <qintdict.h> 31#include <qintdict.h>
32#include <qpushbutton.h> 32#include <qpushbutton.h>
33#include <qvaluelist.h> 33#include <qvaluelist.h>
34#include <qptrvector.h> 34#include <qptrvector.h>
35 35
36#include <libkcal/calendar.h> 36#include <libkcal/calendar.h>
37#include <libkcal/event.h> 37#include <libkcal/event.h>
38 38
39#include "koeventview.h" 39#include "koeventview.h"
40#include "navigatorbar.h" 40#include "navigatorbar.h"
41 41
42#ifdef DESKTOP_VERSION 42#ifdef DESKTOP_VERSION
43class QToolTipGroup; 43class QToolTipGroup;
44#endif 44#endif
45 45
46class KNOWhatsThis; 46class KNOWhatsThis;
47class KOWeekButton : public QPushButton 47class KOWeekButton : public QPushButton
48{ 48{
49 Q_OBJECT 49 Q_OBJECT
50 public: 50 public:
51 KOWeekButton( QWidget *parent=0, const char *name=0 ) : 51 KOWeekButton( QWidget *parent=0, const char *name=0 ) :
52 QPushButton( parent, name) 52 QPushButton( parent, name)
53 { 53 {
54 connect( this, SIGNAL( clicked() ), 54 connect( this, SIGNAL( clicked() ),
55 SLOT( bottonClicked() )); 55 SLOT( bottonClicked() ));
56 mNumber = -1; 56 mNumber = -1;
57 } 57 }
58 void setWeekNum ( int num ) {mNumber = num; setText( QString::number ( num ));} 58 void setWeekNum ( int num ) {mNumber = num; setText( QString::number ( num ));}
59 int getWeekNum() { return mNumber;} 59 int getWeekNum() { return mNumber;}
60 signals: 60 signals:
61 void selectWeekNum ( int ); 61 void selectWeekNum ( int );
62private: 62private:
63 int mNumber; 63 int mNumber;
64private slots : 64private slots :
65 void bottonClicked() { if ( mNumber > 0 ) emit selectWeekNum ( mNumber ); } 65 void bottonClicked() { if ( mNumber > 0 ) emit selectWeekNum ( mNumber ); }
66}; 66};
67 67
68class KNoScrollListBox: public QListBox 68class KNoScrollListBox: public QListBox
69{ 69{
70 Q_OBJECT 70 Q_OBJECT
71 public: 71 public:
72 KNoScrollListBox(QWidget *parent=0, const char *name=0); 72 KNoScrollListBox(QWidget *parent=0, const char *name=0);
73 ~KNoScrollListBox(); 73 ~KNoScrollListBox();
74 QString getWhatsThisText(QPoint p) ; 74 QString getWhatsThisText(QPoint p) ;
75 75
76 signals: 76 signals:
77 void shiftDown(); 77 void shiftDown();
78 void shiftUp(); 78 void shiftUp();
79 void rightClick(); 79 void rightClick();
80 80
81 protected slots: 81 protected slots:
82 void oneDown(); 82 void oneDown();
83 void keyPressEvent(QKeyEvent *); 83 void keyPressEvent(QKeyEvent *);
84 void keyReleaseEvent(QKeyEvent *); 84 void keyReleaseEvent(QKeyEvent *);
85 void mousePressEvent(QMouseEvent *); 85 void mousePressEvent(QMouseEvent *);
86 86
87 private: 87 private:
88 KNOWhatsThis * mWT; 88 KNOWhatsThis * mWT;
89}; 89};
90 90
91 91
92class MonthViewItem: public QListBoxItem 92class MonthViewItem: public QListBoxItem
93{ 93{
94 public: 94 public:
95 MonthViewItem( Incidence *, QDate qd, const QString & title ); 95 MonthViewItem( Incidence *, QDate qd, const QString & title );
96 96 void recycle( Incidence *incidence, QDate qd, const QString & s);
97 void setRecur(bool on) { mRecur = on; } 97 void setRecur(bool on) { mRecur = on; }
98 void setAlarm(bool on) { mAlarm = on; } 98 void setAlarm(bool on) { mAlarm = on; }
99 void setReply(bool on) { mReply = on; } 99 void setReply(bool on) { mReply = on; }
100 void setMoreInfo(bool on) { mInfo = on; } 100 void setMoreInfo(bool on) { mInfo = on; }
101 void setMultiDay(int type) { mMultiday = type; } 101 void setMultiDay(int type) { mMultiday = type; }
102 void setBlockRepaint(bool on) { mblockRepaint = on; }
102 103
103 104
104 void setPalette(const QPalette &p) { mPalette = p; } 105 void setPalette(const QPalette &p) { mPalette = p; }
105 QPalette palette() const { return mPalette; } 106 QPalette palette() const { return mPalette; }
106 107
107 Incidence *incidence() const { return mIncidence; } 108 Incidence *incidence() const { return mIncidence; }
108 QDate incidenceDate() { return mDate; } 109 QDate incidenceDate() { return mDate; }
109 110
110 protected: 111 protected:
111 virtual void paint(QPainter *); 112 virtual void paint(QPainter *);
112 virtual int height(const QListBox *) const; 113 virtual int height(const QListBox *) const;
113 virtual int width(const QListBox *) const; 114 virtual int width(const QListBox *) const;
114 115
115 private: 116 private:
117 bool mblockRepaint;
116 int mMultiday; 118 int mMultiday;
117 bool mRecur; 119 bool mRecur;
118 bool mAlarm; 120 bool mAlarm;
119 bool mReply; 121 bool mReply;
120 bool mInfo; 122 bool mInfo;
121 123
122 QPalette mPalette; 124 QPalette mPalette;
123 QDate mDate; 125 QDate mDate;
124 126
125 Incidence *mIncidence; 127 Incidence *mIncidence;
126}; 128};
127 129
128 130
129class KOMonthView; 131class KOMonthView;
130 132
131class MonthViewCell : public QWidget 133class MonthViewCell : public KNoScrollListBox
132{ 134{
133 Q_OBJECT 135 Q_OBJECT
134 public: 136 public:
135 MonthViewCell(KOMonthView *,QWidget* ); 137 MonthViewCell(KOMonthView *,QWidget* );
138 ~MonthViewCell() {mAvailItemList.setAutoDelete( true );}
136 139
137 void setDate( const QDate & ); 140 void setDate( const QDate & );
138 QDate date() const; 141 QDate date() const;
139 142
140 void setPrimary( bool ); 143 void setPrimary( bool );
141 bool isPrimary() const; 144 bool isPrimary() const;
142 145
143 void setHoliday( bool ); 146 void setHoliday( bool );
144 void setHoliday( const QString & ); 147 void setHoliday( const QString & );
145 148
146 void updateCell(); 149 void updateCell();
147 void startUpdateCell(); 150 void startUpdateCell();
148 void finishUpdateCell(); 151 void finishUpdateCell();
152 void repaintfinishUpdateCell();
149 void insertEvent(Event *); 153 void insertEvent(Event *);
150 void insertTodo(Todo *); 154 void insertTodo(Todo *);
151 155
152 void updateConfig( bool bigFont = false ); 156 void updateConfig( bool bigFont = false );
153 157
154 void enableScrollBars( bool ); 158 void enableScrollBars( bool );
155 159
156 Incidence *selectedIncidence(); 160 Incidence *selectedIncidence();
157 QDate selectedIncidenceDate(); 161 QDate selectedIncidenceDate();
158 162
159 void deselect(); 163 void deselect();
160 void select(); 164 void select();
161 165
162#ifdef DESKTOP_VERSION 166#ifdef DESKTOP_VERSION
163 static QToolTipGroup *toolTipGroup(); 167 static QToolTipGroup *toolTipGroup();
164#endif 168#endif
165 signals: 169 signals:
166 void defaultAction( Incidence * ); 170 void defaultAction( Incidence * );
167 void newEventSignal( QDateTime ); 171 void newEventSignal( QDateTime );
168 void showDaySignal( QDate ); 172 void showDaySignal( QDate );
169 173
170 protected: 174 protected:
171 QStringList mToolTip; 175 QStringList mToolTip;
172 void resizeEvent( QResizeEvent * ); 176 void resizeEvent( QResizeEvent * );
173 177
174 178
175public slots: 179public slots:
176 void showDay(); 180 void showDay();
177 181
178 protected slots: 182 protected slots:
179 void defaultAction( QListBoxItem * ); 183 void defaultAction( QListBoxItem * );
180 void contextMenu( QListBoxItem * ); 184 void contextMenu( QListBoxItem * );
181 void selection( QListBoxItem * ); 185 void selection( QListBoxItem * );
182 void cellClicked( QListBoxItem * ); 186 void cellClicked( QListBoxItem * );
183 void newEvent(); 187 void newEvent();
184 188
185 private: 189 private:
190 MonthViewItem* mCurrentAvailItem;
191 QPtrList <MonthViewItem> mAvailItemList;
186 KOMonthView *mMonthView; 192 KOMonthView *mMonthView;
193 int currentPalette;
187 194
188 QDate mDate; 195 QDate mDate;
189 bool mPrimary; 196 bool mPrimary;
190 bool mHoliday; 197 bool mHoliday;
191 QString mHolidayString; 198 QString mHolidayString;
192 199
193 //QLabel *mLabel; 200 //QLabel *mLabel;
194 QPushButton *mLabel; 201 QPushButton *mLabel;
195 QListBox *mItemList; 202 //QListBox *mItemList;
196#ifdef DESKTOP_VERSION 203#ifdef DESKTOP_VERSION
197 static QToolTipGroup *mToolTipGroup; 204 static QToolTipGroup *mToolTipGroup;
198#endif 205#endif
199 QSize mLabelSize; 206 QSize mLabelSize;
200 QSize mLabelBigSize; 207 QSize mLabelBigSize;
201 QPalette mHolidayPalette; 208 QPalette mHolidayPalette;
202 QPalette mStandardPalette; 209 QPalette mStandardPalette;
203 QPalette mPrimaryPalette; 210 QPalette mPrimaryPalette;
204 QPalette mNonPrimaryPalette; 211 QPalette mNonPrimaryPalette;
205 void setMyPalette(); 212 void setMyPalette();
206 QPalette getPalette (); 213 QPalette getPalette ();
207 void keyPressEvent ( QKeyEvent * ) ;
208 214
209}; 215};
210 216
211 217
212class KOMonthView: public KOEventView 218class KOMonthView: public KOEventView
213{ 219{
214 Q_OBJECT 220 Q_OBJECT
215 public: 221 public:
216 KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 ); 222 KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 );
217 ~KOMonthView(); 223 ~KOMonthView();
218 224
219 /** Returns maximum number of days supported by the komonthview */ 225 /** Returns maximum number of days supported by the komonthview */
220 virtual int maxDatesHint(); 226 virtual int maxDatesHint();
221 227
222 /** Returns number of currently shown dates. */ 228 /** Returns number of currently shown dates. */
223 virtual int currentDateCount(); 229 virtual int currentDateCount();
224 230
225 /** returns the currently selected events */ 231 /** returns the currently selected events */
226 virtual QPtrList<Incidence> selectedIncidences(); 232 virtual QPtrList<Incidence> selectedIncidences();
227 233
228 /** returns dates of the currently selected events */ 234 /** returns dates of the currently selected events */
229 virtual DateList selectedDates(); 235 virtual DateList selectedDates();
230 236
231 virtual void printPreview(CalPrinter *calPrinter, 237 virtual void printPreview(CalPrinter *calPrinter,
232 const QDate &, const QDate &); 238 const QDate &, const QDate &);
233 bool isMonthView() { return !mShowWeekView; } 239 bool isMonthView() { return !mShowWeekView; }
234 bool isUpdatePossible() { return updatePossible; } 240 bool isUpdatePossible() { return updatePossible; }
235 241
236 MonthViewCell * selectedCell(); 242 MonthViewCell * selectedCell();
237 bool skipResize; 243 bool skipResize;
238 NavigatorBar* navigatorBar() { return mNavigatorBar ;} 244 NavigatorBar* navigatorBar() { return mNavigatorBar ;}
239 public slots: 245 public slots:
240 virtual void updateView(); 246 virtual void updateView();
241 virtual void updateConfig(); 247 virtual void updateConfig();
242 virtual void showDates(const QDate &start, const QDate &end); 248 virtual void showDates(const QDate &start, const QDate &end);
243 virtual void showEvents(QPtrList<Event> eventList); 249 virtual void showEvents(QPtrList<Event> eventList);
244 250
245 void changeEventDisplay(Event *, int); 251 void changeEventDisplay(Event *, int);
246 252
247 void clearSelection(); 253 void clearSelection();
248 254
249 void showContextMenu( Incidence * ); 255 void showContextMenu( Incidence * );
250 256
251 void setSelectedCell( MonthViewCell * ); 257 void setSelectedCell( MonthViewCell * );
252 void switchView(); 258 void switchView();
253 259
254 protected slots: 260 protected slots:
255 void slotComputeLayout(); 261 void slotComputeLayout();
256 void selectInternalWeekNum ( int ); 262 void selectInternalWeekNum ( int );
257 void processSelectionChange(); 263 void processSelectionChange();
258 signals: 264 signals:
259 void nextMonth(); 265 void nextMonth();
260 void prevMonth(); 266 void prevMonth();
261 void selectWeekNum ( int ); 267 void selectWeekNum ( int );
262 void selectMonth (); 268 void selectMonth ();
263 void showDaySignal( QDate ); 269 void showDaySignal( QDate );
264 protected: 270 protected:
265 void resizeEvent(QResizeEvent *); 271 void resizeEvent(QResizeEvent *);
266 void viewChanged(); 272 void viewChanged();
267 void updateDayLabels(); 273 void updateDayLabels();
268 274
269 private: 275 private:
270 QTimer* mComputeLayoutTimer; 276 QTimer* mComputeLayoutTimer;
271 NavigatorBar* mNavigatorBar; 277 NavigatorBar* mNavigatorBar;
272 int currentWeek(); 278 int currentWeek();
273 bool clPending; 279 bool clPending;
274 QWidgetStack * mWidStack; 280 QWidgetStack * mWidStack;
275 QWidget* mMonthView; 281 QWidget* mMonthView;
276 QWidget* mWeekView; 282 QWidget* mWeekView;
277 bool mShowWeekView; 283 bool mShowWeekView;
278 bool updatePossible; 284 bool updatePossible;
279 int mDaysPerWeek; 285 int mDaysPerWeek;
280 int mNumWeeks; 286 int mNumWeeks;
281 int mNumCells; 287 int mNumCells;
282 bool mWeekStartsMonday; 288 bool mWeekStartsMonday;
283 bool mShowSatSunComp; 289 bool mShowSatSunComp;
284 void computeLayout(); 290 void computeLayout();
285 void computeLayoutWeek(); 291 void computeLayoutWeek();
286 292
287 QPtrVector<MonthViewCell> mCells; 293 QPtrVector<MonthViewCell> mCells;
288 QPtrVector<QLabel> mDayLabels; 294 QPtrVector<QLabel> mDayLabels;
289 QPtrVector<KOWeekButton> mWeekLabels; 295 QPtrVector<KOWeekButton> mWeekLabels;
290 QPtrVector<MonthViewCell> mCellsW; 296 QPtrVector<MonthViewCell> mCellsW;
291 QPtrVector<QLabel> mDayLabelsW; 297 QPtrVector<QLabel> mDayLabelsW;
292 QPtrVector<KOWeekButton> mWeekLabelsW; 298 QPtrVector<KOWeekButton> mWeekLabelsW;
293 299
294 bool mShortDayLabelsM; 300 bool mShortDayLabelsM;
295 bool mShortDayLabelsW; 301 bool mShortDayLabelsW;
296 int mWidthLongDayLabel; 302 int mWidthLongDayLabel;
297 303
298 QDate mStartDate; 304 QDate mStartDate;
299 305
300 MonthViewCell *mSelectedCell; 306 MonthViewCell *mSelectedCell;
301 307
302 KOEventPopupMenu *mContextMenu; 308 KOEventPopupMenu *mContextMenu;
303 void keyPressEvent ( QKeyEvent * ) ; 309 void keyPressEvent ( QKeyEvent * ) ;