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
@@ -128,7 +128,7 @@ DateBook::DateBook( QWidget *parent, const char *, WFlags f )
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 );
@@ -173,7 +173,7 @@ DateBook::DateBook( QWidget *parent, const char *, WFlags f )
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();
@@ -187,22 +187,22 @@ DateBook::DateBook( QWidget *parent, const char *, WFlags f )
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)
@@ -212,10 +212,10 @@ DateBook::DateBook( QWidget *parent, const char *, WFlags f )
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}
@@ -309,7 +309,7 @@ QString DateBook::checkEvent(const Event &e)
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 ) {
@@ -406,7 +406,7 @@ void DateBook::editEvent( const Event &e )
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 }
@@ -488,7 +488,7 @@ void DateBook::initWeek()
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 );
@@ -498,18 +498,18 @@ void DateBook::initWeek()
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() ) );
@@ -540,7 +540,7 @@ void DateBook::loadSettings()
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");
@@ -566,7 +566,7 @@ void DateBook::newDefaultView(QAction *a) {
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);
@@ -688,7 +688,7 @@ void DateBook::timerEvent( QTimerEvent *e )
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}
@@ -976,7 +976,7 @@ Event DateBookDBHack::eventByUID(int uid) {
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 }
@@ -985,5 +985,7 @@ Event DateBookDBHack::eventByUID(int uid) {
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