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/.cvsignore12
-rw-r--r--core/pim/datebook/Makefile.in385
-rw-r--r--core/pim/datebook/datebook.cpp854
-rw-r--r--core/pim/datebook/datebook.h111
-rw-r--r--core/pim/datebook/datebook.pro36
-rw-r--r--core/pim/datebook/datebookday.cpp553
-rw-r--r--core/pim/datebook/datebookday.h138
-rw-r--r--core/pim/datebook/datebookdayheader.ui424
-rw-r--r--core/pim/datebook/datebookdayheaderimpl.cpp181
-rw-r--r--core/pim/datebook/datebookdayheaderimpl.h57
-rw-r--r--core/pim/datebook/datebooksettings.cpp135
-rw-r--r--core/pim/datebook/datebooksettings.h48
-rw-r--r--core/pim/datebook/datebooksettingsbase.ui232
-rw-r--r--core/pim/datebook/datebookweek.cpp687
-rw-r--r--core/pim/datebook/datebookweek.h152
-rw-r--r--core/pim/datebook/datebookweekheader.ui167
-rw-r--r--core/pim/datebook/datebookweekheaderimpl.cpp126
-rw-r--r--core/pim/datebook/datebookweekheaderimpl.h62
-rw-r--r--core/pim/datebook/dateentry.ui1095
-rw-r--r--core/pim/datebook/dateentryimpl.cpp474
-rw-r--r--core/pim/datebook/dateentryimpl.h71
-rw-r--r--core/pim/datebook/main.cpp38
-rw-r--r--core/pim/datebook/qpe-datebook.control9
-rw-r--r--core/pim/datebook/repeatentry.cpp595
-rw-r--r--core/pim/datebook/repeatentry.h98
-rw-r--r--core/pim/datebook/repeatentrybase.ui713
26 files changed, 7453 insertions, 0 deletions
diff --git a/core/pim/datebook/.cvsignore b/core/pim/datebook/.cvsignore
new file mode 100644
index 0000000..4ba477d
--- a/dev/null
+++ b/core/pim/datebook/.cvsignore
@@ -0,0 +1,12 @@
+moc_*
+Makefile
+dateentry.h
+datebookdayheader.h
+dateentry.cpp
+datebookdayheader.cpp
+datebookweekheader.cpp
+datebookweekheader.h
+datebooksettingsbase.h
+datebooksettingsbase.cpp
+repeatentrybase.cpp
+repeatentrybase.h
diff --git a/core/pim/datebook/Makefile.in b/core/pim/datebook/Makefile.in
new file mode 100644
index 0000000..bdc69dc
--- a/dev/null
+++ b/core/pim/datebook/Makefile.in
@@ -0,0 +1,385 @@
+#############################################################################
+
+####### Compiler, tools and options
+
+CXX = $(SYSCONF_CXX) $(QT_CXX_MT)
+CXXFLAGS= $(SYSCONF_CXXFLAGS_QT) $(SYSCONF_CXXFLAGS)
+CC = $(SYSCONF_CC) $(QT_C_MT)
+CFLAGS = $(SYSCONF_CFLAGS)
+INCPATH = -I$(QPEDIR)/include
+LFLAGS = $(SYSCONF_LFLAGS_QT) $(SYSCONF_RPATH_QT) $(SYSCONF_LFLAGS) $(QT_LFLAGS_MT)
+LIBS = $(SUBLIBS) -lqpe $(SYSCONF_LIBS_QT) $(SYSCONF_LIBS) $(SYSCONF_LIBS_QTAPP)
+MOC = $(SYSCONF_MOC)
+UIC = $(SYSCONF_UIC)
+
+####### Target
+
+DESTDIR = $(QPEDIR)/bin/
+VER_MAJ = 1
+VER_MIN = 0
+VER_PATCH = 0
+TARGET = datebook
+TARGET1 = lib$(TARGET).so.$(VER_MAJ)
+
+####### Files
+
+HEADERS = datebookday.h \
+ datebook.h \
+ dateentryimpl.h \
+ datebookdayheaderimpl.h \
+ datebooksettings.h \
+ datebookweek.h \
+ datebookweekheaderimpl.h \
+ repeatentry.h
+SOURCES = main.cpp \
+ datebookday.cpp \
+ datebook.cpp \
+ dateentryimpl.cpp \
+ datebookdayheaderimpl.cpp \
+ datebooksettings.cpp \
+ datebookweek.cpp \
+ datebookweekheaderimpl.cpp \
+ repeatentry.cpp
+OBJECTS = main.o \
+ datebookday.o \
+ datebook.o \
+ dateentryimpl.o \
+ datebookdayheaderimpl.o \
+ datebooksettings.o \
+ datebookweek.o \
+ datebookweekheaderimpl.o \
+ repeatentry.o \
+ dateentry.o \
+ datebookdayheader.o \
+ datebooksettingsbase.o \
+ datebookweekheader.o \
+ repeatentrybase.o
+INTERFACES = dateentry.ui \
+ datebookdayheader.ui \
+ datebooksettingsbase.ui \
+ datebookweekheader.ui \
+ repeatentrybase.ui
+UICDECLS = dateentry.h \
+ datebookdayheader.h \
+ datebooksettingsbase.h \
+ datebookweekheader.h \
+ repeatentrybase.h
+UICIMPLS = dateentry.cpp \
+ datebookdayheader.cpp \
+ datebooksettingsbase.cpp \
+ datebookweekheader.cpp \
+ repeatentrybase.cpp
+SRCMOC = moc_datebookday.cpp \
+ moc_datebook.cpp \
+ moc_dateentryimpl.cpp \
+ moc_datebookdayheaderimpl.cpp \
+ moc_datebookweek.cpp \
+ moc_datebookweekheaderimpl.cpp \
+ moc_repeatentry.cpp \
+ moc_dateentry.cpp \
+ moc_datebookdayheader.cpp \
+ moc_datebooksettingsbase.cpp \
+ moc_datebookweekheader.cpp \
+ moc_repeatentrybase.cpp
+OBJMOC = moc_datebookday.o \
+ moc_datebook.o \
+ moc_dateentryimpl.o \
+ moc_datebookdayheaderimpl.o \
+ moc_datebookweek.o \
+ moc_datebookweekheaderimpl.o \
+ moc_repeatentry.o \
+ moc_dateentry.o \
+ moc_datebookdayheader.o \
+ moc_datebooksettingsbase.o \
+ moc_datebookweekheader.o \
+ moc_repeatentrybase.o
+
+
+####### Implicit rules
+
+.SUFFIXES: .cpp .cxx .cc .C .c
+
+.cpp.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cxx.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cc.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.C.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.c.o:
+ $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
+
+####### Build rules
+
+
+all: $(DESTDIR)$(TARGET)
+
+$(DESTDIR)$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS)
+ $(SYSCONF_LINK) $(LFLAGS) -o $(DESTDIR)$(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS)
+
+moc: $(SRCMOC)
+
+tmake:
+ tmake datebook.pro
+
+clean:
+ -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS)
+ -rm -f *~ core
+ -rm -f allmoc.cpp
+
+####### Extension Modules
+
+listpromodules:
+ @echo
+
+listallmodules:
+ @echo
+
+listaddonpromodules:
+ @echo
+
+listaddonentmodules:
+ @echo
+
+
+REQUIRES=
+
+####### Sub-libraries
+
+
+###### Combined headers
+
+
+
+####### Compile
+
+main.o: main.cpp \
+ datebook.h \
+ $(QPEDIR)/include/qpe/datebookdb.h \
+ $(QPEDIR)/include/qpe/event.h \
+ $(QPEDIR)/include/qpe/palmtoprecord.h \
+ $(QPEDIR)/include/qpe/qpeapplication.h
+
+datebookday.o: datebookday.cpp \
+ datebookday.h \
+ $(QPEDIR)/include/qpe/event.h \
+ $(QPEDIR)/include/qpe/palmtoprecord.h \
+ datebookdayheaderimpl.h \
+ datebookdayheader.h \
+ $(QPEDIR)/include/qpe/datebookdb.h \
+ $(QPEDIR)/include/qpe/resource.h \
+ $(QPEDIR)/include/qpe/qpeapplication.h \
+ $(QPEDIR)/include/qpe/timestring.h \
+ $(QPEDIR)/include/qpe/qpedebug.h
+
+datebook.o: datebook.cpp \
+ datebook.h \
+ $(QPEDIR)/include/qpe/datebookdb.h \
+ $(QPEDIR)/include/qpe/event.h \
+ $(QPEDIR)/include/qpe/palmtoprecord.h \
+ datebookday.h \
+ datebooksettings.h \
+ datebooksettingsbase.h \
+ datebookweek.h \
+ dateentryimpl.h \
+ dateentry.h \
+ $(QPEDIR)/include/qpe/datebookmonth.h \
+ $(QPEDIR)/include/qpe/qpeapplication.h \
+ $(QPEDIR)/include/qpe/config.h \
+ $(QPEDIR)/include/qpe/qpedebug.h \
+ $(QPEDIR)/include/qpe/finddialog.h \
+ $(QPEDIR)/include/qpe/ir.h \
+ $(QPEDIR)/include/qpe/qpemenubar.h \
+ $(QPEDIR)/include/qpe/qpemessagebox.h \
+ $(QPEDIR)/include/qpe/resource.h \
+ $(QPEDIR)/include/qpe/sound.h \
+ $(QPEDIR)/include/qpe/timestring.h \
+ $(QPEDIR)/include/qpe/qpetoolbar.h \
+ $(QPEDIR)/include/qpe/tzselect.h \
+ $(QPEDIR)/include/qpe/xmlreader.h
+
+dateentryimpl.o: dateentryimpl.cpp \
+ dateentryimpl.h \
+ dateentry.h \
+ $(QPEDIR)/include/qpe/event.h \
+ $(QPEDIR)/include/qpe/palmtoprecord.h \
+ repeatentry.h \
+ repeatentrybase.h \
+ $(QPEDIR)/include/qpe/qpeapplication.h \
+ $(QPEDIR)/include/qpe/categoryselect.h \
+ $(QPEDIR)/include/qpe/datebookmonth.h \
+ $(QPEDIR)/include/qpe/global.h \
+ $(QPEDIR)/include/qpe/timeconversion.h \
+ $(QPEDIR)/include/qpe/timestring.h \
+ $(QPEDIR)/include/qpe/tzselect.h
+
+datebookdayheaderimpl.o: datebookdayheaderimpl.cpp \
+ datebookdayheaderimpl.h \
+ datebookdayheader.h \
+ $(QPEDIR)/include/qpe/datebookmonth.h \
+ $(QPEDIR)/include/qpe/event.h \
+ $(QPEDIR)/include/qpe/palmtoprecord.h \
+ $(QPEDIR)/include/qpe/timestring.h
+
+datebooksettings.o: datebooksettings.cpp \
+ datebooksettings.h \
+ datebooksettingsbase.h \
+ $(QPEDIR)/include/qpe/qpeapplication.h
+
+datebookweek.o: datebookweek.cpp \
+ datebookweek.h \
+ $(QPEDIR)/include/qpe/event.h \
+ $(QPEDIR)/include/qpe/palmtoprecord.h \
+ datebookweekheaderimpl.h \
+ datebookweekheader.h \
+ $(QPEDIR)/include/qpe/calendar.h \
+ $(QPEDIR)/include/qpe/datebookdb.h \
+ $(QPEDIR)/include/qpe/qpeapplication.h \
+ $(QPEDIR)/include/qpe/timestring.h
+
+datebookweekheaderimpl.o: datebookweekheaderimpl.cpp \
+ datebookweekheaderimpl.h \
+ datebookweekheader.h
+
+repeatentry.o: repeatentry.cpp \
+ repeatentry.h \
+ repeatentrybase.h \
+ $(QPEDIR)/include/qpe/event.h \
+ $(QPEDIR)/include/qpe/palmtoprecord.h \
+ $(QPEDIR)/include/qpe/datebookmonth.h \
+ $(QPEDIR)/include/qpe/qpeapplication.h \
+ $(QPEDIR)/include/qpe/timestring.h
+
+dateentry.h: dateentry.ui
+ $(UIC) dateentry.ui -o $(INTERFACE_DECL_PATH)/dateentry.h
+
+dateentry.cpp: dateentry.ui
+ $(UIC) dateentry.ui -i dateentry.h -o dateentry.cpp
+
+datebookdayheader.h: datebookdayheader.ui
+ $(UIC) datebookdayheader.ui -o $(INTERFACE_DECL_PATH)/datebookdayheader.h
+
+datebookdayheader.cpp: datebookdayheader.ui
+ $(UIC) datebookdayheader.ui -i datebookdayheader.h -o datebookdayheader.cpp
+
+datebooksettingsbase.h: datebooksettingsbase.ui
+ $(UIC) datebooksettingsbase.ui -o $(INTERFACE_DECL_PATH)/datebooksettingsbase.h
+
+datebooksettingsbase.cpp: datebooksettingsbase.ui
+ $(UIC) datebooksettingsbase.ui -i datebooksettingsbase.h -o datebooksettingsbase.cpp
+
+datebookweekheader.h: datebookweekheader.ui
+ $(UIC) datebookweekheader.ui -o $(INTERFACE_DECL_PATH)/datebookweekheader.h
+
+datebookweekheader.cpp: datebookweekheader.ui
+ $(UIC) datebookweekheader.ui -i datebookweekheader.h -o datebookweekheader.cpp
+
+repeatentrybase.h: repeatentrybase.ui
+ $(UIC) repeatentrybase.ui -o $(INTERFACE_DECL_PATH)/repeatentrybase.h
+
+repeatentrybase.cpp: repeatentrybase.ui
+ $(UIC) repeatentrybase.ui -i repeatentrybase.h -o repeatentrybase.cpp
+
+dateentry.o: dateentry.cpp
+
+datebookdayheader.o: datebookdayheader.cpp
+
+datebooksettingsbase.o: datebooksettingsbase.cpp
+
+datebookweekheader.o: datebookweekheader.cpp
+
+repeatentrybase.o: repeatentrybase.cpp
+
+moc_datebookday.o: moc_datebookday.cpp \
+ datebookday.h \
+ $(QPEDIR)/include/qpe/event.h \
+ $(QPEDIR)/include/qpe/palmtoprecord.h
+
+moc_datebook.o: moc_datebook.cpp \
+ datebook.h \
+ $(QPEDIR)/include/qpe/datebookdb.h \
+ $(QPEDIR)/include/qpe/event.h \
+ $(QPEDIR)/include/qpe/palmtoprecord.h
+
+moc_dateentryimpl.o: moc_dateentryimpl.cpp \
+ dateentryimpl.h \
+ dateentry.h \
+ $(QPEDIR)/include/qpe/event.h \
+ $(QPEDIR)/include/qpe/palmtoprecord.h
+
+moc_datebookdayheaderimpl.o: moc_datebookdayheaderimpl.cpp \
+ datebookdayheaderimpl.h \
+ datebookdayheader.h
+
+moc_datebookweek.o: moc_datebookweek.cpp \
+ datebookweek.h \
+ $(QPEDIR)/include/qpe/event.h \
+ $(QPEDIR)/include/qpe/palmtoprecord.h
+
+moc_datebookweekheaderimpl.o: moc_datebookweekheaderimpl.cpp \
+ datebookweekheaderimpl.h \
+ datebookweekheader.h
+
+moc_repeatentry.o: moc_repeatentry.cpp \
+ repeatentry.h \
+ repeatentrybase.h \
+ $(QPEDIR)/include/qpe/event.h \
+ $(QPEDIR)/include/qpe/palmtoprecord.h
+
+moc_dateentry.o: moc_dateentry.cpp \
+ dateentry.h
+
+moc_datebookdayheader.o: moc_datebookdayheader.cpp \
+ datebookdayheader.h
+
+moc_datebooksettingsbase.o: moc_datebooksettingsbase.cpp \
+ datebooksettingsbase.h
+
+moc_datebookweekheader.o: moc_datebookweekheader.cpp \
+ datebookweekheader.h
+
+moc_repeatentrybase.o: moc_repeatentrybase.cpp \
+ repeatentrybase.h
+
+moc_datebookday.cpp: datebookday.h
+ $(MOC) datebookday.h -o moc_datebookday.cpp
+
+moc_datebook.cpp: datebook.h
+ $(MOC) datebook.h -o moc_datebook.cpp
+
+moc_dateentryimpl.cpp: dateentryimpl.h
+ $(MOC) dateentryimpl.h -o moc_dateentryimpl.cpp
+
+moc_datebookdayheaderimpl.cpp: datebookdayheaderimpl.h
+ $(MOC) datebookdayheaderimpl.h -o moc_datebookdayheaderimpl.cpp
+
+moc_datebookweek.cpp: datebookweek.h
+ $(MOC) datebookweek.h -o moc_datebookweek.cpp
+
+moc_datebookweekheaderimpl.cpp: datebookweekheaderimpl.h
+ $(MOC) datebookweekheaderimpl.h -o moc_datebookweekheaderimpl.cpp
+
+moc_repeatentry.cpp: repeatentry.h
+ $(MOC) repeatentry.h -o moc_repeatentry.cpp
+
+moc_dateentry.cpp: dateentry.h
+ $(MOC) dateentry.h -o moc_dateentry.cpp
+
+moc_datebookdayheader.cpp: datebookdayheader.h
+ $(MOC) datebookdayheader.h -o moc_datebookdayheader.cpp
+
+moc_datebooksettingsbase.cpp: datebooksettingsbase.h
+ $(MOC) datebooksettingsbase.h -o moc_datebooksettingsbase.cpp
+
+moc_datebookweekheader.cpp: datebookweekheader.h
+ $(MOC) datebookweekheader.h -o moc_datebookweekheader.cpp
+
+moc_repeatentrybase.cpp: repeatentrybase.h
+ $(MOC) repeatentrybase.h -o moc_repeatentrybase.cpp
+
+
diff --git a/core/pim/datebook/datebook.cpp b/core/pim/datebook/datebook.cpp
new file mode 100644
index 0000000..6ec6cc2
--- a/dev/null
+++ b/core/pim/datebook/datebook.cpp
@@ -0,0 +1,854 @@
+/**********************************************************************
+** Copyright (C) 2000 Trolltech AS. All rights reserved.
+**
+** This file is part of Qtopia Environment.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info@trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+** $Id$
+**
+**********************************************************************/
+
+#include "datebook.h"
+#include "datebookday.h"
+#include "datebooksettings.h"
+#include "datebookweek.h"
+#include "dateentryimpl.h"
+
+#include <qpe/datebookmonth.h>
+#include <qpe/qpeapplication.h>
+#include <qpe/config.h>
+#include <qpe/qpedebug.h>
+#include <qpe/event.h>
+#include <qpe/finddialog.h>
+#include <qpe/ir.h>
+#include <qpe/qpemenubar.h>
+#include <qpe/qpemessagebox.h>
+#include <qpe/resource.h>
+#include <qpe/sound.h>
+#include <qpe/timestring.h>
+#include <qpe/qpetoolbar.h>
+#include <qpe/tzselect.h>
+#include <qpe/xmlreader.h>
+
+#include <qaction.h>
+#include <qcopchannel_qws.h>
+#include <qdatetime.h>
+#include <qdialog.h>
+#include <qfile.h>
+#include <qlabel.h>
+#include <qlayout.h>
+#include <qmessagebox.h>
+#include <qpopupmenu.h>
+#include <qpushbutton.h>
+#include <qtextcodec.h>
+#include <qtextstream.h>
+#include <qtl.h>
+#include <qwidgetstack.h>
+#include <qwindowsystem_qws.h>
+
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+#include <stdlib.h>
+
+#define DAY 1
+#define WEEK 2
+#define MONTH 3
+
+
+DateBook::DateBook( QWidget *parent, const char *, WFlags f )
+ : QMainWindow( parent, "datebook", f ),
+ aPreset( FALSE ),
+ presetTime( -1 ),
+ startTime( 8 ), // an acceptable default
+ syncing(FALSE),
+ inSearch(FALSE)
+{
+ QTime t;
+ t.start();
+ db = new DateBookDB;
+ qDebug("loading db t=%d", t.elapsed() );
+ loadSettings();
+ setCaption( tr("Calendar") );
+ setIcon( Resource::loadPixmap( "datebook_icon" ) );
+
+ setToolBarsMovable( FALSE );
+
+ QPEToolBar *bar = new QPEToolBar( this );
+ bar->setHorizontalStretchable( TRUE );
+
+ QPEMenuBar *mb = new QPEMenuBar( bar );
+ mb->setMargin( 0 );
+
+ QPEToolBar *sub_bar = new QPEToolBar(this);
+
+ QPopupMenu *view = new QPopupMenu( this );
+ QPopupMenu *settings = new QPopupMenu( this );
+
+ mb->insertItem( tr( "View" ), view );
+ mb->insertItem( tr( "Settings" ), settings );
+
+ QActionGroup *g = new QActionGroup( this );
+ g->setExclusive( TRUE );
+
+ QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ),
+ QString::null, 0, this, 0 );
+ connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) );
+ a->addTo( sub_bar );
+
+ a = new QAction( tr( "Day" ), Resource::loadPixmap( "day" ), QString::null, 0, g, 0 );
+ connect( a, SIGNAL( activated() ), this, SLOT( viewDay() ) );
+ a->addTo( sub_bar );
+ a->addTo( view );
+ a->setToggleAction( TRUE );
+ a->setOn( TRUE );
+ dayAction = a;
+ a = new QAction( tr( "Week" ), Resource::loadPixmap( "week" ), QString::null, 0, g, 0 );
+ connect( a, SIGNAL( activated() ), this, SLOT( viewWeek() ) );
+ a->addTo( sub_bar );
+ a->addTo( view );
+ a->setToggleAction( TRUE );
+ weekAction = a;
+ a = new QAction( tr( "Month" ), Resource::loadPixmap( "month" ), QString::null, 0, g, 0 );
+ connect( a, SIGNAL( activated() ), this, SLOT( viewMonth() ) );
+ a->addTo( sub_bar );
+ a->addTo( view );
+ a->setToggleAction( TRUE );
+ monthAction = a;
+
+ a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ), QString::null, 0, g, 0 );
+ connect( a, SIGNAL(activated()), this, SLOT(slotFind()) );
+ a->addTo( sub_bar );
+
+ a = new QAction( tr( "Today" ), QString::null, 0, 0 );
+ connect( a, SIGNAL( activated() ), this, SLOT( slotToday() ) );
+ a->addTo( view );
+
+ a = new QAction( tr( "Alarm and Start Time..." ), QString::null, 0, 0 );
+ connect( a, SIGNAL( activated() ), this, SLOT( slotSettings() ) );
+ a->addTo( settings );
+
+ views = new QWidgetStack( this );
+ setCentralWidget( views );
+
+ dayView = 0;
+ weekView = 0;
+ monthView = 0;
+
+ viewDay();
+ connect( qApp, SIGNAL(clockChanged(bool)),
+ this, SLOT(changeClock(bool)) );
+ connect( qApp, SIGNAL(weekChanged(bool)),
+ this, SLOT(changeWeek(bool)) );
+
+#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
+ connect( qApp, SIGNAL(appMessage(const QCString&, const QByteArray&)),
+ this, SLOT(appMessage(const QCString&, const QByteArray&)) );
+#endif
+
+ // listen on QPE/System
+#if defined(Q_WS_QWS)
+#if !defined(QT_NO_COP)
+ QCopChannel *channel = new QCopChannel( "QPE/System", this );
+ connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
+ this, SLOT(receive(const QCString&, const QByteArray&)) );
+#endif
+#endif
+
+ qDebug("done t=%d", t.elapsed() );
+
+}
+
+void DateBook::receive( const QCString &msg, const QByteArray &data )
+{
+ QDataStream stream( data, IO_ReadOnly );
+ if ( msg == "timeChange(QString)" ) {
+ // update active view!
+ if ( dayAction->isOn() )
+ viewDay();
+ else if ( weekAction->isOn() )
+ viewWeek();
+ else if ( monthAction->isOn() )
+ viewMonth();
+ }
+}
+
+DateBook::~DateBook()
+{
+}
+
+void DateBook::slotSettings()
+{
+ DateBookSettings frmSettings( ampm, this );
+ frmSettings.setStartTime( startTime );
+ frmSettings.setAlarmPreset( aPreset, presetTime );
+#if defined (Q_WS_QWS) || defined(_WS_QWS_)
+ frmSettings.showMaximized();
+#endif
+
+ if ( frmSettings.exec() ) {
+ aPreset = frmSettings.alarmPreset();
+ presetTime = frmSettings.presetTime();
+ startTime = frmSettings.startTime();
+ if ( dayView )
+ dayView->setStartViewTime( startTime );
+ if ( weekView )
+ weekView->setStartViewTime( startTime );
+ saveSettings();
+
+ // make the change obvious
+ if ( views->visibleWidget() ) {
+ if ( views->visibleWidget() == dayView )
+ dayView->redraw();
+ else if ( views->visibleWidget() == weekView )
+ weekView->redraw();
+ }
+ }
+}
+
+void DateBook::fileNew()
+{
+ slotNewEventFromKey("");
+}
+
+QString DateBook::checkEvent(const Event &e)
+{
+ /* check if overlaps with itself */
+ bool checkFailed = FALSE;
+
+ /* check the next 12 repeats. should catch most problems */
+ QDate current_date = e.start().date();
+ Event previous = e;
+ for(int i = 0; i < 12; i++)
+ {
+ QDateTime next;
+ if (!nextOccurance(previous, current_date.addDays(1), next)) {
+ break; // no more repeats
+ }
+ if(next < previous.end()) {
+ checkFailed = TRUE;
+ break;
+ }
+ current_date = next.date();
+ }
+
+ if(checkFailed)
+ return tr("Event duration is potentially longer\n"
+ "than interval between repeats.");
+
+ return QString::null;
+}
+
+QDate DateBook::currentDate()
+{
+ QDate d = QDate::currentDate();
+
+ if ( dayView && views->visibleWidget() == dayView ) {
+ d = dayView->date();
+ } else if ( weekView && views->visibleWidget() == weekView ) {
+ d = weekView->date();
+ } else if ( monthView && views->visibleWidget() == monthView ) {
+ d = monthView->selectedDate();
+ }
+
+ return d;
+}
+
+void DateBook::viewDay()
+{
+ initDay();
+ dayAction->setOn( TRUE );
+ QDate d = currentDate();
+ dayView->setDate( d );
+ views->raiseWidget( dayView );
+ dayView->redraw();
+}
+
+void DateBook::viewWeek()
+{
+ initWeek();
+ weekAction->setOn( TRUE );
+ QDate d = currentDate();
+ weekView->setDate( d );
+ views->raiseWidget( weekView );
+ weekView->redraw();
+}
+
+void DateBook::viewMonth()
+{
+ initMonth();
+ monthAction->setOn( TRUE );
+ QDate d = currentDate();
+ monthView->setDate( d.year(), d.month(), d.day() );
+ views->raiseWidget( monthView );
+ monthView->redraw();
+}
+
+void DateBook::editEvent( const Event &e )
+{
+ if (syncing) {
+ QMessageBox::warning( this, tr("Calendar"),
+ tr( "Can not edit data, currently syncing") );
+ return;
+ }
+
+ // workaround added for text input.
+ QDialog editDlg( this, 0, TRUE );
+ DateEntry *entry;
+ editDlg.setCaption( tr("Edit Event") );
+ QVBoxLayout *vb = new QVBoxLayout( &editDlg );
+ QScrollView *sv = new QScrollView( &editDlg, "scrollview" );
+ sv->setResizePolicy( QScrollView::AutoOneFit );
+ // KLUDGE!!!
+ sv->setHScrollBarMode( QScrollView::AlwaysOff );
+ vb->addWidget( sv );
+ entry = new DateEntry( onMonday, e, ampm, &editDlg, "editor" );
+ entry->timezone->setEnabled( FALSE );
+ sv->addChild( entry );
+
+#if defined(Q_WS_QWS) || defined(_WS_QWS_)
+ editDlg.showMaximized();
+#endif
+ while (editDlg.exec() ) {
+ Event newEv = entry->event();
+ QString error = checkEvent(newEv);
+ if (!error.isNull()) {
+ if (QMessageBox::warning(this, "error box",
+ error, "Fix it", "Continue", 0, 0, 1) == 0)
+ continue;
+ }
+ db->editEvent(e, newEv);
+ emit newEvent();
+ break;
+ }
+}
+
+void DateBook::removeEvent( const Event &e )
+{
+ if (syncing) {
+ QMessageBox::warning( this, tr("Calendar"),
+ tr( "Can not edit data, currently syncing") );
+ return;
+ }
+
+ QString strName = e.description();
+
+ if ( !QPEMessageBox::confirmDelete( this, tr( "Calendar" ),strName ) )
+ return;
+
+ db->removeEvent( e );
+ if ( views->visibleWidget() == dayView && dayView )
+ dayView->redraw();
+}
+
+void DateBook::addEvent( const Event &e )
+{
+ QDate d = e.start().date();
+ initDay();
+ dayView->setDate( d );
+}
+
+void DateBook::showDay( int year, int month, int day )
+{
+ initDay();
+ dayView->setDate( year, month, day );
+ views->raiseWidget( dayView );
+ dayAction->setOn( TRUE );
+}
+
+void DateBook::initDay()
+{
+ if ( !dayView ) {
+ dayView = new DateBookDay( ampm, onMonday, db, views, "day view" );
+ views->addWidget( dayView, DAY );
+ dayView->setStartViewTime( startTime );
+ connect( this, SIGNAL( newEvent() ),
+ dayView, SLOT( redraw() ) );
+ connect( dayView, SIGNAL( newEvent() ),
+ this, SLOT( fileNew() ) );
+ connect( dayView, SIGNAL( removeEvent( const Event & ) ),
+ this, SLOT( removeEvent( const Event & ) ) );
+ connect( dayView, SIGNAL( editEvent( const Event & ) ),
+ this, SLOT( editEvent( const Event & ) ) );
+ connect( dayView, SIGNAL( beamEvent( const Event & ) ),
+ this, SLOT( beamEvent( const Event & ) ) );
+ connect( dayView, SIGNAL(sigNewEvent(const QString &)),
+ this, SLOT(slotNewEventFromKey(const QString &)) );
+ }
+}
+
+void DateBook::initWeek()
+{
+ if ( !weekView ) {
+ weekView = new DateBookWeek( ampm, onMonday, db, views, "week view" );
+ weekView->setStartViewTime( startTime );
+ views->addWidget( weekView, WEEK );
+ connect( weekView, SIGNAL( showDate( int, int, int ) ),
+ this, SLOT( showDay( int, int, int ) ) );
+ connect( this, SIGNAL( newEvent() ),
+ weekView, SLOT( redraw() ) );
+ }
+ //But also get it right: the year that we display can be different
+ //from the year of the current date. So, first find the year
+ //number of the current week.
+
+ int yearNumber, totWeeks;
+ calcWeek( currentDate(), totWeeks, yearNumber, onMonday );
+
+ QDate d = QDate( yearNumber, 12, 31 );
+ calcWeek( d, totWeeks, yearNumber, onMonday );
+
+ while ( totWeeks == 1 ) {
+ d = d.addDays( -1 );
+ calcWeek( d, totWeeks, yearNumber, onMonday );
+ }
+ if ( totWeeks != weekView->totalWeeks() )
+ weekView->setTotalWeeks( totWeeks );
+}
+
+void DateBook::initMonth()
+{
+ if ( !monthView ) {
+ monthView = new DateBookMonth( views, "month view", FALSE, db );
+ views->addWidget( monthView, MONTH );
+ connect( monthView, SIGNAL( dateClicked( int, int, int ) ),
+ this, SLOT( showDay( int, int, int ) ) );
+ connect( this, SIGNAL( newEvent() ),
+ monthView, SLOT( redraw() ) );
+ qApp->processEvents();
+ }
+}
+
+void DateBook::loadSettings()
+{
+ {
+ Config config( "qpe" );
+ config.setGroup("Time");
+ ampm = config.readBoolEntry( "AMPM", TRUE );
+ onMonday = config.readBoolEntry( "MONDAY" );
+ }
+
+ {
+ Config config("DateBook");
+ config.setGroup("Main");
+ startTime = config.readNumEntry("startviewtime", 8);
+ aPreset = config.readBoolEntry("alarmpreset");
+ presetTime = config.readNumEntry("presettime");
+ }
+}
+
+void DateBook::saveSettings()
+{
+ Config config( "qpe" );
+ Config configDB( "DateBook" );
+ configDB.setGroup( "Main" );
+ configDB.writeEntry("startviewtime",startTime);
+ configDB.writeEntry("alarmpreset",aPreset);
+ configDB.writeEntry("presettime",presetTime);
+}
+
+void DateBook::appMessage(const QCString& msg, const QByteArray& data)
+{
+ bool needShow = FALSE;
+ if ( msg == "alarm(QDateTime,int)" ) {
+ QDataStream ds(data,IO_ReadOnly);
+ QDateTime when; int warn;
+ ds >> when >> warn;
+
+ // check to make it's okay to continue,
+ // this is the case that the time was set ahead, and
+ // we are forced given a stale alarm...
+ QDateTime current = QDateTime::currentDateTime();
+ if ( current.time().hour() != when.time().hour()
+ && current.time().minute() != when.time().minute() )
+ return;
+
+ QValueList<EffectiveEvent> list = db->getEffectiveEvents(when.addSecs(warn*60));
+ if ( list.count() > 0 ) {
+ QString msg;
+ bool bSound = FALSE;
+ int stopTimer = 0;
+ bool found = FALSE;
+ for ( QValueList<EffectiveEvent>::ConstIterator it=list.begin();
+ it!=list.end(); ++it ) {
+ if ( (*it).event().hasAlarm() ) {
+ found = TRUE;
+ msg += "<CENTER><B>" + (*it).description() + "</B>"
+ + "<BR>" + (*it).location() + "<BR>"
+ + TimeString::dateString((*it).event().start(),ampm)
+ + (warn
+ ? tr(" (in " + QString::number(warn)
+ + tr(" minutes)"))
+ : QString(""))
+ + "<BR>"
+ + (*it).notes() + "</CENTER>";
+ if ( (*it).event().alarmSound() != Event::Silent ) {
+ bSound = TRUE;
+ }
+ }
+ }
+ if ( found ) {
+ if ( bSound ) {
+ Sound::soundAlarm();
+ stopTimer = startTimer( 5000 );
+ }
+
+ QDialog dlg( this, 0, TRUE );
+ QVBoxLayout *vb = new QVBoxLayout( &dlg );
+ QScrollView *view = new QScrollView( &dlg, "scrollView");
+ view->setResizePolicy( QScrollView::AutoOneFit );
+ vb->addWidget( view );
+ QLabel *lblMsg = new QLabel( msg, &dlg );
+ view->addChild( lblMsg );
+ QPushButton *cmdOk = new QPushButton( tr("OK"), &dlg );
+ connect( cmdOk, SIGNAL(clicked()), &dlg, SLOT(accept()) );
+ vb->addWidget( cmdOk );
+
+#if defined(Q_WS_QWS) || defined(_WS_QWS_)
+ dlg.showMaximized();
+#endif
+ needShow = dlg.exec();
+
+ if ( bSound )
+ killTimer( stopTimer );
+ }
+ }
+ } else if ( msg == "nextView()" ) {
+ QWidget* cur = views->visibleWidget();
+ if ( cur ) {
+ if ( cur == dayView )
+ viewWeek();
+ else if ( cur == weekView )
+ viewMonth();
+ else if ( cur == monthView )
+ viewDay();
+ needShow = TRUE;
+ }
+ }
+ if ( needShow ) {
+#if defined(Q_WS_QWS) || defined(_WS_QWS_)
+ showMaximized();
+#else
+ show();
+#endif
+ raise();
+ QPEApplication::setKeepRunning();
+ setActiveWindow();
+ }
+}
+
+void DateBook::reload()
+{
+ db->reload();
+ if ( dayAction->isOn() )
+ viewDay();
+ else if ( weekAction->isOn() )
+ viewWeek();
+ else if ( monthAction->isOn() )
+ viewMonth();
+ syncing = FALSE;
+}
+
+void DateBook::flush()
+{
+ syncing = TRUE;
+ db->save();
+}
+
+void DateBook::timerEvent( QTimerEvent *e )
+{
+ static int stop = 0;
+ if ( stop < 10 ) {
+ Sound::soundAlarm();
+ stop++;
+ } else {
+ stop = 0;
+ killTimer( e->timerId() );
+ }
+}
+
+void DateBook::changeClock( bool newClock )
+{
+ ampm = newClock;
+ // repaint the affected objects...
+ if (dayView) dayView->redraw();
+ if (weekView) weekView->redraw();
+}
+
+void DateBook::changeWeek( bool m )
+{
+ /* no need to redraw, each widget catches. Do need to
+ store though for widgets we haven't made yet */
+ onMonday = m;
+}
+
+void DateBook::slotToday()
+{
+ // we need to view today
+ QDate dt = QDate::currentDate();
+ showDay( dt.year(), dt.month(), dt.day() );
+}
+
+void DateBook::closeEvent( QCloseEvent *e )
+{
+ if(syncing) {
+ /* no need to save, did that at flush */
+ e->accept();
+ return;
+ }
+
+ // save settings will generate it's own error messages, no
+ // need to do checking ourselves.
+ saveSettings();
+ if ( db->save() )
+ e->accept();
+ else {
+ if ( QMessageBox::critical( this, tr( "Out of space" ),
+ tr("Calendar was unable to save\n"
+ "your changes.\n"
+ "Free up some space and try again.\n"
+ "\nQuit anyway?"),
+ QMessageBox::Yes|QMessageBox::Escape,
+ QMessageBox::No|QMessageBox::Default )
+ != QMessageBox::No )
+ e->accept();
+ else
+ e->ignore();
+ }
+}
+
+// Entering directly from the "keyboard"
+void DateBook::slotNewEventFromKey( const QString &str )
+{
+ if (syncing) {
+ QMessageBox::warning( this, tr("Calendar"),
+ tr( "Can not edit data, currently syncing") );
+ return;
+ }
+
+ // We get to here from a key pressed in the Day View
+ // So we can assume some things. We want the string
+ // passed in to be part of the description.
+ QDateTime start, end;
+ if ( views->visibleWidget() == dayView ) {
+ dayView->selectedDates( start, end );
+ } else if ( views->visibleWidget() == monthView ) {
+ QDate d = monthView->selectedDate();
+ start = end = d;
+ start.setTime( QTime( 10, 0 ) );
+ end.setTime( QTime( 12, 0 ) );
+ } else if ( views->visibleWidget() == weekView ) {
+ QDate d = weekView->date();
+ start = end = d;
+ start.setTime( QTime( 10, 0 ) );
+ end.setTime( QTime( 12, 0 ) );
+ }
+
+ // argh! This really needs to be encapsulated in a class
+ // or function.
+ QDialog newDlg( this, 0, TRUE );
+ newDlg.setCaption( DateEntryBase::tr("New Event") );
+ DateEntry *e;
+ QVBoxLayout *vb = new QVBoxLayout( &newDlg );
+ QScrollView *sv = new QScrollView( &newDlg );
+ sv->setResizePolicy( QScrollView::AutoOneFit );
+ sv->setFrameStyle( QFrame::NoFrame );
+ sv->setHScrollBarMode( QScrollView::AlwaysOff );
+ vb->addWidget( sv );
+
+ Event ev;
+ ev.setDescription( str );
+ // When the new gui comes in, change this...
+ ev.setLocation( tr("(Unknown)") );
+ ev.setStart( start );
+ ev.setEnd( end );
+
+ e = new DateEntry( onMonday, ev, ampm, &newDlg );
+ e->setAlarmEnabled( aPreset, presetTime, Event::Loud );
+ sv->addChild( e );
+#if defined(Q_WS_QWS) || defined(_WS_QWS_)
+ newDlg.showMaximized();
+#endif
+ while (newDlg.exec()) {
+ ev = e->event();
+ ev.assignUid();
+ QString error = checkEvent( ev );
+ if ( !error.isNull() ) {
+ if ( QMessageBox::warning( this, tr("Error!"),
+ error, tr("Fix it"), tr("Continue"), 0, 0, 1 ) == 0 )
+ continue;
+ }
+ db->addEvent( ev );
+ emit newEvent();
+ break;
+ }
+}
+
+void DateBook::setDocument( const QString &filename )
+{
+ if ( filename.find(".vcs") != int(filename.length()) - 4 ) return;
+
+ QValueList<Event> tl = Event::readVCalendar( filename );
+ for( QValueList<Event>::Iterator it = tl.begin(); it != tl.end(); ++it ) {
+ db->addEvent( *it );
+ }
+}
+
+static const char * beamfile = "/tmp/obex/event.vcs";
+
+void DateBook::beamEvent( const Event &e )
+{
+ qDebug("trying to beamn");
+ unlink( beamfile ); // delete if exists
+ mkdir("/tmp/obex/", 0755);
+ Event::writeVCalendar( beamfile, e );
+ Ir *ir = new Ir( this );
+ connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) );
+ QString description = e.description();
+ ir->send( beamfile, description, "text/x-vCalendar" );
+}
+
+void DateBook::beamDone( Ir *ir )
+{
+ delete ir;
+ unlink( beamfile );
+}
+
+void DateBook::slotFind()
+{
+ // move it to the day view...
+ viewDay();
+ FindDialog frmFind( "Calendar", this );
+ frmFind.setUseDate( true );
+ frmFind.setDate( currentDate() );
+ QObject::connect( &frmFind,
+ SIGNAL(signalFindClicked(const QString&, const QDate&,
+ bool, bool, int)),
+ this,
+ SLOT(slotDoFind(const QString&, const QDate&,
+ bool, bool, int)) );
+ QObject::connect( this,
+ SIGNAL(signalNotFound()),
+ &frmFind,
+ SLOT(slotNotFound()) );
+ QObject::connect( this,
+ SIGNAL(signalWrapAround()),
+ &frmFind,
+ SLOT(slotWrapAround()) );
+ frmFind.exec();
+ inSearch = false;
+}
+
+bool catComp( QArray<int> cats, int category )
+{
+ bool returnMe;
+ int i,
+ count;
+
+ count = int(cats.count());
+ returnMe = false;
+ if ( (category == -1 && count == 0) || category == -2 )
+ returnMe = true;
+ else {
+ for ( i = 0; i < count; i++ ) {
+ if ( category == cats[i] ) {
+ returnMe = true;
+ break;
+ }
+ }
+ }
+ return returnMe;
+}
+
+
+void DateBook::slotDoFind( const QString& txt, const QDate &dt,
+ bool caseSensitive, bool /*backwards*/,
+ int category )
+{
+ QDateTime dtEnd( QDate(3001, 1, 1), QTime(0, 0, 0) ),
+ next;
+
+ QRegExp r( txt );
+ r.setCaseSensitive( caseSensitive );
+
+
+ static Event rev,
+ nonrev;
+ if ( !inSearch ) {
+ rev.setStart( QDateTime(QDate(1960, 1, 1), QTime(0, 0, 0)) );
+ nonrev.setStart( rev.start() );
+ inSearch = true;
+ }
+ static QDate searchDate = dt;
+ static bool wrapAround = true;
+ bool candidtate;
+ candidtate = false;
+
+ QValueList<Event> repeats = db->getRawRepeats();
+
+ // find the candidate for the first repeat that matches...
+ QValueListConstIterator<Event> it;
+ QDate start = dt;
+ for ( it = repeats.begin(); it != repeats.end(); ++it ) {
+ if ( catComp( (*it).categories(), category ) ) {
+ while ( nextOccurance( *it, start, next ) ) {
+ if ( next < dtEnd ) {
+ if ( (*it).match( r ) && !(next <= rev.start()) ) {
+ rev = *it;
+ dtEnd = next;
+ rev.setStart( next );
+ candidtate = true;
+ wrapAround = true;
+ start = dt;
+ break;
+ } else
+ start = next.date().addDays( 1 );
+ }
+ }
+ }
+ }
+
+ // now the for first non repeat...
+ QValueList<Event> nonRepeats = db->getNonRepeatingEvents( dt, dtEnd.date() );
+ qHeapSort( nonRepeats.begin(), nonRepeats.end() );
+ for ( it = nonRepeats.begin(); it != nonRepeats.end(); ++it ) {
+ if ( catComp( (*it).categories(), category ) ) {
+ if ( (*it).start() < dtEnd ) {
+ if ( (*it).match( r ) && !(*it <= nonrev) ) {
+ nonrev = *it;
+ dtEnd = nonrev.start();
+ candidtate = true;
+ wrapAround = true;
+ break;
+ }
+ }
+ }
+ }
+ if ( candidtate ) {
+ dayView->setStartViewTime( dtEnd.time().hour() );
+ dayView->setDate( dtEnd.date().year(), dtEnd.date().month(),
+ dtEnd.date().day() );
+ } else {
+ if ( wrapAround ) {
+ emit signalWrapAround();
+ rev.setStart( QDateTime(QDate(1960, 1, 1), QTime(0, 0, 0)) );
+ nonrev.setStart( rev.start() );
+ } else
+ emit signalNotFound();
+ wrapAround = !wrapAround;
+ }
+}
diff --git a/core/pim/datebook/datebook.h b/core/pim/datebook/datebook.h
new file mode 100644
index 0000000..44627bb
--- a/dev/null
+++ b/core/pim/datebook/datebook.h
@@ -0,0 +1,111 @@
+/**********************************************************************
+** Copyright (C) 2000 Trolltech AS. All rights reserved.
+**
+** This file is part of Qtopia Environment.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info@trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+#ifndef DATEBOOK_H
+#define DATEBOOK_H
+
+#include <qpe/datebookdb.h>
+
+#include <qmainwindow.h>
+
+class QAction;
+class QWidgetStack;
+class DateBookDay;
+class DateBookWeek;
+class DateBookMonth;
+class Event;
+class QDate;
+class Ir;
+
+class DateBook : public QMainWindow
+{
+ Q_OBJECT
+
+public:
+ DateBook( QWidget *parent = 0, const char *name = 0, WFlags f = 0 );
+ ~DateBook();
+
+signals:
+ void newEvent();
+ void signalNotFound();
+ void signalWrapAround();
+
+protected:
+ QDate currentDate();
+ void timerEvent( QTimerEvent *e );
+ void closeEvent( QCloseEvent *e );
+
+public slots:
+ void flush();
+ void reload();
+
+private slots:
+ void fileNew();
+ void slotSettings();
+ void slotToday(); // view today
+ void changeClock( bool newClock );
+ void changeWeek( bool newDay );
+ void appMessage(const QCString& msg, const QByteArray& data);
+ // handle key events in the day view...
+ void slotNewEventFromKey( const QString &str );
+ void slotFind();
+ void slotDoFind( const QString &, const QDate &, bool, bool, int );
+
+ void viewDay();
+ void viewWeek();
+ void viewMonth();
+
+ void showDay( int y, int m, int d );
+
+ void editEvent( const Event &e );
+ void removeEvent( const Event &e );
+
+ void receive( const QCString &msg, const QByteArray &data );
+ void setDocument( const QString & );
+ void beamEvent( const Event &e );
+ void beamDone( Ir *ir );
+
+private:
+ void addEvent( const Event &e );
+ void initDay();
+ void initWeek();
+ void initMonth();
+ void loadSettings();
+ void saveSettings();
+
+private:
+ DateBookDB *db;
+ QWidgetStack *views;
+ DateBookDay *dayView;
+ DateBookWeek *weekView;
+ DateBookMonth *monthView;
+ QAction *dayAction, *weekAction, *monthAction;
+ bool aPreset; // have everything set to alarm?
+ int presetTime; // the standard time for the alarm
+ int startTime;
+ bool ampm;
+ bool onMonday;
+
+ bool syncing;
+ bool inSearch;
+
+ QString checkEvent(const Event &);
+};
+
+#endif
diff --git a/core/pim/datebook/datebook.pro b/core/pim/datebook/datebook.pro
new file mode 100644
index 0000000..17c02ec
--- a/dev/null
+++ b/core/pim/datebook/datebook.pro
@@ -0,0 +1,36 @@
+TEMPLATE = app
+CONFIG += qt warn_on release
+DESTDIR = $(QPEDIR)/bin
+
+HEADERS = datebookday.h \
+ datebook.h \
+ dateentryimpl.h \
+ datebookdayheaderimpl.h \
+ datebooksettings.h \
+ datebookweek.h \
+ datebookweekheaderimpl.h \
+ repeatentry.h
+
+SOURCES = main.cpp \
+ datebookday.cpp \
+ datebook.cpp \
+ dateentryimpl.cpp \
+ datebookdayheaderimpl.cpp \
+ datebooksettings.cpp \
+ datebookweek.cpp \
+ datebookweekheaderimpl.cpp \
+ repeatentry.cpp
+
+INTERFACES = dateentry.ui \
+ datebookdayheader.ui \
+ datebooksettingsbase.ui \
+ datebookweekheader.ui \
+ repeatentrybase.ui
+
+INCLUDEPATH += $(QPEDIR)/include
+DEPENDPATH += $(QPEDIR)/include
+LIBS += -lqpe
+
+TARGET = datebook
+
+TRANSLATIONS = ../i18n/de/datebook.ts
diff --git a/core/pim/datebook/datebookday.cpp b/core/pim/datebook/datebookday.cpp
new file mode 100644
index 0000000..d5daab2
--- a/dev/null
+++ b/core/pim/datebook/datebookday.cpp
@@ -0,0 +1,553 @@
+/**********************************************************************
+** Copyright (C) 2000 Trolltech AS. All rights reserved.
+**
+** This file is part of Qtopia Environment.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info@trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include "datebookday.h"
+#include "datebookdayheaderimpl.h"
+
+#include <qpe/datebookdb.h>
+#include <qpe/resource.h>
+#include <qpe/event.h>
+#include <qpe/qpeapplication.h>
+#include <qpe/timestring.h>
+#include <qpe/qpedebug.h>
+
+#include <qheader.h>
+#include <qdatetime.h>
+#include <qpainter.h>
+#include <qsimplerichtext.h>
+#include <qpopupmenu.h>
+#include <qtextcodec.h>
+#include <qpalette.h>
+
+DateBookDayView::DateBookDayView( bool whichClock, QWidget *parent,
+ const char *name )
+ : QTable( 24, 1, parent, name ),
+ ampm( whichClock )
+{
+ enableClipper(TRUE);
+ setTopMargin( 0 );
+ horizontalHeader()->hide();
+ setLeftMargin(38);
+ setColumnStretchable( 0, TRUE );
+ setHScrollBarMode( QScrollView::AlwaysOff );
+ verticalHeader()->setPalette(white);
+ verticalHeader()->setResizeEnabled(FALSE);
+ setSelectionMode( Single );
+
+ // get rid of being able to edit things...
+ QTableItem *tmp;
+ int row;
+ for ( row = 0; row < numRows(); row++ ) {
+ tmp = new QTableItem( this, QTableItem::Never, QString::null);
+ setItem( row, 0, tmp );
+ }
+ initHeader();
+ QObject::connect( qApp, SIGNAL(clockChanged(bool)),
+ this, SLOT(slotChangeClock(bool)) );
+}
+
+void DateBookDayView::initHeader()
+{
+ QString strTmp;
+ for ( int i = 0; i < 24; ++i ) {
+ if ( ampm ) {
+ if ( i == 0 )
+ strTmp = QString::number(12) + ":00";
+ else if ( i == 12 )
+ strTmp = QString::number(12) + tr(":00p");
+ else if ( i > 12 )
+ strTmp = QString::number( i - 12 ) + tr(":00p");
+ else
+ strTmp = QString::number(i) + ":00";
+ } else {
+ if ( i < 10 )
+ strTmp = "0" + QString::number(i) + ":00";
+ else
+ strTmp = QString::number(i) + ":00";
+ }
+ strTmp = strTmp.rightJustify( 6, ' ' );
+ verticalHeader()->setLabel( i, strTmp );
+ setRowStretchable( i, FALSE );
+ }
+}
+
+void DateBookDayView::slotChangeClock( bool newClock )
+{
+ ampm = newClock;
+ initHeader();
+}
+
+bool DateBookDayView::whichClock() const
+{
+ return ampm;
+}
+
+void DateBookDayView::moveUp()
+{
+ scrollBy(0, -20);
+}
+
+void DateBookDayView::moveDown()
+{
+ scrollBy(0, 20);
+}
+
+void DateBookDayView::paintCell( QPainter *p, int, int, const QRect &cr, bool )
+{
+ int w = cr.width();
+ int h = cr.height();
+ p->fillRect( 0, 0, w, h, colorGroup().brush( QColorGroup::Base ) );
+ if ( showGrid() ) {
+ // Draw our lines
+ int x2 = w - 1;
+ int y2 = h - 1;
+ QPen pen( p->pen() );
+ p->setPen( colorGroup().mid() );
+ p->drawLine( x2, 0, x2, y2 );
+ p->drawLine( 0, y2, x2, y2 );
+ p->setPen( pen );
+ }
+}
+
+void DateBookDayView::paintFocus( QPainter *, const QRect & )
+{
+}
+
+
+void DateBookDayView::resizeEvent( QResizeEvent *e )
+{
+ QTable::resizeEvent( e );
+ columnWidthChanged( 0 );
+ emit sigColWidthChanged();
+}
+
+void DateBookDayView::keyPressEvent( QKeyEvent *e )
+{
+ QString txt = e->text();
+ if ( !txt.isNull() && txt[0] > ' ' && e->key() < 0x1000 ) {
+ // we this is some sort of thing we know about...
+ e->accept();
+ emit sigCapturedKey( txt );
+ } else {
+ // I don't know what this key is, do you?
+ e->ignore();
+ }
+}
+
+
+//===========================================================================
+
+DateBookDay::DateBookDay( bool ampm, bool startOnMonday,
+ DateBookDB *newDb, QWidget *parent,
+ const char *name )
+ : QVBox( parent, name ),
+ currDate( QDate::currentDate() ),
+ db( newDb ),
+ startTime( 0 )
+{
+ widgetList.setAutoDelete( true );
+ header = new DateBookDayHeader( startOnMonday, this, "day header" );
+ header->setDate( currDate.year(), currDate.month(), currDate.day() );
+ view = new DateBookDayView( ampm, this, "day view" );
+ connect( header, SIGNAL( dateChanged( int, int, int ) ),
+ this, SLOT( dateChanged( int, int, int ) ) );
+ connect( view, SIGNAL( sigColWidthChanged() ),
+ this, SLOT( slotColWidthChanged() ) );
+ connect( qApp, SIGNAL(weekChanged(bool)),
+ this, SLOT(slotWeekChanged(bool)) );
+ connect( view, SIGNAL(sigCapturedKey(const QString &)),
+ this, SIGNAL(sigNewEvent(const QString&)) );
+}
+
+void DateBookDay::selectedDates( QDateTime &start, QDateTime &end )
+{
+ start.setDate( currDate );
+ end.setDate( currDate );
+
+ int sh=99,eh=-1;
+
+ int n = dayView()->numSelections();
+
+ for (int i=0; i<n; i++) {
+ QTableSelection sel = dayView()->selection( i );
+ sh = QMIN(sh,sel.topRow());
+ eh = QMAX(sh,sel.bottomRow()+1);
+ }
+ if (sh > 23 || eh < 1) {
+ sh=8;
+ eh=9;
+ }
+
+ start.setTime( QTime( sh, 0, 0 ) );
+ end.setTime( QTime( eh, 0, 0 ) );
+}
+
+void DateBookDay::setDate( int y, int m, int d )
+{
+ header->setDate( y, m, d );
+}
+
+void DateBookDay::setDate( QDate d)
+{
+ header->setDate( d.year(), d.month(), d.day() );
+}
+
+void DateBookDay::dateChanged( int y, int m, int d )
+{
+ QDate date( y, m, d );
+ if ( currDate == date )
+ return;
+ currDate.setYMD( y, m, d );
+ relayoutPage();
+ dayView()->clearSelection();
+ QTableSelection ts;
+ ts.init( startTime, 0 );
+ ts.expandTo( startTime, 0 );
+ dayView()->addSelection( ts );
+}
+
+void DateBookDay::redraw()
+{
+ if ( isUpdatesEnabled() )
+ relayoutPage();
+}
+
+void DateBookDay::getEvents()
+{
+ widgetList.clear();
+
+ QValueList<EffectiveEvent> eventList = db->getEffectiveEvents( currDate,
+ currDate );
+ QValueListIterator<EffectiveEvent> it;
+ for ( it = eventList.begin(); it != eventList.end(); ++it ) {
+ DateBookDayWidget* w = new DateBookDayWidget( *it, this );
+ connect( w, SIGNAL( deleteMe( const Event & ) ),
+ this, SIGNAL( removeEvent( 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 );
+ }
+}
+
+static int place( const DateBookDayWidget *item, bool *used, int maxn )
+{
+ int place = 0;
+ int start = item->event().start().hour();
+ QTime e = item->event().end();
+ int end = e.hour();
+ if ( e.minute() < 5 )
+ end--;
+ if ( end < start )
+ end = start;
+ while ( place < maxn ) {
+ bool free = TRUE;
+ int s = start;
+ while( s <= end ) {
+ if ( used[10*s+place] ) {
+ free = FALSE;
+ break;
+ }
+ s++;
+ }
+ if ( free ) break;
+ place++;
+ }
+ if ( place == maxn ) {
+ return -1;
+ }
+ while( start <= end ) {
+ used[10*start+place] = TRUE;
+ start++;
+ }
+ return place;
+}
+
+
+void DateBookDay::relayoutPage( bool fromResize )
+{
+ setUpdatesEnabled( FALSE );
+ if ( !fromResize )
+ getEvents(); // no need we already have them!
+
+ int wCount = widgetList.count();
+ int wid = view->columnWidth(0)-1;
+ int n = 1;
+
+ if ( wCount < 20 ) {
+ for ( int i = 0; i < wCount; ) {
+ DateBookDayWidget *w = widgetList.at(i);
+ int x = 0;
+ int xp = 0;
+ QRect geom = w->geometry();
+ geom.setX( x );
+ geom.setWidth( wid );
+ while ( xp < n && intersects( w, geom ) ) {
+ x += wid;
+ xp++;
+ geom.moveBy( wid, 0 );
+ }
+ if ( xp >= n ) {
+ n++;
+ wid = ( view->columnWidth(0)-1 ) / n;
+ i = 0;
+ } else {
+ w->setGeometry( geom );
+ i++;
+ }
+ }
+ view->setContentsPos( 0, startTime * view->rowHeight(0) );
+ } else {
+
+
+ int hours[24];
+ memset( hours, 0, 24*sizeof( int ) );
+ bool overFlow = FALSE;
+ for ( int i = 0; i < wCount; i++ ) {
+ DateBookDayWidget *w = widgetList.at(i);
+ int start = w->event().start().hour();
+ QTime e = w->event().end();
+ int end = e.hour();
+ if ( e.minute() < 5 )
+ end--;
+ if ( end < start )
+ end = start;
+ while( start <= end ) {
+ hours[start]++;
+ if ( hours[start] >= 10 )
+ overFlow = TRUE;
+ ++start;
+ }
+ if ( overFlow )
+ break;
+ }
+ for ( int i = 0; i < 24; i++ ) {
+ n = QMAX( n, hours[i] );
+ }
+ wid = ( view->columnWidth(0)-1 ) / n;
+
+ bool used[24*10];
+ memset( used, FALSE, 24*10*sizeof( bool ) );
+
+ for ( int i = 0; i < wCount; i++ ) {
+ DateBookDayWidget *w = widgetList.at(i);
+ int xp = place( w, used, n );
+ if ( xp != -1 ) {
+ QRect geom = w->geometry();
+ geom.setX( xp*wid );
+ geom.setWidth( wid );
+ w->setGeometry( geom );
+ }
+ }
+ view->setContentsPos( 0, startTime * view->rowHeight(0) );
+ }
+ setUpdatesEnabled( TRUE );
+ return;
+}
+
+DateBookDayWidget *DateBookDay::intersects( const DateBookDayWidget *item, const QRect &geom )
+{
+ int i = 0;
+ DateBookDayWidget *w = widgetList.at(i);
+ int wCount = widgetList.count();
+ while ( i < wCount && w != item ) {
+ if ( w->geometry().intersects( geom ) ) {
+ return w;
+ }
+ w = widgetList.at(++i);
+ }
+
+ return 0;
+}
+
+
+QDate DateBookDay::date() const
+{
+ return currDate;
+}
+
+void DateBookDay::setStartViewTime( int startHere )
+{
+ startTime = startHere;
+ dayView()->clearSelection();
+ QTableSelection ts;
+ ts.init( startTime, 0 );
+ ts.expandTo( startTime, 0 );
+ dayView()->addSelection( ts );
+}
+
+int DateBookDay::startViewTime() const
+{
+ return startTime;
+}
+
+void DateBookDay::slotWeekChanged( bool bStartOnMonday )
+{
+ header->setStartOfWeek( bStartOnMonday );
+ // redraw();
+}
+
+void DateBookDay::keyPressEvent(QKeyEvent *e)
+{
+ switch(e->key()) {
+ case Key_Up:
+ view->moveUp();
+ break;
+ case Key_Down:
+ view->moveDown();
+ break;
+ case Key_Left:
+ setDate(QDate(currDate).addDays(-1));
+ break;
+ case Key_Right:
+ setDate(QDate(currDate).addDays(1));
+ break;
+ default:
+ e->ignore();
+ }
+}
+
+//===========================================================================
+
+DateBookDayWidget::DateBookDayWidget( const EffectiveEvent &e,
+ DateBookDay *db )
+ : QWidget( db->dayView()->viewport() ), ev( e ), dateBook( db )
+{
+ bool whichClock = db->dayView()->whichClock();
+
+ // why would someone use "<"? Oh well, fix it up...
+ // I wonder what other things may be messed up...
+ QString strDesc = ev.description();
+ int where = strDesc.find( "<" );
+ while ( where != -1 ) {
+ strDesc.remove( where, 1 );
+ strDesc.insert( where, "&#60;" );
+ where = strDesc.find( "<", where );
+ }
+
+ QString strCat;
+ // ### Fix later...
+// QString strCat = ev.category();
+// where = strCat.find( "<" );
+// while ( where != -1 ) {
+// strCat.remove( where, 1 );
+// strCat.insert( where, "&#60;" );
+// where = strCat.find( "<", where );
+// }
+
+ QString strNote = ev.notes();
+ where = strNote.find( "<" );
+ while ( where != -1 ) {
+ strNote.remove( where, 1 );
+ strNote.insert( where, "&#60;" );
+ where = strNote.find( "<", where );
+ }
+
+ text = "<b>" + strDesc + "</b><br>" + "<i>"
+ + strCat + "</i>"
+ + "<br><b>" + tr("Start") + "</b>: ";
+
+
+ if ( e.startDate() != ev.date() ) {
+ // multi-day event. Show start date
+ text += TimeString::longDateString( e.startDate() );
+ } else {
+ // Show start time.
+ text += TimeString::timeString( ev.start(), whichClock, FALSE );
+ }
+
+ text += "<br><b>" + tr("End") + "</b>: ";
+ if ( e.endDate() != ev.date() ) {
+ // multi-day event. Show end date
+ text += TimeString::longDateString( e.endDate() );
+ } else {
+ // Show end time.
+ text += TimeString::timeString( ev.end(), whichClock, FALSE );
+ }
+ text += "<br><br>" + strNote;
+ setBackgroundMode( PaletteBase );
+
+ QTime s = ev.start();
+ QTime e = ev.end();
+ int y = s.hour()*60+s.minute();
+ int h = e.hour()*60+e.minute()-y;
+ int rh = dateBook->dayView()->rowHeight(0);
+ y = y*rh/60;
+ h = h*rh/60;
+ if ( h < 3 )
+ h = 3;
+ geom.setY( y );
+ geom.setHeight( h );
+}
+
+DateBookDayWidget::~DateBookDayWidget()
+{
+}
+
+void DateBookDayWidget::paintEvent( QPaintEvent *e )
+{
+ QPainter p( this );
+ p.setPen( QColor(100, 100, 100) );
+ p.setBrush( QColor( 255, 240, 230 ) ); // based on priority?
+ p.drawRect(rect());
+
+ int y = 0;
+ int d = 0;
+
+ if ( ev.event().hasAlarm() ) {
+ p.drawPixmap( width() - 16, 0, Resource::loadPixmap( "bell" ) );
+ y = 20;
+ d = 20;
+ }
+
+ if ( ev.event().hasRepeat() ) {
+ p.drawPixmap( width() - 16, y, Resource::loadPixmap( "repeat" ) );
+ d = 20;
+ }
+
+ QSimpleRichText rt( text, font() );
+ rt.setWidth( geom.width() - d - 6 );
+ rt.draw( &p, 3, 0, e->region(), colorGroup() );
+}
+
+void DateBookDayWidget::mousePressEvent( QMouseEvent *e )
+{
+ QPopupMenu m;
+ m.insertItem( tr( "Edit" ), 1 );
+ m.insertItem( tr( "Delete" ), 2 );
+ m.insertItem( tr( "Beam" ), 3 );
+ int r = m.exec( e->globalPos() );
+ if ( r == 1 ) {
+ emit editMe( ev.event() );
+ } else if ( r == 2 ) {
+ emit deleteMe( ev.event() );
+ } else if ( r == 3 ) {
+ emit beamMe( ev.event() );
+ }
+}
+
+void DateBookDayWidget::setGeometry( const QRect &r )
+{
+ geom = r;
+ setFixedSize( r.width()+1, r.height()+1 );
+ dateBook->dayView()->moveChild( this, r.x(), r.y()-1 );
+ show();
+}
diff --git a/core/pim/datebook/datebookday.h b/core/pim/datebook/datebookday.h
new file mode 100644
index 0000000..531fded
--- a/dev/null
+++ b/core/pim/datebook/datebookday.h
@@ -0,0 +1,138 @@
+/**********************************************************************
+** Copyright (C) 2000 Trolltech AS. All rights reserved.
+**
+** This file is part of Qtopia Environment.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info@trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+#ifndef DATEBOOKDAY_H
+#define DATEBOOKDAY_H
+
+#include <qpe/event.h>
+
+#include <qdatetime.h>
+#include <qtable.h>
+#include <qvbox.h>
+#include <qlist.h>
+
+class DateBookDayHeader;
+class DateBookDB;
+class QDateTime;
+class QMouseEvent;
+class QPaintEvent;
+class QResizeEvent;
+
+class DateBookDayView : public QTable
+{
+ Q_OBJECT
+public:
+ DateBookDayView( bool hourClock, QWidget *parent, const char *name );
+ bool whichClock() const;
+
+public slots:
+ void moveUp();
+ void moveDown();
+
+signals:
+ void sigColWidthChanged();
+ void sigCapturedKey( const QString &txt );
+protected slots:
+ void slotChangeClock( bool );
+protected:
+ virtual void paintCell( QPainter *p, int row, int col, const QRect &cr, bool selected );
+ virtual void paintFocus( QPainter *p, const QRect &cr );
+ virtual void resizeEvent( QResizeEvent *e );
+ void keyPressEvent( QKeyEvent *e );
+ void initHeader();
+private:
+ bool ampm;
+};
+
+class DateBookDay;
+class DateBookDayWidget : public QWidget
+{
+ Q_OBJECT
+
+public:
+ DateBookDayWidget( const EffectiveEvent &e, DateBookDay *db );
+ ~DateBookDayWidget();
+
+ const QRect &geometry() { return geom; }
+ void setGeometry( const QRect &r );
+
+ const EffectiveEvent &event() const { return ev; }
+
+signals:
+ void deleteMe( const Event &e );
+ void editMe( const Event &e );
+ void beamMe( const Event &e );
+
+protected:
+ void paintEvent( QPaintEvent *e );
+ void mousePressEvent( QMouseEvent *e );
+
+private:
+ const EffectiveEvent ev;
+ DateBookDay *dateBook;
+ QString text;
+ QRect geom;
+};
+
+class DateBookDay : public QVBox
+{
+ Q_OBJECT
+
+public:
+ DateBookDay( bool ampm, bool startOnMonday, DateBookDB *newDb,
+ QWidget *parent, const char *name );
+ void selectedDates( QDateTime &start, QDateTime &end );
+ QDate date() const;
+ DateBookDayView *dayView() const { return view; }
+ void setStartViewTime( int startHere );
+ int startViewTime() const;
+
+public slots:
+ void setDate( int y, int m, int d );
+ void setDate( QDate );
+ void redraw();
+ void slotWeekChanged( bool bStartOnMonday );
+
+signals:
+ void removeEvent( const Event& );
+ void editEvent( const Event& );
+ void beamEvent( const Event& );
+ void newEvent();
+ void sigNewEvent( const QString & );
+
+protected slots:
+ void keyPressEvent(QKeyEvent *);
+
+private slots:
+ void dateChanged( int y, int m, int d );
+ void slotColWidthChanged() { relayoutPage(); };
+
+private:
+ void getEvents();
+ void relayoutPage( bool fromResize = false );
+ DateBookDayWidget *intersects( const DateBookDayWidget *item, const QRect &geom );
+ QDate currDate;
+ DateBookDayView *view;
+ DateBookDayHeader *header;
+ DateBookDB *db;
+ QList<DateBookDayWidget> widgetList;
+ int startTime;
+};
+
+#endif
diff --git a/core/pim/datebook/datebookdayheader.ui b/core/pim/datebook/datebookdayheader.ui
new file mode 100644
index 0000000..8bc284f
--- a/dev/null
+++ b/core/pim/datebook/datebookdayheader.ui
@@ -0,0 +1,424 @@
+<!DOCTYPE UI><UI>
+<class>DateBookDayHeaderBase</class>
+<comment>/**********************************************************************
+** Copyright (C) 2001 Trolltech AS. All rights reserved.
+**
+** This file is part of Qtopia Environment.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info@trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+** $Id$
+**
+**********************************************************************/</comment>
+<widget>
+ <class>QWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>DateBookDayHeaderBase</cstring>
+ </property>
+ <property stdset="1">
+ <name>geometry</name>
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>249</width>
+ <height>26</height>
+ </rect>
+ </property>
+ <property stdset="1">
+ <name>caption</name>
+ <string>Form1</string>
+ </property>
+ <property>
+ <name>layoutMargin</name>
+ </property>
+ <property>
+ <name>layoutSpacing</name>
+ </property>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>0</number>
+ </property>
+ <widget>
+ <class>QToolButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>back</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string></string>
+ </property>
+ <property stdset="1">
+ <name>pixmap</name>
+ <pixmap>image0</pixmap>
+ </property>
+ <property stdset="1">
+ <name>toggleButton</name>
+ <bool>false</bool>
+ </property>
+ <property stdset="1">
+ <name>autoRepeat</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>autoRaise</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>toggleButton</name>
+ <bool>false</bool>
+ </property>
+ <property>
+ <name>toolTip</name>
+ <string></string>
+ </property>
+ </widget>
+ <widget>
+ <class>QToolButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>date</cstring>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>1</vsizetype>
+ </sizepolicy>
+ </property>
+ <property stdset="1">
+ <name>font</name>
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string></string>
+ </property>
+ <property stdset="1">
+ <name>pixmap</name>
+ <pixmap></pixmap>
+ </property>
+ <property stdset="1">
+ <name>autoRepeat</name>
+ <bool>false</bool>
+ </property>
+ <property stdset="1">
+ <name>autoRaise</name>
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget>
+ <class>QButtonGroup</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>grpDays</cstring>
+ </property>
+ <property stdset="1">
+ <name>frameShape</name>
+ <enum>NoFrame</enum>
+ </property>
+ <property stdset="1">
+ <name>frameShadow</name>
+ <enum>Plain</enum>
+ </property>
+ <property stdset="1">
+ <name>title</name>
+ <string></string>
+ </property>
+ <property stdset="1">
+ <name>exclusive</name>
+ <bool>true</bool>
+ </property>
+ <property>
+ <name>layoutMargin</name>
+ </property>
+ <property>
+ <name>layoutSpacing</name>
+ </property>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>1</number>
+ </property>
+ <widget>
+ <class>QToolButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>cmdDay1</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>M</string>
+ </property>
+ <property stdset="1">
+ <name>toggleButton</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>autoRaise</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>toggleButton</name>
+ <bool>true</bool>
+ </property>
+ <property>
+ <name>toolTip</name>
+ <string></string>
+ </property>
+ </widget>
+ <widget>
+ <class>QToolButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>cmdDay2</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>T</string>
+ </property>
+ <property stdset="1">
+ <name>toggleButton</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>autoRaise</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>toggleButton</name>
+ <bool>true</bool>
+ </property>
+ <property>
+ <name>toolTip</name>
+ <string></string>
+ </property>
+ </widget>
+ <widget>
+ <class>QToolButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>cmdDay3</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>W</string>
+ </property>
+ <property stdset="1">
+ <name>toggleButton</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>autoRaise</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>toggleButton</name>
+ <bool>true</bool>
+ </property>
+ <property>
+ <name>toolTip</name>
+ <string></string>
+ </property>
+ </widget>
+ <widget>
+ <class>QToolButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>cmdDay4</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>T</string>
+ </property>
+ <property stdset="1">
+ <name>pixmap</name>
+ <pixmap></pixmap>
+ </property>
+ <property stdset="1">
+ <name>toggleButton</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>autoRepeat</name>
+ <bool>false</bool>
+ </property>
+ <property stdset="1">
+ <name>autoRaise</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>toggleButton</name>
+ <bool>true</bool>
+ </property>
+ <property>
+ <name>toolTip</name>
+ <string></string>
+ </property>
+ </widget>
+ <widget>
+ <class>QToolButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>cmdDay5</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>F</string>
+ </property>
+ <property stdset="1">
+ <name>toggleButton</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>autoRaise</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>toggleButton</name>
+ <bool>true</bool>
+ </property>
+ <property>
+ <name>toolTip</name>
+ <string></string>
+ </property>
+ </widget>
+ <widget>
+ <class>QToolButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>cmdDay6</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>S</string>
+ </property>
+ <property stdset="1">
+ <name>toggleButton</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>autoRaise</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>toggleButton</name>
+ <bool>true</bool>
+ </property>
+ <property>
+ <name>toolTip</name>
+ <string></string>
+ </property>
+ </widget>
+ <widget>
+ <class>QToolButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>cmdDay7</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>S</string>
+ </property>
+ <property stdset="1">
+ <name>toggleButton</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>autoRaise</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>toggleButton</name>
+ <bool>true</bool>
+ </property>
+ <property>
+ <name>toolTip</name>
+ <string></string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget>
+ <class>QToolButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>forward</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string></string>
+ </property>
+ <property stdset="1">
+ <name>pixmap</name>
+ <pixmap>image1</pixmap>
+ </property>
+ <property stdset="1">
+ <name>autoRepeat</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>autoRaise</name>
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+</widget>
+<images>
+ <image>
+ <name>image0</name>
+ <data format="XPM.GZ" length="582">789c6dcfcd4e843010c0f13b4fd1d01b31bb6cb325211b1f41e3d1c4789876a60bcbd7aeae07637c773b6d5985d870e0f7ef50605b88e7a707516cb3f72b5c5b2b6c036fa2c08f61f87c79bdffcaf2dd5ef0558b5d7e97e51b61c5e33412df4b7f2fcbb09896a94ab557817063cd744cad74a915734aac35308740d018d9332d5ab0c8ec1229f2c2448d156a661b489ee1ab4e4cf2a08a790e24020abb0dd355442eec8e914e45526215790c749e8e89891069125de466b1fe14295705ccaa5863e2d05cc01894925b2a7e8217dd8a631eb169fd509af10fd1a9ebfbdf32008d9d0c07cd274f70ee162773ba2cdfee935c977ffe6b2edf87ec07796f81cd</data>
+ </image>
+ <image>
+ <name>image1</name>
+ <data format="XPM.GZ" length="627">789c7dcfc94ec3301006e07b9ec28a6f114a13cbb1a8108f00e28884387819676993340b07847877329ea8697a60ec83bfdf232f8784bdbfbdb0e4104db39e6bcb6ca54796b8afb6fdfef87cfe89e25cb2650ac1f2f8218a5366d96bdf01aef9b2e65928a4458a0c07b25c29890352e63293e19c53a0968f52230159e8c22981744495133552097554a1f982b4ce6aeb9013d215165c81ec894e109b4070ca85378f2b35f18c04050214b20d04d010762ba457003eecd6442f88f34a45f4817ea147762b35d1acf4c47457d784737d9f18ebee1363614bf852c6f812b6c460f90abb6e93ba694ed7c49fdbaeee2f76b83da71ba772e0db5d9ccf4b07dfdd5e858edd9b2948fff9d796fc3e457f660e8d47</data>
+ </image>
+</images>
+<connections>
+ <connection>
+ <sender>forward</sender>
+ <signal>clicked()</signal>
+ <receiver>DateBookDayHeaderBase</receiver>
+ <slot>goForward()</slot>
+ </connection>
+ <connection>
+ <sender>back</sender>
+ <signal>clicked()</signal>
+ <receiver>DateBookDayHeaderBase</receiver>
+ <slot>goBack()</slot>
+ </connection>
+ <connection>
+ <sender>grpDays</sender>
+ <signal>clicked(int)</signal>
+ <receiver>DateBookDayHeaderBase</receiver>
+ <slot>setDay( int )</slot>
+ </connection>
+ <slot access="public">goBack()</slot>
+ <slot access="public">goForward()</slot>
+ <slot access="public">setDate( int, int, int )</slot>
+ <slot access="public">setDay( int )</slot>
+</connections>
+</UI>
diff --git a/core/pim/datebook/datebookdayheaderimpl.cpp b/core/pim/datebook/datebookdayheaderimpl.cpp
new file mode 100644
index 0000000..fbcb3d2
--- a/dev/null
+++ b/core/pim/datebook/datebookdayheaderimpl.cpp
@@ -0,0 +1,181 @@
+/**********************************************************************
+** Copyright (C) 2000 Trolltech AS. All rights reserved.
+**
+** This file is part of Qtopia Environment.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info@trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+#include "datebookdayheaderimpl.h"
+
+#include <qpe/datebookmonth.h>
+#include <qpe/timestring.h>
+
+#include <qbuttongroup.h>
+#include <qpopupmenu.h>
+#include <qstringlist.h>
+#include <qtimer.h>
+#include <qtoolbutton.h>
+
+/*
+ * Constructs a DateBookDayHeader which is a child of 'parent', with the
+ * name 'name' and widget flags set to 'f'
+ *
+ * The dialog will by default be modeless, unless you set 'modal' to
+ * TRUE to construct a modal dialog.
+ */
+DateBookDayHeader::DateBookDayHeader( bool useMonday,
+ QWidget* parent, const char* name )
+ : DateBookDayHeaderBase( parent, name ),
+ bUseMonday( useMonday )
+{
+ connect(date,SIGNAL(pressed()),this,SLOT(pickDate()));
+
+ setupNames();
+
+ setBackgroundMode( PaletteButton );
+ grpDays->setBackgroundMode( PaletteButton );
+}
+
+/*
+ * Destroys the object and frees any allocated resources
+ */
+DateBookDayHeader::~DateBookDayHeader()
+{
+ // no need to delete child widgets, Qt does it all for us
+}
+
+void DateBookDayHeader::setStartOfWeek( bool onMonday )
+{
+ bUseMonday = onMonday;
+ setupNames();
+ setDate( currDate.year(), currDate.month(), currDate.day() );
+}
+
+void DateBookDayHeader::setupNames()
+{
+ if ( bUseMonday ) {
+ cmdDay1->setText( DateBookDayHeaderBase::tr("Monday").left(1) );
+ cmdDay2->setText( DateBookDayHeaderBase::tr("Tuesday").left(1) );
+ cmdDay3->setText( DateBookDayHeaderBase::tr("Wednesday").left(1) );
+ cmdDay4->setText( DateBookDayHeaderBase::tr("Thursday").left(1) );
+ cmdDay5->setText( DateBookDayHeaderBase::tr("Friday").left(1) );
+ cmdDay6->setText( DateBookDayHeaderBase::tr("Saturday").left(1) );
+ cmdDay7->setText( DateBookDayHeaderBase::tr("Sunday").left(1) );
+ } else {
+ cmdDay1->setText( DateBookDayHeaderBase::tr("Sunday").left(1) );
+ cmdDay2->setText( DateBookDayHeaderBase::tr("Monday").left(1) );
+ cmdDay3->setText( DateBookDayHeaderBase::tr("Tuesday").left(1) );
+ cmdDay4->setText( DateBookDayHeaderBase::tr("Wednesday").left(1) );
+ cmdDay5->setText( DateBookDayHeaderBase::tr("Thursday").left(1) );
+ cmdDay6->setText( DateBookDayHeaderBase::tr("Friday").left(1) );
+ cmdDay7->setText( DateBookDayHeaderBase::tr("Saturday").left(1) );
+ }
+}
+
+
+void DateBookDayHeader::pickDate()
+{
+ static QPopupMenu *m1 = 0;
+ static DateBookMonth *picker = 0;
+ if ( !m1 ) {
+ m1 = new QPopupMenu( this );
+ picker = new DateBookMonth( m1, 0, TRUE );
+ m1->insertItem( picker );
+ connect( picker, SIGNAL( dateClicked( int, int, int ) ),
+ this, SLOT( setDate( int, int, int ) ) );
+ connect( m1, SIGNAL( aboutToHide() ),
+ this, SLOT( gotHide() ) );
+ }
+ picker->setDate( currDate.year(), currDate.month(), currDate.day() );
+ m1->popup(mapToGlobal(date->pos()+QPoint(0,date->height())));
+ picker->setFocus();
+}
+
+void DateBookDayHeader::gotHide()
+{
+ // we have to redo the button...
+ date->setDown( false );
+}
+
+/*
+ * public slot
+ */
+void DateBookDayHeader::goBack()
+{
+ currDate = currDate.addDays( -1 );
+ setDate( currDate.year(), currDate.month(), currDate.day() );
+}
+/*
+ * public slot
+ */
+void DateBookDayHeader::goForward()
+{
+ currDate = currDate.addDays( 1 );
+ setDate( currDate.year(), currDate.month(), currDate.day() );
+}
+
+
+/*
+ * public slot
+ */
+void DateBookDayHeader::setDate( int y, int m, int d )
+{
+ currDate.setYMD( y, m, d );
+ date->setText( TimeString::shortDate( currDate ) );
+
+ int iDayOfWeek = currDate.dayOfWeek();
+ // cleverly adjust the day depending on how we start the week
+ if ( bUseMonday )
+ iDayOfWeek--;
+ else {
+ if ( iDayOfWeek == 7 ) // Sunday
+ iDayOfWeek = 0;
+ }
+ grpDays->setButton( iDayOfWeek );
+ emit dateChanged( y, m, d );
+}
+
+/*
+ * public slot
+ */
+void DateBookDayHeader::setDay( int day )
+{
+ int realDay;
+ int dayOfWeek = currDate.dayOfWeek();
+
+ // a little adjustment is needed...
+ if ( bUseMonday )
+ realDay = day + 1 ;
+ else if ( !bUseMonday && day == 0 ) // sunday
+ realDay = 7;
+ else
+ realDay = day;
+ // special cases first...
+ if ( realDay == 7 && !bUseMonday ) {
+ while ( currDate.dayOfWeek() != realDay )
+ currDate = currDate.addDays( -1 );
+ } else if ( !bUseMonday && dayOfWeek == 7 && dayOfWeek > realDay ) {
+ while ( currDate.dayOfWeek() != realDay )
+ currDate = currDate.addDays( 1 );
+ } else if ( dayOfWeek < realDay ) {
+ while ( currDate.dayOfWeek() < realDay )
+ currDate = currDate.addDays( 1 );
+ } else if ( dayOfWeek > realDay ) {
+ while ( currDate.dayOfWeek() > realDay )
+ currDate = currDate.addDays( -1 );
+ }
+ // update the date...
+ setDate( currDate.year(), currDate.month(), currDate.day() );
+}
diff --git a/core/pim/datebook/datebookdayheaderimpl.h b/core/pim/datebook/datebookdayheaderimpl.h
new file mode 100644
index 0000000..43f3a93
--- a/dev/null
+++ b/core/pim/datebook/datebookdayheaderimpl.h
@@ -0,0 +1,57 @@
+/**********************************************************************
+** Copyright (C) 2000 Trolltech AS. All rights reserved.
+**
+** This file is part of Qtopia Environment.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info@trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+#ifndef DATEBOOKDAYHEADER_H
+#define DATEBOOKDAYHEADER_H
+#include "datebookdayheader.h"
+
+#include <qdatetime.h>
+
+class DateBookDayHeader : public DateBookDayHeaderBase
+{
+ Q_OBJECT
+
+public:
+ DateBookDayHeader( bool bUseMonday, QWidget* parent = 0,
+ const char* name = 0 );
+ ~DateBookDayHeader();
+ void setStartOfWeek( bool onMonday );
+
+public slots:
+ void goBack();
+ void goForward();
+ void setDate( int, int, int );
+ void setDay( int );
+ void gotHide();
+
+signals:
+ void dateChanged( int y, int m, int d );
+
+private slots:
+ void pickDate();
+
+
+private:
+ QDate currDate;
+ bool bUseMonday;
+ void setupNames();
+
+};
+
+#endif // DATEBOOKDAYHEADER_H
diff --git a/core/pim/datebook/datebooksettings.cpp b/core/pim/datebook/datebooksettings.cpp
new file mode 100644
index 0000000..c5d8ac1
--- a/dev/null
+++ b/core/pim/datebook/datebooksettings.cpp
@@ -0,0 +1,135 @@
+/**********************************************************************
+** Copyright (C) 2000 Trolltech AS. All rights reserved.
+**
+** This file is part of Qtopia Environment.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info@trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include "datebooksettings.h"
+
+#include <qpe/qpeapplication.h>
+
+#include <qspinbox.h>
+#include <qcheckbox.h>
+#include <qcombobox.h>
+
+DateBookSettings::DateBookSettings( bool whichClock, QWidget *parent,
+ const char *name, bool modal, WFlags fl )
+ : DateBookSettingsBase( parent, name, modal, fl ),
+ ampm( whichClock )
+{
+ init();
+ QObject::connect( qApp, SIGNAL( clockChanged( bool ) ),
+ this, SLOT( slotChangeClock( bool ) ) );
+}
+
+DateBookSettings::~DateBookSettings()
+{
+}
+
+void DateBookSettings::setStartTime( int newStartViewTime )
+{
+ if ( ampm ) {
+ if ( newStartViewTime >= 12 ) {
+ newStartViewTime %= 12;
+ if ( newStartViewTime == 0 )
+ newStartViewTime = 12;
+ spinStart->setSuffix( tr(":00 PM") );
+ }
+ else if ( newStartViewTime == 0 ) {
+ newStartViewTime = 12;
+ spinStart->setSuffix( tr(":00 AM") );
+ }
+ oldtime = newStartViewTime;
+ }
+ spinStart->setValue( newStartViewTime );
+}
+
+int DateBookSettings::startTime() const
+{
+ int returnMe = spinStart->value();
+ if ( ampm ) {
+ if ( returnMe != 12 && spinStart->suffix().contains(tr("PM"), FALSE) )
+ returnMe += 12;
+ else if (returnMe == 12 && spinStart->suffix().contains(tr("AM"), TRUE))
+ returnMe = 0;
+ }
+ return returnMe;
+}
+
+
+void DateBookSettings::setAlarmPreset( bool bAlarm, int presetTime )
+{
+ chkAlarmPreset->setChecked( bAlarm );
+ if ( presetTime >=5 )
+ spinPreset->setValue( presetTime );
+}
+
+bool DateBookSettings::alarmPreset() const
+{
+ return chkAlarmPreset->isChecked();
+}
+
+int DateBookSettings::presetTime() const
+{
+ return spinPreset->value();
+}
+
+
+void DateBookSettings::slot12Hour( int i )
+{
+ if ( ampm ) {
+ if ( spinStart->suffix().contains( tr("AM"), FALSE ) ) {
+ if ( oldtime == 12 && i == 11 || oldtime == 11 && i == 12 )
+ spinStart->setSuffix( tr(":00 PM") );
+ } else {
+ if ( oldtime == 12 && i == 11 || oldtime == 11 && i == 12 )
+ spinStart->setSuffix( tr(":00 AM") );
+ }
+ oldtime = i;
+ }
+}
+
+void DateBookSettings::init()
+{
+ if ( ampm ) {
+ spinStart->setMinValue( 1 );
+ spinStart->setMaxValue( 12 );
+ spinStart->setValue( 12 );
+ spinStart->setSuffix( tr(":00 AM") );
+ oldtime = 12;
+ } else {
+ spinStart->setMinValue( 0 );
+ spinStart->setMaxValue( 23 );
+ spinStart->setSuffix( tr(":00") );
+ }
+}
+
+void DateBookSettings::slotChangeClock( bool whichClock )
+{
+ int saveMe;
+ saveMe = spinStart->value();
+ if ( ampm && spinStart->suffix().contains( tr("AM"), FALSE ) ) {
+ if ( saveMe == 12 )
+ saveMe = 0;
+ } else if ( ampm && spinStart->suffix().contains( tr("PM"), FALSE ) ) {
+ if ( saveMe != 12 )
+ saveMe += 12;
+ }
+ ampm = whichClock;
+ init();
+ setStartTime( saveMe );
+}
diff --git a/core/pim/datebook/datebooksettings.h b/core/pim/datebook/datebooksettings.h
new file mode 100644
index 0000000..ee9f39c
--- a/dev/null
+++ b/core/pim/datebook/datebooksettings.h
@@ -0,0 +1,48 @@
+/**********************************************************************
+** Copyright (C) 2000 Trolltech AS. All rights reserved.
+**
+** This file is part of Qtopia Environment.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info@trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef DATEBOOKSETTINGS_H
+#define DATEBOOKSETTINGS_H
+#include "datebooksettingsbase.h"
+
+class DateBookSettings : public DateBookSettingsBase
+{
+public:
+ DateBookSettings( bool whichClock, QWidget *parent = 0,
+ const char *name = 0, bool modal = TRUE, WFlags = 0 );
+ ~DateBookSettings();
+ void setStartTime( int newStartViewTime );
+ int startTime() const;
+ void setAlarmPreset( bool bAlarm, int presetTime );
+ bool alarmPreset() const;
+ int presetTime() const;
+ void setAlarmType( int alarmType );
+ int alarmType() const;
+
+private slots:
+ void slot12Hour( int );
+ void slotChangeClock( bool );
+
+private:
+ void init();
+ bool ampm;
+ int oldtime;
+};
+#endif
diff --git a/core/pim/datebook/datebooksettingsbase.ui b/core/pim/datebook/datebooksettingsbase.ui
new file mode 100644
index 0000000..0f40773
--- a/dev/null
+++ b/core/pim/datebook/datebooksettingsbase.ui
@@ -0,0 +1,232 @@
+<!DOCTYPE UI><UI>
+<class>DateBookSettingsBase</class>
+<comment>**********************************************************************
+** Copyright (C) 2000 Trolltech AS. All rights reserved.
+**
+** This file is part of Qtopia Environment.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info@trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+** $Id$
+**
+**********************************************************************</comment>
+<widget>
+ <class>QDialog</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>DateBookSettingsBase</cstring>
+ </property>
+ <property stdset="1">
+ <name>geometry</name>
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>232</width>
+ <height>290</height>
+ </rect>
+ </property>
+ <property stdset="1">
+ <name>caption</name>
+ <string>Preferences</string>
+ </property>
+ <property>
+ <name>layoutMargin</name>
+ </property>
+ <property>
+ <name>layoutSpacing</name>
+ </property>
+ <vbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>5</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>1</number>
+ </property>
+ <widget>
+ <class>QGroupBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>fraStart</cstring>
+ </property>
+ <property stdset="1">
+ <name>frameShape</name>
+ <enum>Box</enum>
+ </property>
+ <property stdset="1">
+ <name>frameShadow</name>
+ <enum>Sunken</enum>
+ </property>
+ <property stdset="1">
+ <name>title</name>
+ <string>Start viewing events</string>
+ </property>
+ <vbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>11</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout1</cstring>
+ </property>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>lblStartTime</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Start Time:</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QSpinBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>spinStart</cstring>
+ </property>
+ <property stdset="1">
+ <name>suffix</name>
+ <string>:00</string>
+ </property>
+ <property stdset="1">
+ <name>wrapping</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>maxValue</name>
+ <number>23</number>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+ </widget>
+ <widget>
+ <class>QGroupBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>fraAlarm</cstring>
+ </property>
+ <property stdset="1">
+ <name>title</name>
+ <string>Alarm Settings</string>
+ </property>
+ <vbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>11</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout6</cstring>
+ </property>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QCheckBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>chkAlarmPreset</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Alarm Preset</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QSpinBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>spinPreset</cstring>
+ </property>
+ <property stdset="1">
+ <name>enabled</name>
+ <bool>false</bool>
+ </property>
+ <property stdset="1">
+ <name>suffix</name>
+ <string> minutes</string>
+ </property>
+ <property stdset="1">
+ <name>maxValue</name>
+ <number>180</number>
+ </property>
+ <property stdset="1">
+ <name>minValue</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>lineStep</name>
+ <number>5</number>
+ </property>
+ <property stdset="1">
+ <name>value</name>
+ <number>5</number>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+ </widget>
+ </vbox>
+</widget>
+<connections>
+ <connection>
+ <sender>chkAlarmPreset</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>spinPreset</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>spinStart</sender>
+ <signal>valueChanged(int)</signal>
+ <receiver>DateBookSettingsBase</receiver>
+ <slot>slot12Hour( int )</slot>
+ </connection>
+ <slot access="public">slotChangeClock( bool )</slot>
+ <slot access="public">slot12Hour( int )</slot>
+</connections>
+</UI>
diff --git a/core/pim/datebook/datebookweek.cpp b/core/pim/datebook/datebookweek.cpp
new file mode 100644
index 0000000..e9fcc39
--- a/dev/null
+++ b/core/pim/datebook/datebookweek.cpp
@@ -0,0 +1,687 @@
+/**********************************************************************
+** Copyright (C) 2000 Trolltech AS. All rights reserved.
+**
+** This file is part of Qtopia Environment.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info@trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+#include "datebookweek.h"
+#include "datebookweekheaderimpl.h"
+
+#include <qpe/calendar.h>
+#include <qpe/datebookdb.h>
+#include <qpe/event.h>
+#include <qpe/qpeapplication.h>
+#include <qpe/timestring.h>
+
+#include <qdatetime.h>
+#include <qheader.h>
+#include <qlabel.h>
+#include <qlayout.h>
+#include <qpainter.h>
+#include <qpopupmenu.h>
+#include <qtimer.h>
+#include <qspinbox.h>
+#include <qstyle.h>
+
+//-----------------------------------------------------------------
+
+
+DateBookWeekItem::DateBookWeekItem( const EffectiveEvent e )
+ : ev( e )
+{
+ // with the current implementation change the color for all day events
+ if ( ev.event().type() == Event::AllDay && !ev.event().hasAlarm() ) {
+ c = Qt::green;
+ } else {
+ c = ev.event().hasAlarm() ? Qt::red : Qt::blue;
+ }
+}
+
+void DateBookWeekItem::setGeometry( int x, int y, int w, int h )
+{
+ r.setRect( x, y, w, h );
+}
+
+
+//------------------=---------------------------------------------
+
+DateBookWeekView::DateBookWeekView( bool ap, bool startOnMonday,
+ QWidget *parent, const char *name )
+ : QScrollView( parent, name ), ampm( ap ), bOnMonday( startOnMonday ),
+ showingEvent( false )
+{
+ items.setAutoDelete( true );
+
+ viewport()->setBackgroundMode( PaletteBase );
+
+ header = new QHeader( this );
+ header->addLabel( "" );
+
+ header->setMovingEnabled( false );
+ header->setResizeEnabled( false );
+ header->setClickEnabled( false, 0 );
+ initNames();
+
+
+ connect( header, SIGNAL(clicked(int)), this, SIGNAL(showDay(int)) );
+
+ QObject::connect(qApp, SIGNAL(clockChanged(bool)),
+ this, SLOT(slotChangeClock(bool)));
+
+ QFontMetrics fm( font() );
+ rowHeight = fm.height()+2;
+
+ resizeContents( width(), 24*rowHeight );
+}
+
+void DateBookWeekView::initNames()
+{
+ static bool bFirst = true;
+ if ( bFirst ) {
+ if ( bOnMonday ) {
+ header->addLabel( tr("M", "Monday" ) );
+ header->addLabel( tr("T", "Tuesday") );
+ header->addLabel( tr("W", "Wednesday" ) );
+ header->addLabel( tr("T", "Thursday" ) );
+ header->addLabel( tr("F", "Friday" ) );
+ header->addLabel( tr("S", "Saturday" ) );
+ header->addLabel( tr("S", "Sunday" ) );
+ } else {
+ header->addLabel( tr("S", "Sunday" ) );
+ header->addLabel( tr("M", "Monday") );
+ header->addLabel( tr("T", "Tuesday") );
+ header->addLabel( tr("W", "Wednesday" ) );
+ header->addLabel( tr("T", "Thursday" ) );
+ header->addLabel( tr("F", "Friday" ) );
+ header->addLabel( tr("S", "Saturday" ) );
+ }
+ bFirst = false;
+ } else {
+ // we are change things...
+ if ( bOnMonday ) {
+ header->setLabel( 1, tr("M", "Monday") );
+ header->setLabel( 2, tr("T", "Tuesday") );
+ header->setLabel( 3, tr("W", "Wednesday" ) );
+ header->setLabel( 4, tr("T", "Thursday" ) );
+ header->setLabel( 5, tr("F", "Friday" ) );
+ header->setLabel( 6, tr("S", "Saturday" ) );
+ header->setLabel( 7, tr("S", "Sunday" ) );
+ } else {
+ header->setLabel( 1, tr("S", "Sunday" ) );
+ header->setLabel( 2, tr("M", "Monday") );
+ header->setLabel( 3, tr("T", "Tuesday") );
+ header->setLabel( 4, tr("W", "Wednesday" ) );
+ header->setLabel( 5, tr("T", "Thursday" ) );
+ header->setLabel( 6, tr("F", "Friday" ) );
+ header->setLabel( 7, tr("S", "Saturday" ) );
+ }
+ }
+}
+
+
+
+void DateBookWeekView::showEvents( QValueList<EffectiveEvent> &ev )
+{
+ items.clear();
+ QValueListIterator<EffectiveEvent> it;
+ for ( it = ev.begin(); it != ev.end(); ++it ) {
+ DateBookWeekItem *i = new DateBookWeekItem( *it );
+ positionItem( i );
+ items.append( i );
+ }
+ viewport()->update();
+}
+
+void DateBookWeekView::moveToHour( int h )
+{
+ int offset = h*rowHeight;
+ setContentsPos( 0, offset );
+}
+
+void DateBookWeekView::keyPressEvent( QKeyEvent *e )
+{
+ e->ignore();
+}
+
+void DateBookWeekView::slotChangeClock( bool c )
+{
+ ampm = c;
+ viewport()->update();
+}
+
+static inline int db_round30min( int m )
+{
+ if ( m < 15 )
+ m = 0;
+ else if ( m < 45 )
+ m = 1;
+ else
+ m = 2;
+
+ return m;
+}
+
+void DateBookWeekView::alterDay( int day )
+{
+ if ( !bOnMonday ) {
+ day--;
+ }
+ emit showDay( day );
+}
+
+void DateBookWeekView::positionItem( DateBookWeekItem *i )
+{
+ const int Width = 8;
+ const EffectiveEvent ev = i->event();
+
+ // 30 minute intervals
+ int y = ev.start().hour() * 2;
+ y += db_round30min( ev.start().minute() );
+ if ( y > 47 )
+ y = 47;
+ y = y * rowHeight / 2;
+
+ int h;
+ if ( ev.event().type() == Event::AllDay ) {
+ h = 48;
+ y = 0;
+ } else {
+ h = ( ev.end().hour() - ev.start().hour() ) * 2;
+ h += db_round30min( ev.end().minute() - ev.start().minute() );
+ if ( h < 1 ) h = 1;
+ }
+ h = h * rowHeight / 2;
+
+ int dow = ev.date().dayOfWeek();
+ if ( !bOnMonday ) {
+ if ( dow == 7 )
+ dow = 1;
+ else
+ dow++;
+ }
+ int x = header->sectionPos( dow ) - 1;
+ int xlim = header->sectionPos( dow ) + header->sectionSize( dow );
+ DateBookWeekItem *isect = 0;
+ do {
+ i->setGeometry( x, y, Width, h );
+ isect = intersects( i );
+ x += Width - 1;
+ } while ( isect && x < xlim );
+}
+
+DateBookWeekItem *DateBookWeekView::intersects( const DateBookWeekItem *item )
+{
+ QRect geom = item->geometry();
+
+ // We allow the edges to overlap
+ geom.moveBy( 1, 1 );
+ geom.setSize( geom.size()-QSize(2,2) );
+
+ QListIterator<DateBookWeekItem> it(items);
+ for ( ; it.current(); ++it ) {
+ DateBookWeekItem *i = it.current();
+ if ( i != item ) {
+ if ( i->geometry().intersects( geom ) ) {
+ return i;
+ }
+ }
+ }
+
+ return 0;
+}
+
+void DateBookWeekView::contentsMousePressEvent( QMouseEvent *e )
+{
+ QListIterator<DateBookWeekItem> it(items);
+ for ( ; it.current(); ++it ) {
+ DateBookWeekItem *i = it.current();
+ if ( i->geometry().contains( e->pos() ) ) {
+ showingEvent = true;
+ emit signalShowEvent( i->event() );
+ break;
+ }
+ }
+}
+
+void DateBookWeekView::contentsMouseReleaseEvent( QMouseEvent *e )
+{
+ if ( showingEvent ) {
+ showingEvent = false;
+ emit signalHideEvent();
+ } else {
+ int d = header->sectionAt( e->pos().x() );
+ if ( d > 0 ) {
+// if ( !bOnMonday )
+// d--;
+ emit showDay( d );
+ }
+ }
+}
+
+void DateBookWeekView::drawContents( QPainter *p, int cx, int cy, int cw, int ch )
+{
+ QRect ur( cx, cy, cw, ch );
+ p->setPen( lightGray );
+ for ( int i = 1; i <= 7; i++ )
+ p->drawLine( header->sectionPos(i)-2, cy, header->sectionPos(i)-2, cy+ch );
+
+ p->setPen( black );
+ for ( int t = 0; t < 24; t++ ) {
+ int y = t*rowHeight;
+ if ( QRect( 1, y, 20, rowHeight ).intersects( ur ) ) {
+ QString s;
+ if ( ampm ) {
+ if ( t == 0 )
+ s = QString::number( 12 );
+ else if ( t == 12 )
+ s = QString::number(12) + tr( "p" );
+ else if ( t > 12 ) {
+ if ( t - 12 < 10 )
+ s = " ";
+ else
+ s = "";
+ s += QString::number( t - 12 ) + tr("p");
+ } else {
+ if ( 12 - t < 3 )
+ s = "";
+ else
+ s = " ";
+ s += QString::number( t );
+ }
+ } else {
+ s = QString::number( t );
+ if ( s.length() == 1 )
+ s.prepend( "0" );
+ }
+ p->drawText( 1, y+p->fontMetrics().ascent()+1, s );
+ }
+ }
+
+ QListIterator<DateBookWeekItem> it(items);
+ for ( ; it.current(); ++it ) {
+ DateBookWeekItem *i = it.current();
+ if ( i->geometry().intersects( ur ) ) {
+ p->setBrush( i->color() );
+ p->drawRect( i->geometry() );
+ }
+ }
+}
+
+void DateBookWeekView::resizeEvent( QResizeEvent *e )
+{
+ const int hourWidth = 20;
+ QScrollView::resizeEvent( e );
+ int avail = width()-qApp->style().scrollBarExtent().width()-1;
+ header->setGeometry( 0, 0, avail, header->sizeHint().height() );
+ setMargins( 0, header->height(), 0, 0 );
+ header->resizeSection( 0, hourWidth );
+ int sw = (avail - hourWidth) / 7;
+ for ( int i = 1; i < 7; i++ )
+ header->resizeSection( i, sw );
+ header->resizeSection( 7, avail - hourWidth - sw*6 );
+}
+
+void DateBookWeekView::setStartOfWeek( bool bStartOnMonday )
+{
+ bOnMonday = bStartOnMonday;
+ initNames();
+}
+
+//-------------------------------------------------------------------
+
+DateBookWeek::DateBookWeek( bool ap, bool startOnMonday, DateBookDB *newDB,
+ QWidget *parent, const char *name )
+ : QWidget( parent, name ),
+ db( newDB ),
+ startTime( 0 ),
+ ampm( ap ),
+ bStartOnMonday( startOnMonday )
+{
+ setFocusPolicy(StrongFocus);
+ QVBoxLayout *vb = new QVBoxLayout( this );
+ header = new DateBookWeekHeader( bStartOnMonday, this );
+ view = new DateBookWeekView( ampm, startOnMonday, this );
+ vb->addWidget( header );
+ vb->addWidget( view );
+
+ lblDesc = new QLabel( this, "event label" );
+ lblDesc->setFrameStyle( QFrame::Plain | QFrame::Box );
+ lblDesc->setBackgroundColor( yellow );
+ lblDesc->hide();
+
+ tHide = new QTimer( this );
+
+ connect( view, SIGNAL( showDay( int ) ),
+ this, SLOT( showDay( int ) ) );
+ connect( view, SIGNAL(signalShowEvent(const EffectiveEvent&)),
+ this, SLOT(slotShowEvent(const EffectiveEvent&)) );
+ connect( view, SIGNAL(signalHideEvent()),
+ this, SLOT(slotHideEvent()) );
+ connect( header, SIGNAL( dateChanged( int, int ) ),
+ this, SLOT( dateChanged( int, int ) ) );
+ connect( tHide, SIGNAL( timeout() ),
+ lblDesc, SLOT( hide() ) );
+ connect( header->spinYear, SIGNAL(valueChanged(int)),
+ this, SLOT(slotYearChanged(int)) );
+ connect( qApp, SIGNAL(weekChanged(bool)),
+ this, SLOT(slotWeekChanged(bool)) );
+ connect( qApp, SIGNAL(clockChanged(bool)),
+ this, SLOT(slotClockChanged(bool)));
+ setDate(QDate::currentDate());
+
+}
+
+void DateBookWeek::keyPressEvent(QKeyEvent *e)
+{
+ switch(e->key()) {
+ case Key_Up:
+ view->scrollBy(0, -20);
+ break;
+ case Key_Down:
+ view->scrollBy(0, 20);
+ break;
+ case Key_Left:
+ setDate(date().addDays(-7));
+ break;
+ case Key_Right:
+ setDate(date().addDays(7));
+ break;
+ default:
+ e->ignore();
+ }
+}
+
+void DateBookWeek::showDay( int day )
+{
+ QDate d;
+ d = dateFromWeek( _week, year, bStartOnMonday );
+ day--;
+ d = d.addDays( day );
+ emit showDate( d.year(), d.month(), d.day() );
+}
+
+void DateBookWeek::setDate( int y, int m, int d )
+{
+ QDate date;
+ date.setYMD( y, m, d );
+ setDate(QDate(y, m, d));
+}
+
+void DateBookWeek::setDate(QDate date)
+{
+ dow = date.dayOfWeek();
+ int w, y;
+ calcWeek( date, w, y, bStartOnMonday );
+ header->setDate( y, w );
+}
+
+void DateBookWeek::dateChanged( int y, int w )
+{
+ year = y;
+ _week = w;
+ getEvents();
+}
+
+QDate DateBookWeek::date() const
+{
+ QDate d;
+ d = dateFromWeek( _week - 1, year, bStartOnMonday );
+ if ( bStartOnMonday )
+ d = d.addDays( 7 + dow - 1 );
+ else {
+ if ( dow == 7 )
+ d = d.addDays( dow );
+ else
+ d = d.addDays( 7 + dow );
+ }
+ return d;
+}
+
+void DateBookWeek::getEvents()
+{
+ QDate startWeek = weekDate();
+
+ QDate endWeek = startWeek.addDays( 6 );
+ QValueList<EffectiveEvent> eventList = db->getEffectiveEvents(startWeek,
+ endWeek);
+ view->showEvents( eventList );
+ view->moveToHour( startTime );
+}
+
+void DateBookWeek::slotShowEvent( const EffectiveEvent &ev )
+{
+ if ( tHide->isActive() )
+ tHide->stop();
+
+ // why would someone use "<"? Oh well, fix it up...
+ // I wonder what other things may be messed up...
+ QString strDesc = ev.description();
+ int where = strDesc.find( "<" );
+ while ( where != -1 ) {
+ strDesc.remove( where, 1 );
+ strDesc.insert( where, "&#60;" );
+ where = strDesc.find( "<", where );
+ }
+
+ QString strCat;
+ // ### FIX later...
+// QString strCat = ev.category();
+// where = strCat.find( "<" );
+// while ( where != -1 ) {
+// strCat.remove( where, 1 );
+// strCat.insert( where, "&#60;" );
+// where = strCat.find( "<", where );
+// }
+
+ QString strNote = ev.notes();
+ where = strNote.find( "<" );
+ while ( where != -1 ) {
+ strNote.remove( where, 1 );
+ strNote.insert( where, "&#60;" );
+ where = strNote.find( "<", where );
+ }
+
+ QString str = "<b>" + strDesc + "</b><br>" + "<i>"
+ + strCat + "</i>"
+ + "<br>" + TimeString::longDateString( ev.date() )
+ + "<br><b>" + QObject::tr("Start") + "</b>: ";
+
+ if ( ev.startDate() != ev.date() ) {
+ // multi-day event. Show start date
+ str += TimeString::longDateString( ev.startDate() );
+ } else {
+ // Show start time.
+ str += TimeString::timeString(ev.start(), ampm, FALSE );
+ }
+
+ str += "<br><b>" + QObject::tr("End") + "</b>: ";
+ if ( ev.endDate() != ev.date() ) {
+ // multi-day event. Show end date
+ str += TimeString::longDateString( ev.endDate() );
+ } else {
+ // Show end time.
+ str += TimeString::timeString( ev.end(), ampm, FALSE );
+ }
+ str += "<br><br>" + strNote;
+
+ lblDesc->setText( str );
+ lblDesc->resize( lblDesc->sizeHint() );
+ // move the label so it is "centerd" horizontally...
+ lblDesc->move( QMAX(0,(width() - lblDesc->width()) / 2), 0 );
+ lblDesc->show();
+}
+
+void DateBookWeek::slotHideEvent()
+{
+ tHide->start( 2000, true );
+}
+
+void DateBookWeek::setStartViewTime( int startHere )
+{
+ startTime = startHere;
+ view->moveToHour( startTime );
+}
+
+int DateBookWeek::startViewTime() const
+{
+ return startTime;
+}
+
+void DateBookWeek::redraw()
+{
+ getEvents();
+}
+
+void DateBookWeek::slotYearChanged( int y )
+{
+ int totWeek;
+ QDate d( y, 12, 31 );
+ int throwAway;
+ calcWeek( d, totWeek, throwAway, bStartOnMonday );
+ while ( totWeek == 1 ) {
+ d = d.addDays( -1 );
+ calcWeek( d, totWeek, throwAway, bStartOnMonday );
+ }
+ if ( totWeek != totalWeeks() )
+ setTotalWeeks( totWeek );
+}
+
+
+void DateBookWeek::setTotalWeeks( int numWeeks )
+{
+ header->spinWeek->setMaxValue( numWeeks );
+}
+
+int DateBookWeek::totalWeeks() const
+{
+ return header->spinWeek->maxValue();
+}
+
+void DateBookWeek::slotWeekChanged( bool onMonday )
+{
+ bStartOnMonday = onMonday;
+ view->setStartOfWeek( bStartOnMonday );
+ header->setStartOfWeek( bStartOnMonday );
+ redraw();
+}
+
+void DateBookWeek::slotClockChanged( bool ap )
+{
+ ampm = ap;
+}
+
+// return the date at the beginning of the week...
+QDate DateBookWeek::weekDate() const
+{
+ return dateFromWeek( _week, year, bStartOnMonday );
+}
+
+// this used to only be needed by datebook.cpp, but now we need it inside
+// week view since
+// we need to be able to figure out our total number of weeks on the fly...
+// this is probably the best place to put it..
+
+// For Weeks that start on Monday... (EASY!)
+// At the moment we will use ISO 8601 method for computing
+// the week. Granted, other countries use other methods,
+// bet we aren't doing any Locale stuff at the moment. So,
+// this should pass. This Algorithim is public domain and
+// available at:
+// http://personal.ecu.edu/mccartyr/ISOwdALG.txt
+// the week number is return, and the year number is returned in year
+// for Instance 2001/12/31 is actually the first week in 2002.
+// There is a more mathematical definition, but I will implement it when
+// we are pass our deadline.
+
+// For Weeks that start on Sunday... (ahh... home rolled)
+// okay, if Jan 1 is on Friday or Saturday,
+// it will go to the pervious
+// week...
+
+bool calcWeek( const QDate &d, int &week, int &year,
+ bool startOnMonday = false )
+{
+ int weekNumber;
+ int yearNumber;
+
+ // remove a pesky warning, (Optimizations on g++)
+ weekNumber = -1;
+ int jan1WeekDay = QDate(d.year(), 1, 1).dayOfWeek();
+ int dayOfWeek = d.dayOfWeek();
+
+ if ( !d.isValid() )
+ return false;
+
+ if ( startOnMonday ) {
+ // find the Jan1Weekday;
+ if ( d.dayOfYear() <= ( 8 - jan1WeekDay) && jan1WeekDay > 4 ) {
+ yearNumber = d.year() - 1;
+ if ( jan1WeekDay == 5 || ( jan1WeekDay == 6 && QDate::leapYear(yearNumber) ) )
+ weekNumber = 53;
+ else
+ weekNumber = 52;
+ } else
+ yearNumber = d.year();
+ if ( yearNumber == d.year() ) {
+ int totalDays = 365;
+ if ( QDate::leapYear(yearNumber) )
+ totalDays++;
+ if ( ((totalDays - d.dayOfYear()) < (4 - dayOfWeek) )
+ || (jan1WeekDay == 7) && (totalDays - d.dayOfYear()) < 3) {
+ yearNumber++;
+ weekNumber = 1;
+ }
+ }
+ if ( yearNumber == d.year() ) {
+ int j = d.dayOfYear() + (7 - dayOfWeek) + ( jan1WeekDay - 1 );
+ weekNumber = j / 7;
+ if ( jan1WeekDay > 4 )
+ weekNumber--;
+ }
+ } else {
+ // it's better to keep these cases separate...
+ if ( d.dayOfYear() <= (7 - jan1WeekDay) && jan1WeekDay > 4
+ && jan1WeekDay != 7 ) {
+ yearNumber = d.year() - 1;
+ if ( jan1WeekDay == 6
+ || (jan1WeekDay == 7 && QDate::leapYear(yearNumber) ) ) {
+ weekNumber = 53;
+ }else
+ weekNumber = 52;
+ } else
+ yearNumber = d.year();
+ if ( yearNumber == d.year() ) {
+ int totalDays = 365;
+ if ( QDate::leapYear( yearNumber ) )
+ totalDays++;
+ if ( ((totalDays - d.dayOfYear()) < (4 - dayOfWeek % 7)) ) {
+ yearNumber++;
+ weekNumber = 1;
+ }
+ }
+ if ( yearNumber == d.year() ) {
+ int j = d.dayOfYear() + (7 - dayOfWeek % 7) + ( jan1WeekDay - 1 );
+ weekNumber = j / 7;
+ if ( jan1WeekDay > 4 ) {
+ weekNumber--;
+ }
+ }
+ }
+ year = yearNumber;
+ week = weekNumber;
+ return true;
+}
+
diff --git a/core/pim/datebook/datebookweek.h b/core/pim/datebook/datebookweek.h
new file mode 100644
index 0000000..6e675f1
--- a/dev/null
+++ b/core/pim/datebook/datebookweek.h
@@ -0,0 +1,152 @@
+/**********************************************************************
+** Copyright (C) 2000 Trolltech AS. All rights reserved.
+**
+** This file is part of Qtopia Environment.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info@trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+#ifndef DATEBOOKWEEK
+#define DATEBOOKWEEK
+
+#include <qpe/event.h>
+
+#include <qlist.h>
+#include <qscrollview.h>
+#include <qstring.h>
+#include <qvaluelist.h>
+
+class DateBookDB;
+class DateBookWeekHeader;
+class QDate;
+class QLabel;
+class QResizeEvent;
+class QSpinBox;
+class QTimer;
+class QHeader;
+
+class DateBookWeekItem
+{
+public:
+ DateBookWeekItem( const EffectiveEvent e );
+
+ void setGeometry( int x, int y, int w, int h );
+ QRect geometry() const { return r; }
+
+ const QColor &color() const { return c; }
+ const EffectiveEvent event() const { return ev; }
+
+private:
+ const EffectiveEvent ev;
+ QRect r;
+ QColor c;
+};
+
+class DateBookWeekView : public QScrollView
+{
+ Q_OBJECT
+public:
+ DateBookWeekView( bool ampm, bool weekOnMonday, QWidget *parent = 0,
+ const char *name = 0 );
+
+ bool whichClock() const;
+ void showEvents( QValueList<EffectiveEvent> &ev );
+ void moveToHour( int h );
+ void setStartOfWeek( bool bOnMonday );
+
+signals:
+ void showDay( int d );
+ void signalShowEvent( const EffectiveEvent & );
+ void signalHideEvent();
+
+protected slots:
+ void keyPressEvent(QKeyEvent *);
+
+private slots:
+ void slotChangeClock( bool );
+ void alterDay( int );
+
+private:
+ void positionItem( DateBookWeekItem *i );
+ DateBookWeekItem *intersects( const DateBookWeekItem * );
+ void drawContents( QPainter *p, int cx, int cy, int cw, int ch );
+ void contentsMousePressEvent( QMouseEvent * );
+ void contentsMouseReleaseEvent( QMouseEvent * );
+ void resizeEvent( QResizeEvent * );
+ void initNames();
+
+private:
+ bool ampm;
+ bool bOnMonday;
+ QHeader *header;
+ QList<DateBookWeekItem> items;
+ int rowHeight;
+ bool showingEvent;
+};
+
+class DateBookWeek : public QWidget
+{
+ Q_OBJECT
+
+public:
+ DateBookWeek( bool ampm, bool weekOnMonday, DateBookDB *newDB,
+ QWidget *parent = 0, const char *name = 0 );
+ void setDate( int y, int m, int d );
+ void setDate( QDate d );
+ QDate date() const;
+ DateBookWeekView *weekView() const { return view; }
+ void setStartViewTime( int startHere );
+ int startViewTime() const;
+ int week() const { return _week; };
+ void setTotalWeeks( int totalWeeks );
+ int totalWeeks() const;
+ QDate weekDate() const;
+
+public slots:
+ void redraw();
+ void slotWeekChanged( bool bStartOnMonday );
+ void slotClockChanged( bool a );
+
+signals:
+ void showDate( int y, int m, int d );
+
+protected slots:
+ void keyPressEvent(QKeyEvent *);
+
+private slots:
+ void showDay( int day );
+ void dateChanged( int y, int w );
+ void slotShowEvent( const EffectiveEvent & );
+ void slotHideEvent();
+ void slotYearChanged( int );
+
+private:
+ void getEvents();
+ int year;
+ int _week;
+ int dow;
+ DateBookWeekHeader *header;
+ DateBookWeekView *view;
+ DateBookDB *db;
+ QLabel *lblDesc;
+ QTimer *tHide;
+ int startTime;
+ bool ampm;
+ bool bStartOnMonday;
+};
+
+
+bool calcWeek( const QDate &d, int &week, int &year,
+ bool startOnMonday = false );
+#endif
diff --git a/core/pim/datebook/datebookweekheader.ui b/core/pim/datebook/datebookweekheader.ui
new file mode 100644
index 0000000..dd6a5b1
--- a/dev/null
+++ b/core/pim/datebook/datebookweekheader.ui
@@ -0,0 +1,167 @@
+<!DOCTYPE UI><UI>
+<class>DateBookWeekHeaderBase</class>
+<comment>*********************************************************************
+** Copyright (C) 2000 Trolltech AS. All rights reserved.
+**
+** This file is part of Qtopia Environment.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info@trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+*********************************************************************</comment>
+<widget>
+ <class>QWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>DateBookWeekHeaderBase</cstring>
+ </property>
+ <property stdset="1">
+ <name>geometry</name>
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>281</width>
+ <height>30</height>
+ </rect>
+ </property>
+ <property stdset="1">
+ <name>caption</name>
+ <string>Form1</string>
+ </property>
+ <property>
+ <name>layoutMargin</name>
+ </property>
+ <property>
+ <name>layoutSpacing</name>
+ </property>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QSpinBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>spinYear</cstring>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ </sizepolicy>
+ </property>
+ <property stdset="1">
+ <name>prefix</name>
+ <string>Y: </string>
+ </property>
+ <property stdset="1">
+ <name>maxValue</name>
+ <number>2037</number>
+ </property>
+ <property stdset="1">
+ <name>minValue</name>
+ <number>1970</number>
+ </property>
+ <property stdset="1">
+ <name>value</name>
+ <number>2002</number>
+ </property>
+ </widget>
+ <widget>
+ <class>QSpinBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>spinWeek</cstring>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ </sizepolicy>
+ </property>
+ <property stdset="1">
+ <name>prefix</name>
+ <string>W: </string>
+ </property>
+ <property stdset="1">
+ <name>maxValue</name>
+ <number>52</number>
+ </property>
+ <property stdset="1">
+ <name>minValue</name>
+ <number>1</number>
+ </property>
+ <property stdset="1">
+ <name>value</name>
+ <number>1</number>
+ </property>
+ </widget>
+ <widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>labelDate</cstring>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>1</vsizetype>
+ </sizepolicy>
+ </property>
+ <property stdset="1">
+ <name>font</name>
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>00. Jan-00. Jan</string>
+ </property>
+ <property stdset="1">
+ <name>alignment</name>
+ <set>AlignCenter</set>
+ </property>
+ <property>
+ <name>hAlign</name>
+ </property>
+ </widget>
+ </hbox>
+</widget>
+<connections>
+ <connection>
+ <sender>spinYear</sender>
+ <signal>valueChanged(int)</signal>
+ <receiver>DateBookWeekHeaderBase</receiver>
+ <slot>yearChanged( int )</slot>
+ </connection>
+ <connection>
+ <sender>spinWeek</sender>
+ <signal>valueChanged(int)</signal>
+ <receiver>DateBookWeekHeaderBase</receiver>
+ <slot>weekChanged( int )</slot>
+ </connection>
+ <slot access="public">yearChanged( int )</slot>
+ <slot access="public">nextWeek()</slot>
+ <slot access="public">prevWeek()</slot>
+ <slot access="public">weekChanged( int )</slot>
+</connections>
+</UI>
diff --git a/core/pim/datebook/datebookweekheaderimpl.cpp b/core/pim/datebook/datebookweekheaderimpl.cpp
new file mode 100644
index 0000000..e7c7208
--- a/dev/null
+++ b/core/pim/datebook/datebookweekheaderimpl.cpp
@@ -0,0 +1,126 @@
+/**********************************************************************
+** Copyright (C) 2000 Trolltech AS. All rights reserved.
+**
+** This file is part of Qtopia Environment.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info@trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+#include "datebookweekheaderimpl.h"
+#include <qlabel.h>
+#include <qspinbox.h>
+#include <qdatetime.h>
+
+/*
+ * Constructs a DateBookWeekHeader which is a child of 'parent', with the
+ * name 'name' and widget flags set to 'f'
+ */
+DateBookWeekHeader::DateBookWeekHeader( bool startOnMonday, QWidget* parent,
+ const char* name, WFlags fl )
+ : DateBookWeekHeaderBase( parent, name, fl ),
+ bStartOnMonday( startOnMonday )
+{
+ setBackgroundMode( PaletteButton );
+ labelDate->setBackgroundMode( PaletteButton );
+}
+
+/*
+ * Destroys the object and frees any allocated resources
+ */
+DateBookWeekHeader::~DateBookWeekHeader()
+{
+ // no need to delete child widgets, Qt does it all for us
+}
+
+/*
+ * public slot
+ */
+void DateBookWeekHeader::yearChanged( int y )
+{
+ setDate( y, week );
+}
+/*
+ * public slot
+ */
+void DateBookWeekHeader::nextWeek()
+{
+ if ( week < 52 )
+ week++;
+ setDate( year, week );
+}
+/*
+ * public slot
+ */
+void DateBookWeekHeader::prevWeek()
+{
+ if ( week > 1 )
+ week--;
+ setDate( year, week );
+}
+/*
+ * public slot
+ */
+void DateBookWeekHeader::weekChanged( int w )
+{
+ setDate( year, w );
+}
+
+void DateBookWeekHeader::setDate( int y, int w )
+{
+ year = y;
+ week = w;
+ spinYear->setValue( y );
+ spinWeek->setValue( w );
+
+ QDate d = dateFromWeek( week, year, bStartOnMonday );
+
+ QString s = QString::number( d.day() ) + ". " + d.monthName( d.month() )
+ + "-";
+ d = d.addDays( 6 );
+ s += QString::number( d.day() ) + ". " + d.monthName( d.month() );
+ labelDate->setText( s );
+
+ emit dateChanged( y, w );
+}
+
+void DateBookWeekHeader::setStartOfWeek( bool onMonday )
+{
+ bStartOnMonday = onMonday;
+ setDate( year, week );
+}
+
+// dateFromWeek
+// compute the date from the week in the year
+
+QDate dateFromWeek( int week, int year, bool startOnMonday )
+{
+ QDate d;
+ d.setYMD( year, 1, 1 );
+ int dayOfWeek = d.dayOfWeek();
+ if ( startOnMonday ) {
+ if ( dayOfWeek <= 4 ) {
+ d = d.addDays( ( week - 1 ) * 7 - dayOfWeek + 1 );
+ } else {
+ d = d.addDays( (week) * 7 - dayOfWeek + 1 );
+ }
+ } else {
+ if ( dayOfWeek <= 4 || dayOfWeek == 7) {
+ d = d.addDays( ( week - 1 ) * 7 - dayOfWeek % 7 );
+ } else {
+ d = d.addDays( ( week ) * 7 - dayOfWeek % 7 );
+ }
+ }
+ return d;
+}
+
diff --git a/core/pim/datebook/datebookweekheaderimpl.h b/core/pim/datebook/datebookweekheaderimpl.h
new file mode 100644
index 0000000..2abef46
--- a/dev/null
+++ b/core/pim/datebook/datebookweekheaderimpl.h
@@ -0,0 +1,62 @@
+/**********************************************************************
+** Copyright (C) 2000 Trolltech AS. All rights reserved.
+**
+** This file is part of Qtopia Environment.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info@trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+#ifndef DATEBOOKDAYHEADER_H
+#define DATEBOOKDAYHEADER_H
+#include <qdatetime.h>
+#include "datebookweekheader.h"
+
+
+class DateBookWeekHeader : public DateBookWeekHeaderBase
+{
+ Q_OBJECT
+
+public:
+ DateBookWeekHeader( bool startOnMonday, QWidget* parent = 0,
+ const char* name = 0, WFlags fl = 0 );
+ ~DateBookWeekHeader();
+
+ void setDate( int y, int w );
+ void setStartOfWeek( bool onMonday );
+
+signals:
+ void dateChanged( int y, int w );
+
+public slots:
+ void yearChanged( int );
+ void nextWeek();
+ void prevWeek();
+ void weekChanged( int );
+
+protected slots:
+ void keyPressEvent(QKeyEvent *e)
+ {
+ e->ignore();
+ }
+
+private:
+ int year,
+ week;
+ bool bStartOnMonday;
+
+};
+
+QDate dateFromWeek( int week, int year, bool startOnMonday );
+
+#endif // DATEBOOKDAYHEADER_H
diff --git a/core/pim/datebook/dateentry.ui b/core/pim/datebook/dateentry.ui
new file mode 100644
index 0000000..0c363a4
--- a/dev/null
+++ b/core/pim/datebook/dateentry.ui
@@ -0,0 +1,1095 @@
+<!DOCTYPE UI><UI>
+<class>DateEntryBase</class>
+<comment>*********************************************************************
+** Copyright (C) 2000 Trolltech AS. All rights reserved.
+**
+** This file is part of Qtopia Environment.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info@trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+** $Id$
+**
+*********************************************************************</comment>
+<widget>
+ <class>QWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>DateEntryBase</cstring>
+ </property>
+ <property stdset="1">
+ <name>geometry</name>
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>242</width>
+ <height>339</height>
+ </rect>
+ </property>
+ <property stdset="1">
+ <name>caption</name>
+ <string>New Event</string>
+ </property>
+ <property>
+ <name>layoutMargin</name>
+ </property>
+ <property>
+ <name>layoutSpacing</name>
+ </property>
+ <grid>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>0</number>
+ </property>
+ <widget row="1" column="0" >
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TextLabel2</cstring>
+ </property>
+ <property stdset="1">
+ <name>frameShape</name>
+ <enum>MShape</enum>
+ </property>
+ <property stdset="1">
+ <name>frameShadow</name>
+ <enum>MShadow</enum>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Location</string>
+ </property>
+ </widget>
+ <widget row="2" column="0" >
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TextLabel2_2</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Category</string>
+ </property>
+ <property>
+ <name>buddy</name>
+ <cstring>comboPriority</cstring>
+ </property>
+ </widget>
+ <widget row="0" column="1" rowspan="1" colspan="3" >
+ <class>QComboBox</class>
+ <item>
+ <property>
+ <name>text</name>
+ <string>(None)</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>Meeting</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>Lunch</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>Dinner</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>Travel</string>
+ </property>
+ </item>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>comboDescription</cstring>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ </sizepolicy>
+ </property>
+ <property stdset="1">
+ <name>editable</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>currentItem</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>duplicatesEnabled</name>
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget row="0" column="0" >
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TextLabel1</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Description:</string>
+ </property>
+ </widget>
+ <widget row="1" column="1" rowspan="1" colspan="3" >
+ <class>QComboBox</class>
+ <item>
+ <property>
+ <name>text</name>
+ <string>(Unknown)</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>Office</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>Home</string>
+ </property>
+ </item>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>comboLocation</cstring>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ </sizepolicy>
+ </property>
+ <property stdset="1">
+ <name>editable</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>currentItem</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>duplicatesEnabled</name>
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget row="2" column="1" rowspan="1" colspan="3" >
+ <class>CategorySelect</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>comboCategory</cstring>
+ </property>
+ </widget>
+ <widget row="3" column="0" >
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TextLabel3</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Start</string>
+ </property>
+ </widget>
+ <widget row="3" column="1" >
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>buttonStart</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Jan 02 00</string>
+ </property>
+ </widget>
+ <widget row="3" column="2" rowspan="1" colspan="2" >
+ <class>QComboBox</class>
+ <item>
+ <property>
+ <name>text</name>
+ <string>00:00</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>00:30</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>01:00</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>01:30</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>02:00</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>02:30</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>03:00</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>03:30</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>04:00</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>04:30</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>05:00</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>05:30</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>06:00</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>06:30</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>07:00</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>07:30</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>08:00</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>08:30</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>09:00</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>09:30</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>10:00</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>10:30</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>11:00</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>11:30</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>12:00</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>12:30</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>13:00</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>13:30</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>14:00</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>14:30</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>15:00</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>15:30</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>16:00</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>16:30</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>17:00</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>17:30</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>18:00</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>18:30</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>19:00</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>19:30</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>20:00</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>20:30</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>21:00</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>21:30</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>22:00</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>22:30</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>23:00</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>23:30</string>
+ </property>
+ </item>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>comboStart</cstring>
+ </property>
+ <property stdset="1">
+ <name>editable</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>duplicatesEnabled</name>
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget row="4" column="1" >
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>buttonEnd</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Jan 02 00</string>
+ </property>
+ </widget>
+ <widget row="4" column="2" rowspan="1" colspan="2" >
+ <class>QComboBox</class>
+ <item>
+ <property>
+ <name>text</name>
+ <string>00:00</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>00:30</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>01:00</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>01:30</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>02:00</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>02:30</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>03:00</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>03:30</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>04:00</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>04:30</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>05:00</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>05:30</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>06:00</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>06:30</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>07:00</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>07:30</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>08:00</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>08:30</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>09:00</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>09:30</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>10:00</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>10:30</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>11:00</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>11:30</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>12:00</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>12:30</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>13:00</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>13:30</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>14:00</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>14:30</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>15:00</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>15:30</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>16:00</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>16:30</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>17:00</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>17:30</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>18:00</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>18:30</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>19:00</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>19:30</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>20:00</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>20:30</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>21:00</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>21:30</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>22:00</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>22:30</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>23:00</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>23:30</string>
+ </property>
+ </item>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>comboEnd</cstring>
+ </property>
+ <property stdset="1">
+ <name>editable</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>duplicatesEnabled</name>
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget row="4" column="0" >
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TextLabel3_2</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>End</string>
+ </property>
+ </widget>
+ <widget row="5" column="0" >
+ <class>QCheckBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>checkAllDay</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>All day</string>
+ </property>
+ </widget>
+ <widget row="6" column="0" >
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TextLabel3_2_2</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Time zone:</string>
+ </property>
+ </widget>
+ <widget row="6" column="1" rowspan="1" colspan="3" >
+ <class>TimeZoneSelector</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>timezone</cstring>
+ </property>
+ </widget>
+ <widget row="7" column="0" >
+ <class>QCheckBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>checkAlarm</cstring>
+ </property>
+ <property stdset="1">
+ <name>enabled</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>autoMask</name>
+ <bool>false</bool>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>&amp;Alarm</string>
+ </property>
+ <property stdset="1">
+ <name>checked</name>
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget row="7" column="1" rowspan="1" colspan="2" >
+ <class>QSpinBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>spinAlarm</cstring>
+ </property>
+ <property stdset="1">
+ <name>enabled</name>
+ <bool>false</bool>
+ </property>
+ <property stdset="1">
+ <name>suffix</name>
+ <string> minutes</string>
+ </property>
+ <property stdset="1">
+ <name>maxValue</name>
+ <number>180</number>
+ </property>
+ <property stdset="1">
+ <name>minValue</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>lineStep</name>
+ <number>5</number>
+ </property>
+ <property stdset="1">
+ <name>value</name>
+ <number>5</number>
+ </property>
+ </widget>
+ <widget row="7" column="3" >
+ <class>QComboBox</class>
+ <item>
+ <property>
+ <name>text</name>
+ <string>Silent</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>Loud</string>
+ </property>
+ </item>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>comboSound</cstring>
+ </property>
+ <property stdset="1">
+ <name>enabled</name>
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget row="8" column="0" >
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>lblRepeat</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Repeat</string>
+ </property>
+ </widget>
+ <widget row="8" column="1" rowspan="1" colspan="3" >
+ <class>QToolButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>cmdRepeat</cstring>
+ </property>
+ <property stdset="1">
+ <name>focusPolicy</name>
+ <enum>TabFocus</enum>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>No Repeat...</string>
+ </property>
+ </widget>
+ <widget row="9" column="0" rowspan="1" colspan="4" >
+ <class>QMultiLineEdit</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>editNote</cstring>
+ </property>
+ </widget>
+ </grid>
+</widget>
+<customwidgets>
+ <customwidget>
+ <class>TimeZoneSelector</class>
+ <header location="global">qpe/tzselect.h</header>
+ <sizehint>
+ <width>21</width>
+ <height>10</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>7</hordata>
+ <verdata>1</verdata>
+ </sizepolicy>
+ <pixmap>image0</pixmap>
+ </customwidget>
+ <customwidget>
+ <class>CategorySelect</class>
+ <header location="global">qpe/categoryselect.h</header>
+ <sizehint>
+ <width>-1</width>
+ <height>-1</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>7</hordata>
+ <verdata>1</verdata>
+ </sizepolicy>
+ <pixmap>image1</pixmap>
+ </customwidget>
+</customwidgets>
+<images>
+ <image>
+ <name>image0</name>
+ <data format="XPM.GZ" length="45">789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523250004143a55a6b2e0026630c4f</data>
+ </image>
+ <image>
+ <name>image1</name>
+ <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data>
+ </image>
+</images>
+<connections>
+ <connection>
+ <sender>checkAlarm</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>spinAlarm</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>comboEnd</sender>
+ <signal>activated(const QString&amp;)</signal>
+ <receiver>DateEntryBase</receiver>
+ <slot>endTimeChanged( const QString &amp; )</slot>
+ </connection>
+ <connection>
+ <sender>cmdRepeat</sender>
+ <signal>clicked()</signal>
+ <receiver>DateEntryBase</receiver>
+ <slot>slotRepeat()</slot>
+ </connection>
+ <connection>
+ <sender>comboStart</sender>
+ <signal>activated(int)</signal>
+ <receiver>DateEntryBase</receiver>
+ <slot>startTimeChanged( int )</slot>
+ </connection>
+ <connection>
+ <sender>checkAllDay</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>comboEnd</receiver>
+ <slot>setDisabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>checkAlarm</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>comboSound</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>checkAllDay</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>comboStart</receiver>
+ <slot>setDisabled(bool)</slot>
+ </connection>
+ <slot access="public">endDateChanged( const QString &amp; )</slot>
+ <slot access="public">endDateChanged( int, int, int )</slot>
+ <slot access="public">endTimeChanged( const QString &amp; )</slot>
+ <slot access="public">slotRepeat()</slot>
+ <slot access="public">slotWait( int )</slot>
+ <slot access="public">startDateChanged( const QString &amp; )</slot>
+ <slot access="public">startDateChanged(int, int, int)</slot>
+ <slot access="public">startTimeChanged( int )</slot>
+ <slot access="public">typeChanged( const QString &amp; )</slot>
+ <slot access="public">tzexecute(void)</slot>
+</connections>
+</UI>
diff --git a/core/pim/datebook/dateentryimpl.cpp b/core/pim/datebook/dateentryimpl.cpp
new file mode 100644
index 0000000..1122f79
--- a/dev/null
+++ b/core/pim/datebook/dateentryimpl.cpp
@@ -0,0 +1,474 @@
+/**********************************************************************
+** Copyright (C) 2000 Trolltech AS. All rights reserved.
+**
+** This file is part of Qtopia Environment.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info@trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include "dateentryimpl.h"
+#include "repeatentry.h"
+
+#include <qpe/qpeapplication.h>
+#include <qpe/categoryselect.h>
+#include <qpe/datebookmonth.h>
+#include <qpe/global.h>
+#include <qpe/timeconversion.h>
+#include <qpe/timestring.h>
+#include <qpe/tzselect.h>
+
+#include <qcheckbox.h>
+#include <qcombobox.h>
+#include <qlayout.h>
+#include <qlineedit.h>
+#include <qmultilineedit.h>
+#include <qpopupmenu.h>
+#include <qscrollview.h>
+#include <qspinbox.h>
+#include <qtoolbutton.h>
+
+#include <stdlib.h>
+
+/*
+ * Constructs a DateEntry which is a child of 'parent', with the
+ * name 'name' and widget flags set to 'f'
+ *
+ * The dialog will by default be modeless, unless you set 'modal' to
+ * TRUE to construct a modal dialog.
+ */
+
+DateEntry::DateEntry( bool startOnMonday, const QDateTime &start,
+ const QDateTime &end, bool whichClock, QWidget* parent,
+ const char* name )
+ : DateEntryBase( parent, name ),
+ ampm( whichClock ),
+ startWeekOnMonday( startOnMonday )
+{
+ init();
+ setDates(start,end);
+}
+
+static void addOrPick( QComboBox* combo, const QString& t )
+{
+ for (int i=0; i<combo->count(); i++) {
+ if ( combo->text(i) == t ) {
+ combo->setCurrentItem(i);
+ return;
+ }
+ }
+ combo->setEditText(t);
+}
+
+DateEntry::DateEntry( bool startOnMonday, const Event &event, bool whichClock,
+ QWidget* parent, const char* name )
+ : DateEntryBase( parent, name ),
+ ampm( whichClock ),
+ startWeekOnMonday( startOnMonday )
+{
+ init();
+ setDates(event.start(),event.end());
+ comboCategory->setCategories( event.categories(), "Calendar", tr("Calendar") );
+ if(!event.description().isEmpty())
+ addOrPick( comboDescription, event.description() );
+ if(!event.location().isEmpty())
+ addOrPick( comboLocation, event.location() );
+ checkAlarm->setChecked( event.hasAlarm() );
+ checkAllDay->setChecked( event.type() == Event::AllDay );
+ if(!event.notes().isEmpty())
+ editNote->setText(event.notes());
+ spinAlarm->setValue(event.alarmTime());
+ if ( event.alarmSound() != Event::Silent )
+ comboSound->setCurrentItem( 1 );
+ if ( event.hasRepeat() ) {
+ rp = event.repeatPattern();
+ cmdRepeat->setText( tr("Repeat...") );
+ }
+ setRepeatLabel();
+}
+
+void DateEntry::setDates( const QDateTime& s, const QDateTime& e )
+{
+ int shour,
+ ehour;
+ QString strStart,
+ strEnd;
+ startDate = s.date();
+ endDate = e.date();
+ startTime = s.time();
+ endTime = e.time();
+ startDateChanged( s.date().year(), s.date().month(), s.date().day() );
+ if ( ampm ) {
+ shour = s.time().hour();
+ ehour = e.time().hour();
+ if ( shour >= 12 ) {
+ if ( shour > 12 )
+ shour -= 12;
+ strStart.sprintf( "%d:%02d PM", shour, s.time().minute() );
+ } else {
+ if ( shour == 0 )
+ shour = 12;
+ strStart.sprintf( "%d:%02d AM", shour, s.time().minute() );
+ }
+ if ( ehour == 24 && e.time().minute() == 0 ) {
+ strEnd = "11:59 PM"; // or "midnight"
+ } else if ( ehour >= 12 ) {
+ if ( ehour > 12 )
+ ehour -= 12;
+ strEnd.sprintf( "%d:%02d PM", ehour, e.time().minute() );
+ } else {
+ if ( ehour == 0 )
+ ehour = 12;
+ strEnd.sprintf( "%d:%02d AM", ehour, e.time().minute() );
+ }
+ } else {
+ strStart.sprintf( "%02d:%02d", s.time().hour(), s.time().minute() );
+ strEnd.sprintf( "%02d:%02d", e.time().hour(), e.time().minute() );
+ }
+ addOrPick(comboStart, strStart );
+ endDateChanged( e.date().year(), e.date().month(), e.date().day() );
+ addOrPick(comboEnd, strEnd );
+}
+
+void DateEntry::init()
+{
+ comboDescription->setInsertionPolicy(QComboBox::AtCurrent);
+ comboLocation->setInsertionPolicy(QComboBox::AtCurrent);
+
+ initCombos();
+ QPopupMenu *m1 = new QPopupMenu( this );
+ startPicker = new DateBookMonth( m1, 0, TRUE );
+ m1->insertItem( startPicker );
+ buttonStart->setPopup( m1 );
+ connect( startPicker, SIGNAL( dateClicked( int, int, int ) ),
+ this, SLOT( startDateChanged( int, int, int ) ) );
+
+ //Let start button change both start and end dates
+ connect( startPicker, SIGNAL( dateClicked( int, int, int ) ),
+ this, SLOT( endDateChanged( int, int, int ) ) );
+ connect( qApp, SIGNAL( clockChanged( bool ) ),
+ this, SLOT( slotChangeClock( bool ) ) );
+ connect( qApp, SIGNAL(weekChanged(bool)),
+ this, SLOT(slotChangeStartOfWeek(bool)) );
+
+ QPopupMenu *m2 = new QPopupMenu( this );
+ endPicker = new DateBookMonth( m2, 0, TRUE );
+ m2->insertItem( endPicker );
+ buttonEnd->setPopup( m2 );
+ connect( endPicker, SIGNAL( dateClicked( int, int, int ) ),
+ this, SLOT( endDateChanged( int, int, int ) ) );
+}
+
+/*
+ * Destroys the object and frees any allocated resources
+ */
+DateEntry::~DateEntry()
+{
+ // no need to delete child widgets, Qt does it all for us
+}
+
+/*
+ * public slot
+ */
+void DateEntry::endDateChanged( int y, int m, int d )
+{
+ endDate.setYMD( y, m, d );
+ if ( endDate < startDate ) {
+ endDate = startDate;
+ }
+
+ buttonEnd->setText( TimeString::shortDate( endDate ) );
+
+ endPicker->setDate( endDate.year(), endDate.month(), endDate.day() );
+}
+
+static QTime parseTime( const QString& s, bool ampm )
+{
+ QTime tmpTime;
+ QStringList l = QStringList::split( ':', s );
+ int hour = l[0].toInt();
+ if ( ampm ) {
+ int i=0;
+ while (i<int(l[1].length()) && l[1][i]>='0' && l[1][i]<='9')
+ i++;
+ QString digits = l[1].left(i);
+ if ( l[1].contains( "PM", FALSE ) ) {
+ if ( hour != 12 )
+ hour += 12;
+ } else {
+ if ( hour == 12 )
+ hour = 0;
+ }
+ l[1] = digits;
+ }
+ int minute = l[1].toInt();
+ if ( minute > 59 )
+ minute = 59;
+ else if ( minute < 0 )
+ minute = 0;
+ if ( hour > 23 ) {
+ hour = 23;
+ minute = 59;
+ } else if ( hour < 0 )
+ hour = 0;
+ tmpTime.setHMS( hour, minute, 0 );
+ return tmpTime;
+}
+
+/*
+ * public slot
+ */
+void DateEntry::endTimeChanged( const QString &s )
+{
+ QTime tmpTime = parseTime(s,ampm);
+ if ( endDate > startDate || tmpTime >= startTime ) {
+ endTime = tmpTime;
+ } else {
+ endTime = startTime;
+ comboEnd->setCurrentItem( comboStart->currentItem() );
+ }
+}
+
+/*
+ * public slot
+ */
+void DateEntry::startDateChanged( int y, int m, int d )
+{
+ QDate prev = startDate;
+ startDate.setYMD( y, m, d );
+ if ( rp.type == Event::Weekly &&
+ startDate.dayOfWeek() != prev.dayOfWeek() ) {
+ // if we change the start of a weekly repeating event
+ // set the repeating day appropriately
+ char mask = 1 << (prev.dayOfWeek()-1);
+ rp.days &= (~mask);
+ rp.days |= 1 << (startDate.dayOfWeek()-1);
+ }
+
+ buttonStart->setText( TimeString::shortDate( startDate ) );
+
+ // our pickers must be reset...
+ startPicker->setDate( y, m, d );
+ endPicker->setDate( y, m, d );
+}
+
+/*
+ * public slot
+ */
+void DateEntry::startTimeChanged( int index )
+{
+ startTime = parseTime(comboStart->text(index),ampm);
+ changeEndCombo( index );
+}
+/*
+ * public slot
+ */
+void DateEntry::typeChanged( const QString &s )
+{
+ bool b = s != "All Day";
+ buttonStart->setEnabled( b );
+ comboStart->setEnabled( b );
+ comboEnd->setEnabled( b );
+}
+/*
+ * public slot
+ */
+void DateEntry::changeEndCombo( int change )
+{
+ if ( change + 2 < comboEnd->count() )
+ change += 2;
+ comboEnd->setCurrentItem( change );
+ endTimeChanged( comboEnd->currentText() );
+}
+
+void DateEntry::slotRepeat()
+{
+ // Work around for compiler Bug..
+ RepeatEntry *e;
+
+ // it is better in my opinion to just grab this from the mother,
+ // since, this dialog doesn't need to keep track of it...
+ if ( rp.type != Event::NoRepeat )
+ e = new RepeatEntry( startWeekOnMonday, rp, startDate, this);
+ else
+ e = new RepeatEntry( startWeekOnMonday, startDate, this );
+
+#if defined(Q_WS_QWS) || defined(_WS_QWS_)
+ e->showMaximized();
+#endif
+ if ( e->exec() ) {
+ rp = e->repeatPattern();
+ setRepeatLabel();
+ }
+}
+
+void DateEntry::slotChangeStartOfWeek( bool onMonday )
+{
+ startWeekOnMonday = onMonday;
+}
+
+Event DateEntry::event()
+{
+ Event ev;
+ Event::SoundTypeChoice st;
+ ev.setDescription( comboDescription->currentText() );
+ ev.setLocation( comboLocation->currentText() );
+ ev.setCategories( comboCategory->currentCategories() );
+ ev.setType( checkAllDay->isChecked() ? Event::AllDay : Event::Normal );
+ if ( startDate > endDate ) {
+ QDate tmp = endDate;
+ endDate = startDate;
+ startDate = tmp;
+ }
+ startTime = parseTime( comboStart->currentText(), ampm );
+ endTime = parseTime( comboEnd->currentText(), ampm );
+ if ( startTime > endTime && endDate == startDate ) {
+ QTime tmp = endTime;
+ endTime = startTime;
+ startTime = tmp;
+ }
+ // don't set the time if theres no need too
+ if ( ev.type() == Event::AllDay ) {
+ startTime.setHMS( 0, 0, 0 );
+ endTime.setHMS( 23, 59, 59 );
+ }
+
+ // adjust start and end times based on timezone
+ QDateTime start( startDate, startTime );
+ QDateTime end( endDate, endTime );
+ time_t start_utc, end_utc;
+
+// qDebug( "tz: %s", timezone->currentZone().latin1() );
+
+ // get real timezone
+ QString realTZ;
+ realTZ = QString::fromLocal8Bit( getenv("TZ") );
+
+ // set timezone
+ if ( setenv( "TZ", timezone->currentZone(), true ) != 0 )
+ qWarning( "There was a problem setting the timezone." );
+
+ // convert to UTC based on selected TZ (calling tzset internally)
+ start_utc = TimeConversion::toUTC( start );
+ end_utc = TimeConversion::toUTC( end );
+
+ // done playing around... put it all back
+ unsetenv( "TZ" );
+ if ( !realTZ.isNull() )
+ if ( setenv( "TZ", realTZ, true ) != 0 )
+ qWarning( "There was a problem setting the timezone." );
+
+ // convert UTC to local time (calling tzset internally)
+ ev.setStart( TimeConversion::fromUTC( start_utc ) );
+ ev.setEnd( TimeConversion::fromUTC( end_utc ) );
+
+ // we only have one type of sound at the moment... LOUD!!!
+ if ( comboSound->currentItem() != 0 )
+ st = Event::Loud;
+ else
+ st = Event::Silent;
+ ev.setAlarm( checkAlarm->isChecked(), spinAlarm->value(), st );
+ if ( rp.type != Event::NoRepeat )
+ ev.setRepeat( TRUE, rp );
+ ev.setNotes( editNote->text() );
+ return ev;
+}
+
+void DateEntry::setRepeatLabel()
+{
+
+ switch( rp.type ) {
+ case Event::Daily:
+ cmdRepeat->setText( tr("Daily...") );
+ break;
+ case Event::Weekly:
+ cmdRepeat->setText( tr("Weekly...") );
+ break;
+ case Event::MonthlyDay:
+ case Event::MonthlyDate:
+ cmdRepeat->setText( tr("Monthly...") );
+ break;
+ case Event::Yearly:
+ cmdRepeat->setText( tr("Yearly...") );
+ break;
+ default:
+ cmdRepeat->setText( tr("No Repeat...") );
+ }
+}
+
+void DateEntry::setAlarmEnabled( bool alarmPreset, int presetTime, Event::SoundTypeChoice sound )
+{
+ checkAlarm->setChecked( alarmPreset );
+ spinAlarm->setValue( presetTime );
+ if ( sound != Event::Silent )
+ comboSound->setCurrentItem( 1 );
+ else
+ comboSound->setCurrentItem( 0 );
+}
+
+void DateEntry::initCombos()
+{
+ comboStart->clear();
+ comboEnd->clear();
+ if ( ampm ) {
+ for ( int i = 0; i < 24; i++ ) {
+ if ( i == 0 ) {
+ comboStart->insertItem( "12:00 AM" );
+ comboStart->insertItem( "12:30 AM" );
+ comboEnd->insertItem( "12:00 AM" );
+ comboEnd->insertItem( "12:30 AM" );
+ } else if ( i == 12 ) {
+ comboStart->insertItem( "12:00 PM" );
+ comboStart->insertItem( "12:30 PM" );
+ comboEnd->insertItem( "12:00 PM" );
+ comboEnd->insertItem( "12:30 PM" );
+ } else if ( i > 12 ) {
+ comboStart->insertItem( QString::number( i - 12 ) + ":00 PM" );
+ comboStart->insertItem( QString::number( i - 12 ) + ":30 PM" );
+ comboEnd->insertItem( QString::number( i - 12 ) + ":00 PM" );
+ comboEnd->insertItem( QString::number( i - 12 ) + ":30 PM" );
+ } else {
+ comboStart->insertItem( QString::number( i) + ":00 AM" );
+ comboStart->insertItem( QString::number( i ) + ":30 AM" );
+ comboEnd->insertItem( QString::number( i ) + ":00 AM" );
+ comboEnd->insertItem( QString::number( i ) + ":30 AM" );
+ }
+ }
+ } else {
+ for ( int i = 0; i < 24; i++ ) {
+ if ( i < 10 ) {
+ comboStart->insertItem( QString("0")
+ + QString::number(i) + ":00" );
+ comboStart->insertItem( QString("0")
+ + QString::number(i) + ":30" );
+ comboEnd->insertItem( QString("0")
+ + QString::number(i) + ":00" );
+ comboEnd->insertItem( QString("0")
+ + QString::number(i) + ":30" );
+ } else {
+ comboStart->insertItem( QString::number(i) + ":00" );
+ comboStart->insertItem( QString::number(i) + ":30" );
+ comboEnd->insertItem( QString::number(i) + ":00" );
+ comboEnd->insertItem( QString::number(i) + ":30" );
+ }
+ }
+ }
+}
+
+void DateEntry::slotChangeClock( bool whichClock )
+{
+ ampm = whichClock;
+ initCombos();
+ setDates( QDateTime( startDate, startTime ), QDateTime( endDate, endTime ) );
+}
diff --git a/core/pim/datebook/dateentryimpl.h b/core/pim/datebook/dateentryimpl.h
new file mode 100644
index 0000000..785af7a
--- a/dev/null
+++ b/core/pim/datebook/dateentryimpl.h
@@ -0,0 +1,71 @@
+/**********************************************************************
+** Copyright (C) 2000 Trolltech AS. All rights reserved.
+**
+** This file is part of Qtopia Environment.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info@trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+#ifndef DATEENTRY_H
+#define DATEENTRY_H
+
+#include "dateentry.h"
+
+#include <qpe/event.h>
+
+#include <qdatetime.h>
+
+class DateBookMonth;
+
+class DateEntry : public DateEntryBase
+{
+ Q_OBJECT
+
+public:
+ DateEntry( bool startOnMonday, const QDateTime &start,
+ const QDateTime &end, bool whichClock = FALSE,
+ QWidget* parent = 0, const char* name = 0 );
+ DateEntry( bool startOnMonday, const Event &event, bool whichCLock = FALSE,
+ QWidget* parent = 0, const char* name = 0 );
+ ~DateEntry();
+
+ Event event();
+ void setAlarmEnabled( bool alarmPreset, int presetTime, Event::SoundTypeChoice );
+
+public slots:
+ void endDateChanged( int, int, int );
+ void endTimeChanged( const QString & );
+ void startDateChanged(int, int, int);
+ void startTimeChanged( int index );
+ void typeChanged( const QString & );
+ void changeEndCombo( int change );
+ void slotRepeat();
+ void slotChangeClock( bool );
+ void slotChangeStartOfWeek( bool );
+
+private:
+ void init();
+ void initCombos();
+ void setDates( const QDateTime& s, const QDateTime& e );
+ void setRepeatLabel();
+
+ DateBookMonth *startPicker, *endPicker;
+ QDate startDate, endDate;
+ QTime startTime, endTime;
+ Event::RepeatPattern rp;
+ bool ampm;
+ bool startWeekOnMonday;
+};
+
+#endif // DATEENTRY_H
diff --git a/core/pim/datebook/main.cpp b/core/pim/datebook/main.cpp
new file mode 100644
index 0000000..caa5fb6
--- a/dev/null
+++ b/core/pim/datebook/main.cpp
@@ -0,0 +1,38 @@
+/**********************************************************************
+** Copyright (C) 2000 Trolltech AS. All rights reserved.
+**
+** This file is part of Qtopia Environment.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info@trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include "datebook.h"
+#include <qpe/qpeapplication.h>
+
+
+int main( int argc, char **argv )
+{
+ QPEApplication a( argc, argv );
+
+ DateBook e;
+ QObject::connect( &a, SIGNAL( flush() ), &e, SLOT( flush() ) );
+ QObject::connect( &a, SIGNAL( reload() ), &e, SLOT( reload() ) );
+
+
+ e.setCaption( DateBook::tr("Calendar") );
+ a.showMainWidget(&e);
+
+ return a.exec();
+}
diff --git a/core/pim/datebook/qpe-datebook.control b/core/pim/datebook/qpe-datebook.control
new file mode 100644
index 0000000..c6ab81a
--- a/dev/null
+++ b/core/pim/datebook/qpe-datebook.control
@@ -0,0 +1,9 @@
+Files: bin/datebook apps/Applications/datebook.desktop
+Priority: optional
+Section: qpe/applications
+Maintainer: Warwick Allison <warwick@trolltech.com>
+Architecture: arm
+Version: $QPE_VERSION-3
+Depends: qpe-base ($QPE_VERSION)
+Description: A datebook/appointment manager
+ A datebook/appointment manager for the Qtopia environment.
diff --git a/core/pim/datebook/repeatentry.cpp b/core/pim/datebook/repeatentry.cpp
new file mode 100644
index 0000000..5637c4d
--- a/dev/null
+++ b/core/pim/datebook/repeatentry.cpp
@@ -0,0 +1,595 @@
+/**********************************************************************
+** Copyright (C) 2000 Trolltech AS. All rights reserved.
+**
+** This file is part of Qtopia Environment.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info@trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include "repeatentry.h"
+
+#include <qpe/datebookmonth.h>
+#include <qpe/qpeapplication.h>
+#include <qpe/timestring.h>
+
+#include <qbuttongroup.h>
+#include <qlabel.h>
+#include <qpopupmenu.h>
+#include <qspinbox.h>
+#include <qtoolbutton.h>
+
+#include <time.h>
+
+// 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") };
+
+
+static QString numberPlacing( int x ); // return the proper word format for
+ // x (1st, 2nd, etc)
+static int week( const QDate &dt ); // what week in the month is dt?
+
+RepeatEntry::RepeatEntry( bool startOnMonday,
+ const QDate &newStart, QWidget *parent,
+ const char *name, bool modal, WFlags fl )
+ : RepeatEntryBase( parent, name, modal, fl ),
+ start( newStart ),
+ currInterval( NONE ),
+ startWeekOnMonday( startOnMonday )
+{
+ init();
+ fraType->setButton( currInterval );
+ chkNoEnd->setChecked( TRUE );
+ setupNone();
+}
+
+RepeatEntry::RepeatEntry( bool startOnMonday, const Event::RepeatPattern &rp,
+ const QDate &startDate,
+ QWidget *parent, const char *name, bool modal,
+ WFlags fl )
+ : RepeatEntryBase( parent, name, modal, fl ),
+ start( startDate ),
+ end( rp.endDate() ),
+ startWeekOnMonday( startOnMonday )
+{
+ // do some stuff with the repeat pattern
+ init();
+ switch ( rp.type ) {
+ default:
+ case Event::NoRepeat:
+ currInterval = NONE;
+ setupNone();
+ break;
+ case Event::Daily:
+ currInterval = DAY;
+ setupDaily();
+ break;
+ case Event::Weekly:
+ currInterval = WEEK;
+ setupWeekly();
+ int day, buttons;
+ for ( day = 0x01, buttons = 0; buttons < 7;
+ day = day << 1, buttons++ ) {
+ if ( rp.days & day ) {
+ if ( startWeekOnMonday )
+ fraExtra->setButton( buttons );
+ else {
+ if ( buttons == 7 )
+ fraExtra->setButton( 0 );
+ else
+ fraExtra->setButton( buttons + 1 );
+ }
+ }
+ }
+ slotWeekLabel();
+ break;
+ case Event::MonthlyDay:
+ currInterval = MONTH;
+ setupMonthly();
+ fraExtra->setButton( 0 );
+ slotMonthLabel( 0 );
+ break;
+ case Event::MonthlyDate:
+ currInterval = MONTH;
+ setupMonthly();
+ fraExtra->setButton( 1 );
+ slotMonthLabel( 1 );
+ break;
+ case Event::Yearly:
+ currInterval = YEAR;
+ setupYearly();
+ break;
+ }
+ fraType->setButton( currInterval );
+ spinFreq->setValue( rp.frequency );
+ if ( !rp.hasEndDate ) {
+ cmdEnd->setText( RepeatEntryBase::tr("No End Date") );
+ chkNoEnd->setChecked( TRUE );
+ } else
+ cmdEnd->setText( TimeString::shortDate( end ) );
+}
+
+RepeatEntry::~RepeatEntry()
+{
+}
+
+Event::RepeatPattern RepeatEntry::repeatPattern()
+{
+ QListIterator<QToolButton> it( listRTypeButtons );
+ QListIterator<QToolButton> itExtra( listExtra );
+ Event::RepeatPattern rpTmp;
+ int i;
+ for ( i = 0; *it; ++it, i++ ) {
+ if ( (*it)->isOn() ) {
+ switch ( i ) {
+ case NONE:
+ rpTmp.type = Event::NoRepeat;
+ break;
+ case DAY:
+ rpTmp.type = Event::Daily;
+ break;
+ case WEEK:
+ rpTmp.type = Event::Weekly;
+ rpTmp.days = 0;
+ int day;
+ for ( day = 1; *itExtra; ++itExtra, day = day << 1 ) {
+ if ( (*itExtra)->isOn() ) {
+ if ( startWeekOnMonday )
+ rpTmp.days |= day;
+ else {
+ if ( day == 1 )
+ rpTmp.days |= Event::SUN;
+ else
+ rpTmp.days |= day >> 1;
+ }
+ }
+ }
+ break;
+ case MONTH:
+ if ( cmdExtra1->isOn() )
+ rpTmp.type = Event::MonthlyDay;
+ else if ( cmdExtra2->isOn() )
+ rpTmp.type = Event::MonthlyDate;
+ // figure out the montly day...
+ rpTmp.position = week( start );
+ break;
+ case YEAR:
+ rpTmp.type = Event::Yearly;
+ break;
+ }
+ break; // no need to keep looking!
+ }
+ }
+ rpTmp.frequency = spinFreq->value();
+ rpTmp.hasEndDate = !chkNoEnd->isChecked();
+ if ( rpTmp.hasEndDate ) {
+ rpTmp.setEndDate( end );
+ }
+ // timestamp it...
+ rpTmp.createTime = time( NULL );
+ return rpTmp;
+}
+
+void RepeatEntry::slotSetRType( int rtype )
+{
+ // now call the right function based on the type...
+ currInterval = static_cast<repeatButtons>(rtype);
+ switch ( currInterval ) {
+ case NONE:
+ setupNone();
+ break;
+ case DAY:
+ setupDaily();
+ break;
+ case WEEK:
+ setupWeekly();
+ slotWeekLabel();
+ break;
+ case MONTH:
+ setupMonthly();
+ cmdExtra2->setOn( TRUE );
+ slotMonthLabel( 1 );
+ break;
+ case YEAR:
+ setupYearly();
+ break;
+ }
+}
+
+void RepeatEntry::setupNone()
+{
+ lblRepeat->setText( tr("No Repeat") );
+ lblVar1->hide();
+ lblVar2->hide();
+ hideExtras();
+ cmdEnd->hide();
+ lblFreq->hide();
+ lblEvery->hide();
+ lblFreq->hide();
+ spinFreq->hide();
+ lblEnd->hide();
+ lblWeekVar->hide();
+}
+
+void RepeatEntry::setupDaily()
+{
+ hideExtras();
+ lblWeekVar->hide();
+ spinFreq->setValue( 1 );
+ lblFreq->setText( tr("day(s)") );
+ lblVar2->show();
+ showRepeatStuff();
+ lblRepeat->setText( strDayTemplate );
+ setupRepeatLabel( 1 );
+}
+
+void RepeatEntry::setupWeekly()
+{
+ // reshow the buttons...
+ fraExtra->setTitle( RepeatEntryBase::tr("Repeat On") );
+ fraExtra->setExclusive( FALSE );
+ fraExtra->show();
+ if ( startWeekOnMonday ) {
+ cmdExtra1->setText( RepeatEntryBase::tr("Mon") );
+ cmdExtra2->setText( RepeatEntryBase::tr("Tue") );
+ cmdExtra3->setText( RepeatEntryBase::tr("Wed") );
+ cmdExtra4->setText( RepeatEntryBase::tr("Thu") );
+ cmdExtra5->setText( RepeatEntryBase::tr("Fri") );
+ cmdExtra6->setText( RepeatEntryBase::tr("Sat") );
+ cmdExtra7->setText( RepeatEntryBase::tr("Sun") );
+ } else {
+ cmdExtra1->setText( RepeatEntryBase::tr("Sun") );
+ cmdExtra2->setText( RepeatEntryBase::tr("Mon") );
+ cmdExtra3->setText( RepeatEntryBase::tr("Tue") );
+ cmdExtra4->setText( RepeatEntryBase::tr("Wed") );
+ cmdExtra5->setText( RepeatEntryBase::tr("Thu") );
+ cmdExtra6->setText( RepeatEntryBase::tr("Fri") );
+ cmdExtra7->setText( RepeatEntryBase::tr("Sat") );
+ }
+ // I hope clustering these improve performance....
+ cmdExtra1->setOn( FALSE );
+ cmdExtra2->setOn( FALSE );
+ cmdExtra3->setOn( FALSE );
+ cmdExtra4->setOn( FALSE );
+ cmdExtra5->setOn( FALSE );
+ cmdExtra6->setOn( FALSE );
+ cmdExtra7->setOn( FALSE );
+
+ cmdExtra1->show();
+ cmdExtra2->show();
+ cmdExtra3->show();
+ cmdExtra4->show();
+ cmdExtra5->show();
+ cmdExtra6->show();
+ cmdExtra7->show();
+
+ lblWeekVar->show();
+ spinFreq->setValue( 1 );
+ // might as well set the day too...
+ if ( startWeekOnMonday ) {
+ fraExtra->setButton( start.dayOfWeek() - 1 );
+ } else {
+ fraExtra->setButton( start.dayOfWeek() % 7 );
+ }
+ lblFreq->setText( tr("week(s)") );
+ lblVar2->show();
+ showRepeatStuff();
+ setupRepeatLabel( 1 );
+}
+
+void RepeatEntry::setupMonthly()
+{
+ hideExtras();
+ lblWeekVar->hide();
+ fraExtra->setTitle( tr("Repeat By") );
+ fraExtra->setExclusive( TRUE );
+ fraExtra->show();
+ cmdExtra1->setText( tr("Day") );
+ cmdExtra1->show();
+ cmdExtra2->setText( tr("Date") );
+ cmdExtra2->show();
+ spinFreq->setValue( 1 );
+ lblFreq->setText( tr("month(s)") );
+ lblVar2->show();
+ showRepeatStuff();
+ setupRepeatLabel( 1 );
+}
+
+void RepeatEntry::setupYearly()
+{
+ hideExtras();
+ lblWeekVar->hide();
+ spinFreq->setValue( 1 );
+ lblFreq->setText( tr("year(s)") );
+ lblFreq->show();
+ lblFreq->show();
+ showRepeatStuff();
+ lblVar2->show();
+ QString strEvery = strYearTemplate.arg( start.monthName(start.month()) ).arg( numberPlacing(start.day()) );
+ lblRepeat->setText( strEvery );
+ setupRepeatLabel( 1 );
+
+}
+
+void RepeatEntry::init()
+{
+ QPopupMenu *m1 = new QPopupMenu( this );
+ repeatPicker = new DateBookMonth( m1, 0, TRUE );
+ m1->insertItem( repeatPicker );
+ cmdEnd->setPopup( m1 );
+ cmdEnd->setPopupDelay( 0 );
+
+ QObject::connect( repeatPicker, SIGNAL(dateClicked(int, int, int)),
+ this, SLOT(endDateChanged(int, int, int)) );
+ QObject::connect( qApp, SIGNAL(weekChanged(bool)),
+ this, SLOT(slotChangeStartOfWeek(bool)) );
+
+ listRTypeButtons.setAutoDelete( TRUE );
+ listRTypeButtons.append( cmdNone );
+ listRTypeButtons.append( cmdDay );
+ listRTypeButtons.append( cmdWeek );
+ listRTypeButtons.append( cmdMonth );
+ listRTypeButtons.append( cmdYear );
+
+ listExtra.setAutoDelete( TRUE );
+ listExtra.append( cmdExtra1 );
+ listExtra.append( cmdExtra2 );
+ listExtra.append( cmdExtra3 );
+ listExtra.append( cmdExtra4 );
+ listExtra.append( cmdExtra5 );
+ listExtra.append( cmdExtra6 );
+ listExtra.append( cmdExtra7 );
+}
+
+void RepeatEntry::slotNoEnd( bool unused )
+{
+ // if the item was toggled, then go ahead and set it to the maximum date
+ if ( unused ) {
+ end.setYMD( 3000, 12, 31 );
+ cmdEnd->setText( RepeatEntryBase::tr("No End Date") );
+ } else {
+ end = start;
+ cmdEnd->setText( TimeString::shortDate(end) );
+ }
+}
+
+void RepeatEntry::endDateChanged( int y, int m, int d )
+{
+ end.setYMD( y, m, d );
+ if ( end < start )
+ end = start;
+ cmdEnd->setText( TimeString::shortDate( end ) );
+ repeatPicker->setDate( end.year(), end.month(), end.day() );
+}
+
+void RepeatEntry::setupRepeatLabel( const QString &s )
+{
+ lblVar1->setText( s );
+}
+
+void RepeatEntry::setupRepeatLabel( int x )
+{
+ // change the spelling based on the value of x
+ QString strVar2;
+
+ if ( x > 1 )
+ lblVar1->show();
+ else
+ lblVar1->hide();
+
+ switch ( currInterval ) {
+ case NONE:
+ break;
+ case DAY:
+ if ( x > 1 )
+ strVar2 = tr( "days" );
+ else
+ strVar2 = tr( "day" );
+ break;
+ case WEEK:
+ if ( x > 1 )
+ strVar2 = tr( "weeks" );
+ else
+ strVar2 = tr( "week" );
+ break;
+ case MONTH:
+ if ( x > 1 )
+ strVar2 = RepeatEntryBase::tr( "months" );
+ else
+ strVar2 = tr( "month" );
+ break;
+ case YEAR:
+ if ( x > 1 )
+ strVar2 = RepeatEntryBase::tr( "years" );
+ else
+ strVar2 = tr( "year" );
+ break;
+ }
+ if ( !strVar2.isNull() )
+ lblVar2->setText( strVar2 );
+}
+
+void RepeatEntry::showRepeatStuff()
+{
+ cmdEnd->show();
+ chkNoEnd->show();
+ lblFreq->show();
+ lblEvery->show();
+ lblFreq->show();
+ spinFreq->show();
+ lblEnd->show();
+ lblRepeat->setText( RepeatEntryBase::tr("Every") );
+}
+
+void RepeatEntry::slotWeekLabel()
+{
+ QString str;
+ QListIterator<QToolButton> it( listExtra );
+ unsigned int i;
+ unsigned int keepMe;
+ bool bNeedCarriage = FALSE;
+ // don't do something we'll regret!!!
+ if ( currInterval != WEEK )
+ return;
+
+ if ( startWeekOnMonday )
+ keepMe = start.dayOfWeek() - 1;
+ else
+ keepMe = start.dayOfWeek() % 7;
+
+ QStringList list;
+ for ( i = 0; *it; ++it, i++ ) {
+ // a crazy check, if you are repeating weekly, the current day
+ // must be selected!!!
+ if ( i == keepMe && !( (*it)->isOn() ) )
+ (*it)->setOn( TRUE );
+ if ( (*it)->isOn() ) {
+ if ( startWeekOnMonday )
+ list.append( dayLabel[i] );
+ else {
+ if ( i == 0 )
+ list.append( dayLabel[6] );
+ else
+ list.append( dayLabel[i - 1] );
+ }
+ }
+ }
+ QStringList::Iterator itStr;
+ for ( i = 0, itStr = list.begin(); itStr != list.end(); ++itStr, i++ ) {
+ if ( i == 3 )
+ bNeedCarriage = TRUE;
+ else
+ bNeedCarriage = FALSE;
+ if ( str.isNull() )
+ str = *itStr;
+ else if ( i == list.count() - 1 ) {
+ if ( i < 2 )
+ str += tr(" and ") + *itStr;
+ else {
+ if ( bNeedCarriage )
+ str += tr( ",\nand " ) + *itStr;
+ else
+ str += tr( ", and " ) + *itStr;
+ }
+ } else {
+ if ( bNeedCarriage )
+ str += ",\n" + *itStr;
+ else
+ str += ", " + *itStr;
+ }
+ }
+ str = str.prepend( "on " );
+ lblWeekVar->setText( str );
+}
+
+void RepeatEntry::slotMonthLabel( int type )
+{
+ QString str;
+ if ( currInterval != MONTH || type > 1 )
+ return;
+ if ( type == 1 )
+ str = strMonthDateTemplate.arg( numberPlacing(start.day()) );
+ else
+ str = strMonthDayTemplate.arg( numberPlacing(week(start)))
+ .arg( dayLabel[start.dayOfWeek() - 1] );
+ lblRepeat->setText( str );
+}
+
+void RepeatEntry::slotChangeStartOfWeek( bool onMonday )
+{
+ startWeekOnMonday = onMonday;
+ // we need to make this unintrusive as possible...
+ int saveSpin = spinFreq->value();
+ char days = 0;
+ int day;
+ QListIterator<QToolButton> itExtra( listExtra );
+ for ( day = 1; *itExtra; ++itExtra, day = day << 1 ) {
+ if ( (*itExtra)->isOn() ) {
+ if ( !startWeekOnMonday )
+ days |= day;
+ else {
+ if ( day == 1 )
+ days |= Event::SUN;
+ else
+ days |= day >> 1;
+ }
+ }
+ }
+ setupWeekly();
+ spinFreq->setValue( saveSpin );
+ int buttons;
+ for ( day = 0x01, buttons = 0; buttons < 7;
+ day = day << 1, buttons++ ) {
+ if ( days & day ) {
+ if ( startWeekOnMonday )
+ fraExtra->setButton( buttons );
+ else {
+ if ( buttons == 7 )
+ fraExtra->setButton( 0 );
+ else
+ fraExtra->setButton( buttons + 1 );
+ }
+ }
+ }
+ slotWeekLabel();
+}
+
+static int week( const QDate &start )
+{
+ // figure out the week...
+ int stop = start.day(),
+ sentinel = start.dayOfWeek(),
+ dayOfWeek = QDate( start.year(), start.month(), 1 ).dayOfWeek(),
+ week = 1,
+ i;
+ for ( i = 1; i < stop; i++ ) {
+ if ( dayOfWeek++ == sentinel )
+ week++;
+ if ( dayOfWeek > 7 )
+ dayOfWeek = 0;
+ }
+ return week;
+}
+
+static QString numberPlacing( int x )
+{
+ // I hope this works in other languages besides english...
+ QString str = QString::number( x );
+ switch ( x % 10 ) {
+ case 1:
+ str += QWidget::tr( "st" );
+ break;
+ case 2:
+ str += QWidget::tr( "nd" );
+ break;
+ case 3:
+ str += QWidget::tr( "rd" );
+ break;
+ default:
+ str += QWidget::tr( "th" );
+ break;
+ }
+ return str;
+}
diff --git a/core/pim/datebook/repeatentry.h b/core/pim/datebook/repeatentry.h
new file mode 100644
index 0000000..949fecd
--- a/dev/null
+++ b/core/pim/datebook/repeatentry.h
@@ -0,0 +1,98 @@
+/**********************************************************************
+** Copyright (C) 2000 Trolltech AS. All rights reserved.
+**
+** This file is part of Qtopia Environment.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info@trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef REPEATENTRY_H
+#define REPEATENTRY_H
+
+#include "repeatentrybase.h"
+
+#include <qpe/event.h>
+
+#include <qcheckbox.h>
+#include <qbuttongroup.h>
+#include <qdatetime.h>
+#include <qlist.h>
+#include <qtoolbutton.h>
+
+class DateBookMonth;
+
+class RepeatEntry : public RepeatEntryBase
+{
+ Q_OBJECT
+public:
+ RepeatEntry( bool startOnMonday,
+ const QDate &start, QWidget *parent = 0, const char *name = 0,
+ bool modal = TRUE, WFlags fl = 0 );
+ RepeatEntry( bool startOnMonday,
+ const Event::RepeatPattern &rp, const QDate &start,
+ QWidget *parent = 0, const char *name = 0, bool modal = TRUE,
+ WFlags fl = 0 );
+ ~RepeatEntry();
+
+ Event::RepeatPattern repeatPattern();
+ QDate endDate() { return end; };
+
+public slots:
+ void slotSetRType( int );
+ void endDateChanged( int, int, int );
+ void slotNoEnd( bool unused );
+
+private slots:
+ void setupRepeatLabel( const QString& );
+ void setupRepeatLabel( int );
+ void slotWeekLabel();
+ void slotMonthLabel( int );
+ void slotChangeStartOfWeek( bool onMonday );
+
+private:
+ void setupNone();
+ void setupDaily();
+ void setupWeekly();
+ void setupMonthly();
+ void setupYearly();
+
+ enum repeatButtons { NONE, DAY, WEEK, MONTH, YEAR };
+ void init();
+ inline void hideExtras();
+ void showRepeatStuff();
+
+ QList<QToolButton> listRTypeButtons;
+ QList<QToolButton> listExtra;
+ QDate start; // only used in one spot...
+ QDate end;
+ repeatButtons currInterval;
+ bool startWeekOnMonday;
+ DateBookMonth *repeatPicker;
+};
+
+inline void RepeatEntry::hideExtras()
+{
+ // hide the extra buttons...
+ fraExtra->hide();
+ chkNoEnd->hide();
+ QListIterator<QToolButton> it( listExtra );
+ for ( ; *it; ++it ) {
+ (*it)->hide();
+ (*it)->setOn( FALSE );
+ }
+
+}
+
+#endif
diff --git a/core/pim/datebook/repeatentrybase.ui b/core/pim/datebook/repeatentrybase.ui
new file mode 100644
index 0000000..9621d74
--- a/dev/null
+++ b/core/pim/datebook/repeatentrybase.ui
@@ -0,0 +1,713 @@
+<!DOCTYPE UI><UI>
+<class>RepeatEntryBase</class>
+<comment>*********************************************************************
+** Copyright (C) 2000 Trolltech AS. All rights reserved.
+**
+** This file is part of Qtopia Environment.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info@trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+** $Id$
+**
+*********************************************************************</comment>
+<widget>
+ <class>QDialog</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>RepeatEntryBase</cstring>
+ </property>
+ <property stdset="1">
+ <name>geometry</name>
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>250</width>
+ <height>309</height>
+ </rect>
+ </property>
+ <property stdset="1">
+ <name>caption</name>
+ <string>Repeating Event </string>
+ </property>
+ <property>
+ <name>layoutMargin</name>
+ </property>
+ <property>
+ <name>layoutSpacing</name>
+ </property>
+ <vbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>5</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>1</number>
+ </property>
+ <widget>
+ <class>QButtonGroup</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>fraType</cstring>
+ </property>
+ <property stdset="1">
+ <name>frameShape</name>
+ <enum>NoFrame</enum>
+ </property>
+ <property stdset="1">
+ <name>frameShadow</name>
+ <enum>Sunken</enum>
+ </property>
+ <property stdset="1">
+ <name>title</name>
+ <string></string>
+ </property>
+ <property stdset="1">
+ <name>exclusive</name>
+ <bool>true</bool>
+ </property>
+ <property>
+ <name>layoutMargin</name>
+ </property>
+ <property>
+ <name>layoutSpacing</name>
+ </property>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>5</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>1</number>
+ </property>
+ <widget>
+ <class>QToolButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>cmdNone</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>None</string>
+ </property>
+ <property stdset="1">
+ <name>toggleButton</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>toggleButton</name>
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget>
+ <class>QToolButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>cmdDay</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Day</string>
+ </property>
+ <property stdset="1">
+ <name>toggleButton</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>toggleButton</name>
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget>
+ <class>QToolButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>cmdWeek</cstring>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ </sizepolicy>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Week</string>
+ </property>
+ <property stdset="1">
+ <name>toggleButton</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>toggleButton</name>
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget>
+ <class>QToolButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>cmdMonth</cstring>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ </sizepolicy>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Month</string>
+ </property>
+ <property stdset="1">
+ <name>toggleButton</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>toggleButton</name>
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget>
+ <class>QToolButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>cmdYear</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Year</string>
+ </property>
+ <property stdset="1">
+ <name>toggleButton</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>toggleButton</name>
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget>
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout4</cstring>
+ </property>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>lblEvery</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Every:</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QSpinBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>spinFreq</cstring>
+ </property>
+ <property stdset="1">
+ <name>minValue</name>
+ <number>1</number>
+ </property>
+ </widget>
+ <widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>lblFreq</cstring>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>1</vsizetype>
+ </sizepolicy>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Frequency</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget>
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout8</cstring>
+ </property>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>lblEnd</cstring>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ </sizepolicy>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>End On:</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QToolButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>cmdEnd</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>No End Date</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QCheckBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>chkNoEnd</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>No End Date</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget>
+ <class>QButtonGroup</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>fraExtra</cstring>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>7</vsizetype>
+ </sizepolicy>
+ </property>
+ <property stdset="1">
+ <name>frameShape</name>
+ <enum>Box</enum>
+ </property>
+ <property stdset="1">
+ <name>title</name>
+ <string>Repeat On</string>
+ </property>
+ <property>
+ <name>layoutMargin</name>
+ </property>
+ <property>
+ <name>layoutSpacing</name>
+ </property>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>5</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>1</number>
+ </property>
+ <widget>
+ <class>QToolButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>cmdExtra1</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Mon</string>
+ </property>
+ <property stdset="1">
+ <name>toggleButton</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>toggleButton</name>
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget>
+ <class>QToolButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>cmdExtra2</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Tue</string>
+ </property>
+ <property stdset="1">
+ <name>toggleButton</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>toggleButton</name>
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget>
+ <class>QToolButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>cmdExtra3</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Wed</string>
+ </property>
+ <property stdset="1">
+ <name>toggleButton</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>toggleButton</name>
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget>
+ <class>QToolButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>cmdExtra4</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Thu</string>
+ </property>
+ <property stdset="1">
+ <name>toggleButton</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>toggleButton</name>
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget>
+ <class>QToolButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>cmdExtra5</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Fri</string>
+ </property>
+ <property stdset="1">
+ <name>toggleButton</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>toggleButton</name>
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget>
+ <class>QToolButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>cmdExtra6</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Sat</string>
+ </property>
+ <property stdset="1">
+ <name>toggleButton</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>toggleButton</name>
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget>
+ <class>QToolButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>cmdExtra7</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Sun</string>
+ </property>
+ <property stdset="1">
+ <name>toggleButton</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>toggleButton</name>
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget>
+ <class>QFrame</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Frame3</cstring>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>7</vsizetype>
+ </sizepolicy>
+ </property>
+ <property stdset="1">
+ <name>frameShape</name>
+ <enum>Box</enum>
+ </property>
+ <property stdset="1">
+ <name>frameShadow</name>
+ <enum>Sunken</enum>
+ </property>
+ <property>
+ <name>layoutMargin</name>
+ </property>
+ <property>
+ <name>layoutSpacing</name>
+ </property>
+ <vbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>5</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>1</number>
+ </property>
+ <widget>
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout6</cstring>
+ </property>
+ <property>
+ <name>layoutSpacing</name>
+ </property>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>0</number>
+ </property>
+ <widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>lblRepeat</cstring>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>3</vsizetype>
+ </sizepolicy>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Every</string>
+ </property>
+ <property stdset="1">
+ <name>alignment</name>
+ <set>AlignTop|AlignLeft</set>
+ </property>
+ <property>
+ <name>hAlign</name>
+ </property>
+ <property>
+ <name>vAlign</name>
+ </property>
+ </widget>
+ <widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>lblVar1</cstring>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>1</vsizetype>
+ </sizepolicy>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Var1</string>
+ </property>
+ <property stdset="1">
+ <name>alignment</name>
+ <set>AlignTop|AlignLeft</set>
+ </property>
+ <property>
+ <name>hAlign</name>
+ </property>
+ <property>
+ <name>vAlign</name>
+ </property>
+ </widget>
+ <widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>lblVar2</cstring>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>4</hsizetype>
+ <vsizetype>1</vsizetype>
+ </sizepolicy>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Var 2</string>
+ </property>
+ <property stdset="1">
+ <name>alignment</name>
+ <set>AlignTop|AlignRight</set>
+ </property>
+ <property>
+ <name>hAlign</name>
+ </property>
+ <property>
+ <name>vAlign</name>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>lblWeekVar</cstring>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>7</vsizetype>
+ </sizepolicy>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>WeekVar</string>
+ </property>
+ <property stdset="1">
+ <name>alignment</name>
+ <set>AlignTop|AlignHCenter</set>
+ </property>
+ <property>
+ <name>hAlign</name>
+ </property>
+ <property>
+ <name>vAlign</name>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ </vbox>
+</widget>
+<connections>
+ <connection>
+ <sender>chkNoEnd</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>cmdEnd</receiver>
+ <slot>setDisabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>chkNoEnd</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>RepeatEntryBase</receiver>
+ <slot>slotNoEnd(bool)</slot>
+ </connection>
+ <connection>
+ <sender>spinFreq</sender>
+ <signal>valueChanged(int)</signal>
+ <receiver>lblVar1</receiver>
+ <slot>setNum(int)</slot>
+ </connection>
+ <connection>
+ <sender>spinFreq</sender>
+ <signal>valueChanged(int)</signal>
+ <receiver>RepeatEntryBase</receiver>
+ <slot>setupRepeatLabel( int )</slot>
+ </connection>
+ <connection>
+ <sender>fraType</sender>
+ <signal>clicked(int)</signal>
+ <receiver>RepeatEntryBase</receiver>
+ <slot>slotSetRType( int )</slot>
+ </connection>
+ <connection>
+ <sender>fraExtra</sender>
+ <signal>clicked(int)</signal>
+ <receiver>RepeatEntryBase</receiver>
+ <slot>slotMonthLabel( int )</slot>
+ </connection>
+ <connection>
+ <sender>fraExtra</sender>
+ <signal>clicked(int)</signal>
+ <receiver>RepeatEntryBase</receiver>
+ <slot>slotWeekLabel()</slot>
+ </connection>
+ <slot access="public">setupRepeatLabel( const QString &amp; )</slot>
+ <slot access="public">setupRepeatLabel( int )</slot>
+ <slot access="public">slotMonthLabel( int )</slot>
+ <slot access="public">slotNoEnd(bool)</slot>
+ <slot access="public">slotSetRType( int )</slot>
+ <slot access="public">slotWeekLabel()</slot>
+</connections>
+</UI>