From 87a9d6badcf518ffd14559ef886ff7729b63b73b Mon Sep 17 00:00:00 2001 From: waspe Date: Mon, 03 Nov 2003 18:28:50 +0000 Subject: resolved merge conflict --- (limited to 'core/pim/datebook') diff --git a/core/pim/datebook/datebook.cpp b/core/pim/datebook/datebook.cpp index 10a9b59..07d7164 100644 --- a/core/pim/datebook/datebook.cpp +++ b/core/pim/datebook/datebook.cpp @@ -192,6 +192,8 @@ DateBook::DateBook( QWidget *parent, const char *, WFlags f ) qDebug("done t=%d", t.elapsed() ); + connect( qApp, SIGNAL( flush() ), this, SLOT( flush() ) ); + connect( qApp, SIGNAL( reload()), this, SLOT( reload() ) ); /* * Here is a problem description: * When Weekview is the default view @@ -402,6 +404,8 @@ void DateBook::viewMonth() { void DateBook::insertEvent( const Event &e ) { Event dupEvent=e; + if(!dupEvent.isValidUid() ) // tkcRom seems to be different + dupEvent.assignUid(); dupEvent.setLocation(defaultLocation); dupEvent.setCategories(defaultCategories); db->addEvent(dupEvent); @@ -443,15 +447,17 @@ void DateBook::duplicateEvent( const Event &e ) if (QMessageBox::warning(this, tr("error box"), error, tr("Fix it"), tr("Continue"), 0, 0, 1) == 0) continue; } - /* - * The problem: - * DateBookDB does remove repeating events not by uid but by the time - * the recurrence was created - * so we need to update that time as well - */ - Event::RepeatPattern rp = newEv.repeatPattern(); - rp.createTime = ::time( NULL ); - newEv.setRepeat( TRUE, rp ); // has repeat and repeatPattern... + /* + * The problem: + * DateBookDB does remove repeating events not by uid but by the time + * the recurrence was created + * so we need to update that time as well + */ + Event::RepeatPattern rp = newEv.repeatPattern(); + rp.createTime = ::time( NULL ); + newEv.setRepeat( TRUE, rp ); // has repeat and repeatPattern... + if( newEv.uid() == e.uid() || !newEv.isValidUid() ) + newEv.assignUid(); db->addEvent(newEv); emit newEvent(); diff --git a/core/pim/datebook/datebookweekheaderimpl.cpp b/core/pim/datebook/datebookweekheaderimpl.cpp index 770410e..84b4f1b 100644 --- a/core/pim/datebook/datebookweekheaderimpl.cpp +++ b/core/pim/datebook/datebookweekheaderimpl.cpp @@ -98,21 +98,22 @@ void DateBookWeekHeader::setDate(const QDate &d) { int year,week,dayofweek; date=d; dayofweek=d.dayOfWeek(); - if(bStartOnMonday) + if(bStartOnMonday) dayofweek--; else if( dayofweek == 7 ) - /* we already have the right day -7 would lead to the current week..*/ + // we already have the right day -7 would lead to the current week.. dayofweek = 0; - + date=date.addDays(-dayofweek); calcWeek(date,week,year,bStartOnMonday); QDate start=date; QDate stop=start.addDays(6); labelDate->setText( QString::number(start.day()) + "." + - start.monthName(start.month()) + "-" + + Calendar::nameOfMonth( start.month()) + "-" + QString::number(stop.day()) + "." + - start.monthName(stop.month()) +" ("+ + Calendar::nameOfMonth( stop.month()) +" ("+ tr("w")+":"+QString::number( week ) +")"); + date = d; // bugfix: 0001126 - date has to be the selected date, not monday! emit dateChanged(date); } diff --git a/core/pim/datebook/datebookweeklst.cpp b/core/pim/datebook/datebookweeklst.cpp index aad1f3a..24fb0ba 100644 --- a/core/pim/datebook/datebookweeklst.cpp +++ b/core/pim/datebook/datebookweeklst.cpp @@ -1,30 +1,15 @@ #include "datebookweeklst.h" -#include "datebookweekheaderimpl.h" #include "datebook.h" -#include -#include -#include -#include -#include #include #include #include +#include -#include -#include -#include #include -#include -#include -#include -#include #include -#include -#include -#include #include bool calcWeek(const QDate &d, int &week, int &year,bool startOnMonday = false); @@ -73,10 +58,11 @@ void DateBookWeekLstHeader::setDate(const QDate &d) { QDate start=date; QDate stop=start.addDays(6); labelDate->setText( QString::number(start.day()) + "." + - start.monthName(start.month()) + "-" + + Calendar::nameOfMonth( start.month() ) + "-" + QString::number(stop.day()) + "." + - start.monthName(stop.month()) +" ("+ + Calendar::nameOfMonth( stop.month()) +" ("+ tr("w")+":"+QString::number( week ) +")"); + date = d; // bugfix: 0001126 - date has to be the selected date, not monday! emit dateChanged(date); } @@ -125,8 +111,10 @@ DateBookWeekLstDayHdr::DateBookWeekLstDayHdr(const QDate &d, bool /* onM */, static const QString wdays=tr("MTWTFSSM", "Week days"); char day=wdays[d.dayOfWeek()-1]; + //dont use dayOfWeek() to save space ! label->setText( QString(QObject::tr(QString(QChar(day)))) + " " +QString::number(d.day()) ); - add->setText("+"); + + add->setText("+"); if (d == QDate::currentDate()) { QPalette pal=label->palette(); @@ -341,8 +329,23 @@ QDate DateBookWeekLst::date() { return bdate; } +// return the date at the beginning of the week... +// copied from DateBookWeek +QDate DateBookWeekLst::weekDate() const +{ + QDate d=bdate; + + // Calculate offset to first day of week. + int dayoffset=d.dayOfWeek(); + if(bStartOnMonday) dayoffset--; + else if( dayoffset == 7 ) + dayoffset = 0; + + return d.addDays(-dayoffset); +} + void DateBookWeekLst::getEvents() { - QDate start = date(); + QDate start = weekDate(); //date(); QDate stop = start.addDays(6); QValueList el = db->getEffectiveEvents(start, stop); diff --git a/core/pim/datebook/datebookweeklst.h b/core/pim/datebook/datebookweeklst.h index 0bfbcda..f683ce7 100644 --- a/core/pim/datebook/datebookweeklst.h +++ b/core/pim/datebook/datebookweeklst.h @@ -120,6 +120,7 @@ public: void setDate(const QDate &d ); int week() const { return _week; }; QDate date(); + QDate weekDate() const; public slots: void redraw(); -- cgit v0.9.0.2