summaryrefslogtreecommitdiff
authorhakan <hakan>2002-05-07 15:27:34 (UTC)
committer hakan <hakan>2002-05-07 15:27:34 (UTC)
commitad2c6f2e1b5504989ceed297d9ee8c49129ad1fb (patch) (unidiff)
tree60d75877abb05a322b265d8b50621f3f7f75c9d1
parent8ba0398d93f0e70ea2de254a4090d8bd02f593cd (diff)
downloadopie-ad2c6f2e1b5504989ceed297d9ee8c49129ad1fb.zip
opie-ad2c6f2e1b5504989ceed297d9ee8c49129ad1fb.tar.gz
opie-ad2c6f2e1b5504989ceed297d9ee8c49129ad1fb.tar.bz2
Added separate note editor dialog (currently only a QMultiLineEdit)
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
@@ -5,12 +5,14 @@ datebookdayheader.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
@@ -2,45 +2,48 @@ 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
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
@@ -480,31 +480,42 @@
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>
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
@@ -119,26 +119,26 @@ DateEntry::DateEntry( bool startOnMonday, const Event &event, bool whichClock,
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{
@@ -201,52 +201,70 @@ void DateEntry::init()
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
@@ -446,25 +464,25 @@ Event DateEntry::event()
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...") );
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
@@ -12,24 +12,25 @@
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:
@@ -46,30 +47,33 @@ public:
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