summaryrefslogtreecommitdiffabout
path: root/korganizer/koeditorrecurrence.cpp
Side-by-side diff
Diffstat (limited to 'korganizer/koeditorrecurrence.cpp') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/koeditorrecurrence.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/korganizer/koeditorrecurrence.cpp b/korganizer/koeditorrecurrence.cpp
index 0e74a99..e0380c4 100644
--- a/korganizer/koeditorrecurrence.cpp
+++ b/korganizer/koeditorrecurrence.cpp
@@ -380,96 +380,98 @@ int RecurYearly::day()
//////////////////////////// ExceptionsWidget //////////////////////////
ExceptionsWidget::ExceptionsWidget( QWidget *parent, const char *name ) :
QWidget( parent, name )
{
QBoxLayout *topLayout = new QVBoxLayout( this );
QGroupBox *groupBox = new QGroupBox( 1, Horizontal, i18n("Exceptions"),
this );
topLayout->addWidget( groupBox );
QWidget *box = new QWidget( groupBox );
QGridLayout *boxLayout = new QGridLayout( box );
mExceptionDateEdit = new KDateEdit( box );
boxLayout->addWidget( mExceptionDateEdit, 0, 0 );
QPushButton *addExceptionButton = new QPushButton( i18n("Add"), box );
boxLayout->addWidget( addExceptionButton, 1, 0 );
QPushButton *changeExceptionButton = new QPushButton( i18n("Change"), box );
boxLayout->addWidget( changeExceptionButton, 2, 0 );
QPushButton *deleteExceptionButton = new QPushButton( i18n("Delete"), box );
boxLayout->addWidget( deleteExceptionButton, 3, 0 );
mExceptionList = new QListBox( box );
boxLayout->addMultiCellWidget( mExceptionList, 0, 3, 1, 1 );
boxLayout->setRowStretch( 4, 1 );
boxLayout->setColStretch( 1, 3 );
connect( addExceptionButton, SIGNAL( clicked() ),
SLOT( addException() ) );
connect( changeExceptionButton, SIGNAL( clicked() ),
SLOT( changeException() ) );
connect( deleteExceptionButton, SIGNAL( clicked() ),
SLOT( deleteException() ) );
if ( QApplication::desktop()->width() < 480 ) {
setMinimumWidth( 220 );
} else {
setMinimumWidth( 440 );
mExceptionDateEdit->setMinimumWidth( 200 );
}
}
void ExceptionsWidget::setDefaults( const QDateTime &from )
{
+ mExceptionList->clear();
+ mExceptionDates.clear();
mExceptionDateEdit->setDate( from.date() );
}
void ExceptionsWidget::addException()
{
QDate date = mExceptionDateEdit->date();
QString dateStr = KGlobal::locale()->formatDate( date );
if( !mExceptionList->findItem( dateStr ) ) {
mExceptionDates.append( date );
mExceptionList->insertItem( dateStr );
}
}
void ExceptionsWidget::changeException()
{
int pos = mExceptionList->currentItem();
if ( pos < 0 ) return;
QDate date = mExceptionDateEdit->date();
mExceptionDates[ pos ] = date;
mExceptionList->changeItem( KGlobal::locale()->formatDate( date ), pos );
}
void ExceptionsWidget::deleteException()
{
int pos = mExceptionList->currentItem();
if ( pos < 0 ) return;
mExceptionDates.remove( mExceptionDates.at( pos ) );
mExceptionList->removeItem( pos );
}
void ExceptionsWidget::setDates( const DateList &dates )
{
mExceptionList->clear();
mExceptionDates.clear();
DateList::ConstIterator dit;
for ( dit = dates.begin(); dit != dates.end(); ++dit ) {
mExceptionList->insertItem( KGlobal::locale()->formatDate(* dit ) );
mExceptionDates.append( *dit );
}
}
DateList ExceptionsWidget::dates()
{
return mExceptionDates;
}