summaryrefslogtreecommitdiff
path: root/core/pim/datebook/datebookday.h
Unidiff
Diffstat (limited to 'core/pim/datebook/datebookday.h') (more/less context) (show whitespace changes)
-rw-r--r--core/pim/datebook/datebookday.h52
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
@@ -53,6 +53,7 @@ protected slots:
53protected: 53protected:
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();
@@ -90,6 +91,50 @@ private:
90 QRect geom; 91 QRect geom;
91}; 92};
92 93
94//Marker for current time in the dayview
95class DateBookDayTimeMarker : public QWidget
96{
97 Q_OBJECT
98
99public:
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
107signals:
108
109protected:
110 void paintEvent( QPaintEvent *e );
111
112private:
113 QRect geom;
114 QTime time;
115 DateBookDay *dateBook;
116};
117
118//reimplemented the compareItems function so that it sorts DayWidgets by geometry heights
119class 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
93class DateBookDay : public QVBox 138class DateBookDay : public QVBox
94{ 139{
95 Q_OBJECT 140 Q_OBJECT
@@ -102,12 +147,15 @@ public:
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
106public slots: 153public 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
112signals: 160signals:
113 void removeEvent( const Event& ); 161 void removeEvent( const Event& );
@@ -131,8 +179,10 @@ private:
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