author | waspe <waspe> | 2003-11-03 18:28:50 (UTC) |
---|---|---|
committer | waspe <waspe> | 2003-11-03 18:28:50 (UTC) |
commit | 87a9d6badcf518ffd14559ef886ff7729b63b73b (patch) (side-by-side diff) | |
tree | 05af57bcebb8a124c2561336e4ff3dfdd52aeccb /core/pim/datebook | |
parent | 9ce566fd5b280622670cf7b0e158f9d9c54e6e9a (diff) | |
download | opie-87a9d6badcf518ffd14559ef886ff7729b63b73b.zip opie-87a9d6badcf518ffd14559ef886ff7729b63b73b.tar.gz opie-87a9d6badcf518ffd14559ef886ff7729b63b73b.tar.bz2 |
resolved merge conflict
-rw-r--r-- | core/pim/datebook/datebook.cpp | 24 | ||||
-rw-r--r-- | core/pim/datebook/datebookweekheaderimpl.cpp | 11 | ||||
-rw-r--r-- | core/pim/datebook/datebookweeklst.cpp | 43 | ||||
-rw-r--r-- | core/pim/datebook/datebookweeklst.h | 1 |
4 files changed, 45 insertions, 34 deletions
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 <qpe/calendar.h> -#include <qpe/datebookdb.h> -#include <qpe/event.h> -#include <qpe/qpeapplication.h> -#include <qpe/timestring.h> #include <qpe/datebookmonth.h> #include <qpe/config.h> #include <qpe/resource.h> +#include <qpe/calendar.h> -#include <qdatetime.h> -#include <qheader.h> -#include <qlabel.h> #include <qlayout.h> -#include <qpainter.h> -#include <qpopupmenu.h> -#include <qtimer.h> -#include <qstyle.h> #include <qtoolbutton.h> -#include <qvbox.h> -#include <qsizepolicy.h> -#include <qabstractlayout.h> #include <qtl.h> 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<EffectiveEvent> 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(); |