summaryrefslogtreecommitdiff
authorzecke <zecke>2004-02-16 21:32:58 (UTC)
committer zecke <zecke>2004-02-16 21:32:58 (UTC)
commite228f4aa24ce73a49dde349544e55689cb0eccba (patch) (side-by-side diff)
tree5b9be29793b2a72f9260cb1325751d31e40c18f0
parent38d601a7d2a975bc0cbcc4cc933844f5572ec4fa (diff)
downloadopie-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
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/datebook/datebookday.cpp10
-rw-r--r--core/pim/datebook/datebookday.h2
-rw-r--r--core/pim/datebook/datebookdayallday.cpp11
-rw-r--r--core/pim/datebook/datebookweek.cpp4
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
@@ -792,27 +792,29 @@ void DateBookDayWidget::mousePressEvent( QMouseEvent *e )
item->update();
dateBook->setSelectedWidget(this);
update();
dateBook->repaint();
+ Event eve = ev.event();
+
QPopupMenu m;
m.insertItem( tr( "Edit" ), 1 );
m.insertItem( tr( "Duplicate" ), 4 );
m.insertItem( tr( "Delete" ), 2 );
if(Ir::supported()) m.insertItem( tr( "Beam" ), 3 );
if(Ir::supported() && ev.event().doRepeat() ) m.insertItem( tr( "Beam this occurence"), 5 );
int r = m.exec( e->globalPos() );
if ( r == 1 ) {
- emit editMe( ev.event() );
+ emit editMe( eve );
} else if ( r == 2 ) {
- emit deleteMe( ev.event() );
+ emit deleteMe( eve );
} else if ( r == 3 ) {
- emit beamMe( ev.event() );
+ emit beamMe( eve );
} else if ( r == 4 ) {
- emit duplicateMe( ev.event() );
+ emit duplicateMe( eve );
} else if ( r == 5 ) {
// create an Event and beam it...
/*
* Start with the easy stuff. If start and end date is the same we can just use
* the values of effective events
* If it is a multi day event we need to find the real start and 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
@@ -121,13 +121,13 @@ private:
/**
* Sets the EventText
* it got a start and an end Time
*/
void setEventText( QString& text );
- const EffectiveEvent ev;
+ EffectiveEvent ev;
DateBookDay *dateBook;
QString text;
QRect geom;
};
//Marker for current time in the dayview
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
@@ -153,12 +153,13 @@ void DatebookAlldayDisp::beam_single_event()
emit beamMe( m_Event );
}
}
void DatebookAlldayDisp::mousePressEvent(QMouseEvent*e)
{
+ Event ev = m_Ev.event();
QColor b = backgroundColor();
setBackgroundColor(green);
update();
QPopupMenu m;
m.insertItem( DateBookDayWidget::tr( "Edit" ), 1 );
m.insertItem( DateBookDayWidget::tr( "Duplicate" ), 4 );
@@ -168,28 +169,28 @@ void DatebookAlldayDisp::mousePressEvent(QMouseEvent*e)
m.insertItem( tr( "Info"),6);
int r = m.exec( e->globalPos() );
setBackgroundColor(b);
update();
switch (r) {
case 1:
- emit editMe( m_Ev.event() );
+ emit editMe( ev );
break;
case 2:
- emit deleteMe( m_Ev.event() );
+ emit deleteMe( ev );
break;
case 3:
- emit beamMe( m_Ev.event() );
+ emit beamMe( ev );
break;
case 4:
- emit duplicateMe( m_Ev.event() );
+ emit duplicateMe( ev );
break;
case 5:
beam_single_event();
break;
case 6:
- emit displayMe( m_Ev.event() );
+ emit displayMe( ev );
break;
default:
break;
}
}
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
@@ -79,15 +79,12 @@ DateBookWeekView::DateBookWeekView( bool ap, bool startOnMonday,
resizeContents( width(), 24*rowHeight );
}
void DateBookWeekView::initNames()
{
-#warning Please review this ! (eilers)
-
- // Ok, I am Mr. Pedantic, but shouldn't we count until 6 instead of 7, if bOnMonday is false ? (eilers)
static bool bFirst = true;
if ( bFirst ) {
if ( bOnMonday ) {
for ( int i = 1; i<=7; i++ ) {
header->addLabel( Calendar::nameOfDay( i ) );
@@ -311,13 +308,12 @@ void DateBookWeekView::drawContents( QPainter *p, int cx, int cy, int cw, int ch
void DateBookWeekView::resizeEvent( QResizeEvent *e )
{
const int hourWidth = 20;
QScrollView::resizeEvent( e );
-#warning check the geometry i have choosen BRANCH_1_0 (waspe)
//HEAD
/*
int avail = visibleWidth();
header->setGeometry( leftMargin()+frameWidth()+frameRect().left() , frameWidth(),
visibleWidth(), header->sizeHint().height() );