-rw-r--r-- | core/pim/datebook/datebookday.cpp | 10 | ||||
-rw-r--r-- | core/pim/datebook/datebookday.h | 2 | ||||
-rw-r--r-- | core/pim/datebook/datebookdayallday.cpp | 11 | ||||
-rw-r--r-- | core/pim/datebook/datebookweek.cpp | 4 |
4 files changed, 13 insertions, 14 deletions
diff --git a/core/pim/datebook/datebookday.cpp b/core/pim/datebook/datebookday.cpp index 4d64099..751a1da 100644 --- a/core/pim/datebook/datebookday.cpp +++ b/core/pim/datebook/datebookday.cpp | |||
@@ -766,79 +766,81 @@ void DateBookDayWidget::paintEvent( QPaintEvent *e ) | |||
766 | * we need to check from one day to another... | 766 | * we need to check from one day to another... |
767 | */ | 767 | */ |
768 | QDate DateBookDay::findRealStart( int uid, const QDate& isIncluded , DateBookDB* db) { | 768 | QDate DateBookDay::findRealStart( int uid, const QDate& isIncluded , DateBookDB* db) { |
769 | QDate dt( isIncluded ); | 769 | QDate dt( isIncluded ); |
770 | QDate fnd = dt; | 770 | QDate fnd = dt; |
771 | 771 | ||
772 | bool doAgain = true; | 772 | bool doAgain = true; |
773 | do{ | 773 | do{ |
774 | dt = dt.addDays( -1 ); | 774 | dt = dt.addDays( -1 ); |
775 | QValueList<EffectiveEvent> events = db->getEffectiveEvents( dt, dt ); | 775 | QValueList<EffectiveEvent> events = db->getEffectiveEvents( dt, dt ); |
776 | for (QValueList<EffectiveEvent>::Iterator it = events.begin(); it != events.end(); ++it ) { | 776 | for (QValueList<EffectiveEvent>::Iterator it = events.begin(); it != events.end(); ++it ) { |
777 | EffectiveEvent ev = (*it); | 777 | EffectiveEvent ev = (*it); |
778 | if ( uid == ev.event().uid() && ev.start() != QTime(0, 0, 0 ) ) | 778 | if ( uid == ev.event().uid() && ev.start() != QTime(0, 0, 0 ) ) |
779 | return ev.date(); | 779 | return ev.date(); |
780 | } | 780 | } |
781 | }while (doAgain ); | 781 | }while (doAgain ); |
782 | 782 | ||
783 | return fnd; | 783 | return fnd; |
784 | } | 784 | } |
785 | 785 | ||
786 | void DateBookDayWidget::mousePressEvent( QMouseEvent *e ) | 786 | void DateBookDayWidget::mousePressEvent( QMouseEvent *e ) |
787 | { | 787 | { |
788 | DateBookDayWidget *item; | 788 | DateBookDayWidget *item; |
789 | 789 | ||
790 | item = dateBook->getSelectedWidget(); | 790 | item = dateBook->getSelectedWidget(); |
791 | if (item) | 791 | if (item) |
792 | item->update(); | 792 | item->update(); |
793 | 793 | ||
794 | dateBook->setSelectedWidget(this); | 794 | dateBook->setSelectedWidget(this); |
795 | update(); | 795 | update(); |
796 | dateBook->repaint(); | 796 | dateBook->repaint(); |
797 | 797 | ||
798 | Event eve = ev.event(); | ||
799 | |||
798 | QPopupMenu m; | 800 | QPopupMenu m; |
799 | m.insertItem( tr( "Edit" ), 1 ); | 801 | m.insertItem( tr( "Edit" ), 1 ); |
800 | m.insertItem( tr( "Duplicate" ), 4 ); | 802 | m.insertItem( tr( "Duplicate" ), 4 ); |
801 | m.insertItem( tr( "Delete" ), 2 ); | 803 | m.insertItem( tr( "Delete" ), 2 ); |
802 | if(Ir::supported()) m.insertItem( tr( "Beam" ), 3 ); | 804 | if(Ir::supported()) m.insertItem( tr( "Beam" ), 3 ); |
803 | if(Ir::supported() && ev.event().doRepeat() ) m.insertItem( tr( "Beam this occurence"), 5 ); | 805 | if(Ir::supported() && ev.event().doRepeat() ) m.insertItem( tr( "Beam this occurence"), 5 ); |
804 | int r = m.exec( e->globalPos() ); | 806 | int r = m.exec( e->globalPos() ); |
805 | if ( r == 1 ) { | 807 | if ( r == 1 ) { |
806 | emit editMe( ev.event() ); | 808 | emit editMe( eve ); |
807 | } else if ( r == 2 ) { | 809 | } else if ( r == 2 ) { |
808 | emit deleteMe( ev.event() ); | 810 | emit deleteMe( eve ); |
809 | } else if ( r == 3 ) { | 811 | } else if ( r == 3 ) { |
810 | emit beamMe( ev.event() ); | 812 | emit beamMe( eve ); |
811 | } else if ( r == 4 ) { | 813 | } else if ( r == 4 ) { |
812 | emit duplicateMe( ev.event() ); | 814 | emit duplicateMe( eve ); |
813 | } else if ( r == 5 ) { | 815 | } else if ( r == 5 ) { |
814 | // create an Event and beam it... | 816 | // create an Event and beam it... |
815 | /* | 817 | /* |
816 | * Start with the easy stuff. If start and end date is the same we can just use | 818 | * Start with the easy stuff. If start and end date is the same we can just use |
817 | * the values of effective events | 819 | * the values of effective events |
818 | * If it is a multi day event we need to find the real start and end date... | 820 | * If it is a multi day event we need to find the real start and end date... |
819 | */ | 821 | */ |
820 | if ( ev.event().start().date() == ev.event().end().date() ) { | 822 | if ( ev.event().start().date() == ev.event().end().date() ) { |
821 | Event event( ev.event() ); | 823 | Event event( ev.event() ); |
822 | 824 | ||
823 | QDateTime dt( ev.date(), ev.start() ); | 825 | QDateTime dt( ev.date(), ev.start() ); |
824 | event.setStart( dt ); | 826 | event.setStart( dt ); |
825 | 827 | ||
826 | dt.setTime( ev.end() ); | 828 | dt.setTime( ev.end() ); |
827 | event.setEnd( dt ); | 829 | event.setEnd( dt ); |
828 | emit beamMe( event ); | 830 | emit beamMe( event ); |
829 | }else { | 831 | }else { |
830 | /* | 832 | /* |
831 | * at least the the Times are right now | 833 | * at least the the Times are right now |
832 | */ | 834 | */ |
833 | QDateTime start( ev.event().start() ); | 835 | QDateTime start( ev.event().start() ); |
834 | QDateTime end ( ev.event().end () ); | 836 | QDateTime end ( ev.event().end () ); |
835 | 837 | ||
836 | 838 | ||
837 | /* | 839 | /* |
838 | * ok we know the start date or we need to find it | 840 | * ok we know the start date or we need to find it |
839 | */ | 841 | */ |
840 | if ( ev.start() != QTime( 0, 0, 0 ) ) { | 842 | if ( ev.start() != QTime( 0, 0, 0 ) ) { |
841 | start.setDate( ev.date() ); | 843 | start.setDate( ev.date() ); |
842 | }else { | 844 | }else { |
843 | QDate dt = DateBookDay::findRealStart( ev.event().uid(), ev.date(), dateBook->db ); | 845 | QDate dt = DateBookDay::findRealStart( ev.event().uid(), ev.date(), dateBook->db ); |
844 | start.setDate( dt ); | 846 | start.setDate( dt ); |
diff --git a/core/pim/datebook/datebookday.h b/core/pim/datebook/datebookday.h index 3898cbc..c8cb26b 100644 --- a/core/pim/datebook/datebookday.h +++ b/core/pim/datebook/datebookday.h | |||
@@ -95,65 +95,65 @@ class DateBookDayWidget : public QWidget | |||
95 | 95 | ||
96 | public: | 96 | public: |
97 | DateBookDayWidget( const EffectiveEvent &e, DateBookDay *db ); | 97 | DateBookDayWidget( const EffectiveEvent &e, DateBookDay *db ); |
98 | ~DateBookDayWidget(); | 98 | ~DateBookDayWidget(); |
99 | 99 | ||
100 | const QRect &geometry() { return geom; } | 100 | const QRect &geometry() { return geom; } |
101 | void setGeometry( const QRect &r ); | 101 | void setGeometry( const QRect &r ); |
102 | 102 | ||
103 | const EffectiveEvent &event() const { return ev; } | 103 | const EffectiveEvent &event() const { return ev; } |
104 | 104 | ||
105 | signals: | 105 | signals: |
106 | void deleteMe( const Event &e ); | 106 | void deleteMe( const Event &e ); |
107 | void duplicateMe( const Event &e ); | 107 | void duplicateMe( const Event &e ); |
108 | void editMe( const Event &e ); | 108 | void editMe( const Event &e ); |
109 | void beamMe( const Event &e ); | 109 | void beamMe( const Event &e ); |
110 | 110 | ||
111 | protected: | 111 | protected: |
112 | void paintEvent( QPaintEvent *e ); | 112 | void paintEvent( QPaintEvent *e ); |
113 | void mousePressEvent( QMouseEvent *e ); | 113 | void mousePressEvent( QMouseEvent *e ); |
114 | 114 | ||
115 | private: | 115 | private: |
116 | /** | 116 | /** |
117 | * Sets the text for an all day Event | 117 | * Sets the text for an all day Event |
118 | * All day events have no time associated | 118 | * All day events have no time associated |
119 | */ | 119 | */ |
120 | void setAllDayText( QString& text ); | 120 | void setAllDayText( QString& text ); |
121 | 121 | ||
122 | /** | 122 | /** |
123 | * Sets the EventText | 123 | * Sets the EventText |
124 | * it got a start and an end Time | 124 | * it got a start and an end Time |
125 | */ | 125 | */ |
126 | void setEventText( QString& text ); | 126 | void setEventText( QString& text ); |
127 | const EffectiveEvent ev; | 127 | EffectiveEvent ev; |
128 | DateBookDay *dateBook; | 128 | DateBookDay *dateBook; |
129 | QString text; | 129 | QString text; |
130 | QRect geom; | 130 | QRect geom; |
131 | }; | 131 | }; |
132 | 132 | ||
133 | //Marker for current time in the dayview | 133 | //Marker for current time in the dayview |
134 | class DateBookDayTimeMarker : public QWidget | 134 | class DateBookDayTimeMarker : public QWidget |
135 | { | 135 | { |
136 | Q_OBJECT | 136 | Q_OBJECT |
137 | 137 | ||
138 | public: | 138 | public: |
139 | DateBookDayTimeMarker( DateBookDay *db ); | 139 | DateBookDayTimeMarker( DateBookDay *db ); |
140 | ~DateBookDayTimeMarker(); | 140 | ~DateBookDayTimeMarker(); |
141 | 141 | ||
142 | const QRect &geometry() { return geom; } | 142 | const QRect &geometry() { return geom; } |
143 | void setGeometry( const QRect &r ); | 143 | void setGeometry( const QRect &r ); |
144 | void setTime( const QTime &t ); | 144 | void setTime( const QTime &t ); |
145 | 145 | ||
146 | signals: | 146 | signals: |
147 | 147 | ||
148 | protected: | 148 | protected: |
149 | void paintEvent( QPaintEvent *e ); | 149 | void paintEvent( QPaintEvent *e ); |
150 | 150 | ||
151 | private: | 151 | private: |
152 | QRect geom; | 152 | QRect geom; |
153 | QTime time; | 153 | QTime time; |
154 | DateBookDay *dateBook; | 154 | DateBookDay *dateBook; |
155 | }; | 155 | }; |
156 | 156 | ||
157 | //reimplemented the compareItems function so that it sorts DayWidgets by geometry heights | 157 | //reimplemented the compareItems function so that it sorts DayWidgets by geometry heights |
158 | class WidgetListClass : public QList<DateBookDayWidget> | 158 | class WidgetListClass : public QList<DateBookDayWidget> |
159 | { | 159 | { |
diff --git a/core/pim/datebook/datebookdayallday.cpp b/core/pim/datebook/datebookdayallday.cpp index 2294f3c..1244fd3 100644 --- a/core/pim/datebook/datebookdayallday.cpp +++ b/core/pim/datebook/datebookdayallday.cpp | |||
@@ -127,95 +127,96 @@ void DatebookAlldayDisp::beam_single_event() | |||
127 | 127 | ||
128 | /* | 128 | /* |
129 | * ok we know the start date or we need to find it | 129 | * ok we know the start date or we need to find it |
130 | */ | 130 | */ |
131 | if ( m_Ev.start() != QTime( 0, 0, 0 ) ) { | 131 | if ( m_Ev.start() != QTime( 0, 0, 0 ) ) { |
132 | start.setDate( m_Ev.date() ); | 132 | start.setDate( m_Ev.date() ); |
133 | }else { | 133 | }else { |
134 | QDate dt = DateBookDay::findRealStart( m_Ev.event().uid(), m_Ev.date(), dateBook ); | 134 | QDate dt = DateBookDay::findRealStart( m_Ev.event().uid(), m_Ev.date(), dateBook ); |
135 | start.setDate( dt ); | 135 | start.setDate( dt ); |
136 | } | 136 | } |
137 | 137 | ||
138 | /* | 138 | /* |
139 | * ok we know now the end date... | 139 | * ok we know now the end date... |
140 | * else | 140 | * else |
141 | * get to know the offset btw the real start and real end | 141 | * get to know the offset btw the real start and real end |
142 | * and then add it to the new start date... | 142 | * and then add it to the new start date... |
143 | */ | 143 | */ |
144 | if ( m_Ev.end() != QTime(23, 59, 59 ) ) { | 144 | if ( m_Ev.end() != QTime(23, 59, 59 ) ) { |
145 | end.setDate( m_Ev.date() ); | 145 | end.setDate( m_Ev.date() ); |
146 | }else{ | 146 | }else{ |
147 | int days = m_Ev.event().start().date().daysTo( m_Ev.event().end().date() ); | 147 | int days = m_Ev.event().start().date().daysTo( m_Ev.event().end().date() ); |
148 | end.setDate( start.date().addDays( days ) ); | 148 | end.setDate( start.date().addDays( days ) ); |
149 | } | 149 | } |
150 | Event m_Event( m_Ev.event() ); | 150 | Event m_Event( m_Ev.event() ); |
151 | m_Event.setStart( start ); | 151 | m_Event.setStart( start ); |
152 | m_Event.setEnd ( end ); | 152 | m_Event.setEnd ( end ); |
153 | emit beamMe( m_Event ); | 153 | emit beamMe( m_Event ); |
154 | } | 154 | } |
155 | } | 155 | } |
156 | 156 | ||
157 | void DatebookAlldayDisp::mousePressEvent(QMouseEvent*e) | 157 | void DatebookAlldayDisp::mousePressEvent(QMouseEvent*e) |
158 | { | 158 | { |
159 | Event ev = m_Ev.event(); | ||
159 | QColor b = backgroundColor(); | 160 | QColor b = backgroundColor(); |
160 | setBackgroundColor(green); | 161 | setBackgroundColor(green); |
161 | update(); | 162 | update(); |
162 | QPopupMenu m; | 163 | QPopupMenu m; |
163 | m.insertItem( DateBookDayWidget::tr( "Edit" ), 1 ); | 164 | m.insertItem( DateBookDayWidget::tr( "Edit" ), 1 ); |
164 | m.insertItem( DateBookDayWidget::tr( "Duplicate" ), 4 ); | 165 | m.insertItem( DateBookDayWidget::tr( "Duplicate" ), 4 ); |
165 | m.insertItem( DateBookDayWidget::tr( "Delete" ), 2 ); | 166 | m.insertItem( DateBookDayWidget::tr( "Delete" ), 2 ); |
166 | if(Ir::supported()) m.insertItem( DateBookDayWidget::tr( "Beam" ), 3 ); | 167 | if(Ir::supported()) m.insertItem( DateBookDayWidget::tr( "Beam" ), 3 ); |
167 | if(Ir::supported() && m_Ev.event().doRepeat() ) m.insertItem( DateBookDayWidget::tr( "Beam this occurence"), 5 ); | 168 | if(Ir::supported() && m_Ev.event().doRepeat() ) m.insertItem( DateBookDayWidget::tr( "Beam this occurence"), 5 ); |
168 | m.insertItem( tr( "Info"),6); | 169 | m.insertItem( tr( "Info"),6); |
169 | int r = m.exec( e->globalPos() ); | 170 | int r = m.exec( e->globalPos() ); |
170 | setBackgroundColor(b); | 171 | setBackgroundColor(b); |
171 | update(); | 172 | update(); |
172 | switch (r) { | 173 | switch (r) { |
173 | case 1: | 174 | case 1: |
174 | emit editMe( m_Ev.event() ); | 175 | emit editMe( ev ); |
175 | break; | 176 | break; |
176 | case 2: | 177 | case 2: |
177 | emit deleteMe( m_Ev.event() ); | 178 | emit deleteMe( ev ); |
178 | break; | 179 | break; |
179 | case 3: | 180 | case 3: |
180 | emit beamMe( m_Ev.event() ); | 181 | emit beamMe( ev ); |
181 | break; | 182 | break; |
182 | case 4: | 183 | case 4: |
183 | emit duplicateMe( m_Ev.event() ); | 184 | emit duplicateMe( ev ); |
184 | break; | 185 | break; |
185 | case 5: | 186 | case 5: |
186 | beam_single_event(); | 187 | beam_single_event(); |
187 | break; | 188 | break; |
188 | case 6: | 189 | case 6: |
189 | emit displayMe( m_Ev.event() ); | 190 | emit displayMe( ev ); |
190 | break; | 191 | break; |
191 | default: | 192 | default: |
192 | break; | 193 | break; |
193 | } | 194 | } |
194 | } | 195 | } |
195 | 196 | ||
196 | DatebookEventDesc::DatebookEventDesc(QWidget*parent,const char*name) | 197 | DatebookEventDesc::DatebookEventDesc(QWidget*parent,const char*name) |
197 | :QLabel(parent,name) | 198 | :QLabel(parent,name) |
198 | { | 199 | { |
199 | m_Timer=new QTimer(this); | 200 | m_Timer=new QTimer(this); |
200 | connect(m_Timer,SIGNAL(timeout()),this,SLOT(hide())); | 201 | connect(m_Timer,SIGNAL(timeout()),this,SLOT(hide())); |
201 | setFrameStyle(QFrame::Sunken|QFrame::Panel); | 202 | setFrameStyle(QFrame::Sunken|QFrame::Panel); |
202 | setTextFormat(RichText); | 203 | setTextFormat(RichText); |
203 | } | 204 | } |
204 | 205 | ||
205 | DatebookEventDesc::~DatebookEventDesc() | 206 | DatebookEventDesc::~DatebookEventDesc() |
206 | { | 207 | { |
207 | } | 208 | } |
208 | 209 | ||
209 | void DatebookEventDesc::mousePressEvent(QMouseEvent*) | 210 | void DatebookEventDesc::mousePressEvent(QMouseEvent*) |
210 | { | 211 | { |
211 | hide(); | 212 | hide(); |
212 | if (m_Timer->isActive()) m_Timer->stop(); | 213 | if (m_Timer->isActive()) m_Timer->stop(); |
213 | } | 214 | } |
214 | 215 | ||
215 | void DatebookEventDesc::disp_event(const Event&e) | 216 | void DatebookEventDesc::disp_event(const Event&e) |
216 | { | 217 | { |
217 | if (m_Timer->isActive()) m_Timer->stop(); | 218 | if (m_Timer->isActive()) m_Timer->stop(); |
218 | QString text; | 219 | QString text; |
219 | text = "<b><i>"+e.description()+"</i></b><br>"; | 220 | text = "<b><i>"+e.description()+"</i></b><br>"; |
220 | if (e.notes().length()>0) { | 221 | if (e.notes().length()>0) { |
221 | text+="<b>"+e.notes()+"</b><br>"; | 222 | text+="<b>"+e.notes()+"</b><br>"; |
diff --git a/core/pim/datebook/datebookweek.cpp b/core/pim/datebook/datebookweek.cpp index 8435132..933e191 100644 --- a/core/pim/datebook/datebookweek.cpp +++ b/core/pim/datebook/datebookweek.cpp | |||
@@ -53,67 +53,64 @@ void DateBookWeekItem::setGeometry( int x, int y, int w, int h ) | |||
53 | 53 | ||
54 | DateBookWeekView::DateBookWeekView( bool ap, bool startOnMonday, | 54 | DateBookWeekView::DateBookWeekView( bool ap, bool startOnMonday, |
55 | QWidget *parent, const char *name ) | 55 | QWidget *parent, const char *name ) |
56 | : QScrollView( parent, name ), ampm( ap ), bOnMonday( startOnMonday ), | 56 | : QScrollView( parent, name ), ampm( ap ), bOnMonday( startOnMonday ), |
57 | showingEvent( false ) | 57 | showingEvent( false ) |
58 | { | 58 | { |
59 | items.setAutoDelete( true ); | 59 | items.setAutoDelete( true ); |
60 | 60 | ||
61 | viewport()->setBackgroundMode( PaletteBase ); | 61 | viewport()->setBackgroundMode( PaletteBase ); |
62 | 62 | ||
63 | header = new QHeader( this ); | 63 | header = new QHeader( this ); |
64 | header->addLabel( "" ); | 64 | header->addLabel( "" ); |
65 | 65 | ||
66 | header->setMovingEnabled( false ); | 66 | header->setMovingEnabled( false ); |
67 | header->setResizeEnabled( false ); | 67 | header->setResizeEnabled( false ); |
68 | header->setClickEnabled( false, 0 ); | 68 | header->setClickEnabled( false, 0 ); |
69 | initNames(); | 69 | initNames(); |
70 | 70 | ||
71 | 71 | ||
72 | connect( header, SIGNAL(clicked(int)), this, SIGNAL(showDay(int)) ); | 72 | connect( header, SIGNAL(clicked(int)), this, SIGNAL(showDay(int)) ); |
73 | 73 | ||
74 | QObject::connect(qApp, SIGNAL(clockChanged(bool)), | 74 | QObject::connect(qApp, SIGNAL(clockChanged(bool)), |
75 | this, SLOT(slotChangeClock(bool))); | 75 | this, SLOT(slotChangeClock(bool))); |
76 | 76 | ||
77 | QFontMetrics fm( font() ); | 77 | QFontMetrics fm( font() ); |
78 | rowHeight = fm.height()+2; | 78 | rowHeight = fm.height()+2; |
79 | 79 | ||
80 | resizeContents( width(), 24*rowHeight ); | 80 | resizeContents( width(), 24*rowHeight ); |
81 | } | 81 | } |
82 | 82 | ||
83 | void DateBookWeekView::initNames() | 83 | void DateBookWeekView::initNames() |
84 | { | 84 | { |
85 | #warning Please review this ! (eilers) | ||
86 | |||
87 | // Ok, I am Mr. Pedantic, but shouldn't we count until 6 instead of 7, if bOnMonday is false ? (eilers) | ||
88 | 85 | ||
89 | static bool bFirst = true; | 86 | static bool bFirst = true; |
90 | if ( bFirst ) { | 87 | if ( bFirst ) { |
91 | if ( bOnMonday ) { | 88 | if ( bOnMonday ) { |
92 | for ( int i = 1; i<=7; i++ ) { | 89 | for ( int i = 1; i<=7; i++ ) { |
93 | header->addLabel( Calendar::nameOfDay( i ) ); | 90 | header->addLabel( Calendar::nameOfDay( i ) ); |
94 | } | 91 | } |
95 | 92 | ||
96 | } else { | 93 | } else { |
97 | header->addLabel( Calendar::nameOfDay( 7 ) ); | 94 | header->addLabel( Calendar::nameOfDay( 7 ) ); |
98 | for ( int i = 1; i<7; i++ ) { | 95 | for ( int i = 1; i<7; i++ ) { |
99 | header->addLabel( Calendar::nameOfDay( i ) ); | 96 | header->addLabel( Calendar::nameOfDay( i ) ); |
100 | } | 97 | } |
101 | } | 98 | } |
102 | bFirst = false; | 99 | bFirst = false; |
103 | } else { | 100 | } else { |
104 | // we are change things... | 101 | // we are change things... |
105 | if ( bOnMonday ) { | 102 | if ( bOnMonday ) { |
106 | for ( int i = 1; i<=7; i++ ) { | 103 | for ( int i = 1; i<=7; i++ ) { |
107 | header->setLabel( i, Calendar::nameOfDay( i ) ); | 104 | header->setLabel( i, Calendar::nameOfDay( i ) ); |
108 | } | 105 | } |
109 | 106 | ||
110 | } else { | 107 | } else { |
111 | header->setLabel( 1, Calendar::nameOfDay( 7 ) ); | 108 | header->setLabel( 1, Calendar::nameOfDay( 7 ) ); |
112 | for ( int i = 1; i<7; i++ ) { | 109 | for ( int i = 1; i<7; i++ ) { |
113 | header->setLabel( i+1, Calendar::nameOfDay( i ) ); | 110 | header->setLabel( i+1, Calendar::nameOfDay( i ) ); |
114 | } | 111 | } |
115 | 112 | ||
116 | } | 113 | } |
117 | } | 114 | } |
118 | } | 115 | } |
119 | 116 | ||
@@ -285,65 +282,64 @@ void DateBookWeekView::drawContents( QPainter *p, int cx, int cy, int cw, int ch | |||
285 | s += QString::number( t - 12 ) + tr("p"); | 282 | s += QString::number( t - 12 ) + tr("p"); |
286 | } else { | 283 | } else { |
287 | if ( 12 - t < 3 ) | 284 | if ( 12 - t < 3 ) |
288 | s = ""; | 285 | s = ""; |
289 | else | 286 | else |
290 | s = " "; | 287 | s = " "; |
291 | s += QString::number( t ); | 288 | s += QString::number( t ); |
292 | } | 289 | } |
293 | } else { | 290 | } else { |
294 | s = QString::number( t ); | 291 | s = QString::number( t ); |
295 | if ( s.length() == 1 ) | 292 | if ( s.length() == 1 ) |
296 | s.prepend( "0" ); | 293 | s.prepend( "0" ); |
297 | } | 294 | } |
298 | p->drawText( 1, y+p->fontMetrics().ascent()+1, s ); | 295 | p->drawText( 1, y+p->fontMetrics().ascent()+1, s ); |
299 | } | 296 | } |
300 | } | 297 | } |
301 | 298 | ||
302 | QListIterator<DateBookWeekItem> it(items); | 299 | QListIterator<DateBookWeekItem> it(items); |
303 | for ( ; it.current(); ++it ) { | 300 | for ( ; it.current(); ++it ) { |
304 | DateBookWeekItem *i = it.current(); | 301 | DateBookWeekItem *i = it.current(); |
305 | if ( i->geometry().intersects( ur ) ) { | 302 | if ( i->geometry().intersects( ur ) ) { |
306 | p->setBrush( i->color() ); | 303 | p->setBrush( i->color() ); |
307 | p->drawRect( i->geometry() ); | 304 | p->drawRect( i->geometry() ); |
308 | } | 305 | } |
309 | } | 306 | } |
310 | } | 307 | } |
311 | 308 | ||
312 | void DateBookWeekView::resizeEvent( QResizeEvent *e ) | 309 | void DateBookWeekView::resizeEvent( QResizeEvent *e ) |
313 | { | 310 | { |
314 | const int hourWidth = 20; | 311 | const int hourWidth = 20; |
315 | QScrollView::resizeEvent( e ); | 312 | QScrollView::resizeEvent( e ); |
316 | 313 | ||
317 | #warning check the geometry i have choosen BRANCH_1_0 (waspe) | ||
318 | 314 | ||
319 | //HEAD | 315 | //HEAD |
320 | /* | 316 | /* |
321 | int avail = visibleWidth(); | 317 | int avail = visibleWidth(); |
322 | header->setGeometry( leftMargin()+frameWidth()+frameRect().left() , frameWidth(), | 318 | header->setGeometry( leftMargin()+frameWidth()+frameRect().left() , frameWidth(), |
323 | visibleWidth(), header->sizeHint().height() ); | 319 | visibleWidth(), header->sizeHint().height() ); |
324 | setMargins( 0, header->sizeHint().height(), 0, 0 ); | 320 | setMargins( 0, header->sizeHint().height(), 0, 0 ); |
325 | */ | 321 | */ |
326 | //BRANCH_1_0 | 322 | //BRANCH_1_0 |
327 | int avail = width()-qApp->style().scrollBarExtent().width()-1; | 323 | int avail = width()-qApp->style().scrollBarExtent().width()-1; |
328 | header->setGeometry( 0, 0, avail, header->sizeHint().height() ); | 324 | header->setGeometry( 0, 0, avail, header->sizeHint().height() ); |
329 | setMargins( 0, header->height(), 0, 0 ); | 325 | setMargins( 0, header->height(), 0, 0 ); |
330 | 326 | ||
331 | 327 | ||
332 | header->resizeSection( 0, hourWidth ); | 328 | header->resizeSection( 0, hourWidth ); |
333 | int sw = (avail - hourWidth) / 7; | 329 | int sw = (avail - hourWidth) / 7; |
334 | for ( int i = 1; i < 7; i++ ) | 330 | for ( int i = 1; i < 7; i++ ) |
335 | header->resizeSection( i, sw ); | 331 | header->resizeSection( i, sw ); |
336 | header->resizeSection( 7, avail - hourWidth - sw*6 ); | 332 | header->resizeSection( 7, avail - hourWidth - sw*6 ); |
337 | } | 333 | } |
338 | 334 | ||
339 | void DateBookWeekView::setStartOfWeek( bool bStartOnMonday ) | 335 | void DateBookWeekView::setStartOfWeek( bool bStartOnMonday ) |
340 | { | 336 | { |
341 | bOnMonday = bStartOnMonday; | 337 | bOnMonday = bStartOnMonday; |
342 | initNames(); | 338 | initNames(); |
343 | } | 339 | } |
344 | 340 | ||
345 | //------------------------------------------------------------------- | 341 | //------------------------------------------------------------------- |
346 | 342 | ||
347 | DateBookWeek::DateBookWeek( bool ap, bool startOnMonday, DateBookDB *newDB, | 343 | DateBookWeek::DateBookWeek( bool ap, bool startOnMonday, DateBookDB *newDB, |
348 | QWidget *parent, const char *name ) | 344 | QWidget *parent, const char *name ) |
349 | : QWidget( parent, name ), | 345 | : QWidget( parent, name ), |