summaryrefslogtreecommitdiffabout
path: root/korganizer/komonthview.h
authorMichael Krelin <hacker@klever.net>2007-07-04 11:23:42 (UTC)
committer Michael Krelin <hacker@klever.net>2007-07-04 11:23:42 (UTC)
commita08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (unidiff)
tree8ee90d686081c52e7c69b5ce946e9b1a7d690001 /korganizer/komonthview.h
parent11edc920afe4f274c0964436633aa632c8288a40 (diff)
downloadkdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.zip
kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.gz
kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.bz2
initial public commit of qt4 portp1
Diffstat (limited to 'korganizer/komonthview.h') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/komonthview.h57
1 files changed, 32 insertions, 25 deletions
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h
index 1a9d16d..bca76e5 100644
--- a/korganizer/komonthview.h
+++ b/korganizer/komonthview.h
@@ -1,351 +1,358 @@
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 <q3frame.h>
25#include <qdatetime.h> 25#include <qdatetime.h>
26#include <qlistbox.h> 26#include <q3listbox.h>
27#include <qpoint.h> 27#include <qpoint.h>
28#include <qwidgetstack.h> 28#include <q3widgetstack.h>
29#include <qlayout.h> 29#include <qlayout.h>
30#include <qtimer.h> 30#include <qtimer.h>
31#include <qintdict.h> 31#include <q3intdict.h>
32#include <qpushbutton.h> 32#include <qpushbutton.h>
33#include <qvaluelist.h> 33#include <q3valuelist.h>
34#include <qptrvector.h> 34#include <q3ptrvector.h>
35//Added by qt3to4:
36#include <QResizeEvent>
37#include <QFocusEvent>
38#include <QMouseEvent>
39#include <Q3PtrList>
40#include <Q3PopupMenu>
41#include <QKeyEvent>
35 42
36#include <libkcal/calendar.h> 43#include <libkcal/calendar.h>
37#include <libkcal/event.h> 44#include <libkcal/event.h>
38 45
39#include "koeventview.h" 46#include "koeventview.h"
40#include "navigatorbar.h" 47#include "navigatorbar.h"
41 48
42#ifdef DESKTOP_VERSION 49#ifdef DESKTOP_VERSION
43class QToolTipGroup; 50class QToolTipGroup;
44#endif 51#endif
45 52
46class KNOWhatsThis; 53class KNOWhatsThis;
47class MonthViewCell; 54class MonthViewCell;
48class KOWeekButton : public QPushButton 55class KOWeekButton : public QPushButton
49{ 56{
50 Q_OBJECT 57 Q_OBJECT
51 public: 58 public:
52 KOWeekButton( QWidget *parent=0, const char *name=0 ) : 59 KOWeekButton( QWidget *parent=0, const char *name=0 ) :
53 QPushButton( parent, name) 60 QPushButton( parent, name)
54 { 61 {
55 connect( this, SIGNAL( clicked() ), 62 connect( this, SIGNAL( clicked() ),
56 SLOT( bottonClicked() )); 63 SLOT( bottonClicked() ));
57 mNumber = -1; 64 mNumber = -1;
58 } 65 }
59 void setWeekNum ( int num ) {mNumber = num; setText( QString::number ( num ));} 66 void setWeekNum ( int num ) {mNumber = num; setText( QString::number ( num ));}
60 int getWeekNum() { return mNumber;} 67 int getWeekNum() { return mNumber;}
61 signals: 68 signals:
62 void selectWeekNum ( int ); 69 void selectWeekNum ( int );
63private: 70private:
64 void focusInEvent ( QFocusEvent * ){;} 71 void focusInEvent ( QFocusEvent * ){;}
65 int mNumber; 72 int mNumber;
66 void keyPressEvent ( QKeyEvent * e ) 73 void keyPressEvent ( QKeyEvent * e )
67 { 74 {
68 e->ignore(); 75 e->ignore();
69 } 76 }
70 77
71private slots : 78private slots :
72 void bottonClicked() { if ( mNumber > 0 ) emit selectWeekNum ( mNumber ); } 79 void bottonClicked() { if ( mNumber > 0 ) emit selectWeekNum ( mNumber ); }
73}; 80};
74 81
75class KNoScrollListBox: public QListBox 82class KNoScrollListBox: public Q3ListBox
76{ 83{
77 Q_OBJECT 84 Q_OBJECT
78 public: 85 public:
79 KNoScrollListBox(QWidget *parent=0, const char *name=0); 86 KNoScrollListBox(QWidget *parent=0, const char *name=0);
80 ~KNoScrollListBox(); 87 ~KNoScrollListBox();
81 QString getWhatsThisText(QPoint p) ; 88 QString getWhatsThisText(QPoint p) ;
82 89
83 signals: 90 signals:
84 void shiftDown(); 91 void shiftDown();
85 void shiftUp(); 92 void shiftUp();
86 void rightClick(); 93 void rightClick();
87 void nextCell(); 94 void nextCell();
88 void prevCell(); 95 void prevCell();
89 void highlightIncidence( Incidence * , MonthViewCell*, int ); 96 void highlightIncidence( Incidence * , MonthViewCell*, int );
90 protected: 97 protected:
91 bool mBlockDeselect; 98 bool mBlockDeselect;
92 protected slots: 99 protected slots:
93 void oneDown(); 100 void oneDown();
94 void keyPressEvent(QKeyEvent *); 101 void keyPressEvent(QKeyEvent *);
95 void keyReleaseEvent(QKeyEvent *); 102 void keyReleaseEvent(QKeyEvent *);
96 void mousePressEvent(QMouseEvent *); 103 void mousePressEvent(QMouseEvent *);
97 void focusInEvent ( QFocusEvent * ); 104 void focusInEvent ( QFocusEvent * );
98 void focusOutEvent ( QFocusEvent * ); 105 void focusOutEvent ( QFocusEvent * );
99 106
100 private: 107 private:
101 bool resetOnFocusIn; 108 bool resetOnFocusIn;
102 KNOWhatsThis * mWT; 109 KNOWhatsThis * mWT;
103}; 110};
104 111
105 112
106class MonthViewItem: public QListBoxItem 113class MonthViewItem: public Q3ListBoxItem
107{ 114{
108 public: 115 public:
109 MonthViewItem( Incidence *,const QString & title ); 116 MonthViewItem( Incidence *,const QString & title );
110 void recycle( Incidence *incidence, const QString & s); 117 void recycle( Incidence *incidence, const QString & s);
111 void setRecur(bool on) { mRecur = on; } 118 void setRecur(bool on) { mRecur = on; }
112 void setAlarm(bool on) { mAlarm = on; } 119 void setAlarm(bool on) { mAlarm = on; }
113 void setReply(bool on) { mReply = on; } 120 void setReply(bool on) { mReply = on; }
114 void setMoreInfo(bool on) { mInfo = on; } 121 void setMoreInfo(bool on) { mInfo = on; }
115 void setMultiDay(int type) { mMultiday = type; } 122 void setMultiDay(int type) { mMultiday = type; }
116 int multiDay() { return mMultiday; } 123 int multiDay() { return mMultiday; }
117 void setMultiDayPos(int type) { mdayPos = type; } 124 void setMultiDayPos(int type) { mdayPos = type; }
118 int gettMultiDayPos() { return mdayPos; } 125 int gettMultiDayPos() { return mdayPos; }
119 void setBlockRepaint(bool on) { mblockRepaint = on; } 126 void setBlockRepaint(bool on) { mblockRepaint = on; }
120 bool setHighlighted( Incidence * ); 127 bool setHighlighted( Incidence * );
121 128
122 void setPalette(const QPalette &p) { mPalette = p; } 129 void setPalette(const QPalette &p) { mPalette = p; }
123 QPalette palette() const { return mPalette; } 130 QPalette palette() const { return mPalette; }
124 bool setHighlightedFalse(); 131 bool setHighlightedFalse();
125 Incidence *incidence() const { return mIncidence; } 132 Incidence *incidence() const { return mIncidence; }
126 133
127 protected: 134 protected:
128 virtual void paint(QPainter *); 135 virtual void paint(QPainter *);
129 virtual int height(const QListBox *) const; 136 virtual int height(const Q3ListBox *) const;
130 virtual int width(const QListBox *) const; 137 virtual int width(const Q3ListBox *) const;
131 138
132 private: 139 private:
133 int mdayPos; 140 int mdayPos;
134 bool isWeekItem; 141 bool isWeekItem;
135 bool mblockRepaint; 142 bool mblockRepaint;
136 int mMultiday; 143 int mMultiday;
137 bool mRecur; 144 bool mRecur;
138 bool mAlarm; 145 bool mAlarm;
139 bool mReply; 146 bool mReply;
140 bool mInfo; 147 bool mInfo;
141 bool mDisplayHighlighted; 148 bool mDisplayHighlighted;
142 149
143 QPalette mPalette; 150 QPalette mPalette;
144 QDate mDate; 151 QDate mDate;
145 152
146 Incidence *mIncidence; 153 Incidence *mIncidence;
147}; 154};
148 155
149 156
150class KOMonthView; 157class KOMonthView;
151 158
152class MonthViewCell : public KNoScrollListBox 159class MonthViewCell : public KNoScrollListBox
153{ 160{
154 Q_OBJECT 161 Q_OBJECT
155 public: 162 public:
156 MonthViewCell(KOMonthView *,QWidget* ); 163 MonthViewCell(KOMonthView *,QWidget* );
157 ~MonthViewCell() {mAvailItemList.setAutoDelete( true );} 164 ~MonthViewCell() {mAvailItemList.setAutoDelete( true );}
158 165
159 void setDate( const QDate & ); 166 void setDate( const QDate & );
160 QDate date() const; 167 QDate date() const;
161 168
162 void setPrimary( bool ); 169 void setPrimary( bool );
163 bool isPrimary() const; 170 bool isPrimary() const;
164 171
165 void setHoliday( bool ); 172 void setHoliday( bool );
166 void setHoliday( const QString & ); 173 void setHoliday( const QString & );
167 174
168 void updateCell(); 175 void updateCell();
169 void startUpdateCell(); 176 void startUpdateCell();
170 void finishUpdateCell(); 177 void finishUpdateCell();
171 int insertEvent(Event *); 178 int insertEvent(Event *);
172 void insertTodo(Todo *); 179 void insertTodo(Todo *);
173 180
174 void updateConfig( bool bigFont = false ); 181 void updateConfig( bool bigFont = false );
175 182
176 void enableScrollBars( bool ); 183 void enableScrollBars( bool );
177 184
178 Incidence *selectedIncidence(); 185 Incidence *selectedIncidence();
179 QDate selectedIncidenceDate(); 186 QDate selectedIncidenceDate();
180 QPushButton * dateLabel() { return mLabel; } 187 QPushButton * dateLabel() { return mLabel; }
181 bool doHighLight( Incidence *); 188 bool doHighLight( Incidence *);
182 void deselect(); 189 void deselect();
183 void select(); 190 void select();
184#ifdef DESKTOP_VERSION 191#ifdef DESKTOP_VERSION
185 static QToolTipGroup *toolTipGroup(); 192 static QToolTipGroup *toolTipGroup();
186#endif 193#endif
187 signals: 194 signals:
188 void defaultAction( Incidence * ); 195 void defaultAction( Incidence * );
189 void newEventSignal( QDateTime ); 196 void newEventSignal( QDateTime );
190 void showDaySignal( QDate ); 197 void showDaySignal( QDate );
191 198
192 protected: 199 protected:
193 QStringList mToolTip; 200 QStringList mToolTip;
194 void resizeEvent( QResizeEvent * ); 201 void resizeEvent( QResizeEvent * );
195 202
196public slots: 203public slots:
197 void showDay(); 204 void showDay();
198 void deHighLight(); 205 void deHighLight();
199 void repaintfinishUpdateCell(); 206 void repaintfinishUpdateCell();
200 protected slots: 207 protected slots:
201 void defaultAction( QListBoxItem * ); 208 void defaultAction( Q3ListBoxItem * );
202 void contextMenu( QListBoxItem * ); 209 void contextMenu( Q3ListBoxItem * );
203 void selection( QListBoxItem * ); 210 void selection( Q3ListBoxItem * );
204 void cellClicked( QListBoxItem * ); 211 void cellClicked( Q3ListBoxItem * );
205 void newEvent(); 212 void newEvent();
206 213
207 private: 214 private:
208 int mdayCount; 215 int mdayCount;
209 QPtrList <MonthViewItem> mAvailItemList; 216 Q3PtrList <MonthViewItem> mAvailItemList;
210 KOMonthView *mMonthView; 217 KOMonthView *mMonthView;
211 int currentPalette; 218 int currentPalette;
212 219
213 QDate mDate; 220 QDate mDate;
214 bool mPrimary; 221 bool mPrimary;
215 bool mHoliday; 222 bool mHoliday;
216 QString mHolidayString; 223 QString mHolidayString;
217 224
218 //QLabel *mLabel; 225 //QLabel *mLabel;
219 QPushButton *mLabel; 226 QPushButton *mLabel;
220 //QListBox *mItemList; 227 //QListBox *mItemList;
221#ifdef DESKTOP_VERSION 228#ifdef DESKTOP_VERSION
222 static QToolTipGroup *mToolTipGroup; 229 static QToolTipGroup *mToolTipGroup;
223#endif 230#endif
224 QSize mLabelSize; 231 QSize mLabelSize;
225 QSize mLabelBigSize; 232 QSize mLabelBigSize;
226 QPalette mHolidayPalette; 233 QPalette mHolidayPalette;
227 QPalette mStandardPalette; 234 QPalette mStandardPalette;
228 QPalette mPrimaryPalette; 235 QPalette mPrimaryPalette;
229 QPalette mNonPrimaryPalette; 236 QPalette mNonPrimaryPalette;
230 void setMyPalette(); 237 void setMyPalette();
231 QPalette getPalette (); 238 QPalette getPalette ();
232 239
233}; 240};
234 241
235 242
236class KOMonthView: public KOEventView 243class KOMonthView: public KOEventView
237{ 244{
238 Q_OBJECT 245 Q_OBJECT
239 public: 246 public:
240 KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 ); 247 KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 );
241 ~KOMonthView(); 248 ~KOMonthView();
242 249
243 /** Returns maximum number of days supported by the komonthview */ 250 /** Returns maximum number of days supported by the komonthview */
244 virtual int maxDatesHint(); 251 virtual int maxDatesHint();
245 252
246 /** Returns number of currently shown dates. */ 253 /** Returns number of currently shown dates. */
247 virtual int currentDateCount(); 254 virtual int currentDateCount();
248 255
249 /** returns the currently selected events */ 256 /** returns the currently selected events */
250 virtual QPtrList<Incidence> selectedIncidences(); 257 virtual Q3PtrList<Incidence> selectedIncidences();
251 258
252 /** returns dates of the currently selected events */ 259 /** returns dates of the currently selected events */
253 virtual DateList selectedDates(); 260 virtual DateList selectedDates();
254#if 0 261#if 0
255 virtual void printPreview(CalPrinter *calPrinter, 262 virtual void printPreview(CalPrinter *calPrinter,
256 const QDate &, const QDate &); 263 const QDate &, const QDate &);
257#endif 264#endif
258 bool isMonthView() { return !mShowWeekView; } 265 bool isMonthView() { return !mShowWeekView; }
259 bool isUpdatePossible() { return updatePossible; } 266 bool isUpdatePossible() { return updatePossible; }
260 267
261 MonthViewCell * selectedCell(); 268 MonthViewCell * selectedCell();
262 bool skipResize; 269 bool skipResize;
263 NavigatorBar* navigatorBar() { return mNavigatorBar ;} 270 NavigatorBar* navigatorBar() { return mNavigatorBar ;}
264 void clearList(); 271 void clearList();
265 public slots: 272 public slots:
266 void incidenceHighlighted( Incidence *, MonthViewCell*, int ); 273 void incidenceHighlighted( Incidence *, MonthViewCell*, int );
267 void nextCell(); 274 void nextCell();
268 void prevCell(); 275 void prevCell();
269 virtual void updateView(); 276 virtual void updateView();
270 virtual void updateConfig(); 277 virtual void updateConfig();
271 virtual void showDates(const QDate &start, const QDate &end); 278 virtual void showDates(const QDate &start, const QDate &end);
272 virtual void showEvents(QPtrList<Event> eventList); 279 virtual void showEvents(Q3PtrList<Event> eventList);
273 280
274 void changeEventDisplay(Event *, int); 281 void changeEventDisplay(Event *, int);
275 282
276 void clearSelection(); 283 void clearSelection();
277 284
278 void showContextMenu( Incidence * ); 285 void showContextMenu( Incidence * );
279 286
280 void setSelectedCell( MonthViewCell * ); 287 void setSelectedCell( MonthViewCell * );
281 void setPopupCell( MonthViewCell * ); 288 void setPopupCell( MonthViewCell * );
282 void switchView(); 289 void switchView();
283 void setKeyBFocus(); 290 void setKeyBFocus();
284 291
285 protected slots: 292 protected slots:
286 void catChanged( Incidence * ); 293 void catChanged( Incidence * );
287 void setKeyBoardFocus(); 294 void setKeyBoardFocus();
288 void slotNewTodo(); 295 void slotNewTodo();
289 void slotNewEvent(); 296 void slotNewEvent();
290 void slotEditJournal(); 297 void slotEditJournal();
291 void slotComputeLayout(); 298 void slotComputeLayout();
292 void selectInternalWeekNum ( int ); 299 void selectInternalWeekNum ( int );
293 void processSelectionChange(); 300 void processSelectionChange();
294 signals: 301 signals:
295 void nextMonth(); 302 void nextMonth();
296 void prevMonth(); 303 void prevMonth();
297 void selectWeekNum ( int ); 304 void selectWeekNum ( int );
298 void selectMonth (); 305 void selectMonth ();
299 void showDaySignal( QDate ); 306 void showDaySignal( QDate );
300 void newTodoSignal( QDateTime, bool ); 307 void newTodoSignal( QDateTime, bool );
301 void showJournalSignal( int,QDate ); 308 void showJournalSignal( int,QDate );
302 protected: 309 protected:
303 void resizeEvent(QResizeEvent *); 310 void resizeEvent(QResizeEvent *);
304 void viewChanged(); 311 void viewChanged();
305 void updateDayLabels(); 312 void updateDayLabels();
306 int mapWeekLayout( int, bool ); 313 int mapWeekLayout( int, bool );
307 314
308 private: 315 private:
309 int mKBFcounter; 316 int mKBFcounter;
310 QTimer* mComputeLayoutTimer; 317 QTimer* mComputeLayoutTimer;
311 NavigatorBar* mNavigatorBar; 318 NavigatorBar* mNavigatorBar;
312 int currentWeek(); 319 int currentWeek();
313 bool clPending; 320 bool clPending;
314 QWidgetStack * mWidStack; 321 Q3WidgetStack * mWidStack;
315 QWidget* mMonthView; 322 QWidget* mMonthView;
316 QWidget* mWeekView; 323 QWidget* mWeekView;
317 bool mShowWeekView; 324 bool mShowWeekView;
318 bool updatePossible; 325 bool updatePossible;
319 int mDaysPerWeek; 326 int mDaysPerWeek;
320 int mNumWeeks; 327 int mNumWeeks;
321 int mNumCells; 328 int mNumCells;
322 //bool mWeekStartsMonday; 329 //bool mWeekStartsMonday;
323 bool mShowSatSunComp; 330 bool mShowSatSunComp;
324 void computeLayout(); 331 void computeLayout();
325 void computeLayoutWeek(); 332 void computeLayoutWeek();
326 void doComputeLayoutWeek(); 333 void doComputeLayoutWeek();
327 334
328 QPtrVector<MonthViewCell> mCells; 335 Q3PtrVector<MonthViewCell> mCells;
329 QPtrVector<QLabel> mDayLabels; 336 Q3PtrVector<QLabel> mDayLabels;
330 QPtrVector<KOWeekButton> mWeekLabels; 337 Q3PtrVector<KOWeekButton> mWeekLabels;
331 QPtrVector<MonthViewCell> mCellsW; 338 Q3PtrVector<MonthViewCell> mCellsW;
332 QPtrVector<QLabel> mDayLabelsW; 339 Q3PtrVector<QLabel> mDayLabelsW;
333 QPtrVector<KOWeekButton> mWeekLabelsW; 340 Q3PtrVector<KOWeekButton> mWeekLabelsW;
334 341
335 bool mShortDayLabelsM; 342 bool mShortDayLabelsM;
336 bool mShortDayLabelsW; 343 bool mShortDayLabelsW;
337 int mWidthLongDayLabel; 344 int mWidthLongDayLabel;
338 345
339 QDate mStartDate; 346 QDate mStartDate;
340 347
341 MonthViewCell *mSelectedCell; 348 MonthViewCell *mSelectedCell;
342 MonthViewCell *mPopupCell; 349 MonthViewCell *mPopupCell;
343 bool mFlagKeyPressed; 350 bool mFlagKeyPressed;
344 KOEventPopupMenu *mContextMenu; 351 KOEventPopupMenu *mContextMenu;
345 QPopupMenu *mNewItemMenu; 352 Q3PopupMenu *mNewItemMenu;
346 void keyPressEvent ( QKeyEvent * ) ; 353 void keyPressEvent ( QKeyEvent * ) ;
347 void keyReleaseEvent ( QKeyEvent * ) ; 354 void keyReleaseEvent ( QKeyEvent * ) ;
348 355
349}; 356};
350 357
351#endif 358#endif