summaryrefslogtreecommitdiff
authorhakan <hakan>2002-03-26 19:05:31 (UTC)
committer hakan <hakan>2002-03-26 19:05:31 (UTC)
commit78211642003f70797a5faa1767a5ab2f5f83606f (patch) (unidiff)
tree703df6b1f8a98dbd00066ab3c21419b7f97e41b4
parentdbbbe1c0600422e4bd2d6a6aba271476f457ed97 (diff)
downloadopie-78211642003f70797a5faa1767a5ab2f5f83606f.zip
opie-78211642003f70797a5faa1767a5ab2f5f83606f.tar.gz
opie-78211642003f70797a5faa1767a5ab2f5f83606f.tar.bz2
Added shortcut buttons to set the start time
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/datebook/clickablelabel.cpp71
-rw-r--r--core/pim/datebook/clickablelabel.h10
-rw-r--r--core/pim/datebook/datebook.cpp11
-rw-r--r--core/pim/datebook/datebook.pro6
-rw-r--r--core/pim/datebook/dateentry.ui641
-rw-r--r--core/pim/datebook/dateentryimpl.cpp97
-rw-r--r--core/pim/datebook/dateentryimpl.h7
-rw-r--r--core/pim/datebook/timepicker.cpp119
-rw-r--r--core/pim/datebook/timepicker.h32
9 files changed, 342 insertions, 652 deletions
diff --git a/core/pim/datebook/clickablelabel.cpp b/core/pim/datebook/clickablelabel.cpp
index 6912c34..1dd0d15 100644
--- a/core/pim/datebook/clickablelabel.cpp
+++ b/core/pim/datebook/clickablelabel.cpp
@@ -1,31 +1,88 @@
1#include "clickablelabel.h" 1#include "clickablelabel.h"
2#include <stdio.h>
2 3
3ClickableLabel::ClickableLabel(QWidget* parent = 0, 4ClickableLabel::ClickableLabel(QWidget* parent = 0,
4 const char* name = 0, 5 const char* name = 0,
5 WFlags fl = 0) : 6 WFlags fl = 0) :
6 QLabel(parent,name,fl) 7 QLabel(parent,name,fl)
7{ 8{
8 setFrameShape(NoFrame); 9 textInverted=false;
10 isToggle=false;
11 isDown=false;
12 showState(false);
9 setFrameShadow(Sunken); 13 setFrameShadow(Sunken);
10} 14}
11 15
16void ClickableLabel::setToggleButton(bool t) {
17 isToggle=t;
18}
19
12void ClickableLabel::mousePressEvent( QMouseEvent *e ) { 20void ClickableLabel::mousePressEvent( QMouseEvent *e ) {
13 setFrameShape(Panel); 21 if (isToggle && isDown) {
14 repaint(); 22 showState(false);
23 } else {
24 showState(true);
25 }
15} 26}
16 27
17void ClickableLabel::mouseReleaseEvent( QMouseEvent *e ) { 28void ClickableLabel::mouseReleaseEvent( QMouseEvent *e ) {
18 setFrameShape(NoFrame); 29 if (rect().contains(e->pos()) && isToggle) isDown=!isDown;
19 repaint(); 30
31 if (isToggle && isDown) {
32 showState(true);
33 } else {
34 showState(false);
35 }
36
20 if (rect().contains(e->pos())) { 37 if (rect().contains(e->pos())) {
38 if (isToggle) {
39 emit toggled(isDown);
40 }
21 emit clicked(); 41 emit clicked();
22 } 42 }
23} 43}
24 44
25void ClickableLabel::mouseMoveEvent( QMouseEvent *e ) { 45void ClickableLabel::mouseMoveEvent( QMouseEvent *e ) {
26 if (rect().contains(e->pos())) { 46 if (rect().contains(e->pos())) {
27 setFrameShape(Panel); 47 if (isToggle && isDown) {
48 showState(false);
49 } else {
50 showState(true);
51 }
28 } else { 52 } else {
29 setFrameShape(NoFrame); 53 if (isToggle && isDown) {
54 showState(true);
55 } else {
56 showState(false);
57 }
30 } 58 }
31} 59}
60
61void ClickableLabel::showState(bool on) {
62 if (on) {
63 //setFrameShape(Panel);
64 setInverted(true);
65 setBackgroundMode(PaletteHighlight);
66 } else {
67 //setFrameShape(NoFrame);
68 setInverted(false);
69 setBackgroundMode(PaletteBackground);
70 }
71 repaint();
72}
73
74void ClickableLabel::setInverted(bool on) {
75 if ( (!textInverted && on) || (textInverted && !on) ) {
76 QPalette pal=palette();
77 QColor col=pal.color(QPalette::Normal, QColorGroup::Foreground);
78 col.setRgb(255-col.red(),255-col.green(),255-col.blue());
79 pal.setColor(QPalette::Normal, QColorGroup::Foreground, col);
80 setPalette(pal);
81 textInverted=!textInverted;
82 }
83}
84
85void ClickableLabel::setOn(bool on) {
86 isDown=on;
87 showState(isDown);
88}
diff --git a/core/pim/datebook/clickablelabel.h b/core/pim/datebook/clickablelabel.h
index b6d33ad..d00fee6 100644
--- a/core/pim/datebook/clickablelabel.h
+++ b/core/pim/datebook/clickablelabel.h
@@ -1,20 +1,30 @@
1#ifndef CLICKABLELABEL 1#ifndef CLICKABLELABEL
2#define CLICKABLELABEL 2#define CLICKABLELABEL
3 3
4#include <qlabel.h> 4#include <qlabel.h>
5 5
6class ClickableLabel: public QLabel 6class ClickableLabel: public QLabel
7{ 7{
8 Q_OBJECT 8 Q_OBJECT
9public: 9public:
10 ClickableLabel(QWidget* parent = 0, const char* name = 0, 10 ClickableLabel(QWidget* parent = 0, const char* name = 0,
11 WFlags fl = 0); 11 WFlags fl = 0);
12 void setToggleButton(bool t);
12 protected: 13 protected:
13 void mousePressEvent( QMouseEvent *e ); 14 void mousePressEvent( QMouseEvent *e );
14 void mouseReleaseEvent( QMouseEvent *e ); 15 void mouseReleaseEvent( QMouseEvent *e );
15 void mouseMoveEvent( QMouseEvent *e ); 16 void mouseMoveEvent( QMouseEvent *e );
17 public slots:
18 void setOn(bool on);
16 signals: 19 signals:
17 void clicked(); 20 void clicked();
21 void toggled(bool on);
22 private:
23 bool isToggle;
24 bool isDown;
25 void showState(bool on);
26 bool textInverted;
27 void setInverted(bool on);
18}; 28};
19 29
20#endif 30#endif
diff --git a/core/pim/datebook/datebook.cpp b/core/pim/datebook/datebook.cpp
index 92dbdc8..2deb96f 100644
--- a/core/pim/datebook/datebook.cpp
+++ b/core/pim/datebook/datebook.cpp
@@ -1,612 +1,623 @@
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 <qpe/datebookmonth.h> 32#include <qpe/datebookmonth.h>
33#include <qpe/qpeapplication.h> 33#include <qpe/qpeapplication.h>
34#include <qpe/config.h> 34#include <qpe/config.h>
35#include <qpe/qpedebug.h> 35#include <qpe/qpedebug.h>
36#include <qpe/event.h> 36#include <qpe/event.h>
37#include <qpe/finddialog.h> 37#include <qpe/finddialog.h>
38#include <qpe/ir.h> 38#include <qpe/ir.h>
39#include <qpe/qpemenubar.h> 39#include <qpe/qpemenubar.h>
40#include <qpe/qpemessagebox.h> 40#include <qpe/qpemessagebox.h>
41#include <qpe/resource.h> 41#include <qpe/resource.h>
42#include <qpe/sound.h> 42#include <qpe/sound.h>
43#include <qpe/timestring.h> 43#include <qpe/timestring.h>
44#include <qpe/qpetoolbar.h> 44#include <qpe/qpetoolbar.h>
45#include <qpe/tzselect.h> 45#include <qpe/tzselect.h>
46#include <qpe/xmlreader.h> 46#include <qpe/xmlreader.h>
47 47
48#include <qaction.h> 48#include <qaction.h>
49#include <qcopchannel_qws.h> 49#include <qcopchannel_qws.h>
50#include <qdatetime.h> 50#include <qdatetime.h>
51#include <qdialog.h> 51#include <qdialog.h>
52#include <qfile.h> 52#include <qfile.h>
53#include <qlabel.h> 53#include <qlabel.h>
54#include <qlayout.h> 54#include <qlayout.h>
55#include <qmessagebox.h> 55#include <qmessagebox.h>
56#include <qpopupmenu.h> 56#include <qpopupmenu.h>
57#include <qpushbutton.h> 57#include <qpushbutton.h>
58#include <qtextcodec.h> 58#include <qtextcodec.h>
59#include <qtextstream.h> 59#include <qtextstream.h>
60#include <qtl.h> 60#include <qtl.h>
61#include <qwidgetstack.h> 61#include <qwidgetstack.h>
62#include <qwindowsystem_qws.h> 62#include <qwindowsystem_qws.h>
63 63
64#include <sys/stat.h> 64#include <sys/stat.h>
65#include <sys/types.h> 65#include <sys/types.h>
66#include <fcntl.h> 66#include <fcntl.h>
67#include <unistd.h> 67#include <unistd.h>
68 68
69#include <stdlib.h> 69#include <stdlib.h>
70 70
71#define DAY 1 71#define DAY 1
72#define WEEK 2 72#define WEEK 2
73#define WEEKLST 4 73#define WEEKLST 4
74#define MONTH 3 74#define MONTH 3
75 75
76 76
77DateBook::DateBook( QWidget *parent, const char *, WFlags f ) 77DateBook::DateBook( QWidget *parent, const char *, WFlags f )
78 : QMainWindow( parent, "datebook", f ), 78 : QMainWindow( parent, "datebook", f ),
79 aPreset( FALSE ), 79 aPreset( FALSE ),
80 presetTime( -1 ), 80 presetTime( -1 ),
81 startTime( 8 ), // an acceptable default 81 startTime( 8 ), // an acceptable default
82 syncing(FALSE), 82 syncing(FALSE),
83 inSearch(FALSE) 83 inSearch(FALSE)
84{ 84{
85 QTime t; 85 QTime t;
86 t.start(); 86 t.start();
87 db = new DateBookDB; 87 db = new DateBookDB;
88 qDebug("loading db t=%d", t.elapsed() ); 88 qDebug("loading db t=%d", t.elapsed() );
89 loadSettings(); 89 loadSettings();
90 setCaption( tr("Calendar") ); 90 setCaption( tr("Calendar") );
91 setIcon( Resource::loadPixmap( "datebook_icon" ) ); 91 setIcon( Resource::loadPixmap( "datebook_icon" ) );
92 92
93 setToolBarsMovable( FALSE ); 93 setToolBarsMovable( FALSE );
94 94
95 views = new QWidgetStack( this ); 95 views = new QWidgetStack( this );
96 setCentralWidget( views ); 96 setCentralWidget( views );
97 97
98 dayView = 0; 98 dayView = 0;
99 weekView = 0; 99 weekView = 0;
100 weekLstView = 0; 100 weekLstView = 0;
101 monthView = 0; 101 monthView = 0;
102 102
103 QPEToolBar *bar = new QPEToolBar( this ); 103 QPEToolBar *bar = new QPEToolBar( this );
104 bar->setHorizontalStretchable( TRUE ); 104 bar->setHorizontalStretchable( TRUE );
105 105
106 QPEMenuBar *mb = new QPEMenuBar( bar ); 106 QPEMenuBar *mb = new QPEMenuBar( bar );
107 mb->setMargin( 0 ); 107 mb->setMargin( 0 );
108 108
109 QPEToolBar *sub_bar = new QPEToolBar(this); 109 QPEToolBar *sub_bar = new QPEToolBar(this);
110 110
111 QPopupMenu *view = new QPopupMenu( this ); 111 QPopupMenu *view = new QPopupMenu( this );
112 QPopupMenu *settings = new QPopupMenu( this ); 112 QPopupMenu *settings = new QPopupMenu( this );
113 113
114 mb->insertItem( tr( "View" ), view ); 114 mb->insertItem( tr( "View" ), view );
115 mb->insertItem( tr( "Settings" ), settings ); 115 mb->insertItem( tr( "Settings" ), settings );
116 116
117 QActionGroup *g = new QActionGroup( this ); 117 QActionGroup *g = new QActionGroup( this );
118 g->setExclusive( TRUE ); 118 g->setExclusive( TRUE );
119 119
120 QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), 120 QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ),
121 QString::null, 0, this, 0 ); 121 QString::null, 0, this, 0 );
122 connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) ); 122 connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) );
123 a->addTo( sub_bar ); 123 a->addTo( sub_bar );
124 124
125 a = new QAction( tr( "Today" ), Resource::loadPixmap( "to_day" ), QString::null, 0, g, 0 ); 125 a = new QAction( tr( "Today" ), Resource::loadPixmap( "to_day" ), QString::null, 0, g, 0 );
126 connect( a, SIGNAL( activated() ), this, SLOT( slotToday() ) ); 126 connect( a, SIGNAL( activated() ), this, SLOT( slotToday() ) );
127 a->addTo( sub_bar ); 127 a->addTo( sub_bar );
128 a->addTo( view ); 128 a->addTo( view );
129 129
130 a = new QAction( tr( "Day" ), Resource::loadPixmap( "day" ), QString::null, 0, g, 0 ); 130 a = new QAction( tr( "Day" ), Resource::loadPixmap( "day" ), QString::null, 0, g, 0 );
131 connect( a, SIGNAL( activated() ), this, SLOT( viewDay() ) ); 131 connect( a, SIGNAL( activated() ), this, SLOT( viewDay() ) );
132 a->addTo( sub_bar ); 132 a->addTo( sub_bar );
133 a->addTo( view ); 133 a->addTo( view );
134 a->setToggleAction( TRUE ); 134 a->setToggleAction( TRUE );
135 a->setOn( TRUE ); 135 a->setOn( TRUE );
136 dayAction = a; 136 dayAction = a;
137 137
138 a = new QAction( tr( "Week" ), Resource::loadPixmap( "week" ), QString::null, 0, g, 0 ); 138 a = new QAction( tr( "Week" ), Resource::loadPixmap( "week" ), QString::null, 0, g, 0 );
139 connect( a, SIGNAL( activated() ), this, SLOT( viewWeek() ) ); 139 connect( a, SIGNAL( activated() ), this, SLOT( viewWeek() ) );
140 a->addTo( sub_bar ); 140 a->addTo( sub_bar );
141 a->addTo( view ); 141 a->addTo( view );
142 a->setToggleAction( TRUE ); 142 a->setToggleAction( TRUE );
143 weekAction = a; 143 weekAction = a;
144 144
145 a = new QAction( tr( "WeekLst" ), Resource::loadPixmap( "weeklst" ), QString::null, 0, g, 0 ); 145 a = new QAction( tr( "WeekLst" ), Resource::loadPixmap( "weeklst" ), QString::null, 0, g, 0 );
146 connect( a, SIGNAL( activated() ), this, SLOT( viewWeekLst() ) ); 146 connect( a, SIGNAL( activated() ), this, SLOT( viewWeekLst() ) );
147 a->addTo( sub_bar ); 147 a->addTo( sub_bar );
148 a->addTo( view ); 148 a->addTo( view );
149 a->setToggleAction( TRUE ); 149 a->setToggleAction( TRUE );
150 weekLstAction = a; 150 weekLstAction = a;
151 151
152 a = new QAction( tr( "Month" ), Resource::loadPixmap( "month" ), QString::null, 0, g, 0 ); 152 a = new QAction( tr( "Month" ), Resource::loadPixmap( "month" ), QString::null, 0, g, 0 );
153 connect( a, SIGNAL( activated() ), this, SLOT( viewMonth() ) ); 153 connect( a, SIGNAL( activated() ), this, SLOT( viewMonth() ) );
154 a->addTo( sub_bar ); 154 a->addTo( sub_bar );
155 a->addTo( view ); 155 a->addTo( view );
156 a->setToggleAction( TRUE ); 156 a->setToggleAction( TRUE );
157 monthAction = a; 157 monthAction = a;
158 158
159 a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ), QString::null, 0, g, 0 ); 159 a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ), QString::null, 0, g, 0 );
160 connect( a, SIGNAL(activated()), this, SLOT(slotFind()) ); 160 connect( a, SIGNAL(activated()), this, SLOT(slotFind()) );
161 a->addTo( sub_bar ); 161 a->addTo( sub_bar );
162 162
163 a = new QAction( tr( "Alarm and Start Time..." ), QString::null, 0, 0 ); 163 a = new QAction( tr( "Alarm and Start Time..." ), QString::null, 0, 0 );
164 connect( a, SIGNAL( activated() ), this, SLOT( slotSettings() ) ); 164 connect( a, SIGNAL( activated() ), this, SLOT( slotSettings() ) );
165 a->addTo( settings ); 165 a->addTo( settings );
166 166
167 QPopupMenu *default_view = new QPopupMenu(this); 167 QPopupMenu *default_view = new QPopupMenu(this);
168 settings->insertItem( tr( "Default View" ),default_view ); 168 settings->insertItem( tr( "Default View" ),default_view );
169 default_view->setCheckable(TRUE); 169 default_view->setCheckable(TRUE);
170 170
171 Config config("DateBook"); 171 Config config("DateBook");
172 config.setGroup("Main"); 172 config.setGroup("Main");
173 int current=config.readNumEntry("defaultview", DAY); 173 int current=config.readNumEntry("defaultview", DAY);
174 174
175 QActionGroup *ag = new QActionGroup(this); 175 QActionGroup *ag = new QActionGroup(this);
176 a = new QAction( tr( "Day" ), QString::null, 0, 0, 0, true ); 176 a = new QAction( tr( "Day" ), QString::null, 0, 0, 0, true );
177 if (current==DAY) a->setOn(true), viewDay(); 177 if (current==DAY) a->setOn(true), viewDay();
178 ag->insert(a); 178 ag->insert(a);
179 a = new QAction( tr( "Week" ), QString::null, 0, 0, 0, true ); 179 a = new QAction( tr( "Week" ), QString::null, 0, 0, 0, true );
180 if (current==WEEK) a->setOn(true), viewWeek(); 180 if (current==WEEK) a->setOn(true), viewWeek();
181 ag->insert(a); 181 ag->insert(a);
182 a = new QAction( tr( "WeekLst" ), QString::null, 0, 0, 0, true ); 182 a = new QAction( tr( "WeekLst" ), QString::null, 0, 0, 0, true );
183 if (current==WEEKLST) a->setOn(true), viewWeekLst(); 183 if (current==WEEKLST) a->setOn(true), viewWeekLst();
184 ag->insert(a); 184 ag->insert(a);
185 a = new QAction( tr( "Month" ), QString::null, 0, 0, 0, true ); 185 a = new QAction( tr( "Month" ), QString::null, 0, 0, 0, true );
186 if (current==MONTH) a->setOn(true), viewMonth(); 186 if (current==MONTH) a->setOn(true), viewMonth();
187 ag->insert(a); 187 ag->insert(a);
188 188
189 ag->addTo(default_view); 189 ag->addTo(default_view);
190 connect(ag, SIGNAL( selected ( QAction * ) ), 190 connect(ag, SIGNAL( selected ( QAction * ) ),
191 this, SLOT( newDefaultView(QAction *) ) 191 this, SLOT( newDefaultView(QAction *) )
192 ); 192 );
193 193
194 connect( qApp, SIGNAL(clockChanged(bool)), 194 connect( qApp, SIGNAL(clockChanged(bool)),
195 this, SLOT(changeClock(bool)) ); 195 this, SLOT(changeClock(bool)) );
196 connect( qApp, SIGNAL(weekChanged(bool)), 196 connect( qApp, SIGNAL(weekChanged(bool)),
197 this, SLOT(changeWeek(bool)) ); 197 this, SLOT(changeWeek(bool)) );
198 198
199#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 199#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
200 connect( qApp, SIGNAL(appMessage(const QCString&, const QByteArray&)), 200 connect( qApp, SIGNAL(appMessage(const QCString&, const QByteArray&)),
201 this, SLOT(appMessage(const QCString&, const QByteArray&)) ); 201 this, SLOT(appMessage(const QCString&, const QByteArray&)) );
202#endif 202#endif
203 203
204 // listen on QPE/System 204 // listen on QPE/System
205#if defined(Q_WS_QWS) 205#if defined(Q_WS_QWS)
206#if !defined(QT_NO_COP) 206#if !defined(QT_NO_COP)
207 QCopChannel *channel = new QCopChannel( "QPE/System", this ); 207 QCopChannel *channel = new QCopChannel( "QPE/System", this );
208 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 208 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
209 this, SLOT(receive(const QCString&, const QByteArray&)) ); 209 this, SLOT(receive(const QCString&, const QByteArray&)) );
210 channel = new QCopChannel( "QPE/Datebook", this );
211 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
212 this, SLOT(receive(const QCString&, const QByteArray&)) );
210#endif 213#endif
211#endif 214#endif
212 215
213 qDebug("done t=%d", t.elapsed() ); 216 qDebug("done t=%d", t.elapsed() );
214 217
215} 218}
216 219
217void DateBook::receive( const QCString &msg, const QByteArray &data ) 220void DateBook::receive( const QCString &msg, const QByteArray &data )
218{ 221{
219 QDataStream stream( data, IO_ReadOnly ); 222 QDataStream stream( data, IO_ReadOnly );
220 if ( msg == "timeChange(QString)" ) { 223 if ( msg == "timeChange(QString)" ) {
221 // update active view! 224 // update active view!
222 if ( dayAction->isOn() ) 225 if ( dayAction->isOn() )
223 viewDay(); 226 viewDay();
224 else if ( weekAction->isOn() ) 227 else if ( weekAction->isOn() )
225 viewWeek(); 228 viewWeek();
226 else if ( monthAction->isOn() ) 229 else if ( monthAction->isOn() )
227 viewMonth(); 230 viewMonth();
228 } 231 }
232 else if (msg == "editEvent(int)") {
233 /* Not yet working...
234 int uid;
235 stream >> uid;
236 Event e=db->getEvent(uid);
237 editEvent(e);
238 */
239 }
229} 240}
230 241
231DateBook::~DateBook() 242DateBook::~DateBook()
232{ 243{
233} 244}
234 245
235void DateBook::slotSettings() 246void DateBook::slotSettings()
236{ 247{
237 DateBookSettings frmSettings( ampm, this ); 248 DateBookSettings frmSettings( ampm, this );
238 frmSettings.setStartTime( startTime ); 249 frmSettings.setStartTime( startTime );
239 frmSettings.setAlarmPreset( aPreset, presetTime ); 250 frmSettings.setAlarmPreset( aPreset, presetTime );
240#if defined (Q_WS_QWS) || defined(_WS_QWS_) 251#if defined (Q_WS_QWS) || defined(_WS_QWS_)
241 frmSettings.showMaximized(); 252 frmSettings.showMaximized();
242#endif 253#endif
243 254
244 if ( frmSettings.exec() ) { 255 if ( frmSettings.exec() ) {
245 aPreset = frmSettings.alarmPreset(); 256 aPreset = frmSettings.alarmPreset();
246 presetTime = frmSettings.presetTime(); 257 presetTime = frmSettings.presetTime();
247 startTime = frmSettings.startTime(); 258 startTime = frmSettings.startTime();
248 if ( dayView ) 259 if ( dayView )
249 dayView->setStartViewTime( startTime ); 260 dayView->setStartViewTime( startTime );
250 if ( weekView ) 261 if ( weekView )
251 weekView->setStartViewTime( startTime ); 262 weekView->setStartViewTime( startTime );
252 saveSettings(); 263 saveSettings();
253 264
254 // make the change obvious 265 // make the change obvious
255 if ( views->visibleWidget() ) { 266 if ( views->visibleWidget() ) {
256 if ( views->visibleWidget() == dayView ) 267 if ( views->visibleWidget() == dayView )
257 dayView->redraw(); 268 dayView->redraw();
258 else if ( views->visibleWidget() == weekView ) 269 else if ( views->visibleWidget() == weekView )
259 weekView->redraw(); 270 weekView->redraw();
260 } 271 }
261 } 272 }
262} 273}
263 274
264void DateBook::fileNew() 275void DateBook::fileNew()
265{ 276{
266 slotNewEventFromKey(""); 277 slotNewEventFromKey("");
267} 278}
268 279
269QString DateBook::checkEvent(const Event &e) 280QString DateBook::checkEvent(const Event &e)
270{ 281{
271 /* check if overlaps with itself */ 282 /* check if overlaps with itself */
272 bool checkFailed = FALSE; 283 bool checkFailed = FALSE;
273 284
274 /* check the next 12 repeats. should catch most problems */ 285 /* check the next 12 repeats. should catch most problems */
275 QDate current_date = e.start().date(); 286 QDate current_date = e.start().date();
276 Event previous = e; 287 Event previous = e;
277 for(int i = 0; i < 12; i++) 288 for(int i = 0; i < 12; i++)
278 { 289 {
279 QDateTime next; 290 QDateTime next;
280 if (!nextOccurance(previous, current_date.addDays(1), next)) { 291 if (!nextOccurance(previous, current_date.addDays(1), next)) {
281 break; // no more repeats 292 break; // no more repeats
282 } 293 }
283 if(next < previous.end()) { 294 if(next < previous.end()) {
284 checkFailed = TRUE; 295 checkFailed = TRUE;
285 break; 296 break;
286 } 297 }
287 current_date = next.date(); 298 current_date = next.date();
288 } 299 }
289 300
290 if(checkFailed) 301 if(checkFailed)
291 return tr("Event duration is potentially longer\n" 302 return tr("Event duration is potentially longer\n"
292 "than interval between repeats."); 303 "than interval between repeats.");
293 304
294 return QString::null; 305 return QString::null;
295} 306}
296 307
297QDate DateBook::currentDate() 308QDate DateBook::currentDate()
298{ 309{
299 QDate d = QDate::currentDate(); 310 QDate d = QDate::currentDate();
300 311
301 if ( dayView && views->visibleWidget() == dayView ) { 312 if ( dayView && views->visibleWidget() == dayView ) {
302 d = dayView->date(); 313 d = dayView->date();
303 } else if ( weekView && views->visibleWidget() == weekView ) { 314 } else if ( weekView && views->visibleWidget() == weekView ) {
304 d = weekView->date(); 315 d = weekView->date();
305 } else if ( weekLstView && views->visibleWidget() == weekLstView ) { 316 } else if ( weekLstView && views->visibleWidget() == weekLstView ) {
306 d = weekLstView->date(); 317 d = weekLstView->date();
307 } else if ( monthView && views->visibleWidget() == monthView ) { 318 } else if ( monthView && views->visibleWidget() == monthView ) {
308 d = monthView->selectedDate(); 319 d = monthView->selectedDate();
309 } 320 }
310 321
311 return d; 322 return d;
312} 323}
313 324
314void DateBook::view(int v, const QDate &d) { 325void DateBook::view(int v, const QDate &d) {
315 if (v==DAY) { 326 if (v==DAY) {
316 initDay(); 327 initDay();
317 dayAction->setOn( TRUE ); 328 dayAction->setOn( TRUE );
318 dayView->setDate( d ); 329 dayView->setDate( d );
319 views->raiseWidget( dayView ); 330 views->raiseWidget( dayView );
320 dayView->redraw(); 331 dayView->redraw();
321 } else if (v==WEEK) { 332 } else if (v==WEEK) {
322 initWeek(); 333 initWeek();
323 weekAction->setOn( TRUE ); 334 weekAction->setOn( TRUE );
324 weekView->setDate( d ); 335 weekView->setDate( d );
325 views->raiseWidget( weekView ); 336 views->raiseWidget( weekView );
326 weekView->redraw(); 337 weekView->redraw();
327 } else if (v==WEEKLST) { 338 } else if (v==WEEKLST) {
328 initWeekLst(); 339 initWeekLst();
329 weekLstAction->setOn( TRUE ); 340 weekLstAction->setOn( TRUE );
330 weekLstView->setDate(d); 341 weekLstView->setDate(d);
331 views->raiseWidget( weekLstView ); 342 views->raiseWidget( weekLstView );
332 weekLstView->redraw(); 343 weekLstView->redraw();
333 } else if (v==MONTH) { 344 } else if (v==MONTH) {
334 initMonth(); 345 initMonth();
335 monthAction->setOn( TRUE ); 346 monthAction->setOn( TRUE );
336 monthView->setDate( d.year(), d.month(), d.day() ); 347 monthView->setDate( d.year(), d.month(), d.day() );
337 views->raiseWidget( monthView ); 348 views->raiseWidget( monthView );
338 monthView->redraw(); 349 monthView->redraw();
339 } 350 }
340} 351}
341 352
342void DateBook::viewDefault(const QDate &d) { 353void DateBook::viewDefault(const QDate &d) {
343 Config config("DateBook"); 354 Config config("DateBook");
344 config.setGroup("Main"); 355 config.setGroup("Main");
345 int current=config.readNumEntry("defaultview", DAY); 356 int current=config.readNumEntry("defaultview", DAY);
346 357
347 view(current,d); 358 view(current,d);
348} 359}
349 360
350void DateBook::viewDay() { 361void DateBook::viewDay() {
351 view(DAY,currentDate()); 362 view(DAY,currentDate());
352} 363}
353 364
354void DateBook::viewWeek() { 365void DateBook::viewWeek() {
355 view(WEEK,currentDate()); 366 view(WEEK,currentDate());
356} 367}
357 368
358void DateBook::viewWeekLst() { 369void DateBook::viewWeekLst() {
359 view(WEEKLST,currentDate()); 370 view(WEEKLST,currentDate());
360} 371}
361 372
362void DateBook::viewMonth() { 373void DateBook::viewMonth() {
363 view(MONTH,currentDate()); 374 view(MONTH,currentDate());
364} 375}
365 376
366void DateBook::editEvent( const Event &e ) 377void DateBook::editEvent( const Event &e )
367{ 378{
368 if (syncing) { 379 if (syncing) {
369 QMessageBox::warning( this, tr("Calendar"), 380 QMessageBox::warning( this, tr("Calendar"),
370 tr( "Can not edit data, currently syncing") ); 381 tr( "Can not edit data, currently syncing") );
371 return; 382 return;
372 } 383 }
373 384
374 // workaround added for text input. 385 // workaround added for text input.
375 QDialog editDlg( this, 0, TRUE ); 386 QDialog editDlg( this, 0, TRUE );
376 DateEntry *entry; 387 DateEntry *entry;
377 editDlg.setCaption( tr("Edit Event") ); 388 editDlg.setCaption( tr("Edit Event") );
378 QVBoxLayout *vb = new QVBoxLayout( &editDlg ); 389 QVBoxLayout *vb = new QVBoxLayout( &editDlg );
379 QScrollView *sv = new QScrollView( &editDlg, "scrollview" ); 390 QScrollView *sv = new QScrollView( &editDlg, "scrollview" );
380 sv->setResizePolicy( QScrollView::AutoOneFit ); 391 sv->setResizePolicy( QScrollView::AutoOneFit );
381 // KLUDGE!!! 392 // KLUDGE!!!
382 sv->setHScrollBarMode( QScrollView::AlwaysOff ); 393 sv->setHScrollBarMode( QScrollView::AlwaysOff );
383 vb->addWidget( sv ); 394 vb->addWidget( sv );
384 entry = new DateEntry( onMonday, e, ampm, &editDlg, "editor" ); 395 entry = new DateEntry( onMonday, e, ampm, &editDlg, "editor" );
385 entry->timezone->setEnabled( FALSE ); 396 entry->timezone->setEnabled( FALSE );
386 sv->addChild( entry ); 397 sv->addChild( entry );
387 398
388#if defined(Q_WS_QWS) || defined(_WS_QWS_) 399#if defined(Q_WS_QWS) || defined(_WS_QWS_)
389 editDlg.showMaximized(); 400 editDlg.showMaximized();
390#endif 401#endif
391 while (editDlg.exec() ) { 402 while (editDlg.exec() ) {
392 Event newEv = entry->event(); 403 Event newEv = entry->event();
393 QString error = checkEvent(newEv); 404 QString error = checkEvent(newEv);
394 if (!error.isNull()) { 405 if (!error.isNull()) {
395 if (QMessageBox::warning(this, "error box", 406 if (QMessageBox::warning(this, "error box",
396 error, "Fix it", "Continue", 407 error, "Fix it", "Continue",
397 0, 0, 1) == 0) 408 0, 0, 1) == 0)
398 continue; 409 continue;
399 } 410 }
400 db->editEvent(e, newEv); 411 db->editEvent(e, newEv);
401 emit newEvent(); 412 emit newEvent();
402 break; 413 break;
403 } 414 }
404} 415}
405 416
406void DateBook::removeEvent( const Event &e ) 417void DateBook::removeEvent( const Event &e )
407{ 418{
408 if (syncing) { 419 if (syncing) {
409 QMessageBox::warning( this, tr("Calendar"), 420 QMessageBox::warning( this, tr("Calendar"),
410 tr( "Can not edit data, currently syncing") ); 421 tr( "Can not edit data, currently syncing") );
411 return; 422 return;
412 } 423 }
413 424
414 QString strName = e.description(); 425 QString strName = e.description();
415 426
416 if ( !QPEMessageBox::confirmDelete( this, tr( "Calendar" ),strName ) ) 427 if ( !QPEMessageBox::confirmDelete( this, tr( "Calendar" ),strName ) )
417 return; 428 return;
418 429
419 db->removeEvent( e ); 430 db->removeEvent( e );
420 if ( views->visibleWidget() == dayView && dayView ) 431 if ( views->visibleWidget() == dayView && dayView )
421 dayView->redraw(); 432 dayView->redraw();
422} 433}
423 434
424void DateBook::addEvent( const Event &e ) 435void DateBook::addEvent( const Event &e )
425{ 436{
426 QDate d = e.start().date(); 437 QDate d = e.start().date();
427 initDay(); 438 initDay();
428 dayView->setDate( d ); 439 dayView->setDate( d );
429} 440}
430 441
431void DateBook::showDay( int year, int month, int day ) 442void DateBook::showDay( int year, int month, int day )
432{ 443{
433 QDate d(year, month, day); 444 QDate d(year, month, day);
434 view(DAY,d); 445 view(DAY,d);
435} 446}
436 447
437void DateBook::initDay() 448void DateBook::initDay()
438{ 449{
439 if ( !dayView ) { 450 if ( !dayView ) {
440 dayView = new DateBookDay( ampm, onMonday, db, views, "day view" ); 451 dayView = new DateBookDay( ampm, onMonday, db, views, "day view" );
441 views->addWidget( dayView, DAY ); 452 views->addWidget( dayView, DAY );
442 dayView->setStartViewTime( startTime ); 453 dayView->setStartViewTime( startTime );
443 connect( this, SIGNAL( newEvent() ), 454 connect( this, SIGNAL( newEvent() ),
444 dayView, SLOT( redraw() ) ); 455 dayView, SLOT( redraw() ) );
445 connect( dayView, SIGNAL( newEvent() ), 456 connect( dayView, SIGNAL( newEvent() ),
446 this, SLOT( fileNew() ) ); 457 this, SLOT( fileNew() ) );
447 connect( dayView, SIGNAL( removeEvent( const Event & ) ), 458 connect( dayView, SIGNAL( removeEvent( const Event & ) ),
448 this, SLOT( removeEvent( const Event & ) ) ); 459 this, SLOT( removeEvent( const Event & ) ) );
449 connect( dayView, SIGNAL( editEvent( const Event & ) ), 460 connect( dayView, SIGNAL( editEvent( const Event & ) ),
450 this, SLOT( editEvent( const Event & ) ) ); 461 this, SLOT( editEvent( const Event & ) ) );
451 connect( dayView, SIGNAL( beamEvent( const Event & ) ), 462 connect( dayView, SIGNAL( beamEvent( const Event & ) ),
452 this, SLOT( beamEvent( const Event & ) ) ); 463 this, SLOT( beamEvent( const Event & ) ) );
453 connect( dayView, SIGNAL(sigNewEvent(const QString &)), 464 connect( dayView, SIGNAL(sigNewEvent(const QString &)),
454 this, SLOT(slotNewEventFromKey(const QString &)) ); 465 this, SLOT(slotNewEventFromKey(const QString &)) );
455 } 466 }
456} 467}
457 468
458void DateBook::initWeek() 469void DateBook::initWeek()
459{ 470{
460 if ( !weekView ) { 471 if ( !weekView ) {
461 weekView = new DateBookWeek( ampm, onMonday, db, views, "week view" ); 472 weekView = new DateBookWeek( ampm, onMonday, db, views, "week view" );
462 weekView->setStartViewTime( startTime ); 473 weekView->setStartViewTime( startTime );
463 views->addWidget( weekView, WEEK ); 474 views->addWidget( weekView, WEEK );
464 connect( weekView, SIGNAL( showDate( int, int, int ) ), 475 connect( weekView, SIGNAL( showDate( int, int, int ) ),
465 this, SLOT( showDay( int, int, int ) ) ); 476 this, SLOT( showDay( int, int, int ) ) );
466 connect( this, SIGNAL( newEvent() ), 477 connect( this, SIGNAL( newEvent() ),
467 weekView, SLOT( redraw() ) ); 478 weekView, SLOT( redraw() ) );
468 } 479 }
469 //But also get it right: the year that we display can be different 480 //But also get it right: the year that we display can be different
470 //from the year of the current date. So, first find the year 481 //from the year of the current date. So, first find the year
471 //number of the current week. 482 //number of the current week.
472 483
473 int yearNumber, totWeeks; 484 int yearNumber, totWeeks;
474 calcWeek( currentDate(), totWeeks, yearNumber, onMonday ); 485 calcWeek( currentDate(), totWeeks, yearNumber, onMonday );
475 486
476 QDate d = QDate( yearNumber, 12, 31 ); 487 QDate d = QDate( yearNumber, 12, 31 );
477 calcWeek( d, totWeeks, yearNumber, onMonday ); 488 calcWeek( d, totWeeks, yearNumber, onMonday );
478 489
479 while ( totWeeks == 1 ) { 490 while ( totWeeks == 1 ) {
480 d = d.addDays( -1 ); 491 d = d.addDays( -1 );
481 calcWeek( d, totWeeks, yearNumber, onMonday ); 492 calcWeek( d, totWeeks, yearNumber, onMonday );
482 } 493 }
483 if ( totWeeks != weekView->totalWeeks() ) 494 if ( totWeeks != weekView->totalWeeks() )
484 weekView->setTotalWeeks( totWeeks ); 495 weekView->setTotalWeeks( totWeeks );
485} 496}
486void DateBook::initWeekLst() { 497void DateBook::initWeekLst() {
487 if ( !weekLstView ) { 498 if ( !weekLstView ) {
488 weekLstView = new DateBookWeekLst( ampm, onMonday, db, 499 weekLstView = new DateBookWeekLst( ampm, onMonday, db,
489 views, "weeklst view" ); 500 views, "weeklst view" );
490 views->addWidget( weekLstView, WEEKLST ); 501 views->addWidget( weekLstView, WEEKLST );
491 502
492 //weekLstView->setStartViewTime( startTime ); 503 //weekLstView->setStartViewTime( startTime );
493 connect( weekLstView, SIGNAL( showDate( int, int, int ) ), 504 connect( weekLstView, SIGNAL( showDate( int, int, int ) ),
494 this, SLOT( showDay( int, int, int ) ) ); 505 this, SLOT( showDay( int, int, int ) ) );
495 connect( weekLstView, SIGNAL( addEvent( const QDateTime &, 506 connect( weekLstView, SIGNAL( addEvent( const QDateTime &,
496 const QDateTime &, 507 const QDateTime &,
497 const QString & ) ), 508 const QString & ) ),
498 this, SLOT( slotNewEntry( const QDateTime &, 509 this, SLOT( slotNewEntry( const QDateTime &,
499 const QDateTime &, 510 const QDateTime &,
500 const QString & ) ) ); 511 const QString & ) ) );
501 connect( this, SIGNAL( newEvent() ), 512 connect( this, SIGNAL( newEvent() ),
502 weekLstView, SLOT( redraw() ) ); 513 weekLstView, SLOT( redraw() ) );
503 connect( weekLstView, SIGNAL( editEvent( const Event & ) ), 514 connect( weekLstView, SIGNAL( editEvent( const Event & ) ),
504 this, SLOT( editEvent( const Event & ) ) ); 515 this, SLOT( editEvent( const Event & ) ) );
505 } 516 }
506} 517}
507 518
508 519
509void DateBook::initMonth() 520void DateBook::initMonth()
510{ 521{
511 if ( !monthView ) { 522 if ( !monthView ) {
512 monthView = new DateBookMonth( views, "month view", FALSE, db ); 523 monthView = new DateBookMonth( views, "month view", FALSE, db );
513 views->addWidget( monthView, MONTH ); 524 views->addWidget( monthView, MONTH );
514 connect( monthView, SIGNAL( dateClicked( int, int, int ) ), 525 connect( monthView, SIGNAL( dateClicked( int, int, int ) ),
515 this, SLOT( showDay( int, int, int ) ) ); 526 this, SLOT( showDay( int, int, int ) ) );
516 connect( this, SIGNAL( newEvent() ), 527 connect( this, SIGNAL( newEvent() ),
517 monthView, SLOT( redraw() ) ); 528 monthView, SLOT( redraw() ) );
518 qApp->processEvents(); 529 qApp->processEvents();
519 } 530 }
520} 531}
521 532
522void DateBook::loadSettings() 533void DateBook::loadSettings()
523{ 534{
524 { 535 {
525 Config config( "qpe" ); 536 Config config( "qpe" );
526 config.setGroup("Time"); 537 config.setGroup("Time");
527 ampm = config.readBoolEntry( "AMPM", TRUE ); 538 ampm = config.readBoolEntry( "AMPM", TRUE );
528 onMonday = config.readBoolEntry( "MONDAY" ); 539 onMonday = config.readBoolEntry( "MONDAY" );
529 } 540 }
530 541
531 { 542 {
532 Config config("DateBook"); 543 Config config("DateBook");
533 config.setGroup("Main"); 544 config.setGroup("Main");
534 startTime = config.readNumEntry("startviewtime", 8); 545 startTime = config.readNumEntry("startviewtime", 8);
535 aPreset = config.readBoolEntry("alarmpreset"); 546 aPreset = config.readBoolEntry("alarmpreset");
536 presetTime = config.readNumEntry("presettime"); 547 presetTime = config.readNumEntry("presettime");
537 } 548 }
538} 549}
539 550
540void DateBook::saveSettings() 551void DateBook::saveSettings()
541{ 552{
542 Config config( "qpe" ); 553 Config config( "qpe" );
543 Config configDB( "DateBook" ); 554 Config configDB( "DateBook" );
544 configDB.setGroup( "Main" ); 555 configDB.setGroup( "Main" );
545 configDB.writeEntry("startviewtime",startTime); 556 configDB.writeEntry("startviewtime",startTime);
546 configDB.writeEntry("alarmpreset",aPreset); 557 configDB.writeEntry("alarmpreset",aPreset);
547 configDB.writeEntry("presettime",presetTime); 558 configDB.writeEntry("presettime",presetTime);
548} 559}
549 560
550void DateBook::newDefaultView(QAction *a) { 561void DateBook::newDefaultView(QAction *a) {
551 int val=DAY; 562 int val=DAY;
552 if (a->text() == "Day") val=DAY; 563 if (a->text() == "Day") val=DAY;
553 if (a->text() == "Week") val=WEEK; 564 if (a->text() == "Week") val=WEEK;
554 if (a->text() == "WeekLst") val=WEEKLST; 565 if (a->text() == "WeekLst") val=WEEKLST;
555 if (a->text() == "Month") val=MONTH; 566 if (a->text() == "Month") val=MONTH;
556 567
557 Config configDB( "DateBook" ); 568 Config configDB( "DateBook" );
558 configDB.setGroup( "Main" ); 569 configDB.setGroup( "Main" );
559 configDB.writeEntry("defaultview",val); 570 configDB.writeEntry("defaultview",val);
560} 571}
561 572
562void DateBook::appMessage(const QCString& msg, const QByteArray& data) 573void DateBook::appMessage(const QCString& msg, const QByteArray& data)
563{ 574{
564 bool needShow = FALSE; 575 bool needShow = FALSE;
565 if ( msg == "alarm(QDateTime,int)" ) { 576 if ( msg == "alarm(QDateTime,int)" ) {
566 QDataStream ds(data,IO_ReadOnly); 577 QDataStream ds(data,IO_ReadOnly);
567 QDateTime when; int warn; 578 QDateTime when; int warn;
568 ds >> when >> warn; 579 ds >> when >> warn;
569 580
570 // check to make it's okay to continue, 581 // check to make it's okay to continue,
571 // this is the case that the time was set ahead, and 582 // this is the case that the time was set ahead, and
572 // we are forced given a stale alarm... 583 // we are forced given a stale alarm...
573 QDateTime current = QDateTime::currentDateTime(); 584 QDateTime current = QDateTime::currentDateTime();
574 if ( current.time().hour() != when.time().hour() 585 if ( current.time().hour() != when.time().hour()
575 && current.time().minute() != when.time().minute() ) 586 && current.time().minute() != when.time().minute() )
576 return; 587 return;
577 588
578 QValueList<EffectiveEvent> list = db->getEffectiveEvents(when.addSecs(warn*60)); 589 QValueList<EffectiveEvent> list = db->getEffectiveEvents(when.addSecs(warn*60));
579 if ( list.count() > 0 ) { 590 if ( list.count() > 0 ) {
580 QString msg; 591 QString msg;
581 bool bSound = FALSE; 592 bool bSound = FALSE;
582 int stopTimer = 0; 593 int stopTimer = 0;
583 bool found = FALSE; 594 bool found = FALSE;
584 for ( QValueList<EffectiveEvent>::ConstIterator it=list.begin(); 595 for ( QValueList<EffectiveEvent>::ConstIterator it=list.begin();
585 it!=list.end(); ++it ) { 596 it!=list.end(); ++it ) {
586 if ( (*it).event().hasAlarm() ) { 597 if ( (*it).event().hasAlarm() ) {
587 found = TRUE; 598 found = TRUE;
588 msg += "<CENTER><B>" + (*it).description() + "</B>" 599 msg += "<CENTER><B>" + (*it).description() + "</B>"
589 + "<BR>" + (*it).location() + "<BR>" 600 + "<BR>" + (*it).location() + "<BR>"
590 + TimeString::dateString((*it).event().start(),ampm) 601 + TimeString::dateString((*it).event().start(),ampm)
591 + (warn 602 + (warn
592 ? tr(" (in " + QString::number(warn) 603 ? tr(" (in " + QString::number(warn)
593 + tr(" minutes)")) 604 + tr(" minutes)"))
594 : QString("")) 605 : QString(""))
595 + "<BR>" 606 + "<BR>"
596 + (*it).notes() + "</CENTER>"; 607 + (*it).notes() + "</CENTER>";
597 if ( (*it).event().alarmSound() != Event::Silent ) { 608 if ( (*it).event().alarmSound() != Event::Silent ) {
598 bSound = TRUE; 609 bSound = TRUE;
599 } 610 }
600 } 611 }
601 } 612 }
602 if ( found ) { 613 if ( found ) {
603 if ( bSound ) { 614 if ( bSound ) {
604 Sound::soundAlarm(); 615 Sound::soundAlarm();
605 stopTimer = startTimer( 5000 ); 616 stopTimer = startTimer( 5000 );
606 } 617 }
607 618
608 QDialog dlg( this, 0, TRUE ); 619 QDialog dlg( this, 0, TRUE );
609 QVBoxLayout *vb = new QVBoxLayout( &dlg ); 620 QVBoxLayout *vb = new QVBoxLayout( &dlg );
610 QScrollView *view = new QScrollView( &dlg, "scrollView"); 621 QScrollView *view = new QScrollView( &dlg, "scrollView");
611 view->setResizePolicy( QScrollView::AutoOneFit ); 622 view->setResizePolicy( QScrollView::AutoOneFit );
612 vb->addWidget( view ); 623 vb->addWidget( view );
diff --git a/core/pim/datebook/datebook.pro b/core/pim/datebook/datebook.pro
index 314a56a..09d5c2d 100644
--- a/core/pim/datebook/datebook.pro
+++ b/core/pim/datebook/datebook.pro
@@ -1,43 +1,45 @@
1 TEMPLATE= app 1 TEMPLATE= app
2 CONFIG += qt warn_on release 2 CONFIG += qt warn_on release
3 DESTDIR = $(OPIEDIR)/bin 3 DESTDIR = $(OPIEDIR)/bin
4 4
5 HEADERS= datebookday.h \ 5 HEADERS= datebookday.h \
6 datebook.h \ 6 datebook.h \
7 dateentryimpl.h \ 7 dateentryimpl.h \
8 datebookdayheaderimpl.h \ 8 datebookdayheaderimpl.h \
9 datebooksettings.h \ 9 datebooksettings.h \
10 datebookweek.h \ 10 datebookweek.h \
11 datebookweeklst.h \ 11 datebookweeklst.h \
12 datebookweekheaderimpl.h \ 12 datebookweekheaderimpl.h \
13 repeatentry.h \ 13 repeatentry.h \
14 clickablelabel.h 14 clickablelabel.h \
15 timepicker.h
15 16
16 SOURCES= main.cpp \ 17 SOURCES= main.cpp \
17 datebookday.cpp \ 18 datebookday.cpp \
18 datebook.cpp \ 19 datebook.cpp \
19 dateentryimpl.cpp \ 20 dateentryimpl.cpp \
20 datebookdayheaderimpl.cpp \ 21 datebookdayheaderimpl.cpp \
21 datebooksettings.cpp \ 22 datebooksettings.cpp \
22 datebookweek.cpp \ 23 datebookweek.cpp \
23 datebookweeklst.cpp \ 24 datebookweeklst.cpp \
24 datebookweekheaderimpl.cpp \ 25 datebookweekheaderimpl.cpp \
25 repeatentry.cpp \ 26 repeatentry.cpp \
26 clickablelabel.cpp 27 clickablelabel.cpp \
28 timepicker.cpp
27 29
28 INTERFACES= dateentry.ui \ 30 INTERFACES= dateentry.ui \
29 datebookdayheader.ui \ 31 datebookdayheader.ui \
30 datebooksettingsbase.ui \ 32 datebooksettingsbase.ui \
31 datebookweekheader.ui \ 33 datebookweekheader.ui \
32 datebookweeklstheader.ui \ 34 datebookweeklstheader.ui \
33 datebookweeklstdayhdr.ui \ 35 datebookweeklstdayhdr.ui \
34 repeatentrybase.ui 36 repeatentrybase.ui
35 37
36INCLUDEPATH += $(OPIEDIR)/include 38INCLUDEPATH += $(OPIEDIR)/include
37 DEPENDPATH+= $(OPIEDIR)/include 39 DEPENDPATH+= $(OPIEDIR)/include
38LIBS += -lqpe 40LIBS += -lqpe
39 41
40 TARGET = datebook 42 TARGET = datebook
41 43
42TRANSLATIONS = ../i18n/de/datebook.ts 44TRANSLATIONS = ../i18n/de/datebook.ts
43TRANSLATIONS += ../i18n/pt_BR/datebook.ts 45TRANSLATIONS += ../i18n/pt_BR/datebook.ts
diff --git a/core/pim/datebook/dateentry.ui b/core/pim/datebook/dateentry.ui
index eac4e23..22ff32d 100644
--- a/core/pim/datebook/dateentry.ui
+++ b/core/pim/datebook/dateentry.ui
@@ -1,1095 +1,524 @@
1<!DOCTYPE UI><UI> 1<!DOCTYPE UI><UI>
2<class>DateEntryBase</class> 2<class>DateEntryBase</class>
3<comment>********************************************************************* 3<comment>*********************************************************************
4** Copyright (C) 2000 Trolltech AS. All rights reserved. 4** Copyright (C) 2000 Trolltech AS. All rights reserved.
5** 5**
6** This file is part of Qtopia Environment. 6** This file is part of Qtopia Environment.
7** 7**
8** This file may be distributed and/or modified under the terms of the 8** This file may be distributed and/or modified under the terms of the
9** GNU General Public License version 2 as published by the Free Software 9** GNU General Public License version 2 as published by the Free Software
10** Foundation and appearing in the file LICENSE.GPL included in the 10** Foundation and appearing in the file LICENSE.GPL included in the
11** packaging of this file. 11** packaging of this file.
12** 12**
13** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 13** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
14** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 14** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
15** 15**
16** See http://www.trolltech.com/gpl/ for GPL licensing information. 16** See http://www.trolltech.com/gpl/ for GPL licensing information.
17** 17**
18** Contact info@trolltech.com if any conditions of this licensing are 18** Contact info@trolltech.com if any conditions of this licensing are
19** not clear to you. 19** not clear to you.
20** 20**
21** $Id$ 21** $Id$
22** 22**
23*********************************************************************</comment> 23*********************************************************************</comment>
24<widget> 24<widget>
25 <class>QWidget</class> 25 <class>QWidget</class>
26 <property stdset="1"> 26 <property stdset="1">
27 <name>name</name> 27 <name>name</name>
28 <cstring>DateEntryBase</cstring> 28 <cstring>DateEntryBase</cstring>
29 </property> 29 </property>
30 <property stdset="1"> 30 <property stdset="1">
31 <name>geometry</name> 31 <name>geometry</name>
32 <rect> 32 <rect>
33 <x>0</x> 33 <x>0</x>
34 <y>0</y> 34 <y>0</y>
35 <width>242</width> 35 <width>242</width>
36 <height>339</height> 36 <height>339</height>
37 </rect> 37 </rect>
38 </property> 38 </property>
39 <property stdset="1"> 39 <property stdset="1">
40 <name>caption</name> 40 <name>caption</name>
41 <string>New Event</string> 41 <string>New Event</string>
42 </property> 42 </property>
43 <property> 43 <property>
44 <name>layoutMargin</name> 44 <name>layoutMargin</name>
45 </property> 45 </property>
46 <property> 46 <property>
47 <name>layoutSpacing</name> 47 <name>layoutSpacing</name>
48 </property> 48 </property>
49 <grid> 49 <grid>
50 <property stdset="1"> 50 <property stdset="1">
51 <name>margin</name> 51 <name>margin</name>
52 <number>0</number> 52 <number>0</number>
53 </property> 53 </property>
54 <property stdset="1"> 54 <property stdset="1">
55 <name>spacing</name> 55 <name>spacing</name>
56 <number>0</number> 56 <number>0</number>
57 </property> 57 </property>
58 <widget row="1" column="0" > 58 <widget row="1" column="0" >
59 <class>QLabel</class> 59 <class>QLabel</class>
60 <property stdset="1"> 60 <property stdset="1">
61 <name>name</name> 61 <name>name</name>
62 <cstring>TextLabel2</cstring> 62 <cstring>TextLabel2</cstring>
63 </property> 63 </property>
64 <property stdset="1"> 64 <property stdset="1">
65 <name>frameShape</name> 65 <name>frameShape</name>
66 <enum>MShape</enum> 66 <enum>MShape</enum>
67 </property> 67 </property>
68 <property stdset="1"> 68 <property stdset="1">
69 <name>frameShadow</name> 69 <name>frameShadow</name>
70 <enum>MShadow</enum> 70 <enum>MShadow</enum>
71 </property> 71 </property>
72 <property stdset="1"> 72 <property stdset="1">
73 <name>text</name> 73 <name>text</name>
74 <string>Location</string> 74 <string>Location</string>
75 </property> 75 </property>
76 </widget> 76 </widget>
77 <widget row="2" column="0" > 77 <widget row="2" column="0" >
78 <class>QLabel</class> 78 <class>QLabel</class>
79 <property stdset="1"> 79 <property stdset="1">
80 <name>name</name> 80 <name>name</name>
81 <cstring>TextLabel2_2</cstring> 81 <cstring>TextLabel2_2</cstring>
82 </property> 82 </property>
83 <property stdset="1"> 83 <property stdset="1">
84 <name>text</name> 84 <name>text</name>
85 <string>Category</string> 85 <string>Category</string>
86 </property> 86 </property>
87 <property> 87 <property>
88 <name>buddy</name> 88 <name>buddy</name>
89 <cstring>comboPriority</cstring> 89 <cstring>comboPriority</cstring>
90 </property> 90 </property>
91 </widget> 91 </widget>
92 <widget row="0" column="1" rowspan="1" colspan="3" > 92 <widget row="0" column="1" rowspan="1" colspan="3" >
93 <class>QComboBox</class> 93 <class>QComboBox</class>
94 <item> 94 <item>
95 <property> 95 <property>
96 <name>text</name> 96 <name>text</name>
97 <string></string> 97 <string></string>
98 </property> 98 </property>
99 </item> 99 </item>
100 <item> 100 <item>
101 <property> 101 <property>
102 <name>text</name> 102 <name>text</name>
103 <string>Meeting</string> 103 <string>Meeting</string>
104 </property> 104 </property>
105 </item> 105 </item>
106 <item> 106 <item>
107 <property> 107 <property>
108 <name>text</name> 108 <name>text</name>
109 <string>Lunch</string> 109 <string>Lunch</string>
110 </property> 110 </property>
111 </item> 111 </item>
112 <item> 112 <item>
113 <property> 113 <property>
114 <name>text</name> 114 <name>text</name>
115 <string>Dinner</string> 115 <string>Dinner</string>
116 </property> 116 </property>
117 </item> 117 </item>
118 <item> 118 <item>
119 <property> 119 <property>
120 <name>text</name> 120 <name>text</name>
121 <string>Travel</string> 121 <string>Travel</string>
122 </property> 122 </property>
123 </item> 123 </item>
124 <property stdset="1"> 124 <property stdset="1">
125 <name>name</name> 125 <name>name</name>
126 <cstring>comboDescription</cstring> 126 <cstring>comboDescription</cstring>
127 </property> 127 </property>
128 <property stdset="1"> 128 <property stdset="1">
129 <name>sizePolicy</name> 129 <name>sizePolicy</name>
130 <sizepolicy> 130 <sizepolicy>
131 <hsizetype>7</hsizetype> 131 <hsizetype>7</hsizetype>
132 <vsizetype>0</vsizetype> 132 <vsizetype>0</vsizetype>
133 </sizepolicy> 133 </sizepolicy>
134 </property> 134 </property>
135 <property stdset="1"> 135 <property stdset="1">
136 <name>editable</name> 136 <name>editable</name>
137 <bool>true</bool> 137 <bool>true</bool>
138 </property> 138 </property>
139 <property stdset="1"> 139 <property stdset="1">
140 <name>currentItem</name> 140 <name>currentItem</name>
141 <number>0</number> 141 <number>0</number>
142 </property> 142 </property>
143 <property stdset="1"> 143 <property stdset="1">
144 <name>duplicatesEnabled</name> 144 <name>duplicatesEnabled</name>
145 <bool>false</bool> 145 <bool>false</bool>
146 </property> 146 </property>
147 </widget> 147 </widget>
148 <widget row="0" column="0" > 148 <widget row="0" column="0" >
149 <class>QLabel</class> 149 <class>QLabel</class>
150 <property stdset="1"> 150 <property stdset="1">
151 <name>name</name> 151 <name>name</name>
152 <cstring>TextLabel1</cstring> 152 <cstring>TextLabel1</cstring>
153 </property> 153 </property>
154 <property stdset="1"> 154 <property stdset="1">
155 <name>text</name> 155 <name>text</name>
156 <string>Description:</string> 156 <string>Description:</string>
157 </property> 157 </property>
158 </widget> 158 </widget>
159 <widget row="1" column="1" rowspan="1" colspan="3" > 159 <widget row="1" column="1" rowspan="1" colspan="3" >
160 <class>QComboBox</class> 160 <class>QComboBox</class>
161 <item> 161 <item>
162 <property> 162 <property>
163 <name>text</name> 163 <name>text</name>
164 <string></string> 164 <string></string>
165 </property> 165 </property>
166 </item> 166 </item>
167 <item> 167 <item>
168 <property> 168 <property>
169 <name>text</name> 169 <name>text</name>
170 <string>Office</string> 170 <string>Office</string>
171 </property> 171 </property>
172 </item> 172 </item>
173 <item> 173 <item>
174 <property> 174 <property>
175 <name>text</name> 175 <name>text</name>
176 <string>Home</string> 176 <string>Home</string>
177 </property> 177 </property>
178 </item> 178 </item>
179 <property stdset="1"> 179 <property stdset="1">
180 <name>name</name> 180 <name>name</name>
181 <cstring>comboLocation</cstring> 181 <cstring>comboLocation</cstring>
182 </property> 182 </property>
183 <property stdset="1"> 183 <property stdset="1">
184 <name>sizePolicy</name> 184 <name>sizePolicy</name>
185 <sizepolicy> 185 <sizepolicy>
186 <hsizetype>7</hsizetype> 186 <hsizetype>7</hsizetype>
187 <vsizetype>0</vsizetype> 187 <vsizetype>0</vsizetype>
188 </sizepolicy> 188 </sizepolicy>
189 </property> 189 </property>
190 <property stdset="1"> 190 <property stdset="1">
191 <name>editable</name> 191 <name>editable</name>
192 <bool>true</bool> 192 <bool>true</bool>
193 </property> 193 </property>
194 <property stdset="1"> 194 <property stdset="1">
195 <name>currentItem</name> 195 <name>currentItem</name>
196 <number>0</number> 196 <number>0</number>
197 </property> 197 </property>
198 <property stdset="1"> 198 <property stdset="1">
199 <name>duplicatesEnabled</name> 199 <name>duplicatesEnabled</name>
200 <bool>false</bool> 200 <bool>false</bool>
201 </property> 201 </property>
202 </widget> 202 </widget>
203 <widget row="2" column="1" rowspan="1" colspan="3" > 203 <widget row="2" column="1" rowspan="1" colspan="3" >
204 <class>CategorySelect</class> 204 <class>CategorySelect</class>
205 <property stdset="1"> 205 <property stdset="1">
206 <name>name</name> 206 <name>name</name>
207 <cstring>comboCategory</cstring> 207 <cstring>comboCategory</cstring>
208 </property> 208 </property>
209 </widget> 209 </widget>
210 <widget row="3" column="0" > 210 <widget row="3" column="0" >
211 <class>QLabel</class> 211 <class>QLabel</class>
212 <property stdset="1"> 212 <property stdset="1">
213 <name>name</name> 213 <name>name</name>
214 <cstring>TextLabel3</cstring> 214 <cstring>TextLabel3</cstring>
215 </property> 215 </property>
216 <property stdset="1"> 216 <property stdset="1">
217 <name>text</name> 217 <name>text</name>
218 <string>Start</string> 218 <string>Start</string>
219 </property> 219 </property>
220 </widget> 220 </widget>
221 <widget row="3" column="1" > 221 <widget row="3" column="1" >
222 <class>QPushButton</class> 222 <class>QPushButton</class>
223 <property stdset="1"> 223 <property stdset="1">
224 <name>name</name> 224 <name>name</name>
225 <cstring>buttonStart</cstring> 225 <cstring>buttonStart</cstring>
226 </property> 226 </property>
227 <property stdset="1"> 227 <property stdset="1">
228 <name>text</name> 228 <name>text</name>
229 <string>Jan 02 00</string> 229 <string>Jan 02 00</string>
230 </property> 230 </property>
231 </widget> 231 </widget>
232 <widget row="3" column="2" rowspan="1" colspan="2" > 232 <widget row="3" column="2" rowspan="1" colspan="2" >
233 <class>QComboBox</class> 233 <class>QLineEdit</class>
234 <item>
235 <property>
236 <name>text</name>
237 <string>00:00</string>
238 </property>
239 </item>
240 <item>
241 <property>
242 <name>text</name>
243 <string>00:30</string>
244 </property>
245 </item>
246 <item>
247 <property>
248 <name>text</name>
249 <string>01:00</string>
250 </property>
251 </item>
252 <item>
253 <property>
254 <name>text</name>
255 <string>01:30</string>
256 </property>
257 </item>
258 <item>
259 <property>
260 <name>text</name>
261 <string>02:00</string>
262 </property>
263 </item>
264 <item>
265 <property>
266 <name>text</name>
267 <string>02:30</string>
268 </property>
269 </item>
270 <item>
271 <property>
272 <name>text</name>
273 <string>03:00</string>
274 </property>
275 </item>
276 <item>
277 <property>
278 <name>text</name>
279 <string>03:30</string>
280 </property>
281 </item>
282 <item>
283 <property>
284 <name>text</name>
285 <string>04:00</string>
286 </property>
287 </item>
288 <item>
289 <property>
290 <name>text</name>
291 <string>04:30</string>
292 </property>
293 </item>
294 <item>
295 <property>
296 <name>text</name>
297 <string>05:00</string>
298 </property>
299 </item>
300 <item>
301 <property>
302 <name>text</name>
303 <string>05:30</string>
304 </property>
305 </item>
306 <item>
307 <property>
308 <name>text</name>
309 <string>06:00</string>
310 </property>
311 </item>
312 <item>
313 <property>
314 <name>text</name>
315 <string>06:30</string>
316 </property>
317 </item>
318 <item>
319 <property>
320 <name>text</name>
321 <string>07:00</string>
322 </property>
323 </item>
324 <item>
325 <property>
326 <name>text</name>
327 <string>07:30</string>
328 </property>
329 </item>
330 <item>
331 <property>
332 <name>text</name>
333 <string>08:00</string>
334 </property>
335 </item>
336 <item>
337 <property>
338 <name>text</name>
339 <string>08:30</string>
340 </property>
341 </item>
342 <item>
343 <property>
344 <name>text</name>
345 <string>09:00</string>
346 </property>
347 </item>
348 <item>
349 <property>
350 <name>text</name>
351 <string>09:30</string>
352 </property>
353 </item>
354 <item>
355 <property>
356 <name>text</name>
357 <string>10:00</string>
358 </property>
359 </item>
360 <item>
361 <property>
362 <name>text</name>
363 <string>10:30</string>
364 </property>
365 </item>
366 <item>
367 <property>
368 <name>text</name>
369 <string>11:00</string>
370 </property>
371 </item>
372 <item>
373 <property>
374 <name>text</name>
375 <string>11:30</string>
376 </property>
377 </item>
378 <item>
379 <property>
380 <name>text</name>
381 <string>12:00</string>
382 </property>
383 </item>
384 <item>
385 <property>
386 <name>text</name>
387 <string>12:30</string>
388 </property>
389 </item>
390 <item>
391 <property>
392 <name>text</name>
393 <string>13:00</string>
394 </property>
395 </item>
396 <item>
397 <property>
398 <name>text</name>
399 <string>13:30</string>
400 </property>
401 </item>
402 <item>
403 <property>
404 <name>text</name>
405 <string>14:00</string>
406 </property>
407 </item>
408 <item>
409 <property>
410 <name>text</name>
411 <string>14:30</string>
412 </property>
413 </item>
414 <item>
415 <property>
416 <name>text</name>
417 <string>15:00</string>
418 </property>
419 </item>
420 <item>
421 <property>
422 <name>text</name>
423 <string>15:30</string>
424 </property>
425 </item>
426 <item>
427 <property>
428 <name>text</name>
429 <string>16:00</string>
430 </property>
431 </item>
432 <item>
433 <property>
434 <name>text</name>
435 <string>16:30</string>
436 </property>
437 </item>
438 <item>
439 <property>
440 <name>text</name>
441 <string>17:00</string>
442 </property>
443 </item>
444 <item>
445 <property>
446 <name>text</name>
447 <string>17:30</string>
448 </property>
449 </item>
450 <item>
451 <property>
452 <name>text</name>
453 <string>18:00</string>
454 </property>
455 </item>
456 <item>
457 <property>
458 <name>text</name>
459 <string>18:30</string>
460 </property>
461 </item>
462 <item>
463 <property>
464 <name>text</name>
465 <string>19:00</string>
466 </property>
467 </item>
468 <item>
469 <property>
470 <name>text</name>
471 <string>19:30</string>
472 </property>
473 </item>
474 <item>
475 <property>
476 <name>text</name>
477 <string>20:00</string>
478 </property>
479 </item>
480 <item>
481 <property>
482 <name>text</name>
483 <string>20:30</string>
484 </property>
485 </item>
486 <item>
487 <property>
488 <name>text</name>
489 <string>21:00</string>
490 </property>
491 </item>
492 <item>
493 <property>
494 <name>text</name>
495 <string>21:30</string>
496 </property>
497 </item>
498 <item>
499 <property>
500 <name>text</name>
501 <string>22:00</string>
502 </property>
503 </item>
504 <item>
505 <property>
506 <name>text</name>
507 <string>22:30</string>
508 </property>
509 </item>
510 <item>
511 <property>
512 <name>text</name>
513 <string>23:00</string>
514 </property>
515 </item>
516 <item>
517 <property>
518 <name>text</name>
519 <string>23:30</string>
520 </property>
521 </item>
522 <property stdset="1"> 234 <property stdset="1">
523 <name>name</name> 235 <name>name</name>
524 <cstring>comboStart</cstring> 236 <cstring>comboStart</cstring>
525 </property> 237 </property>
238 </widget>
239 <widget row="5" column="1" colspan="3">
240 <class>TimePicker</class>
526 <property stdset="1"> 241 <property stdset="1">
527 <name>editable</name> 242 <name>name</name>
528 <bool>true</bool> 243 <cstring>timePickerStart</cstring>
529 </property>
530 <property stdset="1">
531 <name>duplicatesEnabled</name>
532 <bool>false</bool>
533 </property> 244 </property>
534 </widget> 245 </widget>
535 <widget row="4" column="1" > 246 <widget row="4" column="1" >
536 <class>QPushButton</class> 247 <class>QPushButton</class>
537 <property stdset="1"> 248 <property stdset="1">
538 <name>name</name> 249 <name>name</name>
539 <cstring>buttonEnd</cstring> 250 <cstring>buttonEnd</cstring>
540 </property> 251 </property>
541 <property stdset="1"> 252 <property stdset="1">
542 <name>text</name> 253 <name>text</name>
543 <string>Jan 02 00</string> 254 <string>Jan 02 00</string>
544 </property> 255 </property>
545 </widget> 256 </widget>
546 <widget row="4" column="2" rowspan="1" colspan="2" > 257 <widget row="4" column="2" rowspan="1" colspan="2" >
547 <class>QComboBox</class> 258 <class>QLineEdit</class>
548 <item>
549 <property>
550 <name>text</name>
551 <string>00:00</string>
552 </property>
553 </item>
554 <item>
555 <property>
556 <name>text</name>
557 <string>00:30</string>
558 </property>
559 </item>
560 <item>
561 <property>
562 <name>text</name>
563 <string>01:00</string>
564 </property>
565 </item>
566 <item>
567 <property>
568 <name>text</name>
569 <string>01:30</string>
570 </property>
571 </item>
572 <item>
573 <property>
574 <name>text</name>
575 <string>02:00</string>
576 </property>
577 </item>
578 <item>
579 <property>
580 <name>text</name>
581 <string>02:30</string>
582 </property>
583 </item>
584 <item>
585 <property>
586 <name>text</name>
587 <string>03:00</string>
588 </property>
589 </item>
590 <item>
591 <property>
592 <name>text</name>
593 <string>03:30</string>
594 </property>
595 </item>
596 <item>
597 <property>
598 <name>text</name>
599 <string>04:00</string>
600 </property>
601 </item>
602 <item>
603 <property>
604 <name>text</name>
605 <string>04:30</string>
606 </property>
607 </item>
608 <item>
609 <property>
610 <name>text</name>
611 <string>05:00</string>
612 </property>
613 </item>
614 <item>
615 <property>
616 <name>text</name>
617 <string>05:30</string>
618 </property>
619 </item>
620 <item>
621 <property>
622 <name>text</name>
623 <string>06:00</string>
624 </property>
625 </item>
626 <item>
627 <property>
628 <name>text</name>
629 <string>06:30</string>
630 </property>
631 </item>
632 <item>
633 <property>
634 <name>text</name>
635 <string>07:00</string>
636 </property>
637 </item>
638 <item>
639 <property>
640 <name>text</name>
641 <string>07:30</string>
642 </property>
643 </item>
644 <item>
645 <property>
646 <name>text</name>
647 <string>08:00</string>
648 </property>
649 </item>
650 <item>
651 <property>
652 <name>text</name>
653 <string>08:30</string>
654 </property>
655 </item>
656 <item>
657 <property>
658 <name>text</name>
659 <string>09:00</string>
660 </property>
661 </item>
662 <item>
663 <property>
664 <name>text</name>
665 <string>09:30</string>
666 </property>
667 </item>
668 <item>
669 <property>
670 <name>text</name>
671 <string>10:00</string>
672 </property>
673 </item>
674 <item>
675 <property>
676 <name>text</name>
677 <string>10:30</string>
678 </property>
679 </item>
680 <item>
681 <property>
682 <name>text</name>
683 <string>11:00</string>
684 </property>
685 </item>
686 <item>
687 <property>
688 <name>text</name>
689 <string>11:30</string>
690 </property>
691 </item>
692 <item>
693 <property>
694 <name>text</name>
695 <string>12:00</string>
696 </property>
697 </item>
698 <item>
699 <property>
700 <name>text</name>
701 <string>12:30</string>
702 </property>
703 </item>
704 <item>
705 <property>
706 <name>text</name>
707 <string>13:00</string>
708 </property>
709 </item>
710 <item>
711 <property>
712 <name>text</name>
713 <string>13:30</string>
714 </property>
715 </item>
716 <item>
717 <property>
718 <name>text</name>
719 <string>14:00</string>
720 </property>
721 </item>
722 <item>
723 <property>
724 <name>text</name>
725 <string>14:30</string>
726 </property>
727 </item>
728 <item>
729 <property>
730 <name>text</name>
731 <string>15:00</string>
732 </property>
733 </item>
734 <item>
735 <property>
736 <name>text</name>
737 <string>15:30</string>
738 </property>
739 </item>
740 <item>
741 <property>
742 <name>text</name>
743 <string>16:00</string>
744 </property>
745 </item>
746 <item>
747 <property>
748 <name>text</name>
749 <string>16:30</string>
750 </property>
751 </item>
752 <item>
753 <property>
754 <name>text</name>
755 <string>17:00</string>
756 </property>
757 </item>
758 <item>
759 <property>
760 <name>text</name>
761 <string>17:30</string>
762 </property>
763 </item>
764 <item>
765 <property>
766 <name>text</name>
767 <string>18:00</string>
768 </property>
769 </item>
770 <item>
771 <property>
772 <name>text</name>
773 <string>18:30</string>
774 </property>
775 </item>
776 <item>
777 <property>
778 <name>text</name>
779 <string>19:00</string>
780 </property>
781 </item>
782 <item>
783 <property>
784 <name>text</name>
785 <string>19:30</string>
786 </property>
787 </item>
788 <item>
789 <property>
790 <name>text</name>
791 <string>20:00</string>
792 </property>
793 </item>
794 <item>
795 <property>
796 <name>text</name>
797 <string>20:30</string>
798 </property>
799 </item>
800 <item>
801 <property>
802 <name>text</name>
803 <string>21:00</string>
804 </property>
805 </item>
806 <item>
807 <property>
808 <name>text</name>
809 <string>21:30</string>
810 </property>
811 </item>
812 <item>
813 <property>
814 <name>text</name>
815 <string>22:00</string>
816 </property>
817 </item>
818 <item>
819 <property>
820 <name>text</name>
821 <string>22:30</string>
822 </property>
823 </item>
824 <item>
825 <property>
826 <name>text</name>
827 <string>23:00</string>
828 </property>
829 </item>
830 <item>
831 <property>
832 <name>text</name>
833 <string>23:30</string>
834 </property>
835 </item>
836 <property stdset="1"> 259 <property stdset="1">
837 <name>name</name> 260 <name>name</name>
838 <cstring>comboEnd</cstring> 261 <cstring>comboEnd</cstring>
839 </property> 262 </property>
840 <property stdset="1">
841 <name>editable</name>
842 <bool>true</bool>
843 </property>
844 <property stdset="1">
845 <name>duplicatesEnabled</name>
846 <bool>false</bool>
847 </property>
848 </widget> 263 </widget>
849 <widget row="4" column="0" > 264 <widget row="4" column="0" >
850 <class>QLabel</class> 265 <class>QLabel</class>
851 <property stdset="1"> 266 <property stdset="1">
852 <name>name</name> 267 <name>name</name>
853 <cstring>TextLabel3_2</cstring> 268 <cstring>TextLabel3_2</cstring>
854 </property> 269 </property>
855 <property stdset="1"> 270 <property stdset="1">
856 <name>text</name> 271 <name>text</name>
857 <string>End</string> 272 <string>End</string>
858 </property> 273 </property>
859 </widget> 274 </widget>
860 <widget row="5" column="0" > 275 <widget row="6" column="0" >
861 <class>QCheckBox</class> 276 <class>QCheckBox</class>
862 <property stdset="1"> 277 <property stdset="1">
863 <name>name</name> 278 <name>name</name>
864 <cstring>checkAllDay</cstring> 279 <cstring>checkAllDay</cstring>
865 </property> 280 </property>
866 <property stdset="1"> 281 <property stdset="1">
867 <name>text</name> 282 <name>text</name>
868 <string>All day</string> 283 <string>All day</string>
869 </property> 284 </property>
870 </widget> 285 </widget>
871 <widget row="6" column="0" > 286 <widget row="7" column="0" >
872 <class>QLabel</class> 287 <class>QLabel</class>
873 <property stdset="1"> 288 <property stdset="1">
874 <name>name</name> 289 <name>name</name>
875 <cstring>TextLabel3_2_2</cstring> 290 <cstring>TextLabel3_2_2</cstring>
876 </property> 291 </property>
877 <property stdset="1"> 292 <property stdset="1">
878 <name>text</name> 293 <name>text</name>
879 <string>Time zone:</string> 294 <string>Time zone:</string>
880 </property> 295 </property>
881 </widget> 296 </widget>
882 <widget row="6" column="1" rowspan="1" colspan="3" > 297 <widget row="7" column="1" rowspan="1" colspan="3" >
883 <class>TimeZoneSelector</class> 298 <class>TimeZoneSelector</class>
884 <property stdset="1"> 299 <property stdset="1">
885 <name>name</name> 300 <name>name</name>
886 <cstring>timezone</cstring> 301 <cstring>timezone</cstring>
887 </property> 302 </property>
888 </widget> 303 </widget>
889 <widget row="7" column="0" > 304 <widget row="8" column="0" >
890 <class>QCheckBox</class> 305 <class>QCheckBox</class>
891 <property stdset="1"> 306 <property stdset="1">
892 <name>name</name> 307 <name>name</name>
893 <cstring>checkAlarm</cstring> 308 <cstring>checkAlarm</cstring>
894 </property> 309 </property>
895 <property stdset="1"> 310 <property stdset="1">
896 <name>enabled</name> 311 <name>enabled</name>
897 <bool>true</bool> 312 <bool>true</bool>
898 </property> 313 </property>
899 <property stdset="1"> 314 <property stdset="1">
900 <name>autoMask</name> 315 <name>autoMask</name>
901 <bool>false</bool> 316 <bool>false</bool>
902 </property> 317 </property>
903 <property stdset="1"> 318 <property stdset="1">
904 <name>text</name> 319 <name>text</name>
905 <string>&amp;Alarm</string> 320 <string>&amp;Alarm</string>
906 </property> 321 </property>
907 <property stdset="1"> 322 <property stdset="1">
908 <name>checked</name> 323 <name>checked</name>
909 <bool>false</bool> 324 <bool>false</bool>
910 </property> 325 </property>
911 </widget> 326 </widget>
912 <widget row="7" column="1" rowspan="1" colspan="2" > 327 <widget row="8" column="1" rowspan="1" colspan="2" >
913 <class>QSpinBox</class> 328 <class>QSpinBox</class>
914 <property stdset="1"> 329 <property stdset="1">
915 <name>name</name> 330 <name>name</name>
916 <cstring>spinAlarm</cstring> 331 <cstring>spinAlarm</cstring>
917 </property> 332 </property>
918 <property stdset="1"> 333 <property stdset="1">
919 <name>enabled</name> 334 <name>enabled</name>
920 <bool>false</bool> 335 <bool>false</bool>
921 </property> 336 </property>
922 <property stdset="1"> 337 <property stdset="1">
923 <name>suffix</name> 338 <name>suffix</name>
924 <string> minutes</string> 339 <string> minutes</string>
925 </property> 340 </property>
926 <property stdset="1"> 341 <property stdset="1">
927 <name>maxValue</name> 342 <name>maxValue</name>
928 <number>180</number> 343 <number>180</number>
929 </property> 344 </property>
930 <property stdset="1"> 345 <property stdset="1">
931 <name>minValue</name> 346 <name>minValue</name>
932 <number>0</number> 347 <number>0</number>
933 </property> 348 </property>
934 <property stdset="1"> 349 <property stdset="1">
935 <name>lineStep</name> 350 <name>lineStep</name>
936 <number>5</number> 351 <number>5</number>
937 </property> 352 </property>
938 <property stdset="1"> 353 <property stdset="1">
939 <name>value</name> 354 <name>value</name>
940 <number>5</number> 355 <number>5</number>
941 </property> 356 </property>
942 </widget> 357 </widget>
943 <widget row="7" column="3" > 358 <widget row="8" column="3" >
944 <class>QComboBox</class> 359 <class>QComboBox</class>
945 <item> 360 <item>
946 <property> 361 <property>
947 <name>text</name> 362 <name>text</name>
948 <string>Silent</string> 363 <string>Silent</string>
949 </property> 364 </property>
950 </item> 365 </item>
951 <item> 366 <item>
952 <property> 367 <property>
953 <name>text</name> 368 <name>text</name>
954 <string>Loud</string> 369 <string>Loud</string>
955 </property> 370 </property>
956 </item> 371 </item>
957 <property stdset="1"> 372 <property stdset="1">
958 <name>name</name> 373 <name>name</name>
959 <cstring>comboSound</cstring> 374 <cstring>comboSound</cstring>
960 </property> 375 </property>
961 <property stdset="1"> 376 <property stdset="1">
962 <name>enabled</name> 377 <name>enabled</name>
963 <bool>false</bool> 378 <bool>false</bool>
964 </property> 379 </property>
965 </widget> 380 </widget>
966 <widget row="8" column="0" > 381 <widget row="9" column="0" >
967 <class>QLabel</class> 382 <class>QLabel</class>
968 <property stdset="1"> 383 <property stdset="1">
969 <name>name</name> 384 <name>name</name>
970 <cstring>lblRepeat</cstring> 385 <cstring>lblRepeat</cstring>
971 </property> 386 </property>
972 <property stdset="1"> 387 <property stdset="1">
973 <name>text</name> 388 <name>text</name>
974 <string>Repeat</string> 389 <string>Repeat</string>
975 </property> 390 </property>
976 </widget> 391 </widget>
977 <widget row="8" column="1" rowspan="1" colspan="3" > 392 <widget row="9" column="1" rowspan="1" colspan="3" >
978 <class>QToolButton</class> 393 <class>QToolButton</class>
979 <property stdset="1"> 394 <property stdset="1">
980 <name>name</name> 395 <name>name</name>
981 <cstring>cmdRepeat</cstring> 396 <cstring>cmdRepeat</cstring>
982 </property> 397 </property>
983 <property stdset="1"> 398 <property stdset="1">
984 <name>focusPolicy</name> 399 <name>focusPolicy</name>
985 <enum>TabFocus</enum> 400 <enum>TabFocus</enum>
986 </property> 401 </property>
987 <property stdset="1"> 402 <property stdset="1">
988 <name>text</name> 403 <name>text</name>
989 <string>No Repeat...</string> 404 <string>No Repeat...</string>
990 </property> 405 </property>
991 </widget> 406 </widget>
992 <widget row="9" column="0" rowspan="1" colspan="4" > 407 <widget row="10" column="0" rowspan="1" colspan="4" >
993 <class>QMultiLineEdit</class> 408 <class>QMultiLineEdit</class>
994 <property stdset="1"> 409 <property stdset="1">
995 <name>name</name> 410 <name>name</name>
996 <cstring>editNote</cstring> 411 <cstring>editNote</cstring>
997 </property> 412 </property>
998 </widget> 413 </widget>
999 </grid> 414 </grid>
1000</widget> 415</widget>
1001<customwidgets> 416<customwidgets>
1002 <customwidget> 417 <customwidget>
1003 <class>TimeZoneSelector</class> 418 <class>TimeZoneSelector</class>
1004 <header location="global">qpe/tzselect.h</header> 419 <header location="global">qpe/tzselect.h</header>
1005 <sizehint> 420 <sizehint>
1006 <width>21</width> 421 <width>21</width>
1007 <height>10</height> 422 <height>10</height>
1008 </sizehint> 423 </sizehint>
1009 <container>0</container> 424 <container>0</container>
1010 <sizepolicy> 425 <sizepolicy>
1011 <hordata>7</hordata> 426 <hordata>7</hordata>
1012 <verdata>1</verdata> 427 <verdata>1</verdata>
1013 </sizepolicy> 428 </sizepolicy>
1014 <pixmap>image0</pixmap> 429 <pixmap>image0</pixmap>
1015 </customwidget> 430 </customwidget>
1016 <customwidget> 431 <customwidget>
1017 <class>CategorySelect</class> 432 <class>CategorySelect</class>
1018 <header location="global">qpe/categoryselect.h</header> 433 <header location="global">qpe/categoryselect.h</header>
1019 <sizehint> 434 <sizehint>
1020 <width>-1</width> 435 <width>-1</width>
1021 <height>-1</height> 436 <height>-1</height>
1022 </sizehint> 437 </sizehint>
1023 <container>0</container> 438 <container>0</container>
1024 <sizepolicy> 439 <sizepolicy>
1025 <hordata>7</hordata> 440 <hordata>7</hordata>
1026 <verdata>1</verdata> 441 <verdata>1</verdata>
1027 </sizepolicy> 442 </sizepolicy>
1028 <pixmap>image1</pixmap> 443 <pixmap>image1</pixmap>
1029 </customwidget> 444 </customwidget>
445 <customwidget>
446 <class>TimePicker</class>
447 <header location="local">timepicker.h</header>
448 <sizehint>
449 <width>-1</width>
450 <height>-1</height>
451 </sizehint>
452 <container>0</container>
453 <sizepolicy>
454 <hordata>7</hordata>
455 <verdata>1</verdata>
456 </sizepolicy>
457 <pixmap>image1</pixmap>
458 </customwidget>
1030</customwidgets> 459</customwidgets>
1031<images> 460<images>
1032 <image> 461 <image>
1033 <name>image0</name> 462 <name>image0</name>
1034 <data format="XPM.GZ" length="45">789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523250004143a55a6b2e0026630c4f</data> 463 <data format="XPM.GZ" length="45">789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523250004143a55a6b2e0026630c4f</data>
1035 </image> 464 </image>
1036 <image> 465 <image>
1037 <name>image1</name> 466 <name>image1</name>
1038 <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data> 467 <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data>
1039 </image> 468 </image>
1040</images> 469</images>
1041<connections> 470<connections>
1042 <connection> 471 <connection>
1043 <sender>checkAlarm</sender> 472 <sender>checkAlarm</sender>
1044 <signal>toggled(bool)</signal> 473 <signal>toggled(bool)</signal>
1045 <receiver>spinAlarm</receiver> 474 <receiver>spinAlarm</receiver>
1046 <slot>setEnabled(bool)</slot> 475 <slot>setEnabled(bool)</slot>
1047 </connection> 476 </connection>
1048 <connection> 477 <connection>
1049 <sender>comboEnd</sender> 478 <sender>comboEnd</sender>
1050 <signal>activated(const QString&amp;)</signal> 479 <signal>textChanged(const QString&amp;)</signal>
1051 <receiver>DateEntryBase</receiver> 480 <receiver>DateEntryBase</receiver>
1052 <slot>endTimeChanged( const QString &amp; )</slot> 481 <slot>endTimeChanged( const QString &amp; )</slot>
1053 </connection> 482 </connection>
1054 <connection> 483 <connection>
1055 <sender>cmdRepeat</sender> 484 <sender>cmdRepeat</sender>
1056 <signal>clicked()</signal> 485 <signal>clicked()</signal>
1057 <receiver>DateEntryBase</receiver> 486 <receiver>DateEntryBase</receiver>
1058 <slot>slotRepeat()</slot> 487 <slot>slotRepeat()</slot>
1059 </connection> 488 </connection>
1060 <connection> 489 <connection>
1061 <sender>comboStart</sender> 490 <sender>comboStart</sender>
1062 <signal>activated(int)</signal> 491 <signal>textChanged(const QString &amp;)</signal>
1063 <receiver>DateEntryBase</receiver> 492 <receiver>DateEntryBase</receiver>
1064 <slot>startTimeChanged( int )</slot> 493 <slot>startTimeEdited( const QString &amp; )</slot>
1065 </connection> 494 </connection>
1066 <connection> 495 <connection>
1067 <sender>checkAllDay</sender> 496 <sender>checkAllDay</sender>
1068 <signal>toggled(bool)</signal> 497 <signal>toggled(bool)</signal>
1069 <receiver>comboEnd</receiver> 498 <receiver>comboEnd</receiver>
1070 <slot>setDisabled(bool)</slot> 499 <slot>setDisabled(bool)</slot>
1071 </connection> 500 </connection>
1072 <connection> 501 <connection>
1073 <sender>checkAlarm</sender> 502 <sender>checkAlarm</sender>
1074 <signal>toggled(bool)</signal> 503 <signal>toggled(bool)</signal>
1075 <receiver>comboSound</receiver> 504 <receiver>comboSound</receiver>
1076 <slot>setEnabled(bool)</slot> 505 <slot>setEnabled(bool)</slot>
1077 </connection> 506 </connection>
1078 <connection> 507 <connection>
1079 <sender>checkAllDay</sender> 508 <sender>checkAllDay</sender>
1080 <signal>toggled(bool)</signal> 509 <signal>toggled(bool)</signal>
1081 <receiver>comboStart</receiver> 510 <receiver>comboStart</receiver>
1082 <slot>setDisabled(bool)</slot> 511 <slot>setDisabled(bool)</slot>
1083 </connection> 512 </connection>
1084 <slot access="public">endDateChanged( const QString &amp; )</slot> 513 <slot access="public">endDateChanged( const QString &amp; )</slot>
1085 <slot access="public">endDateChanged( int, int, int )</slot> 514 <slot access="public">endDateChanged( int, int, int )</slot>
1086 <slot access="public">endTimeChanged( const QString &amp; )</slot> 515 <slot access="public">endTimeChanged( const QString &amp; )</slot>
1087 <slot access="public">slotRepeat()</slot> 516 <slot access="public">slotRepeat()</slot>
1088 <slot access="public">slotWait( int )</slot> 517 <slot access="public">slotWait( int )</slot>
1089 <slot access="public">startDateChanged( const QString &amp; )</slot> 518 <slot access="public">startDateChanged( const QString &amp; )</slot>
1090 <slot access="public">startDateChanged(int, int, int)</slot> 519 <slot access="public">startDateChanged(int, int, int)</slot>
1091 <slot access="public">startTimeChanged( int )</slot> 520 <slot access="public">startTimeEdited( const QString &amp; )</slot>
1092 <slot access="public">typeChanged( const QString &amp; )</slot> 521 <slot access="public">typeChanged( const QString &amp; )</slot>
1093 <slot access="public">tzexecute(void)</slot> 522 <slot access="public">tzexecute(void)</slot>
1094</connections> 523</connections>
1095</UI> 524</UI>
diff --git a/core/pim/datebook/dateentryimpl.cpp b/core/pim/datebook/dateentryimpl.cpp
index b2e3e3a..1c43363 100644
--- a/core/pim/datebook/dateentryimpl.cpp
+++ b/core/pim/datebook/dateentryimpl.cpp
@@ -1,482 +1,509 @@
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 "dateentryimpl.h" 21#include "dateentryimpl.h"
22#include "repeatentry.h" 22#include "repeatentry.h"
23 23
24#include <qpe/qpeapplication.h> 24#include <qpe/qpeapplication.h>
25#include <qpe/categoryselect.h> 25#include <qpe/categoryselect.h>
26#include <qpe/datebookmonth.h> 26#include <qpe/datebookmonth.h>
27#include <qpe/global.h> 27#include <qpe/global.h>
28#include <qpe/timeconversion.h> 28#include <qpe/timeconversion.h>
29#include <qpe/timestring.h> 29#include <qpe/timestring.h>
30#include <qpe/tzselect.h> 30#include <qpe/tzselect.h>
31 31
32#include <qcheckbox.h> 32#include <qcheckbox.h>
33#include <qcombobox.h> 33#include <qcombobox.h>
34#include <qlayout.h> 34#include <qlayout.h>
35#include <qlineedit.h> 35#include <qlineedit.h>
36#include <qmultilineedit.h> 36#include <qmultilineedit.h>
37#include <qpopupmenu.h> 37#include <qpopupmenu.h>
38#include <qscrollview.h> 38#include <qscrollview.h>
39#include <qspinbox.h> 39#include <qspinbox.h>
40#include <qtoolbutton.h> 40#include <qtoolbutton.h>
41 41
42#include "timepicker.h"
43
42#include <stdlib.h> 44#include <stdlib.h>
43 45
44#include <stdiostream.h> 46#include <stdiostream.h>
45 47
46/* 48/*
47 * Constructs a DateEntry which is a child of 'parent', with the 49 * Constructs a DateEntry which is a child of 'parent', with the
48 * name 'name' and widget flags set to 'f' 50 * name 'name' and widget flags set to 'f'
49 * 51 *
50 * The dialog will by default be modeless, unless you set 'modal' to 52 * The dialog will by default be modeless, unless you set 'modal' to
51 * TRUE to construct a modal dialog. 53 * TRUE to construct a modal dialog.
52 */ 54 */
53 55
54DateEntry::DateEntry( bool startOnMonday, const QDateTime &start, 56DateEntry::DateEntry( bool startOnMonday, const QDateTime &start,
55 const QDateTime &end, bool whichClock, QWidget* parent, 57 const QDateTime &end, bool whichClock, QWidget* parent,
56 const char* name ) 58 const char* name )
57 : DateEntryBase( parent, name ), 59 : DateEntryBase( parent, name ),
58 ampm( whichClock ), 60 ampm( whichClock ),
59 startWeekOnMonday( startOnMonday ) 61 startWeekOnMonday( startOnMonday )
60{ 62{
61 init(); 63 init();
62 setDates(start,end); 64 setDates(start,end);
63 setFocusProxy(comboDescription); 65 setFocusProxy(comboDescription);
64} 66}
65 67
66static void addOrPick( QComboBox* combo, const QString& t ) 68static void addOrPick( QComboBox* combo, const QString& t )
67{ 69{
70 // Pick an item if one excists
68 for (int i=0; i<combo->count(); i++) { 71 for (int i=0; i<combo->count(); i++) {
69 if ( combo->text(i) == t ) { 72 if ( combo->text(i) == t ) {
70 combo->setCurrentItem(i); 73 combo->setCurrentItem(i);
71 return; 74 return;
72 } 75 }
73 } 76 }
74 combo->setEditText(t); 77
78 // Else add one
79 combo->insertItem(t);
80 combo->setCurrentItem(combo->count()-1);
75} 81}
76 82
77DateEntry::DateEntry( bool startOnMonday, const Event &event, bool whichClock, 83DateEntry::DateEntry( bool startOnMonday, const Event &event, bool whichClock,
78 QWidget* parent, const char* name ) 84 QWidget* parent, const char* name )
79 : DateEntryBase( parent, name ), 85 : DateEntryBase( parent, name ),
80 ampm( whichClock ), 86 ampm( whichClock ),
81 startWeekOnMonday( startOnMonday ) 87 startWeekOnMonday( startOnMonday )
82{ 88{
83 init(); 89 init();
84 setDates(event.start(),event.end()); 90 setDates(event.start(),event.end());
85 comboCategory->setCategories( event.categories(), "Calendar", tr("Calendar") ); 91 comboCategory->setCategories( event.categories(), "Calendar", tr("Calendar") );
86 if(!event.description().isEmpty()) 92 if(!event.description().isEmpty())
87 addOrPick( comboDescription, event.description() ); 93 addOrPick( comboDescription, event.description() );
88 if(!event.location().isEmpty()) 94 if(!event.location().isEmpty())
89 addOrPick( comboLocation, event.location() ); 95 addOrPick( comboLocation, event.location() );
90 checkAlarm->setChecked( event.hasAlarm() ); 96 checkAlarm->setChecked( event.hasAlarm() );
91 checkAllDay->setChecked( event.type() == Event::AllDay ); 97 checkAllDay->setChecked( event.type() == Event::AllDay );
92 if(!event.notes().isEmpty()) 98 if(!event.notes().isEmpty())
93 editNote->setText(event.notes()); 99 editNote->setText(event.notes());
94 spinAlarm->setValue(event.alarmTime()); 100 spinAlarm->setValue(event.alarmTime());
95 if ( event.alarmSound() != Event::Silent ) 101 if ( event.alarmSound() != Event::Silent )
96 comboSound->setCurrentItem( 1 ); 102 comboSound->setCurrentItem( 1 );
97 if ( event.hasRepeat() ) { 103 if ( event.hasRepeat() ) {
98 rp = event.repeatPattern(); 104 rp = event.repeatPattern();
99 cmdRepeat->setText( tr("Repeat...") ); 105 cmdRepeat->setText( tr("Repeat...") );
100 } 106 }
101 setRepeatLabel(); 107 setRepeatLabel();
102} 108}
103 109
104void DateEntry::setDates( const QDateTime& s, const QDateTime& e ) 110void DateEntry::setDates( const QDateTime& s, const QDateTime& e )
105{ 111{
106 int shour,
107 ehour;
108 QString strStart,
109 strEnd;
110 startDate = s.date(); 112 startDate = s.date();
111 endDate = e.date(); 113 endDate = e.date();
112 startTime = s.time(); 114 startTime = s.time();
113 endTime = e.time(); 115 endTime = e.time();
114 startDateChanged( s.date().year(), s.date().month(), s.date().day() ); 116 startDateChanged( s.date().year(), s.date().month(), s.date().day() );
117 endDateChanged( e.date().year(), e.date().month(), e.date().day() );
118 updateTimeEdit(true,true);
119}
120
121void DateEntry::updateTimeEdit(bool s, bool e) {
122
123 // Comboboxes
124 QString strStart, strEnd;
125 int shour, ehour;
115 if ( ampm ) { 126 if ( ampm ) {
116 shour = s.time().hour(); 127 shour = startTime.hour();
117 ehour = e.time().hour(); 128 ehour = endTime.hour();
118 if ( shour >= 12 ) { 129 if ( shour >= 12 ) {
119 if ( shour > 12 ) 130 if ( shour > 12 )
120 shour -= 12; 131 shour -= 12;
121 strStart.sprintf( "%d:%02d PM", shour, s.time().minute() ); 132 strStart.sprintf( "%d:%02d PM", shour, startTime.minute() );
122 } else { 133 } else {
123 if ( shour == 0 ) 134 if ( shour == 0 )
124 shour = 12; 135 shour = 12;
125 strStart.sprintf( "%d:%02d AM", shour, s.time().minute() ); 136 strStart.sprintf( "%d:%02d AM", shour, startTime.minute() );
126 } 137 }
127 if ( ehour == 24 && e.time().minute() == 0 ) { 138 if ( ehour == 24 && endTime.minute() == 0 ) {
128 strEnd = "11:59 PM"; // or "midnight" 139 strEnd = "11:59 PM"; // or "midnight"
129 } else if ( ehour >= 12 ) { 140 } else if ( ehour >= 12 ) {
130 if ( ehour > 12 ) 141 if ( ehour > 12 )
131 ehour -= 12; 142 ehour -= 12;
132 strEnd.sprintf( "%d:%02d PM", ehour, e.time().minute() ); 143 strEnd.sprintf( "%d:%02d PM", ehour, endTime.minute() );
133 } else { 144 } else {
134 if ( ehour == 0 ) 145 if ( ehour == 0 )
135 ehour = 12; 146 ehour = 12;
136 strEnd.sprintf( "%d:%02d AM", ehour, e.time().minute() ); 147 strEnd.sprintf( "%d:%02d AM", ehour, endTime.minute() );
137 } 148 }
138 } else { 149 } else {
139 strStart.sprintf( "%02d:%02d", s.time().hour(), s.time().minute() ); 150 strStart.sprintf( "%02d:%02d", startTime.hour(), startTime.minute() );
140 strEnd.sprintf( "%02d:%02d", e.time().hour(), e.time().minute() ); 151 strEnd.sprintf( "%02d:%02d", endTime.hour(), endTime.minute() );
141 } 152 }
142 addOrPick(comboStart, strStart ); 153
143 endDateChanged( e.date().year(), e.date().month(), e.date().day() ); 154 if (s) comboStart->setText(strStart);
144 addOrPick(comboEnd, strEnd ); 155 if (e) comboEnd->setText(strEnd);
145} 156}
146 157
147void DateEntry::init() 158void DateEntry::init()
148{ 159{
149 comboDescription->setInsertionPolicy(QComboBox::AtCurrent); 160 comboDescription->setInsertionPolicy(QComboBox::AtCurrent);
150 comboLocation->setInsertionPolicy(QComboBox::AtCurrent); 161 comboLocation->setInsertionPolicy(QComboBox::AtCurrent);
151 162
152 initCombos(); 163 initCombos();
153 QPopupMenu *m1 = new QPopupMenu( this ); 164 QPopupMenu *m1 = new QPopupMenu( this );
154 startPicker = new DateBookMonth( m1, 0, TRUE ); 165 startPicker = new DateBookMonth( m1, 0, TRUE );
155 m1->insertItem( startPicker ); 166 m1->insertItem( startPicker );
156 buttonStart->setPopup( m1 ); 167 buttonStart->setPopup( m1 );
157 connect( startPicker, SIGNAL( dateClicked( int, int, int ) ), 168 connect( startPicker, SIGNAL( dateClicked( int, int, int ) ),
158 this, SLOT( startDateChanged( int, int, int ) ) ); 169 this, SLOT( startDateChanged( int, int, int ) ) );
159 170
160 //Let start button change both start and end dates 171 //Let start button change both start and end dates
161 connect( startPicker, SIGNAL( dateClicked( int, int, int ) ), 172 connect( startPicker, SIGNAL( dateClicked( int, int, int ) ),
162 this, SLOT( endDateChanged( int, int, int ) ) ); 173 this, SLOT( endDateChanged( int, int, int ) ) );
163 connect( qApp, SIGNAL( clockChanged( bool ) ), 174 connect( qApp, SIGNAL( clockChanged( bool ) ),
164 this, SLOT( slotChangeClock( bool ) ) ); 175 this, SLOT( slotChangeClock( bool ) ) );
165 connect( qApp, SIGNAL(weekChanged(bool)), 176 connect( qApp, SIGNAL(weekChanged(bool)),
166 this, SLOT(slotChangeStartOfWeek(bool)) ); 177 this, SLOT(slotChangeStartOfWeek(bool)) );
167 178
168 QPopupMenu *m2 = new QPopupMenu( this ); 179 QPopupMenu *m2 = new QPopupMenu( this );
169 endPicker = new DateBookMonth( m2, 0, TRUE ); 180 endPicker = new DateBookMonth( m2, 0, TRUE );
170 m2->insertItem( endPicker ); 181 m2->insertItem( endPicker );
171 buttonEnd->setPopup( m2 ); 182 buttonEnd->setPopup( m2 );
172 connect( endPicker, SIGNAL( dateClicked( int, int, int ) ), 183 connect( endPicker, SIGNAL( dateClicked( int, int, int ) ),
173 this, SLOT( endDateChanged( int, int, int ) ) ); 184 this, SLOT( endDateChanged( int, int, int ) ) );
185
186 connect(timePickerStart, SIGNAL( timeChanged(const QTime &) ),
187 this, SLOT( startTimePicked(const QTime &) ));
188 editNote->setFixedVisibleLines(3);
174} 189}
175 190
176/* 191/*
177 * Destroys the object and frees any allocated resources 192 * Destroys the object and frees any allocated resources
178 */ 193 */
179DateEntry::~DateEntry() 194DateEntry::~DateEntry()
180{ 195{
181 // no need to delete child widgets, Qt does it all for us 196 // no need to delete child widgets, Qt does it all for us
182 //cout << "Del: " << comboStart->currentText() << endl; 197 //cout << "Del: " << comboStart->currentText() << endl;
183} 198}
184 199
185/* 200/*
186 * public slot 201 * public slot
187 */ 202 */
188void DateEntry::endDateChanged( int y, int m, int d ) 203void DateEntry::endDateChanged( int y, int m, int d )
189{ 204{
190 endDate.setYMD( y, m, d ); 205 endDate.setYMD( y, m, d );
191 if ( endDate < startDate ) { 206 if ( endDate < startDate ) {
192 endDate = startDate; 207 endDate = startDate;
193 } 208 }
194 209
195 buttonEnd->setText( TimeString::shortDate( endDate ) ); 210 buttonEnd->setText( TimeString::shortDate( endDate ) );
196 211
197 endPicker->setDate( endDate.year(), endDate.month(), endDate.day() ); 212 endPicker->setDate( endDate.year(), endDate.month(), endDate.day() );
198} 213}
199 214
200static QTime parseTime( const QString& s, bool ampm ) 215static QTime parseTime( const QString& s, bool ampm )
201{ 216{
202 QTime tmpTime; 217 QTime tmpTime;
203 QStringList l = QStringList::split( ':', s ); 218 QStringList l = QStringList::split( ':', s );
204 int hour = l[0].toInt(); 219 int hour = l[0].toInt();
205 if ( ampm ) { 220 if ( ampm ) {
206 int i=0; 221 int i=0;
207 while (i<int(l[1].length()) && l[1][i]>='0' && l[1][i]<='9') 222 while (i<int(l[1].length()) && l[1][i]>='0' && l[1][i]<='9')
208 i++; 223 i++;
209 QString digits = l[1].left(i); 224 QString digits = l[1].left(i);
210 if ( l[1].contains( "PM", FALSE ) ) { 225 if ( l[1].contains( "PM", FALSE ) ) {
211 if ( hour != 12 ) 226 if ( hour != 12 )
212 hour += 12; 227 hour += 12;
213 } else { 228 } else {
214 if ( hour == 12 ) 229 if ( hour == 12 )
215 hour = 0; 230 hour = 0;
216 } 231 }
217 l[1] = digits; 232 l[1] = digits;
218 } 233 }
219 int minute = l[1].toInt(); 234 int minute = l[1].toInt();
220 if ( minute > 59 ) 235 if ( minute > 59 )
221 minute = 59; 236 minute = 59;
222 else if ( minute < 0 ) 237 else if ( minute < 0 )
223 minute = 0; 238 minute = 0;
224 if ( hour > 23 ) { 239 if ( hour > 23 ) {
225 hour = 23; 240 hour = 23;
226 minute = 59; 241 minute = 59;
227 } else if ( hour < 0 ) 242 } else if ( hour < 0 )
228 hour = 0; 243 hour = 0;
229 tmpTime.setHMS( hour, minute, 0 ); 244 tmpTime.setHMS( hour, minute, 0 );
230 return tmpTime; 245 return tmpTime;
231} 246}
232 247
233/* 248/*
234 * public slot 249 * public slot
235 */ 250 */
236void DateEntry::endTimeChanged( const QString &s ) 251void DateEntry::endTimeChanged( const QString &s )
237{ 252{
238 QTime tmpTime = parseTime(s,ampm); 253 QTime tmpTime = parseTime(s,ampm);
239 if ( endDate > startDate || tmpTime >= startTime ) { 254 if ( endDate > startDate || tmpTime >= startTime ) {
240 endTime = tmpTime; 255 endTime = tmpTime;
241 } else { 256 } else {
242 endTime = startTime; 257 endTime = startTime;
243 comboEnd->setCurrentItem( comboStart->currentItem() ); 258 //comboEnd->setCurrentItem( comboStart->currentItem() );
244 } 259 }
260
261}
262
263void DateEntry::endTimeChanged( const QTime &t ) {
245} 264}
246 265
247/* 266/*
248 * public slot 267 * public slot
249 */ 268 */
250void DateEntry::startDateChanged( int y, int m, int d ) 269void DateEntry::startDateChanged( int y, int m, int d )
251{ 270{
252 QDate prev = startDate; 271 QDate prev = startDate;
253 startDate.setYMD( y, m, d ); 272 startDate.setYMD( y, m, d );
254 if ( rp.type == Event::Weekly && 273 if ( rp.type == Event::Weekly &&
255 startDate.dayOfWeek() != prev.dayOfWeek() ) { 274 startDate.dayOfWeek() != prev.dayOfWeek() ) {
256 // if we change the start of a weekly repeating event 275 // if we change the start of a weekly repeating event
257 // set the repeating day appropriately 276 // set the repeating day appropriately
258 char mask = 1 << (prev.dayOfWeek()-1); 277 char mask = 1 << (prev.dayOfWeek()-1);
259 rp.days &= (~mask); 278 rp.days &= (~mask);
260 rp.days |= 1 << (startDate.dayOfWeek()-1); 279 rp.days |= 1 << (startDate.dayOfWeek()-1);
261 } 280 }
262 281
263 buttonStart->setText( TimeString::shortDate( startDate ) ); 282 buttonStart->setText( TimeString::shortDate( startDate ) );
264 283
265 // our pickers must be reset... 284 // our pickers must be reset...
266 startPicker->setDate( y, m, d ); 285 startPicker->setDate( y, m, d );
267 endPicker->setDate( y, m, d ); 286 endPicker->setDate( y, m, d );
268} 287}
269 288
270/* 289/*
271 * public slot 290 * public slot
272 */ 291 */
273void DateEntry::startTimeChanged( int index ) 292void DateEntry::startTimeEdited( const QString &s )
274{ 293{
275 startTime = parseTime(comboStart->text(index),ampm); 294 startTimeChanged(parseTime(s,ampm));
276 changeEndCombo( index ); 295 updateTimeEdit(false,true);
277 //cout << "Start: " << comboStart->currentText() << endl; 296 timePickerStart->setHour(startTime.hour());
297 timePickerStart->setMinute(startTime.minute());
278} 298}
299
300void DateEntry::startTimeChanged( const QTime &t )
301{
302 int duration=startTime.secsTo(endTime);
303 startTime = t;
304 endTime=t.addSecs(duration);
305}
306void DateEntry::startTimePicked( const QTime &t ) {
307 startTimeChanged(t);
308 updateTimeEdit(true,true);
309}
310
279/* 311/*
280 * public slot 312 * public slot
281 */ 313 */
282void DateEntry::typeChanged( const QString &s ) 314void DateEntry::typeChanged( const QString &s )
283{ 315{
284 bool b = s != "All Day"; 316 bool b = s != "All Day";
285 buttonStart->setEnabled( b ); 317 buttonStart->setEnabled( b );
286 comboStart->setEnabled( b ); 318 comboStart->setEnabled( b );
287 comboEnd->setEnabled( b ); 319 comboEnd->setEnabled( b );
288} 320}
289/*
290 * public slot
291 */
292void DateEntry::changeEndCombo( int change )
293{
294 if ( change + 2 < comboEnd->count() )
295 change += 2;
296 comboEnd->setCurrentItem( change );
297 endTimeChanged( comboEnd->currentText() );
298}
299 321
300void DateEntry::slotRepeat() 322void DateEntry::slotRepeat()
301{ 323{
302 // Work around for compiler Bug.. 324 // Work around for compiler Bug..
303 RepeatEntry *e; 325 RepeatEntry *e;
304 326
305 // it is better in my opinion to just grab this from the mother, 327 // it is better in my opinion to just grab this from the mother,
306 // since, this dialog doesn't need to keep track of it... 328 // since, this dialog doesn't need to keep track of it...
307 if ( rp.type != Event::NoRepeat ) 329 if ( rp.type != Event::NoRepeat )
308 e = new RepeatEntry( startWeekOnMonday, rp, startDate, this); 330 e = new RepeatEntry( startWeekOnMonday, rp, startDate, this);
309 else 331 else
310 e = new RepeatEntry( startWeekOnMonday, startDate, this ); 332 e = new RepeatEntry( startWeekOnMonday, startDate, this );
311 333
312#if defined(Q_WS_QWS) || defined(_WS_QWS_) 334#if defined(Q_WS_QWS) || defined(_WS_QWS_)
313 e->showMaximized(); 335 e->showMaximized();
314#endif 336#endif
315 if ( e->exec() ) { 337 if ( e->exec() ) {
316 rp = e->repeatPattern(); 338 rp = e->repeatPattern();
317 setRepeatLabel(); 339 setRepeatLabel();
318 } 340 }
319} 341}
320 342
321void DateEntry::slotChangeStartOfWeek( bool onMonday ) 343void DateEntry::slotChangeStartOfWeek( bool onMonday )
322{ 344{
323 startWeekOnMonday = onMonday; 345 startWeekOnMonday = onMonday;
324} 346}
325 347
326Event DateEntry::event() 348Event DateEntry::event()
327{ 349{
328 Event ev; 350 Event ev;
329 Event::SoundTypeChoice st; 351 Event::SoundTypeChoice st;
330 ev.setDescription( comboDescription->currentText() ); 352 ev.setDescription( comboDescription->currentText() );
331 ev.setLocation( comboLocation->currentText() ); 353 ev.setLocation( comboLocation->currentText() );
332 ev.setCategories( comboCategory->currentCategories() ); 354 ev.setCategories( comboCategory->currentCategories() );
333 ev.setType( checkAllDay->isChecked() ? Event::AllDay : Event::Normal ); 355 ev.setType( checkAllDay->isChecked() ? Event::AllDay : Event::Normal );
334 if ( startDate > endDate ) { 356 if ( startDate > endDate ) {
335 QDate tmp = endDate; 357 QDate tmp = endDate;
336 endDate = startDate; 358 endDate = startDate;
337 startDate = tmp; 359 startDate = tmp;
338 } 360 }
339 startTime = parseTime( comboStart->currentText(), ampm ); 361
340 endTime = parseTime( comboEnd->currentText(), ampm ); 362 // This is now done in the changed slots
363 // startTime = parseTime( comboStart->text(), ampm );
364 //endTime = parseTime( comboEnd->text(), ampm );
365
341 if ( startTime > endTime && endDate == startDate ) { 366 if ( startTime > endTime && endDate == startDate ) {
342 QTime tmp = endTime; 367 QTime tmp = endTime;
343 endTime = startTime; 368 endTime = startTime;
344 startTime = tmp; 369 startTime = tmp;
345 } 370 }
346 // don't set the time if theres no need too 371 // don't set the time if theres no need too
347 if ( ev.type() == Event::AllDay ) { 372 if ( ev.type() == Event::AllDay ) {
348 startTime.setHMS( 0, 0, 0 ); 373 startTime.setHMS( 0, 0, 0 );
349 endTime.setHMS( 23, 59, 59 ); 374 endTime.setHMS( 23, 59, 59 );
350 } 375 }
351 376
352 // adjust start and end times based on timezone 377 // adjust start and end times based on timezone
353 QDateTime start( startDate, startTime ); 378 QDateTime start( startDate, startTime );
354 QDateTime end( endDate, endTime ); 379 QDateTime end( endDate, endTime );
355 time_t start_utc, end_utc; 380 time_t start_utc, end_utc;
356 381
357// qDebug( "tz: %s", timezone->currentZone().latin1() ); 382// qDebug( "tz: %s", timezone->currentZone().latin1() );
358 383
359 // get real timezone 384 // get real timezone
360 QString realTZ; 385 QString realTZ;
361 realTZ = QString::fromLocal8Bit( getenv("TZ") ); 386 realTZ = QString::fromLocal8Bit( getenv("TZ") );
362 387
363 // set timezone 388 // set timezone
364 if ( setenv( "TZ", timezone->currentZone(), true ) != 0 ) 389 if ( setenv( "TZ", timezone->currentZone(), true ) != 0 )
365 qWarning( "There was a problem setting the timezone." ); 390 qWarning( "There was a problem setting the timezone." );
366 391
367 // convert to UTC based on selected TZ (calling tzset internally) 392 // convert to UTC based on selected TZ (calling tzset internally)
368 start_utc = TimeConversion::toUTC( start ); 393 start_utc = TimeConversion::toUTC( start );
369 end_utc = TimeConversion::toUTC( end ); 394 end_utc = TimeConversion::toUTC( end );
370 395
371 // done playing around... put it all back 396 // done playing around... put it all back
372 unsetenv( "TZ" ); 397 unsetenv( "TZ" );
373 if ( !realTZ.isNull() ) 398 if ( !realTZ.isNull() )
374 if ( setenv( "TZ", realTZ, true ) != 0 ) 399 if ( setenv( "TZ", realTZ, true ) != 0 )
375 qWarning( "There was a problem setting the timezone." ); 400 qWarning( "There was a problem setting the timezone." );
376 401
377 // convert UTC to local time (calling tzset internally) 402 // convert UTC to local time (calling tzset internally)
378 ev.setStart( TimeConversion::fromUTC( start_utc ) ); 403 ev.setStart( TimeConversion::fromUTC( start_utc ) );
379 ev.setEnd( TimeConversion::fromUTC( end_utc ) ); 404 ev.setEnd( TimeConversion::fromUTC( end_utc ) );
380 405
381 // we only have one type of sound at the moment... LOUD!!! 406 // we only have one type of sound at the moment... LOUD!!!
382 if ( comboSound->currentItem() != 0 ) 407 if ( comboSound->currentItem() != 0 )
383 st = Event::Loud; 408 st = Event::Loud;
384 else 409 else
385 st = Event::Silent; 410 st = Event::Silent;
386 ev.setAlarm( checkAlarm->isChecked(), spinAlarm->value(), st ); 411 ev.setAlarm( checkAlarm->isChecked(), spinAlarm->value(), st );
387 if ( rp.type != Event::NoRepeat ) 412 if ( rp.type != Event::NoRepeat )
388 ev.setRepeat( TRUE, rp ); 413 ev.setRepeat( TRUE, rp );
389 ev.setNotes( editNote->text() ); 414 ev.setNotes( editNote->text() );
390 415
391 //cout << "Start: " << comboStart->currentText() << endl; 416 //cout << "Start: " << comboStart->currentText() << endl;
392 417
393 return ev; 418 return ev;
394} 419}
395 420
396void DateEntry::setRepeatLabel() 421void DateEntry::setRepeatLabel()
397{ 422{
398 423
399 switch( rp.type ) { 424 switch( rp.type ) {
400 case Event::Daily: 425 case Event::Daily:
401 cmdRepeat->setText( tr("Daily...") ); 426 cmdRepeat->setText( tr("Daily...") );
402 break; 427 break;
403 case Event::Weekly: 428 case Event::Weekly:
404 cmdRepeat->setText( tr("Weekly...") ); 429 cmdRepeat->setText( tr("Weekly...") );
405 break; 430 break;
406 case Event::MonthlyDay: 431 case Event::MonthlyDay:
407 case Event::MonthlyDate: 432 case Event::MonthlyDate:
408 cmdRepeat->setText( tr("Monthly...") ); 433 cmdRepeat->setText( tr("Monthly...") );
409 break; 434 break;
410 case Event::Yearly: 435 case Event::Yearly:
411 cmdRepeat->setText( tr("Yearly...") ); 436 cmdRepeat->setText( tr("Yearly...") );
412 break; 437 break;
413 default: 438 default:
414 cmdRepeat->setText( tr("No Repeat...") ); 439 cmdRepeat->setText( tr("No Repeat...") );
415 } 440 }
416} 441}
417 442
418void DateEntry::setAlarmEnabled( bool alarmPreset, int presetTime, Event::SoundTypeChoice sound ) 443void DateEntry::setAlarmEnabled( bool alarmPreset, int presetTime, Event::SoundTypeChoice sound )
419{ 444{
420 checkAlarm->setChecked( alarmPreset ); 445 checkAlarm->setChecked( alarmPreset );
421 spinAlarm->setValue( presetTime ); 446 spinAlarm->setValue( presetTime );
422 if ( sound != Event::Silent ) 447 if ( sound != Event::Silent )
423 comboSound->setCurrentItem( 1 ); 448 comboSound->setCurrentItem( 1 );
424 else 449 else
425 comboSound->setCurrentItem( 0 ); 450 comboSound->setCurrentItem( 0 );
426} 451}
427 452
428void DateEntry::initCombos() 453void DateEntry::initCombos()
429{ 454{
455 /*
430 comboStart->clear(); 456 comboStart->clear();
431 comboEnd->clear(); 457 comboEnd->clear();
432 if ( ampm ) { 458 if ( ampm ) {
433 for ( int i = 0; i < 24; i++ ) { 459 for ( int i = 0; i < 24; i++ ) {
434 if ( i == 0 ) { 460 if ( i == 0 ) {
435 comboStart->insertItem( "12:00 AM" ); 461 comboStart->insertItem( "12:00 AM" );
436 comboStart->insertItem( "12:30 AM" ); 462 comboStart->insertItem( "12:30 AM" );
437 comboEnd->insertItem( "12:00 AM" ); 463 comboEnd->insertItem( "12:00 AM" );
438 comboEnd->insertItem( "12:30 AM" ); 464 comboEnd->insertItem( "12:30 AM" );
439 } else if ( i == 12 ) { 465 } else if ( i == 12 ) {
440 comboStart->insertItem( "12:00 PM" ); 466 comboStart->insertItem( "12:00 PM" );
441 comboStart->insertItem( "12:30 PM" ); 467 comboStart->insertItem( "12:30 PM" );
442 comboEnd->insertItem( "12:00 PM" ); 468 comboEnd->insertItem( "12:00 PM" );
443 comboEnd->insertItem( "12:30 PM" ); 469 comboEnd->insertItem( "12:30 PM" );
444 } else if ( i > 12 ) { 470 } else if ( i > 12 ) {
445 comboStart->insertItem( QString::number( i - 12 ) + ":00 PM" ); 471 comboStart->insertItem( QString::number( i - 12 ) + ":00 PM" );
446 comboStart->insertItem( QString::number( i - 12 ) + ":30 PM" ); 472 comboStart->insertItem( QString::number( i - 12 ) + ":30 PM" );
447 comboEnd->insertItem( QString::number( i - 12 ) + ":00 PM" ); 473 comboEnd->insertItem( QString::number( i - 12 ) + ":00 PM" );
448 comboEnd->insertItem( QString::number( i - 12 ) + ":30 PM" ); 474 comboEnd->insertItem( QString::number( i - 12 ) + ":30 PM" );
449 } else { 475 } else {
450 comboStart->insertItem( QString::number( i) + ":00 AM" ); 476 comboStart->insertItem( QString::number( i) + ":00 AM" );
451 comboStart->insertItem( QString::number( i ) + ":30 AM" ); 477 comboStart->insertItem( QString::number( i ) + ":30 AM" );
452 comboEnd->insertItem( QString::number( i ) + ":00 AM" ); 478 comboEnd->insertItem( QString::number( i ) + ":00 AM" );
453 comboEnd->insertItem( QString::number( i ) + ":30 AM" ); 479 comboEnd->insertItem( QString::number( i ) + ":30 AM" );
454 } 480 }
455 } 481 }
456 } else { 482 } else {
457 for ( int i = 0; i < 24; i++ ) { 483 for ( int i = 0; i < 24; i++ ) {
458 if ( i < 10 ) { 484 if ( i < 10 ) {
459 comboStart->insertItem( QString("0") 485 comboStart->insertItem( QString("0")
460 + QString::number(i) + ":00" ); 486 + QString::number(i) + ":00" );
461 comboStart->insertItem( QString("0") 487 comboStart->insertItem( QString("0")
462 + QString::number(i) + ":30" ); 488 + QString::number(i) + ":30" );
463 comboEnd->insertItem( QString("0") 489 comboEnd->insertItem( QString("0")
464 + QString::number(i) + ":00" ); 490 + QString::number(i) + ":00" );
465 comboEnd->insertItem( QString("0") 491 comboEnd->insertItem( QString("0")
466 + QString::number(i) + ":30" ); 492 + QString::number(i) + ":30" );
467 } else { 493 } else {
468 comboStart->insertItem( QString::number(i) + ":00" ); 494 comboStart->insertItem( QString::number(i) + ":00" );
469 comboStart->insertItem( QString::number(i) + ":30" ); 495 comboStart->insertItem( QString::number(i) + ":30" );
470 comboEnd->insertItem( QString::number(i) + ":00" ); 496 comboEnd->insertItem( QString::number(i) + ":00" );
471 comboEnd->insertItem( QString::number(i) + ":30" ); 497 comboEnd->insertItem( QString::number(i) + ":30" );
472 } 498 }
473 } 499 }
474 } 500 }
501 */
475} 502}
476 503
477void DateEntry::slotChangeClock( bool whichClock ) 504void DateEntry::slotChangeClock( bool whichClock )
478{ 505{
479 ampm = whichClock; 506 ampm = whichClock;
480 initCombos(); 507 initCombos();
481 setDates( QDateTime( startDate, startTime ), QDateTime( endDate, endTime ) ); 508 setDates( QDateTime( startDate, startTime ), QDateTime( endDate, endTime ) );
482} 509}
diff --git a/core/pim/datebook/dateentryimpl.h b/core/pim/datebook/dateentryimpl.h
index 785af7a..bde3119 100644
--- a/core/pim/datebook/dateentryimpl.h
+++ b/core/pim/datebook/dateentryimpl.h
@@ -1,71 +1,74 @@
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#ifndef DATEENTRY_H 20#ifndef DATEENTRY_H
21#define DATEENTRY_H 21#define DATEENTRY_H
22 22
23#include "dateentry.h" 23#include "dateentry.h"
24 24
25#include <qpe/event.h> 25#include <qpe/event.h>
26 26
27#include <qdatetime.h> 27#include <qdatetime.h>
28 28
29class DateBookMonth; 29class DateBookMonth;
30 30
31class DateEntry : public DateEntryBase 31class DateEntry : public DateEntryBase
32{ 32{
33 Q_OBJECT 33 Q_OBJECT
34 34
35public: 35public:
36 DateEntry( bool startOnMonday, const QDateTime &start, 36 DateEntry( bool startOnMonday, const QDateTime &start,
37 const QDateTime &end, bool whichClock = FALSE, 37 const QDateTime &end, bool whichClock = FALSE,
38 QWidget* parent = 0, const char* name = 0 ); 38 QWidget* parent = 0, const char* name = 0 );
39 DateEntry( bool startOnMonday, const Event &event, bool whichCLock = FALSE, 39 DateEntry( bool startOnMonday, const Event &event, bool whichCLock = FALSE,
40 QWidget* parent = 0, const char* name = 0 ); 40 QWidget* parent = 0, const char* name = 0 );
41 ~DateEntry(); 41 ~DateEntry();
42 42
43 Event event(); 43 Event event();
44 void setAlarmEnabled( bool alarmPreset, int presetTime, Event::SoundTypeChoice ); 44 void setAlarmEnabled( bool alarmPreset, int presetTime, Event::SoundTypeChoice );
45 45
46public slots: 46public slots:
47 void endDateChanged( int, int, int ); 47 void endDateChanged( int, int, int );
48 void endTimeChanged( const QString & ); 48 void endTimeChanged( const QString & );
49 void endTimeChanged( const QTime & );
49 void startDateChanged(int, int, int); 50 void startDateChanged(int, int, int);
50 void startTimeChanged( int index ); 51 void startTimeEdited( const QString & );
52 void startTimeChanged( const QTime & );
53 void startTimePicked( const QTime & );
51 void typeChanged( const QString & ); 54 void typeChanged( const QString & );
52 void changeEndCombo( int change );
53 void slotRepeat(); 55 void slotRepeat();
54 void slotChangeClock( bool ); 56 void slotChangeClock( bool );
55 void slotChangeStartOfWeek( bool ); 57 void slotChangeStartOfWeek( bool );
56 58
57private: 59private:
58 void init(); 60 void init();
59 void initCombos(); 61 void initCombos();
60 void setDates( const QDateTime& s, const QDateTime& e ); 62 void setDates( const QDateTime& s, const QDateTime& e );
61 void setRepeatLabel(); 63 void setRepeatLabel();
64 void updateTimeEdit(bool,bool);
62 65
63 DateBookMonth *startPicker, *endPicker; 66 DateBookMonth *startPicker, *endPicker;
64 QDate startDate, endDate; 67 QDate startDate, endDate;
65 QTime startTime, endTime; 68 QTime startTime, endTime;
66 Event::RepeatPattern rp; 69 Event::RepeatPattern rp;
67 bool ampm; 70 bool ampm;
68 bool startWeekOnMonday; 71 bool startWeekOnMonday;
69}; 72};
70 73
71#endif // DATEENTRY_H 74#endif // DATEENTRY_H
diff --git a/core/pim/datebook/timepicker.cpp b/core/pim/datebook/timepicker.cpp
new file mode 100644
index 0000000..5f08a05
--- a/dev/null
+++ b/core/pim/datebook/timepicker.cpp
@@ -0,0 +1,119 @@
1#include "timepicker.h"
2
3#include <qbuttongroup.h>
4#include <qtoolbutton.h>
5#include <qlayout.h>
6#include "clickablelabel.h"
7#include <qstring.h>
8
9TimePicker::TimePicker(QWidget* parent = 0, const char* name = 0,
10 WFlags fl = 0) :
11 QWidget(parent,name,fl)
12{
13 QVBoxLayout *vbox=new QVBoxLayout(this);
14
15 ClickableLabel *r;
16 QString s;
17
18 // Hour Row
19 QWidget *row=new QWidget(this);
20 QHBoxLayout *l=new QHBoxLayout(row);
21 vbox->addWidget(row);
22
23
24 for (int i=0; i<24; i++) {
25 r=new ClickableLabel(row);
26 hourLst.append(r);
27 s.sprintf("%.2d",i);
28 r->setText(s);
29 r->setToggleButton(true);
30 r->setAlignment(AlignHCenter | AlignVCenter);
31 l->addWidget(r);
32 connect(r, SIGNAL(toggled(bool)),
33 this, SLOT(slotHour(bool)));
34
35 if (i==11) { // Second row
36 row=new QWidget(this);
37 l=new QHBoxLayout(row);
38 vbox->addWidget(row);
39 }
40 }
41
42 // Minute Row
43 row=new QWidget(this);
44 l=new QHBoxLayout(row);
45 vbox->addWidget(row);
46
47 for (int i=0; i<60; i+=5) {
48 r=new ClickableLabel(row);
49 minuteLst.append(r);
50 s.sprintf("%.2d",i);
51 r->setText(s);
52 r->setToggleButton(true);
53 r->setAlignment(AlignHCenter | AlignVCenter);
54 l->addWidget(r);
55 connect(r, SIGNAL(toggled(bool)),
56 this, SLOT(slotMinute(bool)));
57 }
58}
59
60void TimePicker::slotHour(bool b) {
61
62 ClickableLabel *r = (ClickableLabel *) sender();
63
64 if (b) {
65 QValueListIterator<ClickableLabel *> it;
66 for (it=hourLst.begin(); it!=hourLst.end(); it++) {
67 if (*it != r) (*it)->setOn(false);
68 else tm.setHMS((*it)->text().toInt(), tm.minute(), 0);
69 }
70 emit timeChanged(tm);
71 } else {
72 r->setOn(true);
73 }
74
75}
76
77void TimePicker::slotMinute(bool b) {
78
79 ClickableLabel *r = (ClickableLabel *) sender();
80
81 if (b) {
82 QValueListIterator<ClickableLabel *> it;
83 for (it=minuteLst.begin(); it!=minuteLst.end(); it++) {
84 if (*it != r) (*it)->setOn(false);
85 else tm.setHMS(tm.hour(),(*it)->text().toInt(), 0);
86 }
87 emit timeChanged(tm);
88 } else {
89 r->setOn(true);
90 }
91
92}
93
94void TimePicker::setMinute(int m) {
95
96 QString minute;
97 minute.sprintf("%.2d",m);
98
99 QValueListIterator<ClickableLabel *> it;
100 for (it=minuteLst.begin(); it!=minuteLst.end(); it++) {
101 if ((*it)->text() == minute) (*it)->setOn(true);
102 else (*it)->setOn(false);
103 }
104
105 tm.setHMS(tm.hour(),m,0);
106}
107
108void TimePicker::setHour(int h) {
109
110 QString hour;
111 hour.sprintf("%.2d",h);
112
113 QValueListIterator<ClickableLabel *> it;
114 for (it=hourLst.begin(); it!=hourLst.end(); it++) {
115 if ((*it)->text() == hour) (*it)->setOn(true);
116 else (*it)->setOn(false);
117 }
118 tm.setHMS(h,tm.minute(),0);
119}
diff --git a/core/pim/datebook/timepicker.h b/core/pim/datebook/timepicker.h
new file mode 100644
index 0000000..0acadcb
--- a/dev/null
+++ b/core/pim/datebook/timepicker.h
@@ -0,0 +1,32 @@
1#ifndef TIMEPICKER_H
2#define TIMEPICKER_H
3
4#include <qwidget.h>
5#include <qvaluelist.h>
6#include "clickablelabel.h"
7#include <qdatetime.h>
8
9class TimePicker: public QWidget {
10 Q_OBJECT
11
12 public:
13 TimePicker(QWidget* parent = 0, const char* name = 0,
14 WFlags fl = 0);
15 void setHour(int h);
16 void setMinute(int m);
17
18 private:
19 QValueList<ClickableLabel *> hourLst;
20 QValueList<ClickableLabel *> minuteLst;
21 QTime tm;
22
23 private slots:
24 void slotHour(bool b);
25 void slotMinute(bool b);
26
27 signals:
28 void timeChanged(const QTime &);
29};
30
31
32#endif