summaryrefslogtreecommitdiff
path: root/libopie/orecurrancewidget.cpp
Side-by-side diff
Diffstat (limited to 'libopie/orecurrancewidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/orecurrancewidget.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/libopie/orecurrancewidget.cpp b/libopie/orecurrancewidget.cpp
index 0484ab9..db86184 100644
--- a/libopie/orecurrancewidget.cpp
+++ b/libopie/orecurrancewidget.cpp
@@ -84,193 +84,193 @@ void ORecurranceWidget::setRecurrence( const ORecur& rp, const QDate& date ) {
setupWeekly();
int day, buttons;
for ( day = 0x01, buttons = 0; buttons < 7;
day = day << 1, buttons++ ) {
if ( rp.days() & day ) {
if ( startWeekOnMonday )
fraExtra->setButton( buttons );
else {
if ( buttons == 7 )
fraExtra->setButton( 0 );
else
fraExtra->setButton( buttons + 1 );
}
}
}
slotWeekLabel();
break;
case ORecur::MonthlyDay:
currInterval = Month;
setupMonthly();
fraExtra->setButton( 0 );
slotMonthLabel( 0 );
break;
case ORecur::MonthlyDate:
currInterval = Month;
setupMonthly();
fraExtra->setButton( 1 );
slotMonthLabel( 1 );
break;
case ORecur::Yearly:
currInterval = Year;
setupYearly();
break;
}
fraType->setButton( currInterval );
spinFreq->setValue( rp.frequency() );
if ( !rp.hasEndDate() ) {
cmdEnd->setText( tr("No End Date") );
chkNoEnd->setChecked( TRUE );
} else
cmdEnd->setText( TimeString::shortDate( end ) );
}
ORecur ORecurranceWidget::recurrence()const {
QListIterator<QToolButton> it( listRTypeButtons );
QListIterator<QToolButton> itExtra( listExtra );
ORecur rpTmp;
int i;
for ( i = 0; *it; ++it, i++ ) {
if ( (*it)->isOn() ) {
switch ( i ) {
case None:
rpTmp.setType( ORecur::NoRepeat );
break;
case Day:
rpTmp.setType( ORecur::Daily );
break;
case Week:{
rpTmp.setType( ORecur::Weekly );
int day;
int day2 = 0;
for ( day = 1; *itExtra; ++itExtra, day = day << 1 ) {
if ( (*itExtra)->isOn() ) {
if ( startWeekOnMonday )
day2 |= day;
else {
if ( day == 1 )
day2 |= Event::SUN;
else
day2 |= day >> 1;
}
}
}
rpTmp.setDays( day2 );
}
break;
case Month:
if ( cmdExtra1->isOn() )
rpTmp.setType( ORecur::MonthlyDay );
else if ( cmdExtra2->isOn() )
rpTmp.setType( ORecur::MonthlyDate );
// figure out the montly day...
rpTmp.setPosition( week( start ) );
break;
case Year:
rpTmp.setType( ORecur::Yearly );
break;
}
break; // no need to keep looking!
}
}
rpTmp.setFrequency(spinFreq->value() );
rpTmp.setHasEndDate( !chkNoEnd->isChecked() );
if ( rpTmp.hasEndDate() ) {
rpTmp.setEndDate( end );
}
// timestamp it...
- rpTmp.setCreateTime( time( NULL ) );
+// rpTmp.setCreateTime( ); current DateTime is already set -zecke
return rpTmp;
}
QDate ORecurranceWidget::endDate()const {
return end;
}
void ORecurranceWidget::slotSetRType(int rtype) {
// now call the right function based on the type...
currInterval = static_cast<repeatButtons>(rtype);
switch ( currInterval ) {
case None:
setupNone();
break;
case Day:
setupDaily();
break;
case Week:
setupWeekly();
slotWeekLabel();
break;
case Month:
setupMonthly();
cmdExtra2->setOn( TRUE );
slotMonthLabel( 1 );
break;
case Year:
setupYearly();
break;
}
}
void ORecurranceWidget::endDateChanged(int y, int m, int d) {
end.setYMD( y, m, d );
if ( end < start )
end = start;
cmdEnd->setText( TimeString::shortDate( end ) );
repeatPicker->setDate( end.year(), end.month(), end.day() );
}
void ORecurranceWidget::slotNoEnd( bool unused) {
// if the item was toggled, then go ahead and set it to the maximum date
if ( unused ) {
end.setYMD( 3000, 12, 31 );
cmdEnd->setText( tr("No End Date") );
} else {
end = start;
cmdEnd->setText( TimeString::shortDate(end) );
}
}
void ORecurranceWidget::setupRepeatLabel( const QString& s) {
lblVar1->setText( s );
}
void ORecurranceWidget::setupRepeatLabel( int x) {
// change the spelling based on the value of x
QString strVar2;
if ( x > 1 )
lblVar1->show();
else
lblVar1->hide();
switch ( currInterval ) {
case None:
break;
case Day:
if ( x > 1 )
strVar2 = tr( "days" );
else
strVar2 = tr( "day" );
break;
case Week:
if ( x > 1 )
strVar2 = tr( "weeks" );
else
strVar2 = tr( "week" );
break;
case Month:
if ( x > 1 )
strVar2 = tr( "months" );
else
strVar2 = tr( "month" );
break;
case Year:
if ( x > 1 )
strVar2 = tr( "years" );
else
strVar2 = tr( "year" );
break;
}
if ( !strVar2.isNull() )
lblVar2->setText( strVar2 );
}
void ORecurranceWidget::slotWeekLabel() {
QString str;
QListIterator<QToolButton> it( listExtra );
unsigned int i;
unsigned int keepMe;
bool bNeedCarriage = FALSE;
// don't do something we'll regret!!!