summaryrefslogtreecommitdiff
path: root/core/pim/datebook/datebook.cpp
Unidiff
Diffstat (limited to 'core/pim/datebook/datebook.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/datebook/datebook.cpp48
1 files changed, 25 insertions, 23 deletions
diff --git a/core/pim/datebook/datebook.cpp b/core/pim/datebook/datebook.cpp
index 2c2965e..c0d45c9 100644
--- a/core/pim/datebook/datebook.cpp
+++ b/core/pim/datebook/datebook.cpp
@@ -127,9 +127,9 @@ DateBook::DateBook( QWidget *parent, const char *, WFlags f )
127 a = new QAction( tr( "Today" ), Resource::loadPixmap( "to_day" ), QString::null, 0, g, 0 ); 127 a = new QAction( tr( "Today" ), Resource::loadPixmap( "to_day" ), QString::null, 0, g, 0 );
128 connect( a, SIGNAL( activated() ), this, SLOT( slotToday() ) ); 128 connect( a, SIGNAL( activated() ), this, SLOT( slotToday() ) );
129 a->addTo( sub_bar ); 129 a->addTo( sub_bar );
130 a->addTo( view ); 130 a->addTo( view );
131 131
132 a = new QAction( tr( "Day" ), Resource::loadPixmap( "day" ), QString::null, 0, g, 0 ); 132 a = new QAction( tr( "Day" ), Resource::loadPixmap( "day" ), QString::null, 0, g, 0 );
133 connect( a, SIGNAL( activated() ), this, SLOT( viewDay() ) ); 133 connect( a, SIGNAL( activated() ), this, SLOT( viewDay() ) );
134 a->addTo( sub_bar ); 134 a->addTo( sub_bar );
135 a->addTo( view ); 135 a->addTo( view );
@@ -172,9 +172,9 @@ DateBook::DateBook( QWidget *parent, const char *, WFlags f )
172 172
173 Config config("DateBook"); 173 Config config("DateBook");
174 config.setGroup("Main"); 174 config.setGroup("Main");
175 int current=config.readNumEntry("defaultview", DAY); 175 int current=config.readNumEntry("defaultview", DAY);
176 176
177 QActionGroup *ag = new QActionGroup(this); 177 QActionGroup *ag = new QActionGroup(this);
178 a = new QAction( tr( "Day" ), QString::null, 0, 0, 0, true ); 178 a = new QAction( tr( "Day" ), QString::null, 0, 0, 0, true );
179 if (current==DAY) a->setOn(true), viewDay(); 179 if (current==DAY) a->setOn(true), viewDay();
180 ag->insert(a); 180 ag->insert(a);
@@ -186,24 +186,24 @@ DateBook::DateBook( QWidget *parent, const char *, WFlags f )
186 ag->insert(a); 186 ag->insert(a);
187 a = new QAction( tr( "Month" ), QString::null, 0, 0, 0, true ); 187 a = new QAction( tr( "Month" ), QString::null, 0, 0, 0, true );
188 if (current==MONTH) a->setOn(true), viewMonth(); 188 if (current==MONTH) a->setOn(true), viewMonth();
189 ag->insert(a); 189 ag->insert(a);
190 190
191 ag->addTo(default_view); 191 ag->addTo(default_view);
192 connect(ag, SIGNAL( selected ( QAction * ) ), 192 connect(ag, SIGNAL( selected ( QAction * ) ),
193 this, SLOT( newDefaultView(QAction *) ) 193 this, SLOT( newDefaultView(QAction *) )
194 ); 194 );
195 195
196 connect( qApp, SIGNAL(clockChanged(bool)), 196 connect( qApp, SIGNAL(clockChanged(bool)),
197 this, SLOT(changeClock(bool)) ); 197 this, SLOT(changeClock(bool)) );
198 connect( qApp, SIGNAL(weekChanged(bool)), 198 connect( qApp, SIGNAL(weekChanged(bool)),
199 this, SLOT(changeWeek(bool)) ); 199 this, SLOT(changeWeek(bool)) );
200 200
201#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 201#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
202 connect( qApp, SIGNAL(appMessage(const QCString&, const QByteArray&)), 202 connect( qApp, SIGNAL(appMessage(const QCString&, const QByteArray&)),
203 this, SLOT(appMessage(const QCString&, const QByteArray&)) ); 203 this, SLOT(appMessage(const QCString&, const QByteArray&)) );
204#endif 204#endif
205 205
206 // listen on QPE/System 206 // listen on QPE/System
207#if defined(Q_WS_QWS) 207#if defined(Q_WS_QWS)
208#if !defined(QT_NO_COP) 208#if !defined(QT_NO_COP)
209 QCopChannel *channel = new QCopChannel( "QPE/System", this ); 209 QCopChannel *channel = new QCopChannel( "QPE/System", this );
@@ -211,12 +211,12 @@ DateBook::DateBook( QWidget *parent, const char *, WFlags f )
211 this, SLOT(receive(const QCString&, const QByteArray&)) ); 211 this, SLOT(receive(const QCString&, const QByteArray&)) );
212 channel = new QCopChannel( "QPE/Datebook", this ); 212 channel = new QCopChannel( "QPE/Datebook", this );
213 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 213 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
214 this, SLOT(receive(const QCString&, const QByteArray&)) ); 214 this, SLOT(receive(const QCString&, const QByteArray&)) );
215 qDebug("olle\n"); 215 qDebug("olle\n");
216#endif 216#endif
217#endif 217#endif
218 218
219 qDebug("done t=%d", t.elapsed() ); 219 qDebug("done t=%d", t.elapsed() );
220 220
221} 221}
222 222
@@ -308,9 +308,9 @@ QString DateBook::checkEvent(const Event &e)
308 308
309QDate DateBook::currentDate() 309QDate DateBook::currentDate()
310{ 310{
311 QDate d = QDate::currentDate(); 311 QDate d = QDate::currentDate();
312 312
313 if ( dayView && views->visibleWidget() == dayView ) { 313 if ( dayView && views->visibleWidget() == dayView ) {
314 d = dayView->date(); 314 d = dayView->date();
315 } else if ( weekView && views->visibleWidget() == weekView ) { 315 } else if ( weekView && views->visibleWidget() == weekView ) {
316 d = weekView->date(); 316 d = weekView->date();
@@ -405,9 +405,9 @@ void DateBook::editEvent( const Event &e )
405 newEv.setUid(e.uid()); // FIXME: Hack not to clear uid 405 newEv.setUid(e.uid()); // FIXME: Hack not to clear uid
406 QString error = checkEvent(newEv); 406 QString error = checkEvent(newEv);
407 if (!error.isNull()) { 407 if (!error.isNull()) {
408 if (QMessageBox::warning(this, "error box", 408 if (QMessageBox::warning(this, "error box",
409 error, "Fix it", "Continue", 409 error, "Fix it", "Continue",
410 0, 0, 1) == 0) 410 0, 0, 1) == 0)
411 continue; 411 continue;
412 } 412 }
413 db->editEvent(e, newEv); 413 db->editEvent(e, newEv);
@@ -487,9 +487,9 @@ void DateBook::initWeek()
487 calcWeek( currentDate(), totWeeks, yearNumber, onMonday ); 487 calcWeek( currentDate(), totWeeks, yearNumber, onMonday );
488 488
489 QDate d = QDate( yearNumber, 12, 31 ); 489 QDate d = QDate( yearNumber, 12, 31 );
490 calcWeek( d, totWeeks, yearNumber, onMonday ); 490 calcWeek( d, totWeeks, yearNumber, onMonday );
491 491
492 while ( totWeeks == 1 ) { 492 while ( totWeeks == 1 ) {
493 d = d.addDays( -1 ); 493 d = d.addDays( -1 );
494 calcWeek( d, totWeeks, yearNumber, onMonday ); 494 calcWeek( d, totWeeks, yearNumber, onMonday );
495 } 495 }
@@ -497,20 +497,20 @@ void DateBook::initWeek()
497 weekView->setTotalWeeks( totWeeks ); 497 weekView->setTotalWeeks( totWeeks );
498} 498}
499void DateBook::initWeekLst() { 499void DateBook::initWeekLst() {
500 if ( !weekLstView ) { 500 if ( !weekLstView ) {
501 weekLstView = new DateBookWeekLst( ampm, onMonday, db, 501 weekLstView = new DateBookWeekLst( ampm, onMonday, db,
502 views, "weeklst view" ); 502 views, "weeklst view" );
503 views->addWidget( weekLstView, WEEKLST ); 503 views->addWidget( weekLstView, WEEKLST );
504 504
505 //weekLstView->setStartViewTime( startTime ); 505 //weekLstView->setStartViewTime( startTime );
506 connect( weekLstView, SIGNAL( showDate( int, int, int ) ), 506 connect( weekLstView, SIGNAL( showDate( int, int, int ) ),
507 this, SLOT( showDay( int, int, int ) ) ); 507 this, SLOT( showDay( int, int, int ) ) );
508 connect( weekLstView, SIGNAL( addEvent( const QDateTime &, 508 connect( weekLstView, SIGNAL( addEvent( const QDateTime &,
509 const QDateTime &, 509 const QDateTime &,
510 const QString & ) ), 510 const QString & ) ),
511 this, SLOT( slotNewEntry( const QDateTime &, 511 this, SLOT( slotNewEntry( const QDateTime &,
512 const QDateTime &, 512 const QDateTime &,
513 const QString & ) ) ); 513 const QString & ) ) );
514 connect( this, SIGNAL( newEvent() ), 514 connect( this, SIGNAL( newEvent() ),
515 weekLstView, SLOT( redraw() ) ); 515 weekLstView, SLOT( redraw() ) );
516 connect( weekLstView, SIGNAL( editEvent( const Event & ) ), 516 connect( weekLstView, SIGNAL( editEvent( const Event & ) ),
@@ -539,9 +539,9 @@ void DateBook::loadSettings()
539 config.setGroup("Time"); 539 config.setGroup("Time");
540 ampm = config.readBoolEntry( "AMPM", TRUE ); 540 ampm = config.readBoolEntry( "AMPM", TRUE );
541 onMonday = config.readBoolEntry( "MONDAY" ); 541 onMonday = config.readBoolEntry( "MONDAY" );
542 } 542 }
543 543
544 { 544 {
545 Config config("DateBook"); 545 Config config("DateBook");
546 config.setGroup("Main"); 546 config.setGroup("Main");
547 startTime = config.readNumEntry("startviewtime", 8); 547 startTime = config.readNumEntry("startviewtime", 8);
@@ -565,9 +565,9 @@ void DateBook::newDefaultView(QAction *a) {
565 if (a->text() == "Day") val=DAY; 565 if (a->text() == "Day") val=DAY;
566 if (a->text() == "Week") val=WEEK; 566 if (a->text() == "Week") val=WEEK;
567 if (a->text() == "WeekLst") val=WEEKLST; 567 if (a->text() == "WeekLst") val=WEEKLST;
568 if (a->text() == "Month") val=MONTH; 568 if (a->text() == "Month") val=MONTH;
569 569
570 Config configDB( "DateBook" ); 570 Config configDB( "DateBook" );
571 configDB.setGroup( "Main" ); 571 configDB.setGroup( "Main" );
572 configDB.writeEntry("defaultview",val); 572 configDB.writeEntry("defaultview",val);
573} 573}
@@ -687,9 +687,9 @@ void DateBook::timerEvent( QTimerEvent *e )
687{ 687{
688 if ( alarmCounter < 10 ) { 688 if ( alarmCounter < 10 ) {
689 alarmCounter++; 689 alarmCounter++;
690 Sound::soundAlarm(); 690 Sound::soundAlarm();
691 } 691 }
692 else 692 else
693 killTimer( e->timerId() ); 693 killTimer( e->timerId() );
694} 694}
695 695
@@ -975,15 +975,17 @@ Event DateBookDBHack::eventByUID(int uid) {
975 QValueList<Event> myEventList=getNonRepeatingEvents(start,end); 975 QValueList<Event> myEventList=getNonRepeatingEvents(start,end);
976 QValueList<Event> myRepeatEvents=getRawRepeats(); 976 QValueList<Event> myRepeatEvents=getRawRepeats();
977 977
978 QValueList<Event>::ConstIterator it; 978 QValueList<Event>::ConstIterator it;
979 979
980 for (it = myEventList.begin(); it != myEventList.end(); it++) { 980 for (it = myEventList.begin(); it != myEventList.end(); it++) {
981 if ((*it).uid() == uid) return *it; 981 if ((*it).uid() == uid) return *it;
982 } 982 }
983 for (it = myRepeatEvents.begin(); it != myRepeatEvents.end(); it++) { 983 for (it = myRepeatEvents.begin(); it != myRepeatEvents.end(); it++) {
984 if ((*it).uid() == uid) return *it; 984 if ((*it).uid() == uid) return *it;
985 } 985 }
986 986
987 qDebug("Event not found: uid=%d\n", uid); 987 qDebug("Event not found: uid=%d\n", uid);
988 Event ev;
989 return ev; // return at least
988} 990}
989 991