author | zecke <zecke> | 2004-02-16 21:32:58 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-02-16 21:32:58 (UTC) |
commit | e228f4aa24ce73a49dde349544e55689cb0eccba (patch) (unidiff) | |
tree | 5b9be29793b2a72f9260cb1325751d31e40c18f0 | |
parent | 38d601a7d2a975bc0cbcc4cc933844f5572ec4fa (diff) | |
download | opie-e228f4aa24ce73a49dde349544e55689cb0eccba.zip opie-e228f4aa24ce73a49dde349544e55689cb0eccba.tar.gz opie-e228f4aa24ce73a49dde349544e55689cb0eccba.tar.bz2 |
Take care of the lifetime of the EffectiveEvent/Occurence
Make sure not to keep reference on non existing objects
-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 | |||
@@ -790,31 +790,33 @@ void DateBookDayWidget::mousePressEvent( QMouseEvent *e ) | |||
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() ) { |
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 | |||
@@ -119,17 +119,17 @@ private: | |||
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 | { |
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 | |||
@@ -151,47 +151,48 @@ void DatebookAlldayDisp::beam_single_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) |
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 | |||
@@ -77,19 +77,16 @@ DateBookWeekView::DateBookWeekView( bool ap, bool startOnMonday, | |||
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 | ||
@@ -309,17 +306,16 @@ void DateBookWeekView::drawContents( QPainter *p, int cx, int cy, int cw, int ch | |||
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 | */ |