author | zecke <zecke> | 2002-06-17 15:57:13 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-06-17 15:57:13 (UTC) |
commit | 97aca0c9f5f483d01c685d0d0f126ca554d3b199 (patch) (unidiff) | |
tree | 839929bc17e8e86e1a8d35e2b14e02f6343a8823 /core/pim/datebook/datebookday.h | |
parent | 02e724757f13f40d85136c3a14e0a3788d28236e (diff) | |
download | opie-97aca0c9f5f483d01c685d0d0f126ca554d3b199.zip opie-97aca0c9f5f483d01c685d0d0f126ca554d3b199.tar.gz opie-97aca0c9f5f483d01c685d0d0f126ca554d3b199.tar.bz2 |
tboc <tboc@gmx.de> provided a cute patch to show a red time mark
in the current day view
Diffstat (limited to 'core/pim/datebook/datebookday.h') (more/less context) (show whitespace changes)
-rw-r--r-- | core/pim/datebook/datebookday.h | 52 |
1 files changed, 51 insertions, 1 deletions
diff --git a/core/pim/datebook/datebookday.h b/core/pim/datebook/datebookday.h index 531fded..db0f3b6 100644 --- a/core/pim/datebook/datebookday.h +++ b/core/pim/datebook/datebookday.h | |||
@@ -50,12 +50,13 @@ signals: | |||
50 | void sigCapturedKey( const QString &txt ); | 50 | void sigCapturedKey( const QString &txt ); |
51 | protected slots: | 51 | protected slots: |
52 | void slotChangeClock( bool ); | 52 | void slotChangeClock( bool ); |
53 | protected: | 53 | protected: |
54 | virtual void paintCell( QPainter *p, int row, int col, const QRect &cr, bool selected ); | 54 | virtual void paintCell( QPainter *p, int row, int col, const QRect &cr, bool selected ); |
55 | virtual void paintFocus( QPainter *p, const QRect &cr ); | 55 | virtual void paintFocus( QPainter *p, const QRect &cr ); |
56 | |||
56 | virtual void resizeEvent( QResizeEvent *e ); | 57 | virtual void resizeEvent( QResizeEvent *e ); |
57 | void keyPressEvent( QKeyEvent *e ); | 58 | void keyPressEvent( QKeyEvent *e ); |
58 | void initHeader(); | 59 | void initHeader(); |
59 | private: | 60 | private: |
60 | bool ampm; | 61 | bool ampm; |
61 | }; | 62 | }; |
@@ -87,30 +88,77 @@ private: | |||
87 | const EffectiveEvent ev; | 88 | const EffectiveEvent ev; |
88 | DateBookDay *dateBook; | 89 | DateBookDay *dateBook; |
89 | QString text; | 90 | QString text; |
90 | QRect geom; | 91 | QRect geom; |
91 | }; | 92 | }; |
92 | 93 | ||
94 | //Marker for current time in the dayview | ||
95 | class DateBookDayTimeMarker : public QWidget | ||
96 | { | ||
97 | Q_OBJECT | ||
98 | |||
99 | public: | ||
100 | DateBookDayTimeMarker( DateBookDay *db ); | ||
101 | ~DateBookDayTimeMarker(); | ||
102 | |||
103 | const QRect &geometry() { return geom; } | ||
104 | void setGeometry( const QRect &r ); | ||
105 | void setTime( const QTime &t ); | ||
106 | |||
107 | signals: | ||
108 | |||
109 | protected: | ||
110 | void paintEvent( QPaintEvent *e ); | ||
111 | |||
112 | private: | ||
113 | QRect geom; | ||
114 | QTime time; | ||
115 | DateBookDay *dateBook; | ||
116 | }; | ||
117 | |||
118 | //reimplemented the compareItems function so that it sorts DayWidgets by geometry heights | ||
119 | class WidgetListClass : public QList<DateBookDayWidget> | ||
120 | { | ||
121 | private: | ||
122 | |||
123 | int compareItems( QCollection::Item s1, QCollection::Item s2 ) | ||
124 | { | ||
125 | //hmm, don't punish me for that ;) | ||
126 | if (reinterpret_cast<DateBookDayWidget*>(s1)->geometry().height() > reinterpret_cast<DateBookDayWidget*>(s2)->geometry().height()) | ||
127 | { | ||
128 | return -1; | ||
129 | } else | ||
130 | { | ||
131 | return 1; | ||
132 | } | ||
133 | } | ||
134 | |||
135 | |||
136 | }; | ||
137 | |||
93 | class DateBookDay : public QVBox | 138 | class DateBookDay : public QVBox |
94 | { | 139 | { |
95 | Q_OBJECT | 140 | Q_OBJECT |
96 | 141 | ||
97 | public: | 142 | public: |
98 | DateBookDay( bool ampm, bool startOnMonday, DateBookDB *newDb, | 143 | DateBookDay( bool ampm, bool startOnMonday, DateBookDB *newDb, |
99 | QWidget *parent, const char *name ); | 144 | QWidget *parent, const char *name ); |
100 | void selectedDates( QDateTime &start, QDateTime &end ); | 145 | void selectedDates( QDateTime &start, QDateTime &end ); |
101 | QDate date() const; | 146 | QDate date() const; |
102 | DateBookDayView *dayView() const { return view; } | 147 | DateBookDayView *dayView() const { return view; } |
103 | void setStartViewTime( int startHere ); | 148 | void setStartViewTime( int startHere ); |
104 | int startViewTime() const; | 149 | int startViewTime() const; |
150 | void setSelectedWidget( DateBookDayWidget * ); | ||
151 | DateBookDayWidget * getSelectedWidget( void ); | ||
105 | 152 | ||
106 | public slots: | 153 | public slots: |
107 | void setDate( int y, int m, int d ); | 154 | void setDate( int y, int m, int d ); |
108 | void setDate( QDate ); | 155 | void setDate( QDate ); |
109 | void redraw(); | 156 | void redraw(); |
110 | void slotWeekChanged( bool bStartOnMonday ); | 157 | void slotWeekChanged( bool bStartOnMonday ); |
158 | void updateView();//updates TimeMarker and DayWidget-colors | ||
111 | 159 | ||
112 | signals: | 160 | signals: |
113 | void removeEvent( const Event& ); | 161 | void removeEvent( const Event& ); |
114 | void editEvent( const Event& ); | 162 | void editEvent( const Event& ); |
115 | void beamEvent( const Event& ); | 163 | void beamEvent( const Event& ); |
116 | void newEvent(); | 164 | void newEvent(); |
@@ -128,11 +176,13 @@ private: | |||
128 | void relayoutPage( bool fromResize = false ); | 176 | void relayoutPage( bool fromResize = false ); |
129 | DateBookDayWidget *intersects( const DateBookDayWidget *item, const QRect &geom ); | 177 | DateBookDayWidget *intersects( const DateBookDayWidget *item, const QRect &geom ); |
130 | QDate currDate; | 178 | QDate currDate; |
131 | DateBookDayView *view; | 179 | DateBookDayView *view; |
132 | DateBookDayHeader *header; | 180 | DateBookDayHeader *header; |
133 | DateBookDB *db; | 181 | DateBookDB *db; |
134 | QList<DateBookDayWidget> widgetList; | 182 | WidgetListClass widgetList;//reimplemented QList for sorting widgets by height |
135 | int startTime; | 183 | int startTime; |
184 | DateBookDayWidget *selectedWidget; //actual selected widget (obviously) | ||
185 | DateBookDayTimeMarker *timeMarker;//marker for current time | ||
136 | }; | 186 | }; |
137 | 187 | ||
138 | #endif | 188 | #endif |