summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/datebook/.cvsignore2
-rw-r--r--core/pim/datebook/datebook.pro9
-rw-r--r--core/pim/datebook/dateentry.ui13
-rw-r--r--core/pim/datebook/dateentryimpl.cpp26
-rw-r--r--core/pim/datebook/dateentryimpl.h4
-rw-r--r--core/pim/datebook/noteentry.ui68
-rw-r--r--core/pim/datebook/noteentryimpl.cpp16
-rw-r--r--core/pim/datebook/noteentryimpl.h18
8 files changed, 148 insertions, 8 deletions
diff --git a/core/pim/datebook/.cvsignore b/core/pim/datebook/.cvsignore
index d2e4975..74ec374 100644
--- a/core/pim/datebook/.cvsignore
+++ b/core/pim/datebook/.cvsignore
@@ -1,16 +1,18 @@
1moc_* 1moc_*
2Makefile* 2Makefile*
3dateentry.h 3dateentry.h
4datebookdayheader.h 4datebookdayheader.h
5dateentry.cpp 5dateentry.cpp
6datebookdayheader.cpp 6datebookdayheader.cpp
7datebookweekheader.cpp 7datebookweekheader.cpp
8datebookweekheader.h 8datebookweekheader.h
9datebooksettingsbase.h 9datebooksettingsbase.h
10datebooksettingsbase.cpp 10datebooksettingsbase.cpp
11repeatentrybase.cpp 11repeatentrybase.cpp
12repeatentrybase.h 12repeatentrybase.h
13datebookweeklstdayhdr.cpp 13datebookweeklstdayhdr.cpp
14datebookweeklstdayhdr.h 14datebookweeklstdayhdr.h
15datebookweeklstheader.cpp 15datebookweeklstheader.cpp
16datebookweeklstheader.h 16datebookweeklstheader.h
17noteentry.cpp
18noteentry.h
diff --git a/core/pim/datebook/datebook.pro b/core/pim/datebook/datebook.pro
index 9383053..60c2b08 100644
--- a/core/pim/datebook/datebook.pro
+++ b/core/pim/datebook/datebook.pro
@@ -1,53 +1,56 @@
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 timepicker.h 14 timepicker.h \
15 noteentryimpl.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 timepicker.cpp 27 timepicker.cpp \
28 noteentryimpl.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 \
37 noteentry.ui
35 38
36INCLUDEPATH += $(OPIEDIR)/include 39INCLUDEPATH += $(OPIEDIR)/include
37 DEPENDPATH+= $(OPIEDIR)/include 40 DEPENDPATH+= $(OPIEDIR)/include
38LIBS += -lqpe -lopie 41LIBS += -lqpe -lopie
39 42
40 TARGET = datebook 43 TARGET = datebook
41 44
42TRANSLATIONS = ../i18n/pt_BR/datebook.ts 45TRANSLATIONS = ../i18n/pt_BR/datebook.ts
43TRANSLATIONS += ../i18n/de/datebook.ts 46TRANSLATIONS += ../i18n/de/datebook.ts
44TRANSLATIONS += ../i18n/en/datebook.ts 47TRANSLATIONS += ../i18n/en/datebook.ts
45TRANSLATIONS += ../i18n/hu/datebook.ts 48TRANSLATIONS += ../i18n/hu/datebook.ts
46TRANSLATIONS += ../i18n/pl/datebook.ts 49TRANSLATIONS += ../i18n/pl/datebook.ts
47TRANSLATIONS += ../i18n/sl/datebook.ts 50TRANSLATIONS += ../i18n/sl/datebook.ts
48TRANSLATIONS += ../i18n/ja/datebook.ts 51TRANSLATIONS += ../i18n/ja/datebook.ts
49TRANSLATIONS += ../i18n/ko/datebook.ts 52TRANSLATIONS += ../i18n/ko/datebook.ts
50TRANSLATIONS += ../i18n/no/datebook.ts 53TRANSLATIONS += ../i18n/no/datebook.ts
51TRANSLATIONS += ../i18n/zh_CN/datebook.ts 54TRANSLATIONS += ../i18n/zh_CN/datebook.ts
52TRANSLATIONS += ../i18n/zh_TW/datebook.ts 55TRANSLATIONS += ../i18n/zh_TW/datebook.ts
53TRANSLATIONS += ../i18n/fr/datebook.ts 56TRANSLATIONS += ../i18n/fr/datebook.ts
diff --git a/core/pim/datebook/dateentry.ui b/core/pim/datebook/dateentry.ui
index 1a712ec..fadbc35 100644
--- a/core/pim/datebook/dateentry.ui
+++ b/core/pim/datebook/dateentry.ui
@@ -444,103 +444,114 @@
444 <widget row="8" column="3" > 444 <widget row="8" column="3" >
445 <class>QComboBox</class> 445 <class>QComboBox</class>
446 <item> 446 <item>
447 <property> 447 <property>
448 <name>text</name> 448 <name>text</name>
449 <string>Silent</string> 449 <string>Silent</string>
450 </property> 450 </property>
451 </item> 451 </item>
452 <item> 452 <item>
453 <property> 453 <property>
454 <name>text</name> 454 <name>text</name>
455 <string>Loud</string> 455 <string>Loud</string>
456 </property> 456 </property>
457 </item> 457 </item>
458 <property stdset="1"> 458 <property stdset="1">
459 <name>name</name> 459 <name>name</name>
460 <cstring>comboSound</cstring> 460 <cstring>comboSound</cstring>
461 </property> 461 </property>
462 <property stdset="1"> 462 <property stdset="1">
463 <name>enabled</name> 463 <name>enabled</name>
464 <bool>false</bool> 464 <bool>false</bool>
465 </property> 465 </property>
466 </widget> 466 </widget>
467 <widget row="9" column="0" > 467 <widget row="9" column="0" >
468 <class>QLabel</class> 468 <class>QLabel</class>
469 <property stdset="1"> 469 <property stdset="1">
470 <name>name</name> 470 <name>name</name>
471 <cstring>lblRepeat</cstring> 471 <cstring>lblRepeat</cstring>
472 </property> 472 </property>
473 <property stdset="1"> 473 <property stdset="1">
474 <name>text</name> 474 <name>text</name>
475 <string>Repeat</string> 475 <string>Repeat</string>
476 </property> 476 </property>
477 </widget> 477 </widget>
478 <widget row="9" column="1" rowspan="1" colspan="3" > 478 <widget row="9" column="1" rowspan="1" colspan="3" >
479 <class>QToolButton</class> 479 <class>QToolButton</class>
480 <property stdset="1"> 480 <property stdset="1">
481 <name>name</name> 481 <name>name</name>
482 <cstring>cmdRepeat</cstring> 482 <cstring>cmdRepeat</cstring>
483 </property> 483 </property>
484 <property stdset="1"> 484 <property stdset="1">
485 <name>focusPolicy</name> 485 <name>focusPolicy</name>
486 <enum>TabFocus</enum> 486 <enum>TabFocus</enum>
487 </property> 487 </property>
488 <property stdset="1"> 488 <property stdset="1">
489 <name>text</name> 489 <name>text</name>
490 <string>No Repeat...</string> 490 <string>No Repeat...</string>
491 </property> 491 </property>
492 <property stdset="1">
493 <name>sizePolicy</name>
494 <sizepolicy>
495 <hsizetype>7</hsizetype>
496 <vsizetype>0</vsizetype>
497 </sizepolicy>
498 </property>
492 </widget> 499 </widget>
493 <widget row="10" column="0" rowspan="1" colspan="4" > 500 <widget row="10" column="0" rowspan="1" colspan="4" >
494 <class>QMultiLineEdit</class> 501 <class>QToolButton</class>
495 <property stdset="1"> 502 <property stdset="1">
496 <name>name</name> 503 <name>name</name>
497 <cstring>editNote</cstring> 504 <cstring>editNote</cstring>
498 </property> 505 </property>
506 <property stdset="1">
507 <name>text</name>
508 <string>Note...</string>
509 </property>
499 </widget> 510 </widget>
500 </grid> 511 </grid>
501</widget> 512</widget>
502<customwidgets> 513<customwidgets>
503 <customwidget> 514 <customwidget>
504 <class>TimeZoneSelector</class> 515 <class>TimeZoneSelector</class>
505 <header location="global">qpe/tzselect.h</header> 516 <header location="global">qpe/tzselect.h</header>
506 <sizehint> 517 <sizehint>
507 <width>21</width> 518 <width>21</width>
508 <height>10</height> 519 <height>10</height>
509 </sizehint> 520 </sizehint>
510 <container>0</container> 521 <container>0</container>
511 <sizepolicy> 522 <sizepolicy>
512 <hordata>7</hordata> 523 <hordata>7</hordata>
513 <verdata>1</verdata> 524 <verdata>1</verdata>
514 </sizepolicy> 525 </sizepolicy>
515 <pixmap>image0</pixmap> 526 <pixmap>image0</pixmap>
516 </customwidget> 527 </customwidget>
517 <customwidget> 528 <customwidget>
518 <class>CategorySelect</class> 529 <class>CategorySelect</class>
519 <header location="global">qpe/categoryselect.h</header> 530 <header location="global">qpe/categoryselect.h</header>
520 <sizehint> 531 <sizehint>
521 <width>-1</width> 532 <width>-1</width>
522 <height>-1</height> 533 <height>-1</height>
523 </sizehint> 534 </sizehint>
524 <container>0</container> 535 <container>0</container>
525 <sizepolicy> 536 <sizepolicy>
526 <hordata>7</hordata> 537 <hordata>7</hordata>
527 <verdata>1</verdata> 538 <verdata>1</verdata>
528 </sizepolicy> 539 </sizepolicy>
529 <pixmap>image1</pixmap> 540 <pixmap>image1</pixmap>
530 </customwidget> 541 </customwidget>
531 <customwidget> 542 <customwidget>
532 <class>TimePicker</class> 543 <class>TimePicker</class>
533 <header location="local">timepicker.h</header> 544 <header location="local">timepicker.h</header>
534 <sizehint> 545 <sizehint>
535 <width>-1</width> 546 <width>-1</width>
536 <height>-1</height> 547 <height>-1</height>
537 </sizehint> 548 </sizehint>
538 <container>0</container> 549 <container>0</container>
539 <sizepolicy> 550 <sizepolicy>
540 <hordata>7</hordata> 551 <hordata>7</hordata>
541 <verdata>1</verdata> 552 <verdata>1</verdata>
542 </sizepolicy> 553 </sizepolicy>
543 <pixmap>image1</pixmap> 554 <pixmap>image1</pixmap>
544 </customwidget> 555 </customwidget>
545</customwidgets> 556</customwidgets>
546<images> 557<images>
diff --git a/core/pim/datebook/dateentryimpl.cpp b/core/pim/datebook/dateentryimpl.cpp
index c4f6c68..9cc5073 100644
--- a/core/pim/datebook/dateentryimpl.cpp
+++ b/core/pim/datebook/dateentryimpl.cpp
@@ -83,206 +83,224 @@ bool DateEntry::eventFilter(QObject *obj, QEvent *ev )
83 } else if( ev->type() == QEvent::FocusOut ){ 83 } else if( ev->type() == QEvent::FocusOut ){
84 if( obj == comboEnd ){ 84 if( obj == comboEnd ){
85 QString s; 85 QString s;
86 s.sprintf("%.2d:%.2d",endTime.hour(), endTime.minute()); 86 s.sprintf("%.2d:%.2d",endTime.hour(), endTime.minute());
87 comboEnd->setText(s); 87 comboEnd->setText(s);
88 } 88 }
89 else if( obj == comboStart ){ 89 else if( obj == comboStart ){
90 QString s; 90 QString s;
91 s.sprintf("%.2d:%.2d",startTime.hour(), startTime.minute()); 91 s.sprintf("%.2d:%.2d",startTime.hour(), startTime.minute());
92 comboStart->setText(s); 92 comboStart->setText(s);
93 } 93 }
94 } 94 }
95 95
96 return false; 96 return false;
97} 97}
98 98
99static void addOrPick( QComboBox* combo, const QString& t ) 99static void addOrPick( QComboBox* combo, const QString& t )
100{ 100{
101 // Pick an item if one excists 101 // Pick an item if one excists
102 for (int i=0; i<combo->count(); i++) { 102 for (int i=0; i<combo->count(); i++) {
103 if ( combo->text(i) == t ) { 103 if ( combo->text(i) == t ) {
104 combo->setCurrentItem(i); 104 combo->setCurrentItem(i);
105 return; 105 return;
106 } 106 }
107 } 107 }
108 108
109 // Else add one 109 // Else add one
110 combo->insertItem(t); 110 combo->insertItem(t);
111 combo->setCurrentItem(combo->count()-1); 111 combo->setCurrentItem(combo->count()-1);
112} 112}
113 113
114DateEntry::DateEntry( bool startOnMonday, const Event &event, bool whichClock, 114DateEntry::DateEntry( bool startOnMonday, const Event &event, bool whichClock,
115 QWidget* parent, const char* name ) 115 QWidget* parent, const char* name )
116 : DateEntryBase( parent, name ), 116 : DateEntryBase( parent, name ),
117 ampm( whichClock ), 117 ampm( whichClock ),
118 startWeekOnMonday( startOnMonday ), 118 startWeekOnMonday( startOnMonday ),
119 m_showStart(true) 119 m_showStart(true)
120 120
121{ 121{
122 init(); 122 init();
123 setDates(event.start(),event.end()); 123 setDates(event.start(),event.end());
124 comboCategory->setCategories( event.categories(), "Calendar", tr("Calendar") ); 124 comboCategory->setCategories( event.categories(), "Calendar", tr("Calendar") );
125 if(!event.description().isEmpty()) 125 if(!event.description().isEmpty())
126 addOrPick( comboDescription, event.description() ); 126 addOrPick( comboDescription, event.description() );
127 if(!event.location().isEmpty()) 127 if(!event.location().isEmpty())
128 addOrPick( comboLocation, event.location() ); 128 addOrPick( comboLocation, event.location() );
129 checkAlarm->setChecked( event.hasAlarm() ); 129 checkAlarm->setChecked( event.hasAlarm() );
130 checkAllDay->setChecked( event.type() == Event::AllDay ); 130 checkAllDay->setChecked( event.type() == Event::AllDay );
131 if(!event.notes().isEmpty()) 131 if(!event.notes().isEmpty()) noteStr=event.notes();
132 editNote->setText(event.notes()); 132 else noteStr="";
133 spinAlarm->setValue(event.alarmTime()); 133 spinAlarm->setValue(event.alarmTime());
134 if ( event.alarmSound() != Event::Silent ) 134 if ( event.alarmSound() != Event::Silent )
135 comboSound->setCurrentItem( 1 ); 135 comboSound->setCurrentItem( 1 );
136 if ( event.hasRepeat() ) { 136 if ( event.hasRepeat() ) {
137 rp = event.repeatPattern(); 137 rp = event.repeatPattern();
138 cmdRepeat->setText( tr("Repeat...") ); 138 cmdRepeat->setText( tr("Repeat...") );
139 } 139 }
140 setRepeatLabel(); 140 setRepeatLabel();
141} 141}
142 142
143void DateEntry::setDates( const QDateTime& s, const QDateTime& e ) 143void DateEntry::setDates( const QDateTime& s, const QDateTime& e )
144{ 144{
145 startDate = s.date(); 145 startDate = s.date();
146 endDate = e.date(); 146 endDate = e.date();
147 startTime = s.time(); 147 startTime = s.time();
148 endTime = e.time(); 148 endTime = e.time();
149 149
150 startDateChanged( s.date().year(), s.date().month(), s.date().day() ); 150 startDateChanged( s.date().year(), s.date().month(), s.date().day() );
151 endDateChanged( e.date().year(), e.date().month(), e.date().day() ); 151 endDateChanged( e.date().year(), e.date().month(), e.date().day() );
152 152
153 updateTimeEdit(true,true); 153 updateTimeEdit(true,true);
154} 154}
155 155
156void DateEntry::updateTimeEdit(bool s, bool e) { 156void DateEntry::updateTimeEdit(bool s, bool e) {
157 157
158 // Comboboxes 158 // Comboboxes
159 QString strStart, strEnd; 159 QString strStart, strEnd;
160 int shour, ehour; 160 int shour, ehour;
161 if ( ampm ) { 161 if ( ampm ) {
162 shour = startTime.hour(); 162 shour = startTime.hour();
163 ehour = endTime.hour(); 163 ehour = endTime.hour();
164 if ( shour >= 12 ) { 164 if ( shour >= 12 ) {
165 if ( shour > 12 ) 165 if ( shour > 12 )
166 shour -= 12; 166 shour -= 12;
167 strStart.sprintf( "%d:%02d PM", shour, startTime.minute() ); 167 strStart.sprintf( "%d:%02d PM", shour, startTime.minute() );
168 } else { 168 } else {
169 if ( shour == 0 ) 169 if ( shour == 0 )
170 shour = 12; 170 shour = 12;
171 strStart.sprintf( "%d:%02d AM", shour, startTime.minute() ); 171 strStart.sprintf( "%d:%02d AM", shour, startTime.minute() );
172 } 172 }
173 if ( ehour == 24 && endTime.minute() == 0 ) { 173 if ( ehour == 24 && endTime.minute() == 0 ) {
174 strEnd = "11:59 PM"; // or "midnight" 174 strEnd = "11:59 PM"; // or "midnight"
175 } else if ( ehour >= 12 ) { 175 } else if ( ehour >= 12 ) {
176 if ( ehour > 12 ) 176 if ( ehour > 12 )
177 ehour -= 12; 177 ehour -= 12;
178 strEnd.sprintf( "%d:%02d PM", ehour, endTime.minute() ); 178 strEnd.sprintf( "%d:%02d PM", ehour, endTime.minute() );
179 } else { 179 } else {
180 if ( ehour == 0 ) 180 if ( ehour == 0 )
181 ehour = 12; 181 ehour = 12;
182 strEnd.sprintf( "%d:%02d AM", ehour, endTime.minute() ); 182 strEnd.sprintf( "%d:%02d AM", ehour, endTime.minute() );
183 } 183 }
184 } else { 184 } else {
185 strStart.sprintf( "%02d:%02d", startTime.hour(), startTime.minute() ); 185 strStart.sprintf( "%02d:%02d", startTime.hour(), startTime.minute() );
186 strEnd.sprintf( "%02d:%02d", endTime.hour(), endTime.minute() ); 186 strEnd.sprintf( "%02d:%02d", endTime.hour(), endTime.minute() );
187 } 187 }
188 188
189 if (s) comboStart->setText(strStart); 189 if (s) comboStart->setText(strStart);
190 if (e) comboEnd->setText(strEnd); 190 if (e) comboEnd->setText(strEnd);
191} 191}
192 192
193void DateEntry::init() 193void DateEntry::init()
194{ 194{
195 comboDescription->setInsertionPolicy(QComboBox::AtCurrent); 195 comboDescription->setInsertionPolicy(QComboBox::AtCurrent);
196 comboLocation->setInsertionPolicy(QComboBox::AtCurrent); 196 comboLocation->setInsertionPolicy(QComboBox::AtCurrent);
197 197
198 initCombos(); 198 initCombos();
199 QPopupMenu *m1 = new QPopupMenu( this ); 199 QPopupMenu *m1 = new QPopupMenu( this );
200 startPicker = new DateBookMonth( m1, 0, TRUE ); 200 startPicker = new DateBookMonth( m1, 0, TRUE );
201 m1->insertItem( startPicker ); 201 m1->insertItem( startPicker );
202 buttonStart->setPopup( m1 ); 202 buttonStart->setPopup( m1 );
203 connect( startPicker, SIGNAL( dateClicked( int, int, int ) ), 203 connect( startPicker, SIGNAL( dateClicked( int, int, int ) ),
204 this, SLOT( startDateChanged( int, int, int ) ) ); 204 this, SLOT( startDateChanged( int, int, int ) ) );
205 205
206 //Let start button change both start and end dates 206 //Let start button change both start and end dates
207 connect( startPicker, SIGNAL( dateClicked( int, int, int ) ), 207 connect( startPicker, SIGNAL( dateClicked( int, int, int ) ),
208 this, SLOT( endDateChanged( int, int, int ) ) ); 208 this, SLOT( endDateChanged( int, int, int ) ) );
209 connect( qApp, SIGNAL( clockChanged( bool ) ), 209 connect( qApp, SIGNAL( clockChanged( bool ) ),
210 this, SLOT( slotChangeClock( bool ) ) ); 210 this, SLOT( slotChangeClock( bool ) ) );
211 connect( qApp, SIGNAL(weekChanged(bool)), 211 connect( qApp, SIGNAL(weekChanged(bool)),
212 this, SLOT(slotChangeStartOfWeek(bool)) ); 212 this, SLOT(slotChangeStartOfWeek(bool)) );
213
214 connect( editNote, SIGNAL(clicked()),
215 this, SLOT(slotEditNote()) );
213 216
214 QPopupMenu *m2 = new QPopupMenu( this ); 217 QPopupMenu *m2 = new QPopupMenu( this );
215 endPicker = new DateBookMonth( m2, 0, TRUE ); 218 endPicker = new DateBookMonth( m2, 0, TRUE );
216 m2->insertItem( endPicker ); 219 m2->insertItem( endPicker );
217 buttonEnd->setPopup( m2 ); 220 buttonEnd->setPopup( m2 );
218 connect( endPicker, SIGNAL( dateClicked( int, int, int ) ), 221 connect( endPicker, SIGNAL( dateClicked( int, int, int ) ),
219 this, SLOT( endDateChanged( int, int, int ) ) ); 222 this, SLOT( endDateChanged( int, int, int ) ) );
220 223
221 connect(timePickerStart, SIGNAL( timeChanged(const QTime &) ), 224 connect(timePickerStart, SIGNAL( timeChanged(const QTime &) ),
222 this, SLOT( startTimePicked(const QTime &) )); 225 this, SLOT( startTimePicked(const QTime &) ));
223 editNote->setFixedVisibleLines(3);
224 // install eventFilters 226 // install eventFilters
225 comboEnd->installEventFilter( this ); 227 comboEnd->installEventFilter( this );
226 comboStart->installEventFilter( this ); 228 comboStart->installEventFilter( this );
227} 229}
228 230
229/* 231/*
230 * Destroys the object and frees any allocated resources 232 * Destroys the object and frees any allocated resources
231 */ 233 */
232DateEntry::~DateEntry() 234DateEntry::~DateEntry()
233{ 235{
234 // no need to delete child widgets, Qt does it all for us 236 // no need to delete child widgets, Qt does it all for us
235 //cout << "Del: " << comboStart->currentText() << endl; 237 //cout << "Del: " << comboStart->currentText() << endl;
236} 238}
237 239
238/* 240/*
239 * public slot 241 * public slot
240 */ 242 */
243
244void DateEntry::slotEditNote() {
245 QString s;
246 s.sprintf("<B>%d/%d</B> ", startDate.day(), startDate.month());
247 NoteEntry noteDlg(s+comboDescription->currentText(), noteStr,
248 this,0,TRUE);
249
250#if defined(Q_WS_QWS) || defined(_WS_QWS_)
251 noteDlg.showMaximized();
252#endif
253 if (noteDlg.exec() ) {
254 noteStr=noteDlg.note->text();
255 }
256
257}
258
241void DateEntry::endDateChanged( int y, int m, int d ) 259void DateEntry::endDateChanged( int y, int m, int d )
242{ 260{
243 endDate.setYMD( y, m, d ); 261 endDate.setYMD( y, m, d );
244 if ( endDate < startDate ) { 262 if ( endDate < startDate ) {
245 endDate = startDate; 263 endDate = startDate;
246 } 264 }
247 265
248 buttonEnd->setText( TimeString::shortDate( endDate ) ); 266 buttonEnd->setText( TimeString::shortDate( endDate ) );
249 267
250 endPicker->setDate( endDate.year(), endDate.month(), endDate.day() ); 268 endPicker->setDate( endDate.year(), endDate.month(), endDate.day() );
251} 269}
252 270
253static QTime parseTime( const QString& s, bool ampm ) 271static QTime parseTime( const QString& s, bool ampm )
254{ 272{
255 QTime tmpTime; 273 QTime tmpTime;
256 QStringList l = QStringList::split( ':', s ); 274 QStringList l = QStringList::split( ':', s );
257 int hour = l[0].toInt(); 275 int hour = l[0].toInt();
258 if ( ampm ) { 276 if ( ampm ) {
259 int i=0; 277 int i=0;
260 while (i<int(l[1].length()) && l[1][i]>='0' && l[1][i]<='9') 278 while (i<int(l[1].length()) && l[1][i]>='0' && l[1][i]<='9')
261 i++; 279 i++;
262 QString digits = l[1].left(i); 280 QString digits = l[1].left(i);
263 if ( l[1].contains( "PM", FALSE ) ) { 281 if ( l[1].contains( "PM", FALSE ) ) {
264 if ( hour != 12 ) 282 if ( hour != 12 )
265 hour += 12; 283 hour += 12;
266 } else { 284 } else {
267 if ( hour == 12 ) 285 if ( hour == 12 )
268 hour = 0; 286 hour = 0;
269 } 287 }
270 l[1] = digits; 288 l[1] = digits;
271 } 289 }
272 int minute = l[1].toInt(); 290 int minute = l[1].toInt();
273 if ( minute > 59 ) 291 if ( minute > 59 )
274 minute = 59; 292 minute = 59;
275 else if ( minute < 0 ) 293 else if ( minute < 0 )
276 minute = 0; 294 minute = 0;
277 if ( hour > 23 ) { 295 if ( hour > 23 ) {
278 hour = 23; 296 hour = 23;
279 minute = 59; 297 minute = 59;
280 } else if ( hour < 0 ) 298 } else if ( hour < 0 )
281 hour = 0; 299 hour = 0;
282 tmpTime.setHMS( hour, minute, 0 ); 300 tmpTime.setHMS( hour, minute, 0 );
283 return tmpTime; 301 return tmpTime;
284} 302}
285 303
286/* 304/*
287 * public slot 305 * public slot
288 */ 306 */
@@ -410,97 +428,97 @@ Event DateEntry::event()
410 if ( startTime > endTime && endDate == startDate ) { 428 if ( startTime > endTime && endDate == startDate ) {
411 QTime tmp = endTime; 429 QTime tmp = endTime;
412 endTime = startTime; 430 endTime = startTime;
413 startTime = tmp; 431 startTime = tmp;
414 } 432 }
415 // don't set the time if theres no need too 433 // don't set the time if theres no need too
416 if ( ev.type() == Event::AllDay ) { 434 if ( ev.type() == Event::AllDay ) {
417 startTime.setHMS( 0, 0, 0 ); 435 startTime.setHMS( 0, 0, 0 );
418 endTime.setHMS( 23, 59, 59 ); 436 endTime.setHMS( 23, 59, 59 );
419 } 437 }
420 438
421 // adjust start and end times based on timezone 439 // adjust start and end times based on timezone
422 QDateTime start( startDate, startTime ); 440 QDateTime start( startDate, startTime );
423 QDateTime end( endDate, endTime ); 441 QDateTime end( endDate, endTime );
424 time_t start_utc, end_utc; 442 time_t start_utc, end_utc;
425 443
426// qDebug( "tz: %s", timezone->currentZone().latin1() ); 444// qDebug( "tz: %s", timezone->currentZone().latin1() );
427 445
428 // get real timezone 446 // get real timezone
429 QString realTZ; 447 QString realTZ;
430 realTZ = QString::fromLocal8Bit( getenv("TZ") ); 448 realTZ = QString::fromLocal8Bit( getenv("TZ") );
431 449
432 // set timezone 450 // set timezone
433 if ( setenv( "TZ", timezone->currentZone(), true ) != 0 ) 451 if ( setenv( "TZ", timezone->currentZone(), true ) != 0 )
434 qWarning( "There was a problem setting the timezone." ); 452 qWarning( "There was a problem setting the timezone." );
435 453
436 // convert to UTC based on selected TZ (calling tzset internally) 454 // convert to UTC based on selected TZ (calling tzset internally)
437 start_utc = TimeConversion::toUTC( start ); 455 start_utc = TimeConversion::toUTC( start );
438 end_utc = TimeConversion::toUTC( end ); 456 end_utc = TimeConversion::toUTC( end );
439 457
440 // done playing around... put it all back 458 // done playing around... put it all back
441 unsetenv( "TZ" ); 459 unsetenv( "TZ" );
442 if ( !realTZ.isNull() ) 460 if ( !realTZ.isNull() )
443 if ( setenv( "TZ", realTZ, true ) != 0 ) 461 if ( setenv( "TZ", realTZ, true ) != 0 )
444 qWarning( "There was a problem setting the timezone." ); 462 qWarning( "There was a problem setting the timezone." );
445 463
446 // convert UTC to local time (calling tzset internally) 464 // convert UTC to local time (calling tzset internally)
447 ev.setStart( TimeConversion::fromUTC( start_utc ) ); 465 ev.setStart( TimeConversion::fromUTC( start_utc ) );
448 ev.setEnd( TimeConversion::fromUTC( end_utc ) ); 466 ev.setEnd( TimeConversion::fromUTC( end_utc ) );
449 467
450 // we only have one type of sound at the moment... LOUD!!! 468 // we only have one type of sound at the moment... LOUD!!!
451 if ( comboSound->currentItem() != 0 ) 469 if ( comboSound->currentItem() != 0 )
452 st = Event::Loud; 470 st = Event::Loud;
453 else 471 else
454 st = Event::Silent; 472 st = Event::Silent;
455 ev.setAlarm( checkAlarm->isChecked(), spinAlarm->value(), st ); 473 ev.setAlarm( checkAlarm->isChecked(), spinAlarm->value(), st );
456 if ( rp.type != Event::NoRepeat ) 474 if ( rp.type != Event::NoRepeat )
457 ev.setRepeat( TRUE, rp ); 475 ev.setRepeat( TRUE, rp );
458 ev.setNotes( editNote->text() ); 476 ev.setNotes( noteStr );
459 477
460 //cout << "Start: " << comboStart->currentText() << endl; 478 //cout << "Start: " << comboStart->currentText() << endl;
461 479
462 return ev; 480 return ev;
463} 481}
464 482
465void DateEntry::setRepeatLabel() 483void DateEntry::setRepeatLabel()
466{ 484{
467 485
468 switch( rp.type ) { 486 switch( rp.type ) {
469 case Event::Daily: 487 case Event::Daily:
470 cmdRepeat->setText( tr("Daily...") ); 488 cmdRepeat->setText( tr("Daily...") );
471 break; 489 break;
472 case Event::Weekly: 490 case Event::Weekly:
473 cmdRepeat->setText( tr("Weekly...") ); 491 cmdRepeat->setText( tr("Weekly...") );
474 break; 492 break;
475 case Event::MonthlyDay: 493 case Event::MonthlyDay:
476 case Event::MonthlyDate: 494 case Event::MonthlyDate:
477 cmdRepeat->setText( tr("Monthly...") ); 495 cmdRepeat->setText( tr("Monthly...") );
478 break; 496 break;
479 case Event::Yearly: 497 case Event::Yearly:
480 cmdRepeat->setText( tr("Yearly...") ); 498 cmdRepeat->setText( tr("Yearly...") );
481 break; 499 break;
482 default: 500 default:
483 cmdRepeat->setText( tr("No Repeat...") ); 501 cmdRepeat->setText( tr("No Repeat...") );
484 } 502 }
485} 503}
486 504
487void DateEntry::setAlarmEnabled( bool alarmPreset, int presetTime, Event::SoundTypeChoice sound ) 505void DateEntry::setAlarmEnabled( bool alarmPreset, int presetTime, Event::SoundTypeChoice sound )
488{ 506{
489 checkAlarm->setChecked( alarmPreset ); 507 checkAlarm->setChecked( alarmPreset );
490 spinAlarm->setValue( presetTime ); 508 spinAlarm->setValue( presetTime );
491 if ( sound != Event::Silent ) 509 if ( sound != Event::Silent )
492 comboSound->setCurrentItem( 1 ); 510 comboSound->setCurrentItem( 1 );
493 else 511 else
494 comboSound->setCurrentItem( 0 ); 512 comboSound->setCurrentItem( 0 );
495} 513}
496 514
497void DateEntry::initCombos() 515void DateEntry::initCombos()
498{ 516{
499 /* 517 /*
500 comboStart->clear(); 518 comboStart->clear();
501 comboEnd->clear(); 519 comboEnd->clear();
502 if ( ampm ) { 520 if ( ampm ) {
503 for ( int i = 0; i < 24; i++ ) { 521 for ( int i = 0; i < 24; i++ ) {
504 if ( i == 0 ) { 522 if ( i == 0 ) {
505 comboStart->insertItem( "12:00 AM" ); 523 comboStart->insertItem( "12:00 AM" );
506 comboStart->insertItem( "12:30 AM" ); 524 comboStart->insertItem( "12:30 AM" );
diff --git a/core/pim/datebook/dateentryimpl.h b/core/pim/datebook/dateentryimpl.h
index 4eb24b4..a3c4668 100644
--- a/core/pim/datebook/dateentryimpl.h
+++ b/core/pim/datebook/dateentryimpl.h
@@ -1,75 +1,79 @@
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#include "noteentryimpl.h"
24 25
25#include <qpe/event.h> 26#include <qpe/event.h>
26 27
27#include <qdatetime.h> 28#include <qdatetime.h>
28 29
29class DateBookMonth; 30class DateBookMonth;
30 31
31class DateEntry : public DateEntryBase 32class DateEntry : public DateEntryBase
32{ 33{
33 Q_OBJECT 34 Q_OBJECT
34 35
35public: 36public:
36 DateEntry( bool startOnMonday, const QDateTime &start, 37 DateEntry( bool startOnMonday, const QDateTime &start,
37 const QDateTime &end, bool whichClock = FALSE, 38 const QDateTime &end, bool whichClock = FALSE,
38 QWidget* parent = 0, const char* name = 0 ); 39 QWidget* parent = 0, const char* name = 0 );
39 DateEntry( bool startOnMonday, const Event &event, bool whichCLock = FALSE, 40 DateEntry( bool startOnMonday, const Event &event, bool whichCLock = FALSE,
40 QWidget* parent = 0, const char* name = 0 ); 41 QWidget* parent = 0, const char* name = 0 );
41 ~DateEntry(); 42 ~DateEntry();
42 43
43 Event event(); 44 Event event();
44 void setAlarmEnabled( bool alarmPreset, int presetTime, Event::SoundTypeChoice ); 45 void setAlarmEnabled( bool alarmPreset, int presetTime, Event::SoundTypeChoice );
45 virtual bool eventFilter( QObject *, QEvent * ); 46 virtual bool eventFilter( QObject *, QEvent * );
46public slots: 47public slots:
47 void endDateChanged( int, int, int ); 48 void endDateChanged( int, int, int );
48 void endTimeChanged( const QString & ); 49 void endTimeChanged( const QString & );
49 void endTimeChanged( const QTime & ); 50 void endTimeChanged( const QTime & );
50 void startDateChanged(int, int, int); 51 void startDateChanged(int, int, int);
51 void startTimeEdited( const QString & ); 52 void startTimeEdited( const QString & );
52 void startTimeChanged( const QTime & ); 53 void startTimeChanged( const QTime & );
53 void startTimePicked( const QTime & ); 54 void startTimePicked( const QTime & );
54 void typeChanged( const QString & ); 55 void typeChanged( const QString & );
55 void slotRepeat(); 56 void slotRepeat();
56 void slotChangeClock( bool ); 57 void slotChangeClock( bool );
57 void slotChangeStartOfWeek( bool ); 58 void slotChangeStartOfWeek( bool );
59 void slotEditNote();
58 60
59private: 61private:
60 void init(); 62 void init();
61 void initCombos(); 63 void initCombos();
62 void setDates( const QDateTime& s, const QDateTime& e ); 64 void setDates( const QDateTime& s, const QDateTime& e );
63 void setRepeatLabel(); 65 void setRepeatLabel();
64 void updateTimeEdit(bool,bool); 66 void updateTimeEdit(bool,bool);
65 67
66 DateBookMonth *startPicker, *endPicker; 68 DateBookMonth *startPicker, *endPicker;
67 QDate startDate, endDate; 69 QDate startDate, endDate;
68 QTime startTime, endTime; 70 QTime startTime, endTime;
69 Event::RepeatPattern rp; 71 Event::RepeatPattern rp;
70 bool ampm:1; 72 bool ampm:1;
71 bool startWeekOnMonday:1; 73 bool startWeekOnMonday:1;
72 bool m_showStart:1; 74 bool m_showStart:1;
75
76 QString noteStr;
73}; 77};
74 78
75#endif // DATEENTRY_H 79#endif // DATEENTRY_H
diff --git a/core/pim/datebook/noteentry.ui b/core/pim/datebook/noteentry.ui
new file mode 100644
index 0000000..ce3c4ad
--- a/dev/null
+++ b/core/pim/datebook/noteentry.ui
@@ -0,0 +1,68 @@
1<!DOCTYPE UI><UI>
2<class>NoteEntryBase</class>
3<widget>
4 <class>QDialog</class>
5 <property stdset="1">
6 <name>name</name>
7 <cstring>NoteEntryBase</cstring>
8 </property>
9 <property stdset="1">
10 <name>geometry</name>
11 <rect>
12 <x>0</x>
13 <y>0</y>
14 <width>465</width>
15 <height>500</height>
16 </rect>
17 </property>
18 <property stdset="1">
19 <name>caption</name>
20 <string>Edit Note</string>
21 </property>
22 <property>
23 <name>layoutMargin</name>
24 </property>
25 <property>
26 <name>layoutSpacing</name>
27 </property>
28 <vbox>
29 <property stdset="1">
30 <name>margin</name>
31 <number>2</number>
32 </property>
33 <property stdset="1">
34 <name>spacing</name>
35 <number>0</number>
36 </property>
37 <widget>
38 <class>QLabel</class>
39 <property stdset="1">
40 <name>name</name>
41 <cstring>eventLabel</cstring>
42 </property>
43 <property stdset="1">
44 <name>text</name>
45 <string>&lt;b&gt;1/10&lt;/b&gt; Lunch</string>
46 </property>
47 <property stdset="1">
48 <name>alignment</name>
49 <set>AlignCenter</set>
50 </property>
51 <property>
52 <name>hAlign</name>
53 </property>
54 </widget>
55 <widget>
56 <class>QMultiLineEdit</class>
57 <property stdset="1">
58 <name>name</name>
59 <cstring>note</cstring>
60 </property>
61 <property stdset="1">
62 <name>wordWrap</name>
63 <enum>WidgetWidth</enum>
64 </property>
65 </widget>
66 </vbox>
67</widget>
68</UI>
diff --git a/core/pim/datebook/noteentryimpl.cpp b/core/pim/datebook/noteentryimpl.cpp
new file mode 100644
index 0000000..9e1abb9
--- a/dev/null
+++ b/core/pim/datebook/noteentryimpl.cpp
@@ -0,0 +1,16 @@
1#include "noteentryimpl.h"
2#include "qstring.h"
3#include "qmultilinedit.h"
4#include "qlabel.h"
5
6NoteEntry::NoteEntry(const QString &title, const QString &noteStr,
7 QWidget* parent, const char* name, bool modal,
8 WFlags fl) :
9 NoteEntryBase(parent, name, modal, fl) {
10
11
12 eventLabel->setText(title);
13 note->setText(noteStr);
14 int l=note->length();
15 note->setCursorPosition(l,l,false);
16}
diff --git a/core/pim/datebook/noteentryimpl.h b/core/pim/datebook/noteentryimpl.h
new file mode 100644
index 0000000..f3adfa6
--- a/dev/null
+++ b/core/pim/datebook/noteentryimpl.h
@@ -0,0 +1,18 @@
1#ifndef noteentryimpl_h
2#define noteentryimpl_h
3
4#include "noteentry.h"
5
6class QString;
7
8class NoteEntry : public NoteEntryBase
9{
10 Q_OBJECT
11
12public:
13 NoteEntry(const QString &title, const QString &noteStr,
14 QWidget* parent = 0, const char* name = 0,
15 bool modal=TRUE, WFlags fl=0);
16};
17
18#endif