summaryrefslogtreecommitdiff
path: root/core/pim
authoreilers <eilers>2003-08-01 14:19:44 (UTC)
committer eilers <eilers>2003-08-01 14:19:44 (UTC)
commit34991bac7d96b1c17601be6a5607819342571e0c (patch) (side-by-side diff)
tree65d0bc2db22bcc1dc1b5eafdafd53b9cb08a6395 /core/pim
parent5346424fc26bde232a15aa34fbb720f86218b26f (diff)
downloadopie-34991bac7d96b1c17601be6a5607819342571e0c.zip
opie-34991bac7d96b1c17601be6a5607819342571e0c.tar.gz
opie-34991bac7d96b1c17601be6a5607819342571e0c.tar.bz2
Merging changes from BRANCH_1_0 to HEAD..
Diffstat (limited to 'core/pim') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/datebook/datebook.cpp50
-rw-r--r--core/pim/datebook/datebook.pro6
-rw-r--r--core/pim/datebook/datebookday.cpp127
-rw-r--r--core/pim/datebook/datebookday.h6
-rw-r--r--core/pim/datebook/datebookdayallday.cpp226
-rw-r--r--core/pim/datebook/datebookdayallday.h80
-rw-r--r--core/pim/datebook/datebooksettings.h5
-rw-r--r--core/pim/datebook/datebookweek.cpp65
-rw-r--r--core/pim/datebook/datebookweekheaderimpl.cpp12
-rw-r--r--core/pim/datebook/datebookweeklst.cpp10
-rw-r--r--core/pim/datebook/dateentryimpl.cpp2
-rw-r--r--core/pim/datebook/opie-datebook.control6
-rw-r--r--core/pim/datebook/repeatentry.cpp50
13 files changed, 564 insertions, 81 deletions
diff --git a/core/pim/datebook/datebook.cpp b/core/pim/datebook/datebook.cpp
index b7e89b0..10a9b59 100644
--- a/core/pim/datebook/datebook.cpp
+++ b/core/pim/datebook/datebook.cpp
@@ -230,3 +230,7 @@ void DateBook::receive( const QCString &msg, const QByteArray &data )
editEvent(e);
- }
+ }else if (msg == "viewDefault(QDate)"){
+ QDate day;
+ stream >> day;
+ viewDefault(day);
+ }
}
@@ -438,5 +442,15 @@ void DateBook::duplicateEvent( const Event &e )
if (!error.isNull()) {
- if (QMessageBox::warning(this, "error box", error, "Fix it", "Continue", 0, 0, 1) == 0)
+ 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...
+
db->addEvent(newEv);
@@ -478,3 +492,3 @@ void DateBook::editEvent( const Event &e )
if (!error.isNull()) {
- if (QMessageBox::warning(this, "error box", error, "Fix it", "Continue", 0, 0, 1) == 0) continue;
+ if (QMessageBox::warning(this, tr("error box"), error, tr("Fix it"), tr("Continue"), 0, 0, 1) == 0) continue;
}
@@ -521,4 +535,4 @@ void DateBook::initDay()
views->addWidget( dayView, DAY );
+ dayView->setJumpToCurTime( bJumpToCurTime );
dayView->setStartViewTime( startTime );
- dayView->setJumpToCurTime( bJumpToCurTime );
dayView->setRowStyle( rowStyle );
@@ -699,2 +713,3 @@ void DateBook::appMessage(const QCString& msg, const QByteArray& data)
} else if ( msg == "nextView()" ) {
+ needShow = true;
if ( !qApp-> activeWindow ( )) {
@@ -715,12 +730,27 @@ void DateBook::appMessage(const QCString& msg, const QByteArray& data)
}
- }
+ } else if (msg == "editEvent(int)") {
+ /* simple copy from receive */
+ QDataStream stream(data,IO_ReadOnly);
+ int uid;
+ stream >> uid;
+ Event e=db->eventByUID(uid);
+ editEvent(e);
+ } else if (msg == "viewDefault(QDate)"){
+ /* simple copy from receive */
+ QDataStream stream(data,IO_ReadOnly);
+ QDate day;
+ stream >> day;
+ viewDefault(day);
+ needShow = true;
+ }
+
if ( needShow ) {
#if defined(Q_WS_QWS) || defined(_WS_QWS_)
- showMaximized();
+// showMaximized();
#else
- show();
+// show();
#endif
- raise();
+// raise();
QPEApplication::setKeepRunning();
- setActiveWindow();
+// setActiveWindow();
}
@@ -919,3 +949,3 @@ void DateBook::slotFind()
viewDay();
- FindDialog frmFind( "Calendar", this );
+ FindDialog frmFind( "Calendar", this ); // no tr needed
frmFind.setUseDate( true );
diff --git a/core/pim/datebook/datebook.pro b/core/pim/datebook/datebook.pro
index e8e0a98..ae30c8d 100644
--- a/core/pim/datebook/datebook.pro
+++ b/core/pim/datebook/datebook.pro
@@ -13,3 +13,4 @@ HEADERS = datebookday.h \
noteentryimpl.h \
- onoteedit.h
+ onoteedit.h \
+ datebookdayallday.h
SOURCES = main.cpp \
@@ -25,3 +26,4 @@ SOURCES = main.cpp \
noteentryimpl.cpp \
- onoteedit.cpp
+ onoteedit.cpp \
+ datebookdayallday.cpp
INTERFACES = dateentry.ui \
diff --git a/core/pim/datebook/datebookday.cpp b/core/pim/datebook/datebookday.cpp
index 0b213e9..f4008e9 100644
--- a/core/pim/datebook/datebookday.cpp
+++ b/core/pim/datebook/datebookday.cpp
@@ -23,2 +23,3 @@
#include "datebookdayheaderimpl.h"
+#include "datebookdayallday.h"
@@ -213,3 +214,7 @@ void DateBookDayViewQuickLineEdit::slotReturnPressed()
}
- this->close(true); // Close and also delete this widget
+ /* we need to return to this object.. */
+ QTimer::singleShot(500, this, SLOT(finallyCallClose()) ); // Close and also delete this widget
+}
+void DateBookDayViewQuickLineEdit::finallyCallClose() {
+ close(true); // also deletes this widget...
}
@@ -229,2 +234,6 @@ DateBookDay::DateBookDay( bool ampm, bool startOnMonday, DateBookDB *newDb, QWid
header->setDate( currDate.year(), currDate.month(), currDate.day() );
+
+ m_allDays = new DatebookdayAllday(newDb, this, "all day event list" );
+ m_allDays->hide();
+
view = new DateBookDayView( ampm, this, "day view" );
@@ -247,2 +256,3 @@ DateBookDay::DateBookDay( bool ampm, bool startOnMonday, DateBookDB *newDb, QWid
rowStyle = -1; // initialize with bogus values
+ jumpToCurTime = false;
}
@@ -345,4 +355,9 @@ void DateBookDay::getEvents()
+ /* clear the AllDay List */
+ m_allDays->hide(); // just in case
+ m_allDays->removeAllEvents();
+
QValueList<EffectiveEvent> eventList = db->getEffectiveEvents( currDate, currDate );
QValueListIterator<EffectiveEvent> it;
+ QObject* object = 0;
for ( it = eventList.begin(); it != eventList.end(); ++it ) {
@@ -350,8 +365,17 @@ void DateBookDay::getEvents()
if(!((ev.end().hour()==0) && (ev.end().minute()==0) && (ev.startDate()!=ev.date()))) { // Skip events ending at 00:00 starting at another day.
+ if (ev.event().type() == Event::AllDay ) {
+ object = m_allDays->addEvent( ev );
+ if (!object)
+ continue;
+ }else {
DateBookDayWidget* w = new DateBookDayWidget( *it, this );
- connect( w, SIGNAL( deleteMe( const Event & ) ), this, SIGNAL( removeEvent( const Event & ) ) );
- connect( w, SIGNAL( duplicateMe( const Event & ) ), this, SIGNAL( duplicateEvent( const Event & ) ) );
- connect( w, SIGNAL( editMe( const Event & ) ), this, SIGNAL( editEvent( const Event & ) ) );
- connect( w, SIGNAL( beamMe( const Event & ) ), this, SIGNAL( beamEvent( const Event & ) ) );
- widgetList.append( w );
+ widgetList.append( w );
+ object = w;
+ }
+
+ connect( object, SIGNAL( deleteMe( const Event & ) ), this, SIGNAL( removeEvent( const Event & ) ) );
+ connect( object, SIGNAL( duplicateMe( const Event & ) ), this, SIGNAL( duplicateEvent( const Event & ) ) );
+ connect( object, SIGNAL( editMe( const Event & ) ), this, SIGNAL( editEvent( const Event & ) ) );
+ connect( object, SIGNAL( beamMe( const Event & ) ), this, SIGNAL( beamEvent( const Event & ) ) );
+
}
@@ -398,5 +422,12 @@ void DateBookDay::relayoutPage( bool fromResize )
setUpdatesEnabled( FALSE );
- if ( !fromResize )
+ if ( !fromResize ) {
getEvents(); // no need we already have them!
+ if (m_allDays->items() > 0 )
+ m_allDays->show();
+ /*
+ * else if ( m_allDays->items() == 0 ) already hide in getEvents
+ */
+ }
+
widgetList.sort();
@@ -732,2 +763,24 @@ void DateBookDayWidget::paintEvent( QPaintEvent *e )
+/*
+ * we need to find the real start date for a uid
+ * we need to check from one day to another...
+ */
+QDate DateBookDay::findRealStart( int uid, const QDate& isIncluded , DateBookDB* db) {
+ QDate dt( isIncluded );
+ QDate fnd = dt;
+
+ bool doAgain = true;
+ do{
+ dt = dt.addDays( -1 );
+ QValueList<EffectiveEvent> events = db->getEffectiveEvents( dt, dt );
+ for (QValueList<EffectiveEvent>::Iterator it = events.begin(); it != events.end(); ++it ) {
+ EffectiveEvent ev = (*it);
+ if ( uid == ev.event().uid() && ev.start() != QTime(0, 0, 0 ) )
+ return ev.date();
+ }
+ }while (doAgain );
+
+ return fnd;
+}
+
void DateBookDayWidget::mousePressEvent( QMouseEvent *e )
@@ -749,2 +802,3 @@ void DateBookDayWidget::mousePressEvent( QMouseEvent *e )
if(Ir::supported()) m.insertItem( tr( "Beam" ), 3 );
+ if(Ir::supported() && ev.event().doRepeat() ) m.insertItem( tr( "Beam this occurence"), 5 );
int r = m.exec( e->globalPos() );
@@ -758,3 +812,60 @@ void DateBookDayWidget::mousePressEvent( QMouseEvent *e )
emit duplicateMe( ev.event() );
- }
+ } else if ( r == 5 ) {
+ // create an Event and beam it...
+ /*
+ * Start with the easy stuff. If start and end date is the same we can just use
+ * the values of effective events
+ * If it is a multi day event we need to find the real start and end date...
+ */
+ if ( ev.event().start().date() == ev.event().end().date() ) {
+ Event event( ev.event() );
+
+ QDateTime dt( ev.date(), ev.start() );
+ event.setStart( dt );
+
+ dt.setTime( ev.end() );
+ event.setEnd( dt );
+ emit beamMe( event );
+ }else {
+ /*
+ * at least the the Times are right now
+ */
+ QDateTime start( ev.event().start() );
+ QDateTime end ( ev.event().end () );
+
+
+ /*
+ * ok we know the start date or we need to find it
+ */
+ if ( ev.start() != QTime( 0, 0, 0 ) ) {
+ start.setDate( ev.date() );
+ }else {
+ QDate dt = DateBookDay::findRealStart( ev.event().uid(), ev.date(), dateBook->db );
+ start.setDate( dt );
+ }
+
+
+ /*
+ * ok we know now the end date...
+ * else
+ * get to know the offset btw the real start and real end
+ * and then add it to the new start date...
+ */
+ if ( ev.end() != QTime(23, 59, 59 ) ) {
+ end.setDate( ev.date() );
+ }else{
+ int days = ev.event().start().date().daysTo( ev.event().end().date() );
+ end.setDate( start.date().addDays( days ) );
+ }
+
+
+
+ Event event( ev.event() );
+ event.setStart( start );
+ event.setEnd ( end );
+
+
+ emit beamMe( event );
+ }
+ }
}
diff --git a/core/pim/datebook/datebookday.h b/core/pim/datebook/datebookday.h
index 961f60f..3898cbc 100644
--- a/core/pim/datebook/datebookday.h
+++ b/core/pim/datebook/datebookday.h
@@ -34,2 +34,3 @@ class DateBookDayHeader;
class DateBookDB;
+class DatebookdayAllday;
class QDateTime;
@@ -50,2 +51,3 @@ protected slots:
void slotReturnPressed(void);
+ void finallyCallClose();
signals:
@@ -178,2 +180,3 @@ class DateBookDay : public QVBox
+ friend class DateBookDayWidget; // for beam this occurence and access to DateBookDB
public:
@@ -190,2 +193,4 @@ public:
void setRowStyle( int style );
+ static QDate findRealStart( int uid, const QDate& isIncluded,
+ DateBookDB* );
@@ -220,2 +225,3 @@ private:
DateBookDayHeader *header;
+ DatebookdayAllday *m_allDays;
DateBookDB *db;
diff --git a/core/pim/datebook/datebookdayallday.cpp b/core/pim/datebook/datebookdayallday.cpp
new file mode 100644
index 0000000..985f31a
--- a/dev/null
+++ b/core/pim/datebook/datebookdayallday.cpp
@@ -0,0 +1,226 @@
+/****************************************************************************
+** GPL by Rajko Albrecht
+**
+**
+**
+**
+**
+****************************************************************************/
+#include "datebookdayallday.h"
+
+#include <qpushbutton.h>
+#include <qlayout.h>
+#include <qvariant.h>
+#include <qtooltip.h>
+#include <qwhatsthis.h>
+#include <qobjectlist.h>
+#include <qpe/event.h>
+#include <qpe/ir.h>
+#include <qpe/datebookdb.h>
+#include <qpe/resource.h>
+#include <qpopupmenu.h>
+#include <qtimer.h>
+#include <qregexp.h>
+#include <qdatetime.h>
+
+#include "datebookday.h"
+
+/*
+ * Constructs a DatebookdayAllday which is a child of 'parent', with the
+ * name 'name' and widget flags set to 'f'
+ */
+DatebookdayAllday::DatebookdayAllday(DateBookDB* db, QWidget* parent, const char* name, WFlags fl )
+ : QWidget( parent, name,fl ),item_count(0),dateBook(db)
+{
+ if ( !name )
+ setName( "DatebookdayAllday" );
+ setMinimumSize( QSize( 0, 0 ) );
+
+ datebookdayalldayLayout = new QVBoxLayout( this );
+ datebookdayalldayLayout->setSpacing( 0 );
+ datebookdayalldayLayout->setMargin( 0 );
+
+ lblDesc = new DatebookEventDesc(parent->parentWidget(),"");
+ lblDesc->setBackgroundColor(Qt::yellow);
+ lblDesc->hide();
+ subWidgets.setAutoDelete(true);
+}
+
+/*
+ * Destroys the object and frees any allocated resources
+ */
+DatebookdayAllday::~DatebookdayAllday()
+{
+ // no need to delete child widgets, Qt does it all for us
+}
+
+DatebookAlldayDisp* DatebookdayAllday::addEvent(const EffectiveEvent&ev)
+{
+ DatebookAlldayDisp * lb;
+ lb = new DatebookAlldayDisp(dateBook,ev,this,NULL);
+ datebookdayalldayLayout->addWidget(lb);
+ subWidgets.append(lb);
+
+ connect(lb,SIGNAL(displayMe(const Event &)),lblDesc,SLOT(disp_event(const Event&)));
+ ++item_count;
+
+ return lb;
+}
+
+void DatebookdayAllday::removeAllEvents()
+{
+ subWidgets.clear();
+ item_count = 0;
+}
+
+DatebookAlldayDisp::DatebookAlldayDisp(DateBookDB *db,const EffectiveEvent& ev,
+ QWidget* parent,const char* name,WFlags f)
+ : QLabel(parent,name,f),m_Ev(ev),dateBook(db)
+{
+ QString strDesc = m_Ev.description();
+ strDesc = strDesc.replace(QRegExp("<"),"&#60;");
+ setBackgroundColor(yellow);
+ setText(strDesc);
+ setFrameStyle(QFrame::Raised|QFrame::Panel);
+ QSize s = sizeHint();
+ setMaximumSize( QSize( 32767, s.height()-4 ) );
+ setMinimumSize( QSize( 0, s.height()-4 ) );
+}
+
+DatebookAlldayDisp::~DatebookAlldayDisp()
+{
+}
+
+void DatebookAlldayDisp::beam_single_event()
+{
+ // create an Event and beam it...
+ /*
+ * Start with the easy stuff. If start and end date is the same we can just use
+ * the values of effective m_Events
+ * If it is a multi day m_Event we need to find the real start and end date...
+ */
+ if ( m_Ev.event().start().date() == m_Ev.event().end().date() ) {
+ Event m_Event( m_Ev.event() );
+
+ QDateTime dt( m_Ev.date(), m_Ev.start() );
+ m_Event.setStart( dt );
+
+ dt.setTime( m_Ev.end() );
+ m_Event.setEnd( dt );
+ emit beamMe( m_Event );
+ }else {
+ /*
+ * at least the the Times are right now
+ */
+ QDateTime start( m_Ev.event().start() );
+ QDateTime end ( m_Ev.event().end () );
+
+ /*
+ * ok we know the start date or we need to find it
+ */
+ if ( m_Ev.start() != QTime( 0, 0, 0 ) ) {
+ start.setDate( m_Ev.date() );
+ }else {
+ QDate dt = DateBookDay::findRealStart( m_Ev.event().uid(), m_Ev.date(), dateBook );
+ start.setDate( dt );
+ }
+
+ /*
+ * ok we know now the end date...
+ * else
+ * get to know the offset btw the real start and real end
+ * and then add it to the new start date...
+ */
+ if ( m_Ev.end() != QTime(23, 59, 59 ) ) {
+ end.setDate( m_Ev.date() );
+ }else{
+ int days = m_Ev.event().start().date().daysTo( m_Ev.event().end().date() );
+ end.setDate( start.date().addDays( days ) );
+ }
+ Event m_Event( m_Ev.event() );
+ m_Event.setStart( start );
+ m_Event.setEnd ( end );
+ emit beamMe( m_Event );
+ }
+}
+
+void DatebookAlldayDisp::mousePressEvent(QMouseEvent*e)
+{
+ QColor b = backgroundColor();
+ setBackgroundColor(green);
+ update();
+ QPopupMenu m;
+ m.insertItem( DateBookDayWidget::tr( "Edit" ), 1 );
+ m.insertItem( DateBookDayWidget::tr( "Duplicate" ), 4 );
+ m.insertItem( DateBookDayWidget::tr( "Delete" ), 2 );
+ if(Ir::supported()) m.insertItem( DateBookDayWidget::tr( "Beam" ), 3 );
+ if(Ir::supported() && m_Ev.event().doRepeat() ) m.insertItem( DateBookDayWidget::tr( "Beam this occurence"), 5 );
+ m.insertItem( tr( "Info"),6);
+ int r = m.exec( e->globalPos() );
+ setBackgroundColor(b);
+ update();
+ switch (r) {
+ case 1:
+ emit editMe( m_Ev.event() );
+ break;
+ case 2:
+ emit deleteMe( m_Ev.event() );
+ break;
+ case 3:
+ emit beamMe( m_Ev.event() );
+ break;
+ case 4:
+ emit duplicateMe( m_Ev.event() );
+ break;
+ case 5:
+ beam_single_event();
+ break;
+ case 6:
+ emit displayMe( m_Ev.event() );
+ break;
+ default:
+ break;
+ }
+}
+
+DatebookEventDesc::DatebookEventDesc(QWidget*parent,const char*name)
+ :QLabel(parent,name)
+{
+ m_Timer=new QTimer(this);
+ connect(m_Timer,SIGNAL(timeout()),this,SLOT(hide()));
+ setFrameStyle(QFrame::Sunken|QFrame::Panel);
+ setTextFormat(RichText);
+}
+
+DatebookEventDesc::~DatebookEventDesc()
+{
+}
+
+void DatebookEventDesc::mousePressEvent(QMouseEvent*)
+{
+ hide();
+ if (m_Timer->isActive()) m_Timer->stop();
+}
+
+void DatebookEventDesc::disp_event(const Event&e)
+{
+ if (m_Timer->isActive()) m_Timer->stop();
+ QString text;
+ text = "<b><i>"+e.description()+"</i></b><br>";
+ if (e.notes().length()>0) {
+ text+="<b>"+e.notes()+"</b><br>";
+ }
+ if (e.location().length()>0) {
+ text+="<i>"+e.location()+"</i><br>";
+ }
+ text = text.replace(QRegExp("\n"),"<br>");
+ setText(text);
+ QSize s = sizeHint();
+ s+=QSize(10,10);
+ resize(s);
+ move( QMAX(0,(parentWidget()->width()-width()) / 2),
+ (parentWidget()->height()-height())/2 );
+ show();
+ m_Timer->start(2000,true);
+}
+
diff --git a/core/pim/datebook/datebookdayallday.h b/core/pim/datebook/datebookdayallday.h
new file mode 100644
index 0000000..c781785
--- a/dev/null
+++ b/core/pim/datebook/datebookdayallday.h
@@ -0,0 +1,80 @@
+#ifndef DATEBOOKDAYALLDAYBASE_H
+#define DATEBOOKDAYALLDAYBASE_H
+
+#include <qvariant.h>
+#include <qframe.h>
+#include <qlabel.h>
+#include <qlist.h>
+#include <qpe/event.h>
+
+class QVBoxLayout;
+class QHBoxLayout;
+class QGridLayout;
+class DatebookAlldayDisp;
+class DatebookEventDesc;
+class DateBookDB;
+
+class DatebookdayAllday : public QWidget
+{
+ Q_OBJECT
+
+public:
+ DatebookdayAllday(DateBookDB* db,
+ QWidget* parent = 0, const char* name = 0, WFlags fl = 0);
+ ~DatebookdayAllday();
+ DatebookAlldayDisp* addEvent(const EffectiveEvent&e);
+ const unsigned int items()const{return item_count;}
+
+public slots:
+ void removeAllEvents();
+
+protected:
+ QVBoxLayout* datebookdayalldayLayout;
+ DatebookEventDesc * lblDesc;
+ unsigned int item_count;
+ QList<DatebookAlldayDisp> subWidgets;
+ DateBookDB *dateBook;
+};
+
+class DatebookAlldayDisp : public QLabel
+{
+ Q_OBJECT
+
+public:
+ DatebookAlldayDisp(DateBookDB* db,const EffectiveEvent& e,
+ QWidget* parent=0,const char* name = 0, WFlags fl=0);
+ virtual ~DatebookAlldayDisp();
+
+signals:
+ void deleteMe( const Event &e );
+ void duplicateMe( const Event &e );
+ void editMe( const Event &e );
+ void beamMe( const Event &e );
+ void displayMe(const Event &e);
+
+public slots:
+
+protected:
+ EffectiveEvent m_Ev;
+ DateBookDB* dateBook;
+ void mousePressEvent( QMouseEvent *e );
+ void beam_single_event();
+};
+
+class DatebookEventDesc: public QLabel
+{
+ Q_OBJECT
+
+public:
+ DatebookEventDesc(QWidget* Parent=0,const char* name = 0);
+ virtual ~DatebookEventDesc();
+
+public slots:
+ void disp_event(const Event&e);
+
+protected:
+ void mousePressEvent(QMouseEvent*e);
+ QTimer* m_Timer;
+};
+
+#endif // DATEBOOKDAYALLDAYBASE_H
diff --git a/core/pim/datebook/datebooksettings.h b/core/pim/datebook/datebooksettings.h
index c3036e1..cf8a0ff 100644
--- a/core/pim/datebook/datebooksettings.h
+++ b/core/pim/datebook/datebooksettings.h
@@ -27,2 +27,3 @@ class DateBookSettings : public DateBookSettingsBase
{
+ Q_OBJECT
public:
@@ -38,3 +39,3 @@ public:
int alarmType() const;
-
+
void setJumpToCurTime( bool bJump );
@@ -43,3 +44,3 @@ public:
int rowStyle() const;
-
+
private slots:
diff --git a/core/pim/datebook/datebookweek.cpp b/core/pim/datebook/datebookweek.cpp
index 2ad7aa9..ab7e963 100644
--- a/core/pim/datebook/datebookweek.cpp
+++ b/core/pim/datebook/datebookweek.cpp
@@ -22,9 +22,6 @@
-#include <qpe/calendar.h>
#include <qpe/datebookdb.h>
-#include <qpe/event.h>
#include <qpe/qpeapplication.h>
-#include <qpe/timestring.h>
+#include <qpe/calendar.h>
-#include <qdatetime.h>
#include <qheader.h>
@@ -32,7 +29,3 @@
#include <qlayout.h>
-#include <qpainter.h>
-#include <qpopupmenu.h>
#include <qtimer.h>
-#include <qspinbox.h>
-#include <qstyle.h>
@@ -91,2 +84,6 @@ void DateBookWeekView::initNames()
{
+#warning Please review this ! (eilers)
+
+ // Ok, I am Mr. Pedantic, but shouldn't we count until 6 instead of 7, if bOnMonday is false ? (eilers)
+
static bool bFirst = true;
@@ -94,18 +91,12 @@ void DateBookWeekView::initNames()
if ( bOnMonday ) {
- header->addLabel( tr("Mo", "Monday" ) );
- header->addLabel( tr("Tu", "Tuesday") );
- header->addLabel( tr("We", "Wednesday" ) );
- header->addLabel( tr("Th", "Thursday" ) );
- header->addLabel( tr("Fr", "Friday" ) );
- header->addLabel( tr("Sa", "Saturday" ) );
- header->addLabel( tr("Su", "Sunday" ) );
+ for ( int i = 1; i<=7; i++ ) {
+ header->addLabel( Calendar::nameOfDay( i ) );
+ }
+
} else {
- header->addLabel( tr("Su", "Sunday" ) );
- header->addLabel( tr("Mo", "Monday") );
- header->addLabel( tr("Tu", "Tuesday") );
- header->addLabel( tr("We", "Wednesday" ) );
- header->addLabel( tr("Th", "Thursday" ) );
- header->addLabel( tr("Fr", "Friday" ) );
- header->addLabel( tr("Sa", "Saturday" ) );
- }
+ header->addLabel( Calendar::nameOfDay( 7 ) );
+ for ( int i = 1; i<7; i++ ) {
+ header->addLabel( Calendar::nameOfDay( i ) );
+ }
+ }
bFirst = false;
@@ -114,17 +105,12 @@ void DateBookWeekView::initNames()
if ( bOnMonday ) {
- header->setLabel( 1, tr("Mo", "Monday") );
- header->setLabel( 2, tr("Tu", "Tuesday") );
- header->setLabel( 3, tr("We", "Wednesday" ) );
- header->setLabel( 4, tr("Th", "Thursday" ) );
- header->setLabel( 5, tr("Fr", "Friday" ) );
- header->setLabel( 6, tr("Sa", "Saturday" ) );
- header->setLabel( 7, tr("Su", "Sunday" ) );
+ for ( int i = 1; i<=7; i++ ) {
+ header->setLabel( i, Calendar::nameOfDay( i ) );
+ }
+
} else {
- header->setLabel( 1, tr("Su", "Sunday" ) );
- header->setLabel( 2, tr("Mo", "Monday") );
- header->setLabel( 3, tr("Tu", "Tuesday") );
- header->setLabel( 4, tr("We", "Wednesday" ) );
- header->setLabel( 5, tr("Th", "Thursday" ) );
- header->setLabel( 6, tr("Fr", "Friday" ) );
- header->setLabel( 7, tr("Sa", "Saturday" ) );
+ header->setLabel( 1, Calendar::nameOfDay( 7 ) );
+ for ( int i = 1; i<7; i++ ) {
+ header->setLabel( i+1, Calendar::nameOfDay( i ) );
+ }
+
}
@@ -404,3 +390,4 @@ void DateBookWeek::showDay( int day )
// Calculate offset to first day of week.
- int dayoffset=d.dayOfWeek();
+ int dayoffset=d.dayOfWeek() % 7;
+
if(bStartOnMonday) dayoffset--;
@@ -577,2 +564,4 @@ QDate DateBookWeek::weekDate() const
if(bStartOnMonday) dayoffset--;
+ else if( dayoffset == 7 )
+ dayoffset = 0;
diff --git a/core/pim/datebook/datebookweekheaderimpl.cpp b/core/pim/datebook/datebookweekheaderimpl.cpp
index ff7626f..770410e 100644
--- a/core/pim/datebook/datebookweekheaderimpl.cpp
+++ b/core/pim/datebook/datebookweekheaderimpl.cpp
@@ -72,2 +72,3 @@ void DateBookWeekHeader::nextMonth()
{
+ qWarning("nextMonth() " );
setDate(date.addDays(28));
@@ -76,2 +77,3 @@ void DateBookWeekHeader::prevMonth()
{
+ qWarning("prevMonth() " );
setDate(date.addDays(-28));
@@ -80,2 +82,3 @@ void DateBookWeekHeader::nextWeek()
{
+ qWarning("nextWeek() " );
setDate(date.addDays(7));
@@ -84,2 +87,3 @@ void DateBookWeekHeader::prevWeek()
{
+ qWarning("prevWeek() ");
setDate(date.addDays(-7));
@@ -96,5 +100,9 @@ void DateBookWeekHeader::setDate(const QDate &d) {
dayofweek=d.dayOfWeek();
- if(bStartOnMonday) dayofweek--;
+ if(bStartOnMonday)
+ dayofweek--;
+ else if( dayofweek == 7 )
+ /* we already have the right day -7 would lead to the current week..*/
+ dayofweek = 0;
+
date=date.addDays(-dayofweek);
-
calcWeek(date,week,year,bStartOnMonday);
diff --git a/core/pim/datebook/datebookweeklst.cpp b/core/pim/datebook/datebookweeklst.cpp
index 7817042..aad1f3a 100644
--- a/core/pim/datebook/datebookweeklst.cpp
+++ b/core/pim/datebook/datebookweeklst.cpp
@@ -63,3 +63,8 @@ void DateBookWeekLstHeader::setDate(const QDate &d) {
dayofweek=d.dayOfWeek();
- if(bStartOnMonday) dayofweek--;
+ if(bStartOnMonday)
+ dayofweek--;
+ else if( dayofweek == 7 )
+ /* we already have the right day -7 would lead to the same week */
+ dayofweek = 0;
+
date=date.addDays(-dayofweek);
@@ -119,3 +124,3 @@ DateBookWeekLstDayHdr::DateBookWeekLstDayHdr(const QDate &d, bool /* onM */,
- static const char *wdays={"MTWTFSSM"};
+ static const QString wdays=tr("MTWTFSSM", "Week days");
char day=wdays[d.dayOfWeek()-1];
@@ -239,2 +244,3 @@ DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev,
if(bStartOnMonday) dayoffset--;
+ else if( dayoffset == 7 ) dayoffset = 0;
diff --git a/core/pim/datebook/dateentryimpl.cpp b/core/pim/datebook/dateentryimpl.cpp
index 13d2ce2..d9e5225 100644
--- a/core/pim/datebook/dateentryimpl.cpp
+++ b/core/pim/datebook/dateentryimpl.cpp
@@ -404,2 +404,4 @@ void DateEntry::slotRepeat()
}
+ // deleting sounds like a nice idea...
+ delete e;
}
diff --git a/core/pim/datebook/opie-datebook.control b/core/pim/datebook/opie-datebook.control
index 1a28448..fe5a086 100644
--- a/core/pim/datebook/opie-datebook.control
+++ b/core/pim/datebook/opie-datebook.control
@@ -1,3 +1,3 @@
Package: opie-datebook
-Files: bin/datebook apps/1Pim/datebook.desktop pics/datebook
+Files: bin/datebook apps/1Pim/datebook.desktop
Priority: optional
@@ -7,5 +7,5 @@ Maintainer: Warwick Allison <warwick@trolltech.com>
Architecture: arm
-Version: $QPE_VERSION-$SUB_VERSION
-Depends: task-opie-minimal, libopie1
+Depends: task-opie-minimal, libopie1, opie-pics
Description: A datebook/appointment manager
A datebook/appointment manager for the Opie environment.
+Version: $QPE_VERSION$EXTRAVERSION
diff --git a/core/pim/datebook/repeatentry.cpp b/core/pim/datebook/repeatentry.cpp
index 5637c4d..b1a162d 100644
--- a/core/pim/datebook/repeatentry.cpp
+++ b/core/pim/datebook/repeatentry.cpp
@@ -35,15 +35,32 @@
// Global Templates for use in setting up the repeat label...
-const QString strDayTemplate = QObject::tr("Every");
-const QString strYearTemplate = QObject::tr("%1 %2 every ");
-const QString strMonthDateTemplate = QObject::tr("The %1 every ");
-const QString strMonthDayTemplate = QObject::tr("The %1 %1 of every");
-const QString strWeekTemplate = QObject::tr("Every ");
-const QString dayLabel[] = { QObject::tr("Monday"),
- QObject::tr("Tuesday"),
- QObject::tr("Wednesday"),
- QObject::tr("Thursday"),
- QObject::tr("Friday"),
- QObject::tr("Saturday"),
- QObject::tr("Sunday") };
+// the problem is these strings get initialized before QPEApplication can install the translator -zecke
+namespace {
+QString strDayTemplate;
+QString strYearTemplate;
+QString strMonthDateTemplate;
+QString strMonthDayTemplate;
+QString strWeekTemplate;
+QString dayLabel[7];
+}
+/*
+ * static linkage to not polute the symbol table...
+ * The problem is that const and static linkage are resolved prior to installing a translator
+ * leading to that the above strings are translted but to the original we delay the init of these strings...
+ * -zecke
+ */
+static void fillStrings() {
+ strDayTemplate = QObject::tr("Every");
+ strYearTemplate = QObject::tr("%1 %2 every ");
+ strMonthDateTemplate = QObject::tr("The %1 every ");
+ strMonthDayTemplate = QObject::tr("The %1 %1 of every");
+ strWeekTemplate = QObject::tr("Every ");
+ dayLabel[0] = QObject::tr("Monday");
+ dayLabel[1] = QObject::tr("Tuesday");
+ dayLabel[2] = QObject::tr("Wednesday");
+ dayLabel[3] = QObject::tr("Thursday");
+ dayLabel[4] = QObject::tr("Friday");
+ dayLabel[5] = QObject::tr("Saturday");
+ dayLabel[6] = QObject::tr("Sunday");
+}
@@ -61,2 +78,5 @@ RepeatEntry::RepeatEntry( bool startOnMonday,
{
+ if (strDayTemplate.isEmpty() )
+ fillStrings();
+
init();
@@ -76,2 +96,4 @@ RepeatEntry::RepeatEntry( bool startOnMonday, const Event::RepeatPattern &rp,
{
+ if (strDayTemplate.isEmpty() )
+ fillStrings();
// do some stuff with the repeat pattern
@@ -408,3 +430,3 @@ void RepeatEntry::setupRepeatLabel( int x )
else
- strVar2 = tr( "day" );
+ strVar2 = tr( "day" );
break;
@@ -502,3 +524,3 @@ void RepeatEntry::slotWeekLabel()
}
- str = str.prepend( "on " );
+ str = str.prepend( tr("on ") );
lblWeekVar->setText( str );