author | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
commit | a08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (unidiff) | |
tree | 8ee90d686081c52e7c69b5ce946e9b1a7d690001 /korganizer/komonthview.h | |
parent | 11edc920afe4f274c0964436633aa632c8288a40 (diff) | |
download | kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.zip kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.gz kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.bz2 |
initial public commit of qt4 portp1
-rw-r--r-- | korganizer/komonthview.h | 57 |
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 | |||
@@ -8,43 +8,50 @@ | |||
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 |
43 | class QToolTipGroup; | 50 | class QToolTipGroup; |
44 | #endif | 51 | #endif |
45 | 52 | ||
46 | class KNOWhatsThis; | 53 | class KNOWhatsThis; |
47 | class MonthViewCell; | 54 | class MonthViewCell; |
48 | class KOWeekButton : public QPushButton | 55 | class KOWeekButton : public QPushButton |
49 | { | 56 | { |
50 | Q_OBJECT | 57 | Q_OBJECT |
@@ -59,88 +66,88 @@ class KOWeekButton : public QPushButton | |||
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 ); |
63 | private: | 70 | private: |
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 | ||
71 | private slots : | 78 | private slots : |
72 | void bottonClicked() { if ( mNumber > 0 ) emit selectWeekNum ( mNumber ); } | 79 | void bottonClicked() { if ( mNumber > 0 ) emit selectWeekNum ( mNumber ); } |
73 | }; | 80 | }; |
74 | 81 | ||
75 | class KNoScrollListBox: public QListBox | 82 | class 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 | ||
106 | class MonthViewItem: public QListBoxItem | 113 | class 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; |
@@ -185,41 +192,41 @@ class MonthViewCell : public KNoScrollListBox | |||
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 | ||
196 | public slots: | 203 | public 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; |
@@ -234,55 +241,55 @@ public slots: | |||
234 | 241 | ||
235 | 242 | ||
236 | class KOMonthView: public KOEventView | 243 | class 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(); |
@@ -298,54 +305,54 @@ class KOMonthView: public KOEventView | |||
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 |