summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/datebook/config.in2
-rw-r--r--core/pim/datebook/datebook.cpp10
-rw-r--r--core/pim/datebook/datebook.pro12
-rw-r--r--core/pim/datebook/datebookweekheaderimpl.cpp11
-rw-r--r--core/pim/datebook/datebookweeklst.cpp7
-rw-r--r--core/pim/datebook/dateentryimpl.cpp10
-rw-r--r--core/pim/datebook/opie-datebook.control2
7 files changed, 31 insertions, 23 deletions
diff --git a/core/pim/datebook/config.in b/core/pim/datebook/config.in
index d1dd44f..4658f3c 100644
--- a/core/pim/datebook/config.in
+++ b/core/pim/datebook/config.in
@@ -1,4 +1,4 @@
1 config DATEBOOK 1 config DATEBOOK
2 boolean "opie-datebook (a datebook/appointment manager)" 2 boolean "opie-datebook (a datebook/appointment manager)"
3 default "y" 3 default "y"
4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2UI 4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && LIBOPIE2UI && LIBOPIE2PIM
diff --git a/core/pim/datebook/datebook.cpp b/core/pim/datebook/datebook.cpp
index 3934411..3d1bc0c 100644
--- a/core/pim/datebook/datebook.cpp
+++ b/core/pim/datebook/datebook.cpp
@@ -1,121 +1,123 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19** $Id$ 19** $Id$
20** 20**
21**********************************************************************/ 21**********************************************************************/
22 22
23#define QTOPIA_INTERNAL_FD 23#define QTOPIA_INTERNAL_FD
24 24
25#include "datebook.h" 25#include "datebook.h"
26#include "datebookday.h" 26#include "datebookday.h"
27#include "datebooksettings.h" 27#include "datebooksettings.h"
28#include "datebookweek.h" 28#include "datebookweek.h"
29#include "datebookweeklst.h" 29#include "datebookweeklst.h"
30#include "dateentryimpl.h" 30#include "dateentryimpl.h"
31 31
32#include <opie2/odebug.h>
33
32#include <qpe/datebookmonth.h> 34#include <qpe/datebookmonth.h>
33#include <qpe/qpeapplication.h> 35#include <qpe/qpeapplication.h>
34#include <qpe/config.h> 36#include <qpe/config.h>
35#include <qpe/finddialog.h> 37#include <qpe/finddialog.h>
36#include <qpe/ir.h> 38#include <qpe/ir.h>
37#include <qpe/qpemessagebox.h> 39#include <qpe/qpemessagebox.h>
38#include <qpe/resource.h> 40#include <qpe/resource.h>
39#include <qpe/sound.h> 41#include <qpe/sound.h>
40#include <qtoolbar.h>
41#include <qpe/tzselect.h> 42#include <qpe/tzselect.h>
42 43
43#include <qaction.h> 44#include <qaction.h>
44#include <qcopchannel_qws.h> 45#include <qcopchannel_qws.h>
45#include <qlayout.h> 46#include <qlayout.h>
46#include <qmessagebox.h> 47#include <qmessagebox.h>
47#include <qtimer.h> 48#include <qtimer.h>
48#include <qtl.h> 49#include <qtl.h>
50#include <qtoolbar.h>
49#include <qwidgetstack.h> 51#include <qwidgetstack.h>
50 52
51#include <sys/stat.h> 53#include <sys/stat.h>
52#include <sys/types.h> 54#include <sys/types.h>
53#include <fcntl.h> 55#include <fcntl.h>
54#include <unistd.h> 56#include <unistd.h>
55 57
56#include <stdlib.h> 58#include <stdlib.h>
57 59
58DateBook::DateBook( QWidget *parent, const char *, WFlags f ) 60DateBook::DateBook( QWidget *parent, const char *, WFlags f )
59 : QMainWindow( parent, "datebook", f ), 61 : QMainWindow( parent, "datebook", f ),
60 aPreset( FALSE ), 62 aPreset( FALSE ),
61 presetTime( -1 ), 63 presetTime( -1 ),
62 startTime( 8 ), // an acceptable default 64 startTime( 8 ), // an acceptable default
63 rowStyle( 0 ), 65 rowStyle( 0 ),
64 bJumpToCurTime(FALSE), 66 bJumpToCurTime(FALSE),
65 syncing(FALSE), 67 syncing(FALSE),
66 inSearch(FALSE), 68 inSearch(FALSE),
67 alarmCounter(0) 69 alarmCounter(0)
68{ 70{
69 bool needEvilHack= false; // if we need an Evil Hack 71 bool needEvilHack= false; // if we need an Evil Hack
70 QTime t; 72 QTime t;
71 t.start(); 73 t.start();
72 db = new DateBookDBHack; 74 db = new DateBookDBHack;
73 qDebug("loading db t=%d", t.elapsed() ); 75 Opie::Core::odebug << "loading db t=" << t.elapsed() << oendl;
74 loadSettings(); 76 loadSettings();
75 setCaption( tr("Calendar") ); 77 setCaption( tr("Calendar") );
76 setIcon( Resource::loadPixmap( "datebook_icon" ) ); 78 setIcon( Resource::loadPixmap( "datebook_icon" ) );
77 79
78 setToolBarsMovable( FALSE ); 80 setToolBarsMovable( FALSE );
79 81
80 views = new QWidgetStack( this ); 82 views = new QWidgetStack( this );
81 setCentralWidget( views ); 83 setCentralWidget( views );
82 84
83 dayView = 0; 85 dayView = 0;
84 weekView = 0; 86 weekView = 0;
85 weekLstView = 0; 87 weekLstView = 0;
86 monthView = 0; 88 monthView = 0;
87 89
88// QToolBar *bar = new QToolBar( this ); 90// QToolBar *bar = new QToolBar( this );
89// bar->setHorizontalStretchable( TRUE ); 91// bar->setHorizontalStretchable( TRUE );
90 92
91// QMenuBar *mb = new QMenuBar( bar ); 93// QMenuBar *mb = new QMenuBar( bar );
92// mb->setMargin( 0 ); 94// mb->setMargin( 0 );
93 95
94// QPopupMenu *view = new QPopupMenu( this ); 96// QPopupMenu *view = new QPopupMenu( this );
95// mb->insertItem( tr( "View" ), view ); 97// mb->insertItem( tr( "View" ), view );
96 98
97 QToolBar *sub_bar = new QToolBar(this); 99 QToolBar *sub_bar = new QToolBar(this);
98 sub_bar->setHorizontalStretchable(TRUE); 100 sub_bar->setHorizontalStretchable(TRUE);
99 101
100 QActionGroup *g = new QActionGroup( this ); 102 QActionGroup *g = new QActionGroup( this );
101 g->setExclusive( TRUE ); 103 g->setExclusive( TRUE );
102 104
103 QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 ); 105 QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 );
104 connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) ); 106 connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) );
105 a->addTo( sub_bar ); 107 a->addTo( sub_bar );
106 108
107 sub_bar->addSeparator(); 109 sub_bar->addSeparator();
108 110
109 a = new QAction( tr( "Today" ), Resource::loadPixmap( "datebook/to_day" ), QString::null, 0, g, 0 ); 111 a = new QAction( tr( "Today" ), Resource::loadPixmap( "datebook/to_day" ), QString::null, 0, g, 0 );
110 connect( a, SIGNAL( activated() ), this, SLOT( slotToday() ) ); 112 connect( a, SIGNAL( activated() ), this, SLOT( slotToday() ) );
111 a->addTo( sub_bar ); 113 a->addTo( sub_bar );
112 //a->addTo( view ); 114 //a->addTo( view );
113 115
114 sub_bar->addSeparator(); 116 sub_bar->addSeparator();
115 117
116 a = new QAction( tr( "Day" ), Resource::loadPixmap( "day" ), QString::null, 0, g, 0 ); 118 a = new QAction( tr( "Day" ), Resource::loadPixmap( "day" ), QString::null, 0, g, 0 );
117 connect( a, SIGNAL( activated() ), this, SLOT( viewDay() ) ); 119 connect( a, SIGNAL( activated() ), this, SLOT( viewDay() ) );
118 a->addTo( sub_bar ); 120 a->addTo( sub_bar );
119// a->addTo( view ); 121// a->addTo( view );
120 a->setToggleAction( TRUE ); 122 a->setToggleAction( TRUE );
121 a->setOn( TRUE ); 123 a->setOn( TRUE );
@@ -129,97 +131,97 @@ DateBook::DateBook( QWidget *parent, const char *, WFlags f )
129 weekAction = a; 131 weekAction = a;
130 132
131 a = new QAction( tr( "WeekLst" ), Resource::loadPixmap( "datebook/weeklst" ), QString::null, 0, g, 0 ); 133 a = new QAction( tr( "WeekLst" ), Resource::loadPixmap( "datebook/weeklst" ), QString::null, 0, g, 0 );
132 connect( a, SIGNAL( activated() ), this, SLOT( viewWeekLst() ) ); 134 connect( a, SIGNAL( activated() ), this, SLOT( viewWeekLst() ) );
133 a->addTo( sub_bar ); 135 a->addTo( sub_bar );
134// a->addTo( view ); 136// a->addTo( view );
135 a->setToggleAction( TRUE ); 137 a->setToggleAction( TRUE );
136 weekLstAction = a; 138 weekLstAction = a;
137 139
138 a = new QAction( tr( "Month" ), Resource::loadPixmap( "month" ), QString::null, 0, g, 0 ); 140 a = new QAction( tr( "Month" ), Resource::loadPixmap( "month" ), QString::null, 0, g, 0 );
139 connect( a, SIGNAL( activated() ), this, SLOT( viewMonth() ) ); 141 connect( a, SIGNAL( activated() ), this, SLOT( viewMonth() ) );
140 a->addTo( sub_bar ); 142 a->addTo( sub_bar );
141// a->addTo( view ); 143// a->addTo( view );
142 a->setToggleAction( TRUE ); 144 a->setToggleAction( TRUE );
143 monthAction = a; 145 monthAction = a;
144 146
145 sub_bar->addSeparator(); 147 sub_bar->addSeparator();
146 148
147 a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ), QString::null, 0, this, 0 ); 149 a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ), QString::null, 0, this, 0 );
148 connect( a, SIGNAL(activated()), this, SLOT(slotFind()) ); 150 connect( a, SIGNAL(activated()), this, SLOT(slotFind()) );
149 a->addTo( sub_bar ); 151 a->addTo( sub_bar );
150 152
151 a = new QAction( tr( "Edit..." ), Resource::loadPixmap("SettingsIcon"), QString::null, 0, this, 0 ); 153 a = new QAction( tr( "Edit..." ), Resource::loadPixmap("SettingsIcon"), QString::null, 0, this, 0 );
152 connect( a, SIGNAL( activated() ), this, SLOT( slotSettings() ) ); 154 connect( a, SIGNAL( activated() ), this, SLOT( slotSettings() ) );
153 a->addTo( sub_bar ); 155 a->addTo( sub_bar );
154 156
155 if(defaultView==DAY) viewDay(); 157 if(defaultView==DAY) viewDay();
156 if(defaultView==WEEK) needEvilHack=true;// viewWeek(); 158 if(defaultView==WEEK) needEvilHack=true;// viewWeek();
157 if(defaultView==WEEKLST) viewWeekLst(); 159 if(defaultView==WEEKLST) viewWeekLst();
158 if(defaultView==MONTH) viewMonth(); 160 if(defaultView==MONTH) viewMonth();
159 161
160 connect( qApp, SIGNAL(clockChanged(bool)), this, SLOT(changeClock(bool)) ); 162 connect( qApp, SIGNAL(clockChanged(bool)), this, SLOT(changeClock(bool)) );
161 connect( qApp, SIGNAL(weekChanged(bool)), this, SLOT(changeWeek(bool)) ); 163 connect( qApp, SIGNAL(weekChanged(bool)), this, SLOT(changeWeek(bool)) );
162 164
163#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 165#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
164 connect( qApp, SIGNAL(appMessage(const QCString&,const QByteArray&)), this, SLOT(appMessage(const QCString&,const QByteArray&)) ); 166 connect( qApp, SIGNAL(appMessage(const QCString&,const QByteArray&)), this, SLOT(appMessage(const QCString&,const QByteArray&)) );
165#endif 167#endif
166 168
167 // listen on QPE/System 169 // listen on QPE/System
168#if defined(Q_WS_QWS) 170#if defined(Q_WS_QWS)
169#if !defined(QT_NO_COP) 171#if !defined(QT_NO_COP)
170 QCopChannel *channel = new QCopChannel( "QPE/System", this ); 172 QCopChannel *channel = new QCopChannel( "QPE/System", this );
171 connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), this, SLOT(receive(const QCString&,const QByteArray&)) ); 173 connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), this, SLOT(receive(const QCString&,const QByteArray&)) );
172 channel = new QCopChannel( "QPE/Datebook", this ); 174 channel = new QCopChannel( "QPE/Datebook", this );
173 connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), this, SLOT(receive(const QCString&,const QByteArray&)) ); 175 connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), this, SLOT(receive(const QCString&,const QByteArray&)) );
174#endif 176#endif
175#endif 177#endif
176 178
177 qDebug("done t=%d", t.elapsed() ); 179 Opie::Core::odebug << "done t=" << t.elapsed() << oendl;
178 180
179 connect( qApp, SIGNAL( flush() ), this, SLOT( flush() ) ); 181 connect( qApp, SIGNAL( flush() ), this, SLOT( flush() ) );
180 connect( qApp, SIGNAL( reload()), this, SLOT( reload() ) ); 182 connect( qApp, SIGNAL( reload()), this, SLOT( reload() ) );
181 /* 183 /*
182 * Here is a problem description: 184 * Here is a problem description:
183 * When Weekview is the default view 185 * When Weekview is the default view
184 * a DateBookWeekView get's created 186 * a DateBookWeekView get's created
185 * redraw() get's called. So what? 187 * redraw() get's called. So what?
186 * Remember that we're still in the c'tor 188 * Remember that we're still in the c'tor
187 * and no final layout has happened? Ok 189 * and no final layout has happened? Ok
188 * now all Events get arranged. Their x 190 * now all Events get arranged. Their x
189 * position get's determined by a QHeader 191 * position get's determined by a QHeader
190 * position. But the QHeader isn't layouted or 192 * position. But the QHeader isn't layouted or
191 * at the right position. redraw() is a slot 193 * at the right position. redraw() is a slot
192 * so we'll call it then via a singleShot 194 * so we'll call it then via a singleShot
193 * from view() 195 * from view()
194 */ 196 */
195 if( needEvilHack ){ 197 if( needEvilHack ){
196 QTimer::singleShot( 500, this, SLOT(viewWeek()) ); 198 QTimer::singleShot( 500, this, SLOT(viewWeek()) );
197 } 199 }
198} 200}
199 201
200void DateBook::receive( const QCString &msg, const QByteArray &data ) 202void DateBook::receive( const QCString &msg, const QByteArray &data )
201{ 203{
202 QDataStream stream( data, IO_ReadOnly ); 204 QDataStream stream( data, IO_ReadOnly );
203 if ( msg == "timeChange(QString)" ) { 205 if ( msg == "timeChange(QString)" ) {
204 // update active view! 206 // update active view!
205 if ( dayAction->isOn() ) 207 if ( dayAction->isOn() )
206 viewDay(); 208 viewDay();
207 else if ( weekAction->isOn() ) 209 else if ( weekAction->isOn() )
208 viewWeek(); 210 viewWeek();
209 else if ( monthAction->isOn() ) 211 else if ( monthAction->isOn() )
210 viewMonth(); 212 viewMonth();
211 } 213 }
212 else if (msg == "editEvent(int)") { 214 else if (msg == "editEvent(int)") {
213 int uid; 215 int uid;
214 stream >> uid; 216 stream >> uid;
215 Event e=db->eventByUID(uid); 217 Event e=db->eventByUID(uid);
216 editEvent(e); 218 editEvent(e);
217 }else if (msg == "viewDefault(QDate)"){ 219 }else if (msg == "viewDefault(QDate)"){
218 QDate day; 220 QDate day;
219 stream >> day; 221 stream >> day;
220 viewDefault(day); 222 viewDefault(day);
221 } 223 }
222} 224}
223 225
224DateBook::~DateBook() 226DateBook::~DateBook()
225{ 227{
@@ -855,97 +857,97 @@ void DateBook::slotNewEntry(const QDateTime &start, const QDateTime &end, const
855 857
856 Event ev; 858 Event ev;
857 ev.setDescription( str ); 859 ev.setDescription( str );
858 // When the new gui comes in, change this... 860 // When the new gui comes in, change this...
859 if(location==0) { 861 if(location==0) {
860 if(defaultLocation.isEmpty()) { 862 if(defaultLocation.isEmpty()) {
861 ev.setLocation(tr("(Unknown)")); 863 ev.setLocation(tr("(Unknown)"));
862 } else { 864 } else {
863 ev.setLocation( defaultLocation ); 865 ev.setLocation( defaultLocation );
864 } 866 }
865 } else { 867 } else {
866 ev.setLocation(location); 868 ev.setLocation(location);
867 } 869 }
868 ev.setCategories(defaultCategories); 870 ev.setCategories(defaultCategories);
869 ev.setStart( start ); 871 ev.setStart( start );
870 ev.setEnd( end ); 872 ev.setEnd( end );
871 873
872 e = new DateEntry( onMonday, ev, ampm, &newDlg ); 874 e = new DateEntry( onMonday, ev, ampm, &newDlg );
873 e->setAlarmEnabled( aPreset, presetTime, Event::Loud ); 875 e->setAlarmEnabled( aPreset, presetTime, Event::Loud );
874 sv->addChild( e ); 876 sv->addChild( e );
875 while ( QPEApplication::execDialog( &newDlg ) ) { 877 while ( QPEApplication::execDialog( &newDlg ) ) {
876 ev = e->event(); 878 ev = e->event();
877 ev.assignUid(); 879 ev.assignUid();
878 QString error = checkEvent( ev ); 880 QString error = checkEvent( ev );
879 if ( !error.isNull() ) { 881 if ( !error.isNull() ) {
880 if ( QMessageBox::warning( this, tr("Error!"), error, tr("Fix it"), tr("Continue"), 0, 0, 1 ) == 0 ) 882 if ( QMessageBox::warning( this, tr("Error!"), error, tr("Fix it"), tr("Continue"), 0, 0, 1 ) == 0 )
881 continue; 883 continue;
882 } 884 }
883 db->addEvent( ev ); 885 db->addEvent( ev );
884 emit newEvent(); 886 emit newEvent();
885 break; 887 break;
886 } 888 }
887} 889}
888 890
889void DateBook::setDocument( const QString &filename ) 891void DateBook::setDocument( const QString &filename )
890{ 892{
891 if ( filename.find(".vcs") != int(filename.length()) - 4 ) return; 893 if ( filename.find(".vcs") != int(filename.length()) - 4 ) return;
892 894
893 QValueList<Event> tl = Event::readVCalendar( filename ); 895 QValueList<Event> tl = Event::readVCalendar( filename );
894 for( QValueList<Event>::Iterator it = tl.begin(); it != tl.end(); ++it ) { 896 for( QValueList<Event>::Iterator it = tl.begin(); it != tl.end(); ++it ) {
895 db->addEvent( *it ); 897 db->addEvent( *it );
896 } 898 }
897} 899}
898 900
899static const char * beamfile = "/tmp/obex/event.vcs"; 901static const char * beamfile = "/tmp/obex/event.vcs";
900 902
901void DateBook::beamEvent( const Event &e ) 903void DateBook::beamEvent( const Event &e )
902{ 904{
903 qDebug("trying to beamn"); 905 Opie::Core::odebug << "trying to beam" << oendl;
904 unlink( beamfile ); // delete if exists 906 unlink( beamfile ); // delete if exists
905 mkdir("/tmp/obex/", 0755); 907 mkdir("/tmp/obex/", 0755);
906 Event::writeVCalendar( beamfile, e ); 908 Event::writeVCalendar( beamfile, e );
907 Ir *ir = new Ir( this ); 909 Ir *ir = new Ir( this );
908 connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); 910 connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) );
909 QString description = e.description(); 911 QString description = e.description();
910 ir->send( beamfile, description, "text/x-vCalendar" ); 912 ir->send( beamfile, description, "text/x-vCalendar" );
911} 913}
912 914
913void DateBook::beamDone( Ir *ir ) 915void DateBook::beamDone( Ir *ir )
914{ 916{
915 delete ir; 917 delete ir;
916 unlink( beamfile ); 918 unlink( beamfile );
917} 919}
918 920
919void DateBook::slotFind() 921void DateBook::slotFind()
920{ 922{
921 // move it to the day view... 923 // move it to the day view...
922 viewDay(); 924 viewDay();
923 FindDialog frmFind( "Calendar", this ); // no tr needed 925 FindDialog frmFind( "Calendar", this ); // no tr needed
924 frmFind.setUseDate( true ); 926 frmFind.setUseDate( true );
925 frmFind.setDate( currentDate() ); 927 frmFind.setDate( currentDate() );
926 QObject::connect( &frmFind, 928 QObject::connect( &frmFind,
927 SIGNAL(signalFindClicked(const QString&,const QDate&,bool,bool,int)), 929 SIGNAL(signalFindClicked(const QString&,const QDate&,bool,bool,int)),
928 this, 930 this,
929 SLOT(slotDoFind(const QString&,const QDate&,bool,bool,int)) ); 931 SLOT(slotDoFind(const QString&,const QDate&,bool,bool,int)) );
930 QObject::connect( this, 932 QObject::connect( this,
931 SIGNAL(signalNotFound()), 933 SIGNAL(signalNotFound()),
932 &frmFind, 934 &frmFind,
933 SLOT(slotNotFound()) ); 935 SLOT(slotNotFound()) );
934 QObject::connect( this, 936 QObject::connect( this,
935 SIGNAL(signalWrapAround()), 937 SIGNAL(signalWrapAround()),
936 &frmFind, 938 &frmFind,
937 SLOT(slotWrapAround()) ); 939 SLOT(slotWrapAround()) );
938 frmFind.move(0,0); 940 frmFind.move(0,0);
939 frmFind.exec(); 941 frmFind.exec();
940 inSearch = false; 942 inSearch = false;
941} 943}
942 944
943bool catComp( QArray<int> cats, int category ) 945bool catComp( QArray<int> cats, int category )
944{ 946{
945 bool returnMe; 947 bool returnMe;
946 int i, 948 int i,
947 count; 949 count;
948 950
949 count = int(cats.count()); 951 count = int(cats.count());
950 returnMe = false; 952 returnMe = false;
951 if ( (category == -1 && count == 0) || category == -2 ) 953 if ( (category == -1 && count == 0) || category == -2 )
diff --git a/core/pim/datebook/datebook.pro b/core/pim/datebook/datebook.pro
index bf9a2cc..a79c25c 100644
--- a/core/pim/datebook/datebook.pro
+++ b/core/pim/datebook/datebook.pro
@@ -1,41 +1,41 @@
1 CONFIG += qt warn_on quick-app 1 CONFIG += qt warn_on quick-app
2 HEADERS= datebookday.h \ 2 HEADERS= datebookday.h \
3 datebook.h \ 3 datebook.h \
4 dateentryimpl.h \ 4 dateentryimpl.h \
5 datebookdayheaderimpl.h \ 5 datebookdayheaderimpl.h \
6 datebooksettings.h \ 6 datebooksettings.h \
7 datebookweek.h \ 7 datebookweek.h \
8 datebookweeklst.h \ 8 datebookweeklst.h \
9 datebookweekheaderimpl.h \ 9 datebookweekheaderimpl.h \
10 repeatentry.h \ 10 repeatentry.h \
11 noteentryimpl.h \ 11 noteentryimpl.h \
12 onoteedit.h \ 12 onoteedit.h \
13 datebookdayallday.h \ 13 datebookdayallday.h \
14 namespace_hack.h 14 namespace_hack.h
15 SOURCES= main.cpp \ 15 SOURCES= main.cpp \
16 datebookday.cpp \ 16 datebookday.cpp \
17 datebook.cpp \ 17 datebook.cpp \
18 dateentryimpl.cpp \ 18 dateentryimpl.cpp \
19 datebookdayheaderimpl.cpp \ 19 datebookdayheaderimpl.cpp \
20 datebooksettings.cpp \ 20 datebooksettings.cpp \
21 datebookweek.cpp \ 21 datebookweek.cpp \
22 datebookweeklst.cpp \ 22 datebookweeklst.cpp \
23 datebookweekheaderimpl.cpp \ 23 datebookweekheaderimpl.cpp \
24 repeatentry.cpp \ 24 repeatentry.cpp \
25 noteentryimpl.cpp \ 25 noteentryimpl.cpp \
26 onoteedit.cpp \ 26 onoteedit.cpp \
27 datebookdayallday.cpp 27 datebookdayallday.cpp
28 INTERFACES= dateentry.ui \ 28 INTERFACES= dateentry.ui \
29 datebookdayheader.ui \ 29 datebookdayheader.ui \
30 datebookweekheader.ui \ 30 datebookweekheader.ui \
31 datebookweeklstheader.ui \ 31 datebookweeklstheader.ui \
32 datebookweeklstdayhdr.ui \ 32 datebookweeklstdayhdr.ui \
33 repeatentrybase.ui \ 33 repeatentrybase.ui \
34 datebooksettingsbase.ui \ 34 datebooksettingsbase.ui \
35 noteentry.ui 35 noteentry.ui
36INCLUDEPATH += $(OPIEDIR)/include 36INCLUDEPATH += $(OPIEDIR)/include
37 DEPENDPATH+= $(OPIEDIR)/include 37 DEPENDPATH+= $(OPIEDIR)/include
38LIBS += -lqpe -lopieui2 -lopiecore2 38LIBS += -lqpe -lopieui2 -lopiecore2 -lopiepim2
39 TARGET = datebook 39 TARGET = datebook
40 40
41include ( $(OPIEDIR)/include.pro ) 41include ( $(OPIEDIR)/include.pro )
diff --git a/core/pim/datebook/datebookweekheaderimpl.cpp b/core/pim/datebook/datebookweekheaderimpl.cpp
index c237b2d..123a478 100644
--- a/core/pim/datebook/datebookweekheaderimpl.cpp
+++ b/core/pim/datebook/datebookweekheaderimpl.cpp
@@ -1,120 +1,123 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#include "datebookweekheaderimpl.h" 20#include "datebookweekheaderimpl.h"
21#include "datebookweek.h" 21#include "datebookweek.h"
22
23#include <opie2/odebug.h>
24
22#include <qpe/resource.h> 25#include <qpe/resource.h>
23#include <qpe/datebookmonth.h> 26#include <qpe/datebookmonth.h>
24 27
25#include <qtoolbutton.h> 28#include <qtoolbutton.h>
26 29
27/* 30/*
28 * Constructs a DateBookWeekHeader which is a child of 'parent', with the 31 * Constructs a DateBookWeekHeader which is a child of 'parent', with the
29 * name 'name' and widget flags set to 'f' 32 * name 'name' and widget flags set to 'f'
30 */ 33 */
31DateBookWeekHeader::DateBookWeekHeader( bool startOnMonday, QWidget* parent, const char* name, WFlags fl ) 34DateBookWeekHeader::DateBookWeekHeader( bool startOnMonday, QWidget* parent, const char* name, WFlags fl )
32 : DateBookWeekHeaderBase( parent, name, fl ), 35 : DateBookWeekHeaderBase( parent, name, fl ),
33 bStartOnMonday( startOnMonday ) 36 bStartOnMonday( startOnMonday )
34{ 37{
35 setBackgroundMode( PaletteButton ); 38 setBackgroundMode( PaletteButton );
36 labelDate->setBackgroundMode( PaletteButton ); 39 labelDate->setBackgroundMode( PaletteButton );
37 backmonth->setPixmap( Resource::loadPixmap("fastback") ); 40 backmonth->setPixmap( Resource::loadPixmap("fastback") );
38 backweek->setPixmap( Resource::loadPixmap("back") ); 41 backweek->setPixmap( Resource::loadPixmap("back") );
39 forwardweek->setPixmap( Resource::loadPixmap("forward") ); 42 forwardweek->setPixmap( Resource::loadPixmap("forward") );
40 forwardmonth->setPixmap( Resource::loadPixmap("fastforward") ); 43 forwardmonth->setPixmap( Resource::loadPixmap("fastforward") );
41} 44}
42 45
43/* 46/*
44 * Destroys the object and frees any allocated resources 47 * Destroys the object and frees any allocated resources
45 */ 48 */
46DateBookWeekHeader::~DateBookWeekHeader() 49DateBookWeekHeader::~DateBookWeekHeader()
47{ 50{
48 // no need to delete child widgets, Qt does it all for us 51 // no need to delete child widgets, Qt does it all for us
49} 52}
50 53
51void DateBookWeekHeader::pickDate() 54void DateBookWeekHeader::pickDate()
52{ 55{
53 static QPopupMenu *m1 = 0; 56 static QPopupMenu *m1 = 0;
54 static DateBookMonth *picker = 0; 57 static DateBookMonth *picker = 0;
55 if ( !m1 ) { 58 if ( !m1 ) {
56 m1 = new QPopupMenu( this ); 59 m1 = new QPopupMenu( this );
57 picker = new DateBookMonth( m1, 0, TRUE ); 60 picker = new DateBookMonth( m1, 0, TRUE );
58 m1->insertItem( picker ); 61 m1->insertItem( picker );
59 connect( picker, SIGNAL( dateClicked(int,int,int) ), this, SLOT( setDate(int,int,int) ) ); 62 connect( picker, SIGNAL( dateClicked(int,int,int) ), this, SLOT( setDate(int,int,int) ) );
60 // connect( m1, SIGNAL( aboutToHide() ), this, SLOT( gotHide() ) ); 63 // connect( m1, SIGNAL( aboutToHide() ), this, SLOT( gotHide() ) );
61 } 64 }
62 picker->setDate( date.year(), date.month(), date.day() ); 65 picker->setDate( date.year(), date.month(), date.day() );
63 m1->popup(mapToGlobal(labelDate->pos()+QPoint(0,labelDate->height()))); 66 m1->popup(mapToGlobal(labelDate->pos()+QPoint(0,labelDate->height())));
64 picker->setFocus(); 67 picker->setFocus();
65} 68}
66 69
67void DateBookWeekHeader::nextMonth() 70void DateBookWeekHeader::nextMonth()
68{ 71{
69 qWarning("nextMonth() " ); 72 Opie::Core::owarn << "nextMonth()" << oendl;
70 setDate(date.addDays(28)); 73 setDate(date.addDays(28));
71} 74}
72void DateBookWeekHeader::prevMonth() 75void DateBookWeekHeader::prevMonth()
73{ 76{
74 qWarning("prevMonth() " ); 77 Opie::Core::owarn << "prevMonth()" << oendl;
75 setDate(date.addDays(-28)); 78 setDate(date.addDays(-28));
76} 79}
77void DateBookWeekHeader::nextWeek() 80void DateBookWeekHeader::nextWeek()
78{ 81{
79 qWarning("nextWeek() " ); 82 Opie::Core::owarn << "nextWeek()" << oendl;
80 setDate(date.addDays(7)); 83 setDate(date.addDays(7));
81} 84}
82void DateBookWeekHeader::prevWeek() 85void DateBookWeekHeader::prevWeek()
83{ 86{
84 qWarning("prevWeek() "); 87 Opie::Core::owarn << "prevWeek()" << oendl;
85 setDate(date.addDays(-7)); 88 setDate(date.addDays(-7));
86} 89}
87 90
88void DateBookWeekHeader::setDate( int y, int m, int d ) 91void DateBookWeekHeader::setDate( int y, int m, int d )
89{ 92{
90 setDate(QDate(y,m,d)); 93 setDate(QDate(y,m,d));
91} 94}
92 95
93void DateBookWeekHeader::setDate(const QDate &d) { 96void DateBookWeekHeader::setDate(const QDate &d) {
94 int year,week,dayofweek; 97 int year,week,dayofweek;
95 date=d; 98 date=d;
96 dayofweek=d.dayOfWeek(); 99 dayofweek=d.dayOfWeek();
97 if(bStartOnMonday) 100 if(bStartOnMonday)
98 dayofweek--; 101 dayofweek--;
99 else if( dayofweek == 7 ) 102 else if( dayofweek == 7 )
100 // we already have the right day -7 would lead to the current week.. 103 // we already have the right day -7 would lead to the current week..
101 dayofweek = 0; 104 dayofweek = 0;
102 105
103 date=date.addDays(-dayofweek); 106 date=date.addDays(-dayofweek);
104 calcWeek(date,week,year,bStartOnMonday); 107 calcWeek(date,week,year,bStartOnMonday);
105 QDate start=date; 108 QDate start=date;
106 QDate stop=start.addDays(6); 109 QDate stop=start.addDays(6);
107 labelDate->setText( QString::number(start.day()) + "." + 110 labelDate->setText( QString::number(start.day()) + "." +
108 Calendar::nameOfMonth( start.month()) + "-" + 111 Calendar::nameOfMonth( start.month()) + "-" +
109 QString::number(stop.day()) + "." + 112 QString::number(stop.day()) + "." +
110 Calendar::nameOfMonth( stop.month()) +" ("+ 113 Calendar::nameOfMonth( stop.month()) +" ("+
111 tr("w")+":"+QString::number( week ) +")"); 114 tr("w")+":"+QString::number( week ) +")");
112 date = d; // bugfix: 0001126 - date has to be the selected date, not monday! 115 date = d; // bugfix: 0001126 - date has to be the selected date, not monday!
113 emit dateChanged(date); 116 emit dateChanged(date);
114} 117}
115 118
116void DateBookWeekHeader::setStartOfWeek( bool onMonday ) 119void DateBookWeekHeader::setStartOfWeek( bool onMonday )
117{ 120{
118 bStartOnMonday = onMonday; 121 bStartOnMonday = onMonday;
119 setDate( date ); 122 setDate( date );
120} 123}
diff --git a/core/pim/datebook/datebookweeklst.cpp b/core/pim/datebook/datebookweeklst.cpp
index abaf3ea..de74d46 100644
--- a/core/pim/datebook/datebookweeklst.cpp
+++ b/core/pim/datebook/datebookweeklst.cpp
@@ -1,54 +1,55 @@
1#include "namespace_hack.h" 1#include "namespace_hack.h"
2#include "datebookweeklst.h" 2#include "datebookweeklst.h"
3 3
4
5#include "datebook.h" 4#include "datebook.h"
6 5
6#include <opie2/odebug.h>
7
7#include <qpe/datebookmonth.h> 8#include <qpe/datebookmonth.h>
8#include <qpe/config.h> 9#include <qpe/config.h>
9#include <qpe/resource.h> 10#include <qpe/resource.h>
10 11
11#include <qlayout.h> 12#include <qlayout.h>
12#include <qtoolbutton.h> 13#include <qtoolbutton.h>
13#include <qtl.h> 14#include <qtl.h>
14 15
15bool calcWeek(const QDate &d, int &week, int &year,bool startOnMonday = false); 16bool calcWeek(const QDate &d, int &week, int &year,bool startOnMonday = false);
16 17
17using namespace Opie::Ui; 18using namespace Opie::Ui;
18DateBookWeekLstHeader::DateBookWeekLstHeader(bool onM, QWidget* parent, const char* name, WFlags fl) 19DateBookWeekLstHeader::DateBookWeekLstHeader(bool onM, QWidget* parent, const char* name, WFlags fl)
19 : DateBookWeekLstHeaderBase(parent, name, fl) 20 : DateBookWeekLstHeaderBase(parent, name, fl)
20{ 21{
21 setBackgroundMode( PaletteButton ); 22 setBackgroundMode( PaletteButton );
22 labelDate->setBackgroundMode( PaletteButton ); 23 labelDate->setBackgroundMode( PaletteButton );
23 forwardweek->setBackgroundMode( PaletteButton ); 24 forwardweek->setBackgroundMode( PaletteButton );
24 forwardweek->setPixmap( Resource::loadPixmap("forward") ); 25 forwardweek->setPixmap( Resource::loadPixmap("forward") );
25 forwardmonth->setBackgroundMode( PaletteButton ); 26 forwardmonth->setBackgroundMode( PaletteButton );
26 forwardmonth->setPixmap( Resource::loadPixmap("fastforward") ); 27 forwardmonth->setPixmap( Resource::loadPixmap("fastforward") );
27 backweek->setBackgroundMode( PaletteButton ); 28 backweek->setBackgroundMode( PaletteButton );
28 backweek->setPixmap( Resource::loadPixmap("back") ); 29 backweek->setPixmap( Resource::loadPixmap("back") );
29 backmonth->setBackgroundMode( PaletteButton ); 30 backmonth->setBackgroundMode( PaletteButton );
30 backmonth->setPixmap( Resource::loadPixmap("fastback") ); 31 backmonth->setPixmap( Resource::loadPixmap("fastback") );
31 DateBookWeekLstHeaderBaseLayout->setSpacing(0); 32 DateBookWeekLstHeaderBaseLayout->setSpacing(0);
32 DateBookWeekLstHeaderBaseLayout->setMargin(0); 33 DateBookWeekLstHeaderBaseLayout->setMargin(0);
33 //setSizePolicy(QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Expanding)); 34 //setSizePolicy(QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Expanding));
34 setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed)); 35 setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed));
35 36
36 connect(backmonth, SIGNAL(clicked()), this, SLOT(prevMonth())); 37 connect(backmonth, SIGNAL(clicked()), this, SLOT(prevMonth()));
37 connect(backweek, SIGNAL(clicked()), this, SLOT(prevWeek())); 38 connect(backweek, SIGNAL(clicked()), this, SLOT(prevWeek()));
38 connect(forwardweek, SIGNAL(clicked()), this, SLOT(nextWeek())); 39 connect(forwardweek, SIGNAL(clicked()), this, SLOT(nextWeek()));
39 connect(forwardmonth, SIGNAL(clicked()), this, SLOT(nextMonth())); 40 connect(forwardmonth, SIGNAL(clicked()), this, SLOT(nextMonth()));
40 connect(labelDate, SIGNAL(clicked()), this, SLOT(pickDate())); 41 connect(labelDate, SIGNAL(clicked()), this, SLOT(pickDate()));
41 connect(dbl, SIGNAL(toggled(bool)), this, SIGNAL(setDbl(bool))); 42 connect(dbl, SIGNAL(toggled(bool)), this, SIGNAL(setDbl(bool)));
42 bStartOnMonday=onM; 43 bStartOnMonday=onM;
43} 44}
44DateBookWeekLstHeader::~DateBookWeekLstHeader(){} 45DateBookWeekLstHeader::~DateBookWeekLstHeader(){}
45 46
46void DateBookWeekLstHeader::setDate(const QDate &d) { 47void DateBookWeekLstHeader::setDate(const QDate &d) {
47 int year,week,dayofweek; 48 int year,week,dayofweek;
48 date=d; 49 date=d;
49 dayofweek=d.dayOfWeek(); 50 dayofweek=d.dayOfWeek();
50 if(bStartOnMonday) 51 if(bStartOnMonday)
51 dayofweek--; 52 dayofweek--;
52 else if( dayofweek == 7 ) 53 else if( dayofweek == 7 )
53 /* we already have the right day -7 would lead to the same week */ 54 /* we already have the right day -7 would lead to the same week */
54 dayofweek = 0; 55 dayofweek = 0;
@@ -114,146 +115,146 @@ DateBookWeekLstDayHdr::DateBookWeekLstDayHdr(const QDate &d, bool /* onM */,
114 115
115 //dont use dayOfWeek() to save space ! 116 //dont use dayOfWeek() to save space !
116 label->setText( QString(QObject::tr(QString(QChar(day)))) + " " +QString::number(d.day()) ); 117 label->setText( QString(QObject::tr(QString(QChar(day)))) + " " +QString::number(d.day()) );
117 118
118 add->setText("+"); 119 add->setText("+");
119 120
120 if (d == QDate::currentDate()) { 121 if (d == QDate::currentDate()) {
121 QPalette pal=label->palette(); 122 QPalette pal=label->palette();
122 pal.setColor(QColorGroup::Foreground, QColor(0,0,255)); 123 pal.setColor(QColorGroup::Foreground, QColor(0,0,255));
123 label->setPalette(pal); 124 label->setPalette(pal);
124 125
125 /* 126 /*
126 QFont f=label->font(); 127 QFont f=label->font();
127 f.setItalic(true); 128 f.setItalic(true);
128 label->setFont(f); 129 label->setFont(f);
129 label->setPalette(QPalette(QColor(0,0,255),label->backgroundColor())); 130 label->setPalette(QPalette(QColor(0,0,255),label->backgroundColor()));
130 */ 131 */
131 } else if (d.dayOfWeek() == 7) { // FIXME: Match any holiday 132 } else if (d.dayOfWeek() == 7) { // FIXME: Match any holiday
132 QPalette pal=label->palette(); 133 QPalette pal=label->palette();
133 pal.setColor(QColorGroup::Foreground, QColor(255,0,0)); 134 pal.setColor(QColorGroup::Foreground, QColor(255,0,0));
134 label->setPalette(pal); 135 label->setPalette(pal);
135 } 136 }
136 137
137 connect (label, SIGNAL(clicked()), this, SLOT(showDay())); 138 connect (label, SIGNAL(clicked()), this, SLOT(showDay()));
138 connect (add, SIGNAL(clicked()), this, SLOT(newEvent())); 139 connect (add, SIGNAL(clicked()), this, SLOT(newEvent()));
139} 140}
140 141
141void DateBookWeekLstDayHdr::showDay() { 142void DateBookWeekLstDayHdr::showDay() {
142 emit showDate(date.year(), date.month(), date.day()); 143 emit showDate(date.year(), date.month(), date.day());
143} 144}
144 145
145void DateBookWeekLstDayHdr::newEvent() { 146void DateBookWeekLstDayHdr::newEvent() {
146 QDateTime start, stop; 147 QDateTime start, stop;
147 start=stop=date; 148 start=stop=date;
148 start.setTime(QTime(10,0)); 149 start.setTime(QTime(10,0));
149 stop.setTime(QTime(12,0)); 150 stop.setTime(QTime(12,0));
150 151
151 emit addEvent(start,stop,"",0); 152 emit addEvent(start,stop,"",0);
152} 153}
153DateBookWeekLstEvent::DateBookWeekLstEvent(const EffectiveEvent &ev, 154DateBookWeekLstEvent::DateBookWeekLstEvent(const EffectiveEvent &ev,
154 int weeklistviewconfig, 155 int weeklistviewconfig,
155 QWidget* parent, 156 QWidget* parent,
156 const char* name, 157 const char* name,
157 WFlags fl ) : OClickableLabel(parent,name,fl), event(ev) 158 WFlags fl ) : OClickableLabel(parent,name,fl), event(ev)
158{ 159{
159 // old values... lastday = "__|__", middle=" |---", Firstday="00:00", 160 // old values... lastday = "__|__", middle=" |---", Firstday="00:00",
160 QString s,start,middle,end,day; 161 QString s,start,middle,end,day;
161 162
162 qDebug("weeklistviewconfig=%d",weeklistviewconfig); 163 Opie::Core::odebug << "weeklistviewconfig=" << weeklistviewconfig << oendl;
163 if(weeklistviewconfig==NONE) {// No times displayed. 164 if(weeklistviewconfig==NONE) {// No times displayed.
164 // start.sprintf("%.2d:%.2d-",ev.start().hour(),ev.start().minute()); 165 // start.sprintf("%.2d:%.2d-",ev.start().hour(),ev.start().minute());
165 // middle.sprintf("<--->"); 166 // middle.sprintf("<--->");
166 // end.sprintf("-%.2d:%.2d",ev.end().hour(),ev.end().minute()); 167 // end.sprintf("-%.2d:%.2d",ev.end().hour(),ev.end().minute());
167 // day.sprintf("%.2d:%.2d-%.2d:%.2d",ev.start().hour(),ev.start().minute(),ev.end().hour(),ev.end().minute()); 168 // day.sprintf("%.2d:%.2d-%.2d:%.2d",ev.start().hour(),ev.start().minute(),ev.end().hour(),ev.end().minute());
168 } else if(weeklistviewconfig==NORMAL) {// "Normal", only display start time. 169 } else if(weeklistviewconfig==NORMAL) {// "Normal", only display start time.
169 start.sprintf("%.2d:%.2d",ev.start().hour(),ev.start().minute()); 170 start.sprintf("%.2d:%.2d",ev.start().hour(),ev.start().minute());
170 middle.sprintf(" |---"); 171 middle.sprintf(" |---");
171 end.sprintf("__|__"); 172 end.sprintf("__|__");
172 day.sprintf("%.2d:%.2d",ev.start().hour(),ev.start().minute()); 173 day.sprintf("%.2d:%.2d",ev.start().hour(),ev.start().minute());
173 } else if(weeklistviewconfig==EXTENDED) { // Extended mode, display start and end times. 174 } else if(weeklistviewconfig==EXTENDED) { // Extended mode, display start and end times.
174 start.sprintf("%.2d:%.2d-",ev.start().hour(),ev.start().minute()); 175 start.sprintf("%.2d:%.2d-",ev.start().hour(),ev.start().minute());
175 middle.sprintf("<--->"); 176 middle.sprintf("<--->");
176 end.sprintf("-%.2d:%.2d",ev.end().hour(),ev.end().minute()); 177 end.sprintf("-%.2d:%.2d",ev.end().hour(),ev.end().minute());
177 day.sprintf("%.2d:%.2d-%.2d:%.2d",ev.start().hour(),ev.start().minute(),ev.end().hour(),ev.end().minute()); 178 day.sprintf("%.2d:%.2d-%.2d:%.2d",ev.start().hour(),ev.start().minute(),ev.end().hour(),ev.end().minute());
178 } 179 }
179 180
180 if(ev.event().type() == Event::Normal) { 181 if(ev.event().type() == Event::Normal) {
181 if(ev.startDate()==ev.date() && ev.endDate()==ev.date()) {// day event. 182 if(ev.startDate()==ev.date() && ev.endDate()==ev.date()) {// day event.
182 s=day; 183 s=day;
183 } else if(ev.startDate()==ev.date()) {// start event. 184 } else if(ev.startDate()==ev.date()) {// start event.
184 s=start; 185 s=start;
185 } else if(ev.endDate()==ev.date()) { // end event. 186 } else if(ev.endDate()==ev.date()) { // end event.
186 s=end; 187 s=end;
187 } else {// middle day. 188 } else {// middle day.
188 s=middle; 189 s=middle;
189 } 190 }
190 } else { 191 } else {
191 s=""; 192 s="";
192 } 193 }
193 setText(QString(s) + " " + ev.description()); 194 setText(QString(s) + " " + ev.description());
194 connect(this, SIGNAL(clicked()), this, SLOT(editMe())); 195 connect(this, SIGNAL(clicked()), this, SLOT(editMe()));
195 setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) ); 196 setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) );
196} 197}
197void DateBookWeekLstEvent::editMe() { 198void DateBookWeekLstEvent::editMe() {
198 emit editEvent(event.event()); 199 emit editEvent(event.event());
199} 200}
200 201
201 202
202DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev, 203DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev,
203 const QDate &d, bool onM, 204 const QDate &d, bool onM,
204 QWidget* parent, 205 QWidget* parent,
205 const char* name, WFlags fl) 206 const char* name, WFlags fl)
206 : QWidget( parent, name, fl ) 207 : QWidget( parent, name, fl )
207{ 208{
208 Config config("DateBook"); 209 Config config("DateBook");
209 config.setGroup("Main"); 210 config.setGroup("Main");
210 int weeklistviewconfig=config.readNumEntry("weeklistviewconfig", NORMAL); 211 int weeklistviewconfig=config.readNumEntry("weeklistviewconfig", NORMAL);
211 qDebug("Read weeklistviewconfig: %d",weeklistviewconfig); 212 Opie::Core::odebug << "weeklistviewconfig: " << weeklistviewconfig << oendl;
212 213
213 bStartOnMonday=onM; 214 bStartOnMonday=onM;
214 setPalette(white); 215 setPalette(white);
215 setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding)); 216 setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding));
216 217
217 QVBoxLayout *layout = new QVBoxLayout( this ); 218 QVBoxLayout *layout = new QVBoxLayout( this );
218 219
219 qBubbleSort(ev); 220 qBubbleSort(ev);
220 QValueListIterator<EffectiveEvent> it; 221 QValueListIterator<EffectiveEvent> it;
221 it=ev.begin(); 222 it=ev.begin();
222 223
223 int dayOrder[7]; 224 int dayOrder[7];
224 if (bStartOnMonday) { 225 if (bStartOnMonday) {
225 for (int d=0; d<7; d++) dayOrder[d]=d+1; 226 for (int d=0; d<7; d++) dayOrder[d]=d+1;
226 } else { 227 } else {
227 for (int d=0; d<7; d++) dayOrder[d]=d; 228 for (int d=0; d<7; d++) dayOrder[d]=d;
228 dayOrder[0]=7; 229 dayOrder[0]=7;
229 } 230 }
230 231
231 // Calculate offset to first day of week. 232 // Calculate offset to first day of week.
232 int dayoffset=d.dayOfWeek(); 233 int dayoffset=d.dayOfWeek();
233 if(bStartOnMonday) dayoffset--; 234 if(bStartOnMonday) dayoffset--;
234 else if( dayoffset == 7 ) dayoffset = 0; 235 else if( dayoffset == 7 ) dayoffset = 0;
235 236
236 for (int i=0; i<7; i++) { 237 for (int i=0; i<7; i++) {
237 // Header 238 // Header
238 DateBookWeekLstDayHdr *hdr=new DateBookWeekLstDayHdr(d.addDays(i-dayoffset), bStartOnMonday,this); 239 DateBookWeekLstDayHdr *hdr=new DateBookWeekLstDayHdr(d.addDays(i-dayoffset), bStartOnMonday,this);
239 connect(hdr, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int))); 240 connect(hdr, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int)));
240 connect(hdr, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)), 241 connect(hdr, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)),
241 this, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&))); 242 this, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)));
242 layout->addWidget(hdr); 243 layout->addWidget(hdr);
243 244
244 // Events 245 // Events
245 while ( (*it).date().dayOfWeek() == dayOrder[i] && it!=ev.end() ) { 246 while ( (*it).date().dayOfWeek() == dayOrder[i] && it!=ev.end() ) {
246 if(!(((*it).end().hour()==0) && ((*it).end().minute()==0) && ((*it).startDate()!=(*it).date()))) {// Skip events ending at 00:00 starting at another day. 247 if(!(((*it).end().hour()==0) && ((*it).end().minute()==0) && ((*it).startDate()!=(*it).date()))) {// Skip events ending at 00:00 starting at another day.
247 DateBookWeekLstEvent *l=new DateBookWeekLstEvent(*it,weeklistviewconfig,this); 248 DateBookWeekLstEvent *l=new DateBookWeekLstEvent(*it,weeklistviewconfig,this);
248 layout->addWidget(l); 249 layout->addWidget(l);
249 connect (l, SIGNAL(editEvent(const Event&)), this, SIGNAL(editEvent(const Event&))); 250 connect (l, SIGNAL(editEvent(const Event&)), this, SIGNAL(editEvent(const Event&)));
250 } 251 }
251 it++; 252 it++;
252 } 253 }
253 layout->addItem(new QSpacerItem(1,1, QSizePolicy::Minimum, QSizePolicy::Expanding)); 254 layout->addItem(new QSpacerItem(1,1, QSizePolicy::Minimum, QSizePolicy::Expanding));
254 } 255 }
255} 256}
256DateBookWeekLstView::~DateBookWeekLstView(){} 257DateBookWeekLstView::~DateBookWeekLstView(){}
257void DateBookWeekLstView::keyPressEvent(QKeyEvent *e) {e->ignore();} 258void DateBookWeekLstView::keyPressEvent(QKeyEvent *e) {e->ignore();}
258 259
259DateBookWeekLstDblView::DateBookWeekLstDblView(QValueList<EffectiveEvent> &ev1, 260DateBookWeekLstDblView::DateBookWeekLstDblView(QValueList<EffectiveEvent> &ev1,
diff --git a/core/pim/datebook/dateentryimpl.cpp b/core/pim/datebook/dateentryimpl.cpp
index 7b4716f..42bdbe2 100644
--- a/core/pim/datebook/dateentryimpl.cpp
+++ b/core/pim/datebook/dateentryimpl.cpp
@@ -1,81 +1,83 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include "namespace_hack.h" 21#include "namespace_hack.h"
22#include "dateentryimpl.h" 22#include "dateentryimpl.h"
23#include "repeatentry.h" 23#include "repeatentry.h"
24 24
25#include <opie2/odebug.h>
26#include <opie2/otimepicker.h>
27
25#include <qpe/qpeapplication.h> 28#include <qpe/qpeapplication.h>
26#include <qpe/categoryselect.h> 29#include <qpe/categoryselect.h>
27#include <qpe/datebookmonth.h> 30#include <qpe/datebookmonth.h>
28#include <qpe/tzselect.h> 31#include <qpe/tzselect.h>
29 32
30#include <qlineedit.h> 33#include <qlineedit.h>
31#include <qspinbox.h> 34#include <qspinbox.h>
32 35
33#include <opie2/otimepicker.h>
34#include "onoteedit.h" 36#include "onoteedit.h"
35 37
36#include <stdlib.h> 38#include <stdlib.h>
37#include <stdio.h> 39#include <stdio.h>
38 40
39/* 41/*
40 * Constructs a DateEntry which is a child of 'parent', with the 42 * Constructs a DateEntry which is a child of 'parent', with the
41 * name 'name' and widget flags set to 'f' 43 * name 'name' and widget flags set to 'f'
42 * 44 *
43 * The dialog will by default be modeless, unless you set 'modal' to 45 * The dialog will by default be modeless, unless you set 'modal' to
44 * TRUE to construct a modal dialog. 46 * TRUE to construct a modal dialog.
45 */ 47 */
46 48
47DateEntry::DateEntry( bool startOnMonday, const QDateTime &start, 49DateEntry::DateEntry( bool startOnMonday, const QDateTime &start,
48 const QDateTime &end, bool whichClock, QWidget* parent, 50 const QDateTime &end, bool whichClock, QWidget* parent,
49 const char* name ) 51 const char* name )
50 : DateEntryBase( parent, name ), 52 : DateEntryBase( parent, name ),
51 ampm( whichClock ), 53 ampm( whichClock ),
52 startWeekOnMonday( startOnMonday ), 54 startWeekOnMonday( startOnMonday ),
53 m_showStart(true) 55 m_showStart(true)
54{ 56{
55 init(); 57 init();
56 setDates(start,end); 58 setDates(start,end);
57 setFocusProxy(comboDescription); 59 setFocusProxy(comboDescription);
58} 60}
59 61
60bool DateEntry::eventFilter(QObject *obj, QEvent *ev ) 62bool DateEntry::eventFilter(QObject *obj, QEvent *ev )
61{ 63{
62 if( ev->type() == QEvent::FocusIn ){ 64 if( ev->type() == QEvent::FocusIn ){
63 if( obj == comboStart ){ 65 if( obj == comboStart ){
64 timePickerStart->setHour(startTime.hour()); 66 timePickerStart->setHour(startTime.hour());
65 timePickerStart->setMinute(startTime.minute()); 67 timePickerStart->setMinute(startTime.minute());
66 TimePickerLabel->setText( tr("Start Time" ) ); 68 TimePickerLabel->setText( tr("Start Time" ) );
67 m_showStart= true; 69 m_showStart= true;
68 }else if( obj == comboEnd ){ 70 }else if( obj == comboEnd ){
69 timePickerStart->setHour(endTime.hour()); 71 timePickerStart->setHour(endTime.hour());
70 timePickerStart->setMinute(endTime.minute()); 72 timePickerStart->setMinute(endTime.minute());
71 TimePickerLabel->setText( tr("End Time") ); 73 TimePickerLabel->setText( tr("End Time") );
72 m_showStart = false; 74 m_showStart = false;
73 } 75 }
74 } else if( ev->type() == QEvent::FocusOut ){ 76 } else if( ev->type() == QEvent::FocusOut ){
75// if( obj == comboEnd ){ 77// if( obj == comboEnd ){
76// QString s; 78// QString s;
77// s.sprintf("%.2d:%.2d",endTime.hour(), endTime.minute()); 79// s.sprintf("%.2d:%.2d",endTime.hour(), endTime.minute());
78// comboEnd->setText(s); 80// comboEnd->setText(s);
79// } 81// }
80// else if( obj == comboStart ){ 82// else if( obj == comboStart ){
81// QString s; 83// QString s;
@@ -384,115 +386,115 @@ void DateEntry::slotRepeat()
384 386
385 if ( QPEApplication::execDialog( e ) ) { 387 if ( QPEApplication::execDialog( e ) ) {
386 rp = e->repeatPattern(); 388 rp = e->repeatPattern();
387 setRepeatLabel(); 389 setRepeatLabel();
388 } 390 }
389 // deleting sounds like a nice idea... 391 // deleting sounds like a nice idea...
390 delete e; 392 delete e;
391} 393}
392 394
393void DateEntry::slotChangeStartOfWeek( bool onMonday ) 395void DateEntry::slotChangeStartOfWeek( bool onMonday )
394{ 396{
395 startWeekOnMonday = onMonday; 397 startWeekOnMonday = onMonday;
396} 398}
397 399
398Event DateEntry::event() 400Event DateEntry::event()
399{ 401{
400 Event ev; 402 Event ev;
401 Event::SoundTypeChoice st; 403 Event::SoundTypeChoice st;
402 ev.setDescription( comboDescription->currentText() ); 404 ev.setDescription( comboDescription->currentText() );
403 ev.setLocation( comboLocation->currentText() ); 405 ev.setLocation( comboLocation->currentText() );
404 ev.setCategories( comboCategory->currentCategories() ); 406 ev.setCategories( comboCategory->currentCategories() );
405 ev.setType( checkAllDay->isChecked() ? Event::AllDay : Event::Normal ); 407 ev.setType( checkAllDay->isChecked() ? Event::AllDay : Event::Normal );
406 if ( startDate > endDate ) { 408 if ( startDate > endDate ) {
407 QDate tmp = endDate; 409 QDate tmp = endDate;
408 endDate = startDate; 410 endDate = startDate;
409 startDate = tmp; 411 startDate = tmp;
410 } 412 }
411 413
412 // This is now done in the changed slots 414 // This is now done in the changed slots
413 // startTime = parseTime( comboStart->text(), ampm ); 415 // startTime = parseTime( comboStart->text(), ampm );
414 //endTime = parseTime( comboEnd->text(), ampm ); 416 //endTime = parseTime( comboEnd->text(), ampm );
415 417
416 if ( startTime > endTime && endDate == startDate ) { 418 if ( startTime > endTime && endDate == startDate ) {
417 QTime tmp = endTime; 419 QTime tmp = endTime;
418 endTime = startTime; 420 endTime = startTime;
419 startTime = tmp; 421 startTime = tmp;
420 } 422 }
421 // don't set the time if theres no need too 423 // don't set the time if theres no need too
422 if ( ev.type() == Event::AllDay ) { 424 if ( ev.type() == Event::AllDay ) {
423 startTime.setHMS( 0, 0, 0 ); 425 startTime.setHMS( 0, 0, 0 );
424 endTime.setHMS( 23, 59, 59 ); 426 endTime.setHMS( 23, 59, 59 );
425 } 427 }
426 428
427 // adjust start and end times based on timezone 429 // adjust start and end times based on timezone
428 QDateTime start( startDate, startTime ); 430 QDateTime start( startDate, startTime );
429 QDateTime end( endDate, endTime ); 431 QDateTime end( endDate, endTime );
430 time_t start_utc, end_utc; 432 time_t start_utc, end_utc;
431 433
432// qDebug( "tz: %s", timezone->currentZone().latin1() ); 434 //Opie::Core::odebug << "tz: " << timezone->currentZone() << oendl;
433 435
434 // get real timezone 436 // get real timezone
435 QString realTZ; 437 QString realTZ;
436 realTZ = QString::fromLocal8Bit( getenv("TZ") ); 438 realTZ = QString::fromLocal8Bit( getenv("TZ") );
437 439
438 // set timezone 440 // set timezone
439 if ( setenv( "TZ", timezone->currentZone(), true ) != 0 ) 441 if ( setenv( "TZ", timezone->currentZone(), true ) != 0 )
440 qWarning( "There was a problem setting the timezone." ); 442 Opie::Core::owarn << "There was a problem setting the timezone." << oendl;
441 443
442 // convert to UTC based on selected TZ (calling tzset internally) 444 // convert to UTC based on selected TZ (calling tzset internally)
443 start_utc = TimeConversion::toUTC( start ); 445 start_utc = TimeConversion::toUTC( start );
444 end_utc = TimeConversion::toUTC( end ); 446 end_utc = TimeConversion::toUTC( end );
445 447
446 // done playing around... put it all back 448 // done playing around... put it all back
447 unsetenv( "TZ" ); 449 unsetenv( "TZ" );
448 if ( !realTZ.isNull() ) 450 if ( !realTZ.isNull() )
449 if ( setenv( "TZ", realTZ, true ) != 0 ) 451 if ( setenv( "TZ", realTZ, true ) != 0 )
450 qWarning( "There was a problem setting the timezone." ); 452 Opie::Core::owarn << "There was a problem setting the timezone." << oendl;
451 453
452 // convert UTC to local time (calling tzset internally) 454 // convert UTC to local time (calling tzset internally)
453 ev.setStart( TimeConversion::fromUTC( start_utc ) ); 455 ev.setStart( TimeConversion::fromUTC( start_utc ) );
454 ev.setEnd( TimeConversion::fromUTC( end_utc ) ); 456 ev.setEnd( TimeConversion::fromUTC( end_utc ) );
455 457
456 // we only have one type of sound at the moment... LOUD!!! 458 // we only have one type of sound at the moment... LOUD!!!
457 if ( comboSound->currentItem() != 0 ) 459 if ( comboSound->currentItem() != 0 )
458 st = Event::Loud; 460 st = Event::Loud;
459 else 461 else
460 st = Event::Silent; 462 st = Event::Silent;
461 ev.setAlarm( checkAlarm->isChecked(), spinAlarm->value(), st ); 463 ev.setAlarm( checkAlarm->isChecked(), spinAlarm->value(), st );
462 if ( rp.type != Event::NoRepeat ) 464 if ( rp.type != Event::NoRepeat )
463 ev.setRepeat( TRUE, rp ); 465 ev.setRepeat( TRUE, rp );
464 ev.setNotes( noteStr ); 466 ev.setNotes( noteStr );
465 467
466 //cout << "Start: " << comboStart->currentText() << endl; 468 //cout << "Start: " << comboStart->currentText() << endl;
467 469
468 return ev; 470 return ev;
469} 471}
470 472
471void DateEntry::setRepeatLabel() 473void DateEntry::setRepeatLabel()
472{ 474{
473 475
474 switch( rp.type ) { 476 switch( rp.type ) {
475 case Event::Daily: 477 case Event::Daily:
476 cmdRepeat->setText( tr("Daily...") ); 478 cmdRepeat->setText( tr("Daily...") );
477 break; 479 break;
478 case Event::Weekly: 480 case Event::Weekly:
479 cmdRepeat->setText( tr("Weekly...") ); 481 cmdRepeat->setText( tr("Weekly...") );
480 break; 482 break;
481 case Event::MonthlyDay: 483 case Event::MonthlyDay:
482 case Event::MonthlyDate: 484 case Event::MonthlyDate:
483 cmdRepeat->setText( tr("Monthly...") ); 485 cmdRepeat->setText( tr("Monthly...") );
484 break; 486 break;
485 case Event::Yearly: 487 case Event::Yearly:
486 cmdRepeat->setText( tr("Yearly...") ); 488 cmdRepeat->setText( tr("Yearly...") );
487 break; 489 break;
488 default: 490 default:
489 cmdRepeat->setText( tr("No Repeat...") ); 491 cmdRepeat->setText( tr("No Repeat...") );
490 } 492 }
491} 493}
492 494
493void DateEntry::setAlarmEnabled( bool alarmPreset, int presetTime, Event::SoundTypeChoice sound ) 495void DateEntry::setAlarmEnabled( bool alarmPreset, int presetTime, Event::SoundTypeChoice sound )
494{ 496{
495 checkAlarm->setChecked( alarmPreset ); 497 checkAlarm->setChecked( alarmPreset );
496 spinAlarm->setValue( presetTime ); 498 spinAlarm->setValue( presetTime );
497 if ( sound != Event::Silent ) 499 if ( sound != Event::Silent )
498 comboSound->setCurrentItem( 1 ); 500 comboSound->setCurrentItem( 1 );
diff --git a/core/pim/datebook/opie-datebook.control b/core/pim/datebook/opie-datebook.control
index 730b09d..acf28a7 100644
--- a/core/pim/datebook/opie-datebook.control
+++ b/core/pim/datebook/opie-datebook.control
@@ -1,11 +1,11 @@
1Package: opie-datebook 1Package: opie-datebook
2Files: plugins/application/libdatebook.so* bin/datebook apps/1Pim/datebook.desktop 2Files: plugins/application/libdatebook.so* bin/datebook apps/1Pim/datebook.desktop
3Priority: optional 3Priority: optional
4Section: opie/pim 4Section: opie/pim
5Conflicts: qpe-tkccalendar 5Conflicts: qpe-tkccalendar
6Maintainer: Holger 'Zecke' Freyther <zecke@handhelds.org> 6Maintainer: Holger 'Zecke' Freyther <zecke@handhelds.org>
7Architecture: arm 7Architecture: arm
8Depends: task-opie-minimal, libopiecore2, libopieui2,libopiepim2, opie-pics 8Depends: task-opie-minimal, libopiecore2, libopieui2, libopiepim2, opie-pics
9Description: A datebook/appointment manager 9Description: A datebook/appointment manager
10 A datebook/appointment manager for the Opie environment. 10 A datebook/appointment manager for the Opie environment.
11Version: $QPE_VERSION$EXTRAVERSION 11Version: $QPE_VERSION$EXTRAVERSION