summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/datebook/datebook.cpp189
1 files changed, 97 insertions, 92 deletions
diff --git a/core/pim/datebook/datebook.cpp b/core/pim/datebook/datebook.cpp
index 1bc82a5..829f8f8 100644
--- a/core/pim/datebook/datebook.cpp
+++ b/core/pim/datebook/datebook.cpp
@@ -222,5 +222,5 @@ DateBook::DateBook( QWidget *parent, const char *, WFlags f )
qDebug("done t=%d", t.elapsed() );
-
+
/*
* Here is a problem description:
@@ -237,7 +237,7 @@ DateBook::DateBook( QWidget *parent, const char *, WFlags f )
* from view()
*/
- if( needEvilHack ){
- QTimer::singleShot( 500, this, SLOT(viewWeek()) );
- }
+ if( needEvilHack ){
+ QTimer::singleShot( 500, this, SLOT(viewWeek()) );
+ }
}
@@ -277,26 +277,30 @@ void DateBook::slotSettings()
#endif
- if ( frmSettings.exec() ) {
- aPreset = frmSettings.alarmPreset();
- presetTime = frmSettings.presetTime();
- startTime = frmSettings.startTime();
- bJumpToCurTime = frmSettings.jumpToCurTime();
- rowStyle = frmSettings.rowStyle();
- if ( dayView )
- dayView->setStartViewTime( startTime );
- dayView->setJumpToCurTime( bJumpToCurTime );
- dayView->setRowStyle( rowStyle );
- if ( weekView )
- weekView->setStartViewTime( startTime );
- saveSettings();
-
- // make the change obvious
- if ( views->visibleWidget() ) {
- if ( views->visibleWidget() == dayView )
- dayView->redraw();
- else if ( views->visibleWidget() == weekView )
- weekView->redraw();
+ if ( frmSettings.exec() ) {
+
+ aPreset = frmSettings.alarmPreset();
+ presetTime = frmSettings.presetTime();
+ startTime = frmSettings.startTime();
+ bJumpToCurTime = frmSettings.jumpToCurTime();
+ rowStyle = frmSettings.rowStyle();
+
+ if ( dayView ) {
+ dayView->setStartViewTime( startTime );
+ dayView->setJumpToCurTime( bJumpToCurTime );
+ dayView->setRowStyle( rowStyle );
+ }
+ if ( weekView ) {
+ weekView->setStartViewTime( startTime );
+ }
+ saveSettings();
+
+ // make the change obvious
+ if ( views->visibleWidget() ) {
+ if ( views->visibleWidget() == dayView )
+ dayView->redraw();
+ else if ( views->visibleWidget() == weekView )
+ weekView->redraw();
+ }
}
- }
}
@@ -352,29 +356,29 @@ QDate DateBook::currentDate()
void DateBook::view(int v, const QDate &d) {
- if (v==DAY) {
- initDay();
- dayAction->setOn( TRUE );
- dayView->setDate( d );
- views->raiseWidget( dayView );
- dayView->redraw();
- } else if (v==WEEK) {
- initWeek();
- weekAction->setOn( TRUE );
- weekView->setDate( d );
- views->raiseWidget( weekView );
- weekView->redraw();
- } else if (v==WEEKLST) {
- initWeekLst();
- weekLstAction->setOn( TRUE );
- weekLstView->setDate(d);
- views->raiseWidget( weekLstView );
- weekLstView->redraw();
- } else if (v==MONTH) {
- initMonth();
- monthAction->setOn( TRUE );
- monthView->setDate( d.year(), d.month(), d.day() );
- views->raiseWidget( monthView );
- monthView->redraw();
- }
+ if (v==DAY) {
+ initDay();
+ dayAction->setOn( TRUE );
+ dayView->setDate( d );
+ views->raiseWidget( dayView );
+ dayView->redraw();
+ } else if (v==WEEK) {
+ initWeek();
+ weekAction->setOn( TRUE );
+ weekView->setDate( d );
+ views->raiseWidget( weekView );
+ weekView->redraw();
+ } else if (v==WEEKLST) {
+ initWeekLst();
+ weekLstAction->setOn( TRUE );
+ weekLstView->setDate(d);
+ views->raiseWidget( weekLstView );
+ weekLstView->redraw();
+ } else if (v==MONTH) {
+ initMonth();
+ monthAction->setOn( TRUE );
+ monthView->setDate( d.year(), d.month(), d.day() );
+ views->raiseWidget( monthView );
+ monthView->redraw();
+ }
}
@@ -515,24 +519,24 @@ void DateBook::showDay( int year, int month, int day )
void DateBook::initDay()
{
- if ( !dayView ) {
- dayView = new DateBookDay( ampm, onMonday, db, views, "day view" );
- views->addWidget( dayView, DAY );
- dayView->setStartViewTime( startTime );
- dayView->setJumpToCurTime( bJumpToCurTime );
- dayView->setRowStyle( rowStyle );
- connect( this, SIGNAL( newEvent() ),
- dayView, SLOT( redraw() ) );
- connect( dayView, SIGNAL( newEvent() ),
- this, SLOT( fileNew() ) );
- connect( dayView, SIGNAL( removeEvent( const Event & ) ),
- this, SLOT( removeEvent( const Event & ) ) );
- connect( dayView, SIGNAL( editEvent( const Event & ) ),
- this, SLOT( editEvent( const Event & ) ) );
- connect( dayView, SIGNAL( duplicateEvent( const Event & ) ),
- this, SLOT( duplicateEvent( const Event & ) ) );
- connect( dayView, SIGNAL( beamEvent( const Event & ) ),
- this, SLOT( beamEvent( const Event & ) ) );
- connect( dayView, SIGNAL(sigNewEvent(const QString &)),
- this, SLOT(slotNewEventFromKey(const QString &)) );
+ if ( !dayView ) {
+ dayView = new DateBookDay( ampm, onMonday, db, views, "day view" );
+ views->addWidget( dayView, DAY );
+ dayView->setStartViewTime( startTime );
+ dayView->setJumpToCurTime( bJumpToCurTime );
+ dayView->setRowStyle( rowStyle );
+ connect( this, SIGNAL( newEvent() ),
+ dayView, SLOT( redraw() ) );
+ connect( dayView, SIGNAL( newEvent() ),
+ this, SLOT( fileNew() ) );
+ connect( dayView, SIGNAL( removeEvent( const Event & ) ),
+ this, SLOT( removeEvent( const Event & ) ) );
+ connect( dayView, SIGNAL( editEvent( const Event & ) ),
+ this, SLOT( editEvent( const Event & ) ) );
+ connect( dayView, SIGNAL( duplicateEvent( const Event & ) ),
+ this, SLOT( duplicateEvent( const Event & ) ) );
+ connect( dayView, SIGNAL( beamEvent( const Event & ) ),
+ this, SLOT( beamEvent( const Event & ) ) );
+ connect( dayView, SIGNAL(sigNewEvent(const QString &)),
+ this, SLOT(slotNewEventFromKey(const QString &)) );
}
}
@@ -540,30 +544,31 @@ void DateBook::initDay()
void DateBook::initWeek()
{
- if ( !weekView ) {
- weekView = new DateBookWeek( ampm, onMonday, db, views, "week view" );
- weekView->setStartViewTime( startTime );
- views->addWidget( weekView, WEEK );
- connect( weekView, SIGNAL( showDate( int, int, int ) ),
- this, SLOT( showDay( int, int, int ) ) );
- connect( this, SIGNAL( newEvent() ),
- weekView, SLOT( redraw() ) );
- }
- //But also get it right: the year that we display can be different
- //from the year of the current date. So, first find the year
- //number of the current week.
-
- int yearNumber, totWeeks;
- calcWeek( currentDate(), totWeeks, yearNumber, onMonday );
+ if ( !weekView ) {
+ weekView = new DateBookWeek( ampm, onMonday, db, views, "week view" );
+ weekView->setStartViewTime( startTime );
+ views->addWidget( weekView, WEEK );
+ connect( weekView, SIGNAL( showDate( int, int, int ) ),
+ this, SLOT( showDay( int, int, int ) ) );
+ connect( this, SIGNAL( newEvent() ),
+ weekView, SLOT( redraw() ) );
+ }
- QDate d = QDate( yearNumber, 12, 31 );
- calcWeek( d, totWeeks, yearNumber, onMonday );
+ //But also get it right: the year that we display can be different
+ //from the year of the current date. So, first find the year
+ //number of the current week.
+ int yearNumber, totWeeks;
+ calcWeek( currentDate(), totWeeks, yearNumber, onMonday );
- while ( totWeeks == 1 ) {
- d = d.addDays( -1 );
+ QDate d = QDate( yearNumber, 12, 31 );
calcWeek( d, totWeeks, yearNumber, onMonday );
- }
- if ( totWeeks != weekView->totalWeeks() )
- weekView->setTotalWeeks( totWeeks );
+
+ while ( totWeeks == 1 ) {
+ d = d.addDays( -1 );
+ calcWeek( d, totWeeks, yearNumber, onMonday );
+ }
+ if ( totWeeks != weekView->totalWeeks() )
+ weekView->setTotalWeeks( totWeeks );
}
+
void DateBook::initWeekLst() {
if ( !weekLstView ) {