summaryrefslogtreecommitdiff
path: root/core/pim/datebook
Side-by-side diff
Diffstat (limited to 'core/pim/datebook') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/datebook/datebook.cpp24
-rw-r--r--core/pim/datebook/datebookweekheaderimpl.cpp11
-rw-r--r--core/pim/datebook/datebookweeklst.cpp43
-rw-r--r--core/pim/datebook/datebookweeklst.h1
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
@@ -191,8 +191,10 @@ DateBook::DateBook( QWidget *parent, const char *, WFlags f )
#endif
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
* a DateBookWeekView get's created
@@ -401,8 +403,10 @@ 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);
emit newEvent();
@@ -442,17 +446,19 @@ void DateBook::duplicateEvent( const Event &e )
if (!error.isNull()) {
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();
break;
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
@@ -97,23 +97,24 @@ void DateBookWeekHeader::setDate( int y, int m, int d )
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);
}
void DateBookWeekHeader::setStartOfWeek( bool onMonday )
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,31 +1,16 @@
#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);
@@ -72,12 +57,13 @@ void DateBookWeekLstHeader::setDate(const QDate &d) {
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);
}
void DateBookWeekLstHeader::pickDate() {
@@ -124,10 +110,12 @@ 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();
pal.setColor(QColorGroup::Foreground, QColor(0,0,255));
@@ -340,10 +328,25 @@ void DateBookWeekLst::redraw() {getEvents();}
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);
if (view) delete view;
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
@@ -119,8 +119,9 @@ public:
void setDate( int y, int w );
void setDate(const QDate &d );
int week() const { return _week; };
QDate date();
+ QDate weekDate() const;
public slots:
void redraw();
void dateChanged(QDate &date);