author | hakan <hakan> | 2002-05-12 09:54:24 (UTC) |
---|---|---|
committer | hakan <hakan> | 2002-05-12 09:54:24 (UTC) |
commit | 6f19bc4691ec2c0ebbe36fc1aff09e879564fe7d (patch) (unidiff) | |
tree | 6fac867effefe67c98896418047fe794a88c6953 | |
parent | 6f5ac2fbf69f019cc9d3a1522fc507c6b88d2bd6 (diff) | |
download | opie-6f19bc4691ec2c0ebbe36fc1aff09e879564fe7d.zip opie-6f19bc4691ec2c0ebbe36fc1aff09e879564fe7d.tar.gz opie-6f19bc4691ec2c0ebbe36fc1aff09e879564fe7d.tar.bz2 |
Added a ONoteEdit class which is a QMultiLineEdit subclass copying indentation from line to line
-rw-r--r-- | core/pim/datebook/datebook.pro | 6 | ||||
-rw-r--r-- | core/pim/datebook/dateentryimpl.cpp | 1 | ||||
-rw-r--r-- | core/pim/datebook/noteentry.ui | 28 | ||||
-rw-r--r-- | core/pim/datebook/noteentryimpl.cpp | 1 | ||||
-rw-r--r-- | core/pim/datebook/onoteedit.cpp | 19 | ||||
-rw-r--r-- | core/pim/datebook/onoteedit.h | 19 |
6 files changed, 67 insertions, 7 deletions
diff --git a/core/pim/datebook/datebook.pro b/core/pim/datebook/datebook.pro index 60c2b08..cf3ed30 100644 --- a/core/pim/datebook/datebook.pro +++ b/core/pim/datebook/datebook.pro | |||
@@ -1,56 +1,58 @@ | |||
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 | noteentryimpl.h \ |
16 | onoteedit.h | ||
16 | 17 | ||
17 | SOURCES= main.cpp \ | 18 | SOURCES= main.cpp \ |
18 | datebookday.cpp \ | 19 | datebookday.cpp \ |
19 | datebook.cpp \ | 20 | datebook.cpp \ |
20 | dateentryimpl.cpp \ | 21 | dateentryimpl.cpp \ |
21 | datebookdayheaderimpl.cpp \ | 22 | datebookdayheaderimpl.cpp \ |
22 | datebooksettings.cpp \ | 23 | datebooksettings.cpp \ |
23 | datebookweek.cpp \ | 24 | datebookweek.cpp \ |
24 | datebookweeklst.cpp \ | 25 | datebookweeklst.cpp \ |
25 | datebookweekheaderimpl.cpp \ | 26 | datebookweekheaderimpl.cpp \ |
26 | repeatentry.cpp \ | 27 | repeatentry.cpp \ |
27 | timepicker.cpp \ | 28 | timepicker.cpp \ |
28 | noteentryimpl.cpp | 29 | noteentryimpl.cpp \ |
30 | onoteedit.cpp | ||
29 | 31 | ||
30 | INTERFACES= dateentry.ui \ | 32 | INTERFACES= dateentry.ui \ |
31 | datebookdayheader.ui \ | 33 | datebookdayheader.ui \ |
32 | datebooksettingsbase.ui \ | 34 | datebooksettingsbase.ui \ |
33 | datebookweekheader.ui \ | 35 | datebookweekheader.ui \ |
34 | datebookweeklstheader.ui \ | 36 | datebookweeklstheader.ui \ |
35 | datebookweeklstdayhdr.ui \ | 37 | datebookweeklstdayhdr.ui \ |
36 | repeatentrybase.ui \ | 38 | repeatentrybase.ui \ |
37 | noteentry.ui | 39 | noteentry.ui |
38 | 40 | ||
39 | INCLUDEPATH += $(OPIEDIR)/include | 41 | INCLUDEPATH += $(OPIEDIR)/include |
40 | DEPENDPATH+= $(OPIEDIR)/include | 42 | DEPENDPATH+= $(OPIEDIR)/include |
41 | LIBS += -lqpe -lopie | 43 | LIBS += -lqpe -lopie |
42 | 44 | ||
43 | TARGET = datebook | 45 | TARGET = datebook |
44 | 46 | ||
45 | TRANSLATIONS = ../i18n/pt_BR/datebook.ts | 47 | TRANSLATIONS = ../i18n/pt_BR/datebook.ts |
46 | TRANSLATIONS += ../i18n/de/datebook.ts | 48 | TRANSLATIONS += ../i18n/de/datebook.ts |
47 | TRANSLATIONS += ../i18n/en/datebook.ts | 49 | TRANSLATIONS += ../i18n/en/datebook.ts |
48 | TRANSLATIONS += ../i18n/hu/datebook.ts | 50 | TRANSLATIONS += ../i18n/hu/datebook.ts |
49 | TRANSLATIONS += ../i18n/pl/datebook.ts | 51 | TRANSLATIONS += ../i18n/pl/datebook.ts |
50 | TRANSLATIONS += ../i18n/sl/datebook.ts | 52 | TRANSLATIONS += ../i18n/sl/datebook.ts |
51 | TRANSLATIONS += ../i18n/ja/datebook.ts | 53 | TRANSLATIONS += ../i18n/ja/datebook.ts |
52 | TRANSLATIONS += ../i18n/ko/datebook.ts | 54 | TRANSLATIONS += ../i18n/ko/datebook.ts |
53 | TRANSLATIONS += ../i18n/no/datebook.ts | 55 | TRANSLATIONS += ../i18n/no/datebook.ts |
54 | TRANSLATIONS += ../i18n/zh_CN/datebook.ts | 56 | TRANSLATIONS += ../i18n/zh_CN/datebook.ts |
55 | TRANSLATIONS += ../i18n/zh_TW/datebook.ts | 57 | TRANSLATIONS += ../i18n/zh_TW/datebook.ts |
56 | TRANSLATIONS += ../i18n/fr/datebook.ts | 58 | TRANSLATIONS += ../i18n/fr/datebook.ts |
diff --git a/core/pim/datebook/dateentryimpl.cpp b/core/pim/datebook/dateentryimpl.cpp index 9cc5073..dab3375 100644 --- a/core/pim/datebook/dateentryimpl.cpp +++ b/core/pim/datebook/dateentryimpl.cpp | |||
@@ -1,571 +1,572 @@ | |||
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 <qevent.h> | 32 | #include <qevent.h> |
33 | #include <qcheckbox.h> | 33 | #include <qcheckbox.h> |
34 | #include <qcombobox.h> | 34 | #include <qcombobox.h> |
35 | #include <qlayout.h> | 35 | #include <qlayout.h> |
36 | #include <qlineedit.h> | 36 | #include <qlineedit.h> |
37 | #include <qmultilineedit.h> | 37 | #include <qmultilineedit.h> |
38 | #include <qpopupmenu.h> | 38 | #include <qpopupmenu.h> |
39 | #include <qscrollview.h> | 39 | #include <qscrollview.h> |
40 | #include <qspinbox.h> | 40 | #include <qspinbox.h> |
41 | #include <qtoolbutton.h> | 41 | #include <qtoolbutton.h> |
42 | 42 | ||
43 | #include "timepicker.h" | 43 | #include "timepicker.h" |
44 | #include "onoteedit.h" | ||
44 | 45 | ||
45 | #include <stdlib.h> | 46 | #include <stdlib.h> |
46 | #include <stdio.h> | 47 | #include <stdio.h> |
47 | 48 | ||
48 | /* | 49 | /* |
49 | * Constructs a DateEntry which is a child of 'parent', with the | 50 | * Constructs a DateEntry which is a child of 'parent', with the |
50 | * name 'name' and widget flags set to 'f' | 51 | * name 'name' and widget flags set to 'f' |
51 | * | 52 | * |
52 | * The dialog will by default be modeless, unless you set 'modal' to | 53 | * The dialog will by default be modeless, unless you set 'modal' to |
53 | * TRUE to construct a modal dialog. | 54 | * TRUE to construct a modal dialog. |
54 | */ | 55 | */ |
55 | 56 | ||
56 | DateEntry::DateEntry( bool startOnMonday, const QDateTime &start, | 57 | DateEntry::DateEntry( bool startOnMonday, const QDateTime &start, |
57 | const QDateTime &end, bool whichClock, QWidget* parent, | 58 | const QDateTime &end, bool whichClock, QWidget* parent, |
58 | const char* name ) | 59 | const char* name ) |
59 | : DateEntryBase( parent, name ), | 60 | : DateEntryBase( parent, name ), |
60 | ampm( whichClock ), | 61 | ampm( whichClock ), |
61 | startWeekOnMonday( startOnMonday ), | 62 | startWeekOnMonday( startOnMonday ), |
62 | m_showStart(true) | 63 | m_showStart(true) |
63 | { | 64 | { |
64 | init(); | 65 | init(); |
65 | setDates(start,end); | 66 | setDates(start,end); |
66 | setFocusProxy(comboDescription); | 67 | setFocusProxy(comboDescription); |
67 | } | 68 | } |
68 | 69 | ||
69 | bool DateEntry::eventFilter(QObject *obj, QEvent *ev ) | 70 | bool DateEntry::eventFilter(QObject *obj, QEvent *ev ) |
70 | { | 71 | { |
71 | if( ev->type() == QEvent::FocusIn ){ | 72 | if( ev->type() == QEvent::FocusIn ){ |
72 | if( obj == comboStart ){ | 73 | if( obj == comboStart ){ |
73 | timePickerStart->setHour(startTime.hour()); | 74 | timePickerStart->setHour(startTime.hour()); |
74 | timePickerStart->setMinute(startTime.minute()); | 75 | timePickerStart->setMinute(startTime.minute()); |
75 | TimePickerLabel->setText( tr("Start Time" ) ); | 76 | TimePickerLabel->setText( tr("Start Time" ) ); |
76 | m_showStart= true; | 77 | m_showStart= true; |
77 | }else if( obj == comboEnd ){ | 78 | }else if( obj == comboEnd ){ |
78 | timePickerStart->setHour(endTime.hour()); | 79 | timePickerStart->setHour(endTime.hour()); |
79 | timePickerStart->setMinute(endTime.minute()); | 80 | timePickerStart->setMinute(endTime.minute()); |
80 | TimePickerLabel->setText( tr("End Time") ); | 81 | TimePickerLabel->setText( tr("End Time") ); |
81 | m_showStart = false; | 82 | m_showStart = false; |
82 | } | 83 | } |
83 | } else if( ev->type() == QEvent::FocusOut ){ | 84 | } else if( ev->type() == QEvent::FocusOut ){ |
84 | if( obj == comboEnd ){ | 85 | if( obj == comboEnd ){ |
85 | QString s; | 86 | QString s; |
86 | s.sprintf("%.2d:%.2d",endTime.hour(), endTime.minute()); | 87 | s.sprintf("%.2d:%.2d",endTime.hour(), endTime.minute()); |
87 | comboEnd->setText(s); | 88 | comboEnd->setText(s); |
88 | } | 89 | } |
89 | else if( obj == comboStart ){ | 90 | else if( obj == comboStart ){ |
90 | QString s; | 91 | QString s; |
91 | s.sprintf("%.2d:%.2d",startTime.hour(), startTime.minute()); | 92 | s.sprintf("%.2d:%.2d",startTime.hour(), startTime.minute()); |
92 | comboStart->setText(s); | 93 | comboStart->setText(s); |
93 | } | 94 | } |
94 | } | 95 | } |
95 | 96 | ||
96 | return false; | 97 | return false; |
97 | } | 98 | } |
98 | 99 | ||
99 | static void addOrPick( QComboBox* combo, const QString& t ) | 100 | static void addOrPick( QComboBox* combo, const QString& t ) |
100 | { | 101 | { |
101 | // Pick an item if one excists | 102 | // Pick an item if one excists |
102 | for (int i=0; i<combo->count(); i++) { | 103 | for (int i=0; i<combo->count(); i++) { |
103 | if ( combo->text(i) == t ) { | 104 | if ( combo->text(i) == t ) { |
104 | combo->setCurrentItem(i); | 105 | combo->setCurrentItem(i); |
105 | return; | 106 | return; |
106 | } | 107 | } |
107 | } | 108 | } |
108 | 109 | ||
109 | // Else add one | 110 | // Else add one |
110 | combo->insertItem(t); | 111 | combo->insertItem(t); |
111 | combo->setCurrentItem(combo->count()-1); | 112 | combo->setCurrentItem(combo->count()-1); |
112 | } | 113 | } |
113 | 114 | ||
114 | DateEntry::DateEntry( bool startOnMonday, const Event &event, bool whichClock, | 115 | DateEntry::DateEntry( bool startOnMonday, const Event &event, bool whichClock, |
115 | QWidget* parent, const char* name ) | 116 | QWidget* parent, const char* name ) |
116 | : DateEntryBase( parent, name ), | 117 | : DateEntryBase( parent, name ), |
117 | ampm( whichClock ), | 118 | ampm( whichClock ), |
118 | startWeekOnMonday( startOnMonday ), | 119 | startWeekOnMonday( startOnMonday ), |
119 | m_showStart(true) | 120 | m_showStart(true) |
120 | 121 | ||
121 | { | 122 | { |
122 | init(); | 123 | init(); |
123 | setDates(event.start(),event.end()); | 124 | setDates(event.start(),event.end()); |
124 | comboCategory->setCategories( event.categories(), "Calendar", tr("Calendar") ); | 125 | comboCategory->setCategories( event.categories(), "Calendar", tr("Calendar") ); |
125 | if(!event.description().isEmpty()) | 126 | if(!event.description().isEmpty()) |
126 | addOrPick( comboDescription, event.description() ); | 127 | addOrPick( comboDescription, event.description() ); |
127 | if(!event.location().isEmpty()) | 128 | if(!event.location().isEmpty()) |
128 | addOrPick( comboLocation, event.location() ); | 129 | addOrPick( comboLocation, event.location() ); |
129 | checkAlarm->setChecked( event.hasAlarm() ); | 130 | checkAlarm->setChecked( event.hasAlarm() ); |
130 | checkAllDay->setChecked( event.type() == Event::AllDay ); | 131 | checkAllDay->setChecked( event.type() == Event::AllDay ); |
131 | if(!event.notes().isEmpty()) noteStr=event.notes(); | 132 | if(!event.notes().isEmpty()) noteStr=event.notes(); |
132 | else noteStr=""; | 133 | else noteStr=""; |
133 | spinAlarm->setValue(event.alarmTime()); | 134 | spinAlarm->setValue(event.alarmTime()); |
134 | if ( event.alarmSound() != Event::Silent ) | 135 | if ( event.alarmSound() != Event::Silent ) |
135 | comboSound->setCurrentItem( 1 ); | 136 | comboSound->setCurrentItem( 1 ); |
136 | if ( event.hasRepeat() ) { | 137 | if ( event.hasRepeat() ) { |
137 | rp = event.repeatPattern(); | 138 | rp = event.repeatPattern(); |
138 | cmdRepeat->setText( tr("Repeat...") ); | 139 | cmdRepeat->setText( tr("Repeat...") ); |
139 | } | 140 | } |
140 | setRepeatLabel(); | 141 | setRepeatLabel(); |
141 | } | 142 | } |
142 | 143 | ||
143 | void DateEntry::setDates( const QDateTime& s, const QDateTime& e ) | 144 | void DateEntry::setDates( const QDateTime& s, const QDateTime& e ) |
144 | { | 145 | { |
145 | startDate = s.date(); | 146 | startDate = s.date(); |
146 | endDate = e.date(); | 147 | endDate = e.date(); |
147 | startTime = s.time(); | 148 | startTime = s.time(); |
148 | endTime = e.time(); | 149 | endTime = e.time(); |
149 | 150 | ||
150 | startDateChanged( s.date().year(), s.date().month(), s.date().day() ); | 151 | startDateChanged( s.date().year(), s.date().month(), s.date().day() ); |
151 | endDateChanged( e.date().year(), e.date().month(), e.date().day() ); | 152 | endDateChanged( e.date().year(), e.date().month(), e.date().day() ); |
152 | 153 | ||
153 | updateTimeEdit(true,true); | 154 | updateTimeEdit(true,true); |
154 | } | 155 | } |
155 | 156 | ||
156 | void DateEntry::updateTimeEdit(bool s, bool e) { | 157 | void DateEntry::updateTimeEdit(bool s, bool e) { |
157 | 158 | ||
158 | // Comboboxes | 159 | // Comboboxes |
159 | QString strStart, strEnd; | 160 | QString strStart, strEnd; |
160 | int shour, ehour; | 161 | int shour, ehour; |
161 | if ( ampm ) { | 162 | if ( ampm ) { |
162 | shour = startTime.hour(); | 163 | shour = startTime.hour(); |
163 | ehour = endTime.hour(); | 164 | ehour = endTime.hour(); |
164 | if ( shour >= 12 ) { | 165 | if ( shour >= 12 ) { |
165 | if ( shour > 12 ) | 166 | if ( shour > 12 ) |
166 | shour -= 12; | 167 | shour -= 12; |
167 | strStart.sprintf( "%d:%02d PM", shour, startTime.minute() ); | 168 | strStart.sprintf( "%d:%02d PM", shour, startTime.minute() ); |
168 | } else { | 169 | } else { |
169 | if ( shour == 0 ) | 170 | if ( shour == 0 ) |
170 | shour = 12; | 171 | shour = 12; |
171 | strStart.sprintf( "%d:%02d AM", shour, startTime.minute() ); | 172 | strStart.sprintf( "%d:%02d AM", shour, startTime.minute() ); |
172 | } | 173 | } |
173 | if ( ehour == 24 && endTime.minute() == 0 ) { | 174 | if ( ehour == 24 && endTime.minute() == 0 ) { |
174 | strEnd = "11:59 PM"; // or "midnight" | 175 | strEnd = "11:59 PM"; // or "midnight" |
175 | } else if ( ehour >= 12 ) { | 176 | } else if ( ehour >= 12 ) { |
176 | if ( ehour > 12 ) | 177 | if ( ehour > 12 ) |
177 | ehour -= 12; | 178 | ehour -= 12; |
178 | strEnd.sprintf( "%d:%02d PM", ehour, endTime.minute() ); | 179 | strEnd.sprintf( "%d:%02d PM", ehour, endTime.minute() ); |
179 | } else { | 180 | } else { |
180 | if ( ehour == 0 ) | 181 | if ( ehour == 0 ) |
181 | ehour = 12; | 182 | ehour = 12; |
182 | strEnd.sprintf( "%d:%02d AM", ehour, endTime.minute() ); | 183 | strEnd.sprintf( "%d:%02d AM", ehour, endTime.minute() ); |
183 | } | 184 | } |
184 | } else { | 185 | } else { |
185 | strStart.sprintf( "%02d:%02d", startTime.hour(), startTime.minute() ); | 186 | strStart.sprintf( "%02d:%02d", startTime.hour(), startTime.minute() ); |
186 | strEnd.sprintf( "%02d:%02d", endTime.hour(), endTime.minute() ); | 187 | strEnd.sprintf( "%02d:%02d", endTime.hour(), endTime.minute() ); |
187 | } | 188 | } |
188 | 189 | ||
189 | if (s) comboStart->setText(strStart); | 190 | if (s) comboStart->setText(strStart); |
190 | if (e) comboEnd->setText(strEnd); | 191 | if (e) comboEnd->setText(strEnd); |
191 | } | 192 | } |
192 | 193 | ||
193 | void DateEntry::init() | 194 | void DateEntry::init() |
194 | { | 195 | { |
195 | comboDescription->setInsertionPolicy(QComboBox::AtCurrent); | 196 | comboDescription->setInsertionPolicy(QComboBox::AtCurrent); |
196 | comboLocation->setInsertionPolicy(QComboBox::AtCurrent); | 197 | comboLocation->setInsertionPolicy(QComboBox::AtCurrent); |
197 | 198 | ||
198 | initCombos(); | 199 | initCombos(); |
199 | QPopupMenu *m1 = new QPopupMenu( this ); | 200 | QPopupMenu *m1 = new QPopupMenu( this ); |
200 | startPicker = new DateBookMonth( m1, 0, TRUE ); | 201 | startPicker = new DateBookMonth( m1, 0, TRUE ); |
201 | m1->insertItem( startPicker ); | 202 | m1->insertItem( startPicker ); |
202 | buttonStart->setPopup( m1 ); | 203 | buttonStart->setPopup( m1 ); |
203 | connect( startPicker, SIGNAL( dateClicked( int, int, int ) ), | 204 | connect( startPicker, SIGNAL( dateClicked( int, int, int ) ), |
204 | this, SLOT( startDateChanged( int, int, int ) ) ); | 205 | this, SLOT( startDateChanged( int, int, int ) ) ); |
205 | 206 | ||
206 | //Let start button change both start and end dates | 207 | //Let start button change both start and end dates |
207 | connect( startPicker, SIGNAL( dateClicked( int, int, int ) ), | 208 | connect( startPicker, SIGNAL( dateClicked( int, int, int ) ), |
208 | this, SLOT( endDateChanged( int, int, int ) ) ); | 209 | this, SLOT( endDateChanged( int, int, int ) ) ); |
209 | connect( qApp, SIGNAL( clockChanged( bool ) ), | 210 | connect( qApp, SIGNAL( clockChanged( bool ) ), |
210 | this, SLOT( slotChangeClock( bool ) ) ); | 211 | this, SLOT( slotChangeClock( bool ) ) ); |
211 | connect( qApp, SIGNAL(weekChanged(bool)), | 212 | connect( qApp, SIGNAL(weekChanged(bool)), |
212 | this, SLOT(slotChangeStartOfWeek(bool)) ); | 213 | this, SLOT(slotChangeStartOfWeek(bool)) ); |
213 | 214 | ||
214 | connect( editNote, SIGNAL(clicked()), | 215 | connect( editNote, SIGNAL(clicked()), |
215 | this, SLOT(slotEditNote()) ); | 216 | this, SLOT(slotEditNote()) ); |
216 | 217 | ||
217 | QPopupMenu *m2 = new QPopupMenu( this ); | 218 | QPopupMenu *m2 = new QPopupMenu( this ); |
218 | endPicker = new DateBookMonth( m2, 0, TRUE ); | 219 | endPicker = new DateBookMonth( m2, 0, TRUE ); |
219 | m2->insertItem( endPicker ); | 220 | m2->insertItem( endPicker ); |
220 | buttonEnd->setPopup( m2 ); | 221 | buttonEnd->setPopup( m2 ); |
221 | connect( endPicker, SIGNAL( dateClicked( int, int, int ) ), | 222 | connect( endPicker, SIGNAL( dateClicked( int, int, int ) ), |
222 | this, SLOT( endDateChanged( int, int, int ) ) ); | 223 | this, SLOT( endDateChanged( int, int, int ) ) ); |
223 | 224 | ||
224 | connect(timePickerStart, SIGNAL( timeChanged(const QTime &) ), | 225 | connect(timePickerStart, SIGNAL( timeChanged(const QTime &) ), |
225 | this, SLOT( startTimePicked(const QTime &) )); | 226 | this, SLOT( startTimePicked(const QTime &) )); |
226 | // install eventFilters | 227 | // install eventFilters |
227 | comboEnd->installEventFilter( this ); | 228 | comboEnd->installEventFilter( this ); |
228 | comboStart->installEventFilter( this ); | 229 | comboStart->installEventFilter( this ); |
229 | } | 230 | } |
230 | 231 | ||
231 | /* | 232 | /* |
232 | * Destroys the object and frees any allocated resources | 233 | * Destroys the object and frees any allocated resources |
233 | */ | 234 | */ |
234 | DateEntry::~DateEntry() | 235 | DateEntry::~DateEntry() |
235 | { | 236 | { |
236 | // no need to delete child widgets, Qt does it all for us | 237 | // no need to delete child widgets, Qt does it all for us |
237 | //cout << "Del: " << comboStart->currentText() << endl; | 238 | //cout << "Del: " << comboStart->currentText() << endl; |
238 | } | 239 | } |
239 | 240 | ||
240 | /* | 241 | /* |
241 | * public slot | 242 | * public slot |
242 | */ | 243 | */ |
243 | 244 | ||
244 | void DateEntry::slotEditNote() { | 245 | void DateEntry::slotEditNote() { |
245 | QString s; | 246 | QString s; |
246 | s.sprintf("<B>%d/%d</B> ", startDate.day(), startDate.month()); | 247 | s.sprintf("<B>%d/%d</B> ", startDate.day(), startDate.month()); |
247 | NoteEntry noteDlg(s+comboDescription->currentText(), noteStr, | 248 | NoteEntry noteDlg(s+comboDescription->currentText(), noteStr, |
248 | this,0,TRUE); | 249 | this,0,TRUE); |
249 | 250 | ||
250 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) | 251 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) |
251 | noteDlg.showMaximized(); | 252 | noteDlg.showMaximized(); |
252 | #endif | 253 | #endif |
253 | if (noteDlg.exec() ) { | 254 | if (noteDlg.exec() ) { |
254 | noteStr=noteDlg.note->text(); | 255 | noteStr=noteDlg.note->text(); |
255 | } | 256 | } |
256 | 257 | ||
257 | } | 258 | } |
258 | 259 | ||
259 | void DateEntry::endDateChanged( int y, int m, int d ) | 260 | void DateEntry::endDateChanged( int y, int m, int d ) |
260 | { | 261 | { |
261 | endDate.setYMD( y, m, d ); | 262 | endDate.setYMD( y, m, d ); |
262 | if ( endDate < startDate ) { | 263 | if ( endDate < startDate ) { |
263 | endDate = startDate; | 264 | endDate = startDate; |
264 | } | 265 | } |
265 | 266 | ||
266 | buttonEnd->setText( TimeString::shortDate( endDate ) ); | 267 | buttonEnd->setText( TimeString::shortDate( endDate ) ); |
267 | 268 | ||
268 | endPicker->setDate( endDate.year(), endDate.month(), endDate.day() ); | 269 | endPicker->setDate( endDate.year(), endDate.month(), endDate.day() ); |
269 | } | 270 | } |
270 | 271 | ||
271 | static QTime parseTime( const QString& s, bool ampm ) | 272 | static QTime parseTime( const QString& s, bool ampm ) |
272 | { | 273 | { |
273 | QTime tmpTime; | 274 | QTime tmpTime; |
274 | QStringList l = QStringList::split( ':', s ); | 275 | QStringList l = QStringList::split( ':', s ); |
275 | int hour = l[0].toInt(); | 276 | int hour = l[0].toInt(); |
276 | if ( ampm ) { | 277 | if ( ampm ) { |
277 | int i=0; | 278 | int i=0; |
278 | while (i<int(l[1].length()) && l[1][i]>='0' && l[1][i]<='9') | 279 | while (i<int(l[1].length()) && l[1][i]>='0' && l[1][i]<='9') |
279 | i++; | 280 | i++; |
280 | QString digits = l[1].left(i); | 281 | QString digits = l[1].left(i); |
281 | if ( l[1].contains( "PM", FALSE ) ) { | 282 | if ( l[1].contains( "PM", FALSE ) ) { |
282 | if ( hour != 12 ) | 283 | if ( hour != 12 ) |
283 | hour += 12; | 284 | hour += 12; |
284 | } else { | 285 | } else { |
285 | if ( hour == 12 ) | 286 | if ( hour == 12 ) |
286 | hour = 0; | 287 | hour = 0; |
287 | } | 288 | } |
288 | l[1] = digits; | 289 | l[1] = digits; |
289 | } | 290 | } |
290 | int minute = l[1].toInt(); | 291 | int minute = l[1].toInt(); |
291 | if ( minute > 59 ) | 292 | if ( minute > 59 ) |
292 | minute = 59; | 293 | minute = 59; |
293 | else if ( minute < 0 ) | 294 | else if ( minute < 0 ) |
294 | minute = 0; | 295 | minute = 0; |
295 | if ( hour > 23 ) { | 296 | if ( hour > 23 ) { |
296 | hour = 23; | 297 | hour = 23; |
297 | minute = 59; | 298 | minute = 59; |
298 | } else if ( hour < 0 ) | 299 | } else if ( hour < 0 ) |
299 | hour = 0; | 300 | hour = 0; |
300 | tmpTime.setHMS( hour, minute, 0 ); | 301 | tmpTime.setHMS( hour, minute, 0 ); |
301 | return tmpTime; | 302 | return tmpTime; |
302 | } | 303 | } |
303 | 304 | ||
304 | /* | 305 | /* |
305 | * public slot | 306 | * public slot |
306 | */ | 307 | */ |
307 | void DateEntry::endTimeChanged( const QString &s ) | 308 | void DateEntry::endTimeChanged( const QString &s ) |
308 | { | 309 | { |
309 | endTimeChanged( parseTime(s,ampm) ); | 310 | endTimeChanged( parseTime(s,ampm) ); |
310 | } | 311 | } |
311 | 312 | ||
312 | void DateEntry::endTimeChanged( const QTime &t ) { | 313 | void DateEntry::endTimeChanged( const QTime &t ) { |
313 | if ( endDate > startDate || t >= startTime ) { | 314 | if ( endDate > startDate || t >= startTime ) { |
314 | endTime = t; | 315 | endTime = t; |
315 | } else { | 316 | } else { |
316 | endTime = startTime; | 317 | endTime = startTime; |
317 | //comboEnd->setCurrentItem( comboStart->currentItem() ); | 318 | //comboEnd->setCurrentItem( comboStart->currentItem() ); |
318 | } | 319 | } |
319 | timePickerStart->setHour(endTime.hour()); | 320 | timePickerStart->setHour(endTime.hour()); |
320 | timePickerStart->setMinute(endTime.minute()); | 321 | timePickerStart->setMinute(endTime.minute()); |
321 | } | 322 | } |
322 | 323 | ||
323 | /* | 324 | /* |
324 | * public slot | 325 | * public slot |
325 | */ | 326 | */ |
326 | void DateEntry::startDateChanged( int y, int m, int d ) | 327 | void DateEntry::startDateChanged( int y, int m, int d ) |
327 | { | 328 | { |
328 | QDate prev = startDate; | 329 | QDate prev = startDate; |
329 | startDate.setYMD( y, m, d ); | 330 | startDate.setYMD( y, m, d ); |
330 | if ( rp.type == Event::Weekly && | 331 | if ( rp.type == Event::Weekly && |
331 | startDate.dayOfWeek() != prev.dayOfWeek() ) { | 332 | startDate.dayOfWeek() != prev.dayOfWeek() ) { |
332 | // if we change the start of a weekly repeating event | 333 | // if we change the start of a weekly repeating event |
333 | // set the repeating day appropriately | 334 | // set the repeating day appropriately |
334 | char mask = 1 << (prev.dayOfWeek()-1); | 335 | char mask = 1 << (prev.dayOfWeek()-1); |
335 | rp.days &= (~mask); | 336 | rp.days &= (~mask); |
336 | rp.days |= 1 << (startDate.dayOfWeek()-1); | 337 | rp.days |= 1 << (startDate.dayOfWeek()-1); |
337 | } | 338 | } |
338 | 339 | ||
339 | buttonStart->setText( TimeString::shortDate( startDate ) ); | 340 | buttonStart->setText( TimeString::shortDate( startDate ) ); |
340 | 341 | ||
341 | // our pickers must be reset... | 342 | // our pickers must be reset... |
342 | startPicker->setDate( y, m, d ); | 343 | startPicker->setDate( y, m, d ); |
343 | endPicker->setDate( y, m, d ); | 344 | endPicker->setDate( y, m, d ); |
344 | } | 345 | } |
345 | 346 | ||
346 | /* | 347 | /* |
347 | * public slot | 348 | * public slot |
348 | */ | 349 | */ |
349 | void DateEntry::startTimeEdited( const QString &s ) | 350 | void DateEntry::startTimeEdited( const QString &s ) |
350 | { | 351 | { |
351 | startTimeChanged(parseTime(s,ampm)); | 352 | startTimeChanged(parseTime(s,ampm)); |
352 | updateTimeEdit(false,true); | 353 | updateTimeEdit(false,true); |
353 | timePickerStart->setHour(startTime.hour()); | 354 | timePickerStart->setHour(startTime.hour()); |
354 | timePickerStart->setMinute(startTime.minute()); | 355 | timePickerStart->setMinute(startTime.minute()); |
355 | } | 356 | } |
356 | 357 | ||
357 | void DateEntry::startTimeChanged( const QTime &t ) | 358 | void DateEntry::startTimeChanged( const QTime &t ) |
358 | { | 359 | { |
359 | int duration=startTime.secsTo(endTime); | 360 | int duration=startTime.secsTo(endTime); |
360 | startTime = t; | 361 | startTime = t; |
361 | endTime=t.addSecs(duration); | 362 | endTime=t.addSecs(duration); |
362 | } | 363 | } |
363 | void DateEntry::startTimePicked( const QTime &t ) { | 364 | void DateEntry::startTimePicked( const QTime &t ) { |
364 | if(m_showStart ){ | 365 | if(m_showStart ){ |
365 | startTimeChanged(t); | 366 | startTimeChanged(t); |
366 | updateTimeEdit(true,true); | 367 | updateTimeEdit(true,true); |
367 | }else{ | 368 | }else{ |
368 | endTimeChanged(t); | 369 | endTimeChanged(t); |
369 | updateTimeEdit(false, true ); | 370 | updateTimeEdit(false, true ); |
370 | } | 371 | } |
371 | } | 372 | } |
372 | 373 | ||
373 | /* | 374 | /* |
374 | * public slot | 375 | * public slot |
375 | */ | 376 | */ |
376 | void DateEntry::typeChanged( const QString &s ) | 377 | void DateEntry::typeChanged( const QString &s ) |
377 | { | 378 | { |
378 | bool b = s != "All Day"; | 379 | bool b = s != "All Day"; |
379 | buttonStart->setEnabled( b ); | 380 | buttonStart->setEnabled( b ); |
380 | comboStart->setEnabled( b ); | 381 | comboStart->setEnabled( b ); |
381 | comboEnd->setEnabled( b ); | 382 | comboEnd->setEnabled( b ); |
382 | } | 383 | } |
383 | 384 | ||
384 | void DateEntry::slotRepeat() | 385 | void DateEntry::slotRepeat() |
385 | { | 386 | { |
386 | // Work around for compiler Bug.. | 387 | // Work around for compiler Bug.. |
387 | RepeatEntry *e; | 388 | RepeatEntry *e; |
388 | 389 | ||
389 | // it is better in my opinion to just grab this from the mother, | 390 | // it is better in my opinion to just grab this from the mother, |
390 | // since, this dialog doesn't need to keep track of it... | 391 | // since, this dialog doesn't need to keep track of it... |
391 | if ( rp.type != Event::NoRepeat ) | 392 | if ( rp.type != Event::NoRepeat ) |
392 | e = new RepeatEntry( startWeekOnMonday, rp, startDate, this); | 393 | e = new RepeatEntry( startWeekOnMonday, rp, startDate, this); |
393 | else | 394 | else |
394 | e = new RepeatEntry( startWeekOnMonday, startDate, this ); | 395 | e = new RepeatEntry( startWeekOnMonday, startDate, this ); |
395 | 396 | ||
396 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) | 397 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) |
397 | e->showMaximized(); | 398 | e->showMaximized(); |
398 | #endif | 399 | #endif |
399 | if ( e->exec() ) { | 400 | if ( e->exec() ) { |
400 | rp = e->repeatPattern(); | 401 | rp = e->repeatPattern(); |
401 | setRepeatLabel(); | 402 | setRepeatLabel(); |
402 | } | 403 | } |
403 | } | 404 | } |
404 | 405 | ||
405 | void DateEntry::slotChangeStartOfWeek( bool onMonday ) | 406 | void DateEntry::slotChangeStartOfWeek( bool onMonday ) |
406 | { | 407 | { |
407 | startWeekOnMonday = onMonday; | 408 | startWeekOnMonday = onMonday; |
408 | } | 409 | } |
409 | 410 | ||
410 | Event DateEntry::event() | 411 | Event DateEntry::event() |
411 | { | 412 | { |
412 | Event ev; | 413 | Event ev; |
413 | Event::SoundTypeChoice st; | 414 | Event::SoundTypeChoice st; |
414 | ev.setDescription( comboDescription->currentText() ); | 415 | ev.setDescription( comboDescription->currentText() ); |
415 | ev.setLocation( comboLocation->currentText() ); | 416 | ev.setLocation( comboLocation->currentText() ); |
416 | ev.setCategories( comboCategory->currentCategories() ); | 417 | ev.setCategories( comboCategory->currentCategories() ); |
417 | ev.setType( checkAllDay->isChecked() ? Event::AllDay : Event::Normal ); | 418 | ev.setType( checkAllDay->isChecked() ? Event::AllDay : Event::Normal ); |
418 | if ( startDate > endDate ) { | 419 | if ( startDate > endDate ) { |
419 | QDate tmp = endDate; | 420 | QDate tmp = endDate; |
420 | endDate = startDate; | 421 | endDate = startDate; |
421 | startDate = tmp; | 422 | startDate = tmp; |
422 | } | 423 | } |
423 | 424 | ||
424 | // This is now done in the changed slots | 425 | // This is now done in the changed slots |
425 | // startTime = parseTime( comboStart->text(), ampm ); | 426 | // startTime = parseTime( comboStart->text(), ampm ); |
426 | //endTime = parseTime( comboEnd->text(), ampm ); | 427 | //endTime = parseTime( comboEnd->text(), ampm ); |
427 | 428 | ||
428 | if ( startTime > endTime && endDate == startDate ) { | 429 | if ( startTime > endTime && endDate == startDate ) { |
429 | QTime tmp = endTime; | 430 | QTime tmp = endTime; |
430 | endTime = startTime; | 431 | endTime = startTime; |
431 | startTime = tmp; | 432 | startTime = tmp; |
432 | } | 433 | } |
433 | // don't set the time if theres no need too | 434 | // don't set the time if theres no need too |
434 | if ( ev.type() == Event::AllDay ) { | 435 | if ( ev.type() == Event::AllDay ) { |
435 | startTime.setHMS( 0, 0, 0 ); | 436 | startTime.setHMS( 0, 0, 0 ); |
436 | endTime.setHMS( 23, 59, 59 ); | 437 | endTime.setHMS( 23, 59, 59 ); |
437 | } | 438 | } |
438 | 439 | ||
439 | // adjust start and end times based on timezone | 440 | // adjust start and end times based on timezone |
440 | QDateTime start( startDate, startTime ); | 441 | QDateTime start( startDate, startTime ); |
441 | QDateTime end( endDate, endTime ); | 442 | QDateTime end( endDate, endTime ); |
442 | time_t start_utc, end_utc; | 443 | time_t start_utc, end_utc; |
443 | 444 | ||
444 | // qDebug( "tz: %s", timezone->currentZone().latin1() ); | 445 | // qDebug( "tz: %s", timezone->currentZone().latin1() ); |
445 | 446 | ||
446 | // get real timezone | 447 | // get real timezone |
447 | QString realTZ; | 448 | QString realTZ; |
448 | realTZ = QString::fromLocal8Bit( getenv("TZ") ); | 449 | realTZ = QString::fromLocal8Bit( getenv("TZ") ); |
449 | 450 | ||
450 | // set timezone | 451 | // set timezone |
451 | if ( setenv( "TZ", timezone->currentZone(), true ) != 0 ) | 452 | if ( setenv( "TZ", timezone->currentZone(), true ) != 0 ) |
452 | qWarning( "There was a problem setting the timezone." ); | 453 | qWarning( "There was a problem setting the timezone." ); |
453 | 454 | ||
454 | // convert to UTC based on selected TZ (calling tzset internally) | 455 | // convert to UTC based on selected TZ (calling tzset internally) |
455 | start_utc = TimeConversion::toUTC( start ); | 456 | start_utc = TimeConversion::toUTC( start ); |
456 | end_utc = TimeConversion::toUTC( end ); | 457 | end_utc = TimeConversion::toUTC( end ); |
457 | 458 | ||
458 | // done playing around... put it all back | 459 | // done playing around... put it all back |
459 | unsetenv( "TZ" ); | 460 | unsetenv( "TZ" ); |
460 | if ( !realTZ.isNull() ) | 461 | if ( !realTZ.isNull() ) |
461 | if ( setenv( "TZ", realTZ, true ) != 0 ) | 462 | if ( setenv( "TZ", realTZ, true ) != 0 ) |
462 | qWarning( "There was a problem setting the timezone." ); | 463 | qWarning( "There was a problem setting the timezone." ); |
463 | 464 | ||
464 | // convert UTC to local time (calling tzset internally) | 465 | // convert UTC to local time (calling tzset internally) |
465 | ev.setStart( TimeConversion::fromUTC( start_utc ) ); | 466 | ev.setStart( TimeConversion::fromUTC( start_utc ) ); |
466 | ev.setEnd( TimeConversion::fromUTC( end_utc ) ); | 467 | ev.setEnd( TimeConversion::fromUTC( end_utc ) ); |
467 | 468 | ||
468 | // we only have one type of sound at the moment... LOUD!!! | 469 | // we only have one type of sound at the moment... LOUD!!! |
469 | if ( comboSound->currentItem() != 0 ) | 470 | if ( comboSound->currentItem() != 0 ) |
470 | st = Event::Loud; | 471 | st = Event::Loud; |
471 | else | 472 | else |
472 | st = Event::Silent; | 473 | st = Event::Silent; |
473 | ev.setAlarm( checkAlarm->isChecked(), spinAlarm->value(), st ); | 474 | ev.setAlarm( checkAlarm->isChecked(), spinAlarm->value(), st ); |
474 | if ( rp.type != Event::NoRepeat ) | 475 | if ( rp.type != Event::NoRepeat ) |
475 | ev.setRepeat( TRUE, rp ); | 476 | ev.setRepeat( TRUE, rp ); |
476 | ev.setNotes( noteStr ); | 477 | ev.setNotes( noteStr ); |
477 | 478 | ||
478 | //cout << "Start: " << comboStart->currentText() << endl; | 479 | //cout << "Start: " << comboStart->currentText() << endl; |
479 | 480 | ||
480 | return ev; | 481 | return ev; |
481 | } | 482 | } |
482 | 483 | ||
483 | void DateEntry::setRepeatLabel() | 484 | void DateEntry::setRepeatLabel() |
484 | { | 485 | { |
485 | 486 | ||
486 | switch( rp.type ) { | 487 | switch( rp.type ) { |
487 | case Event::Daily: | 488 | case Event::Daily: |
488 | cmdRepeat->setText( tr("Daily...") ); | 489 | cmdRepeat->setText( tr("Daily...") ); |
489 | break; | 490 | break; |
490 | case Event::Weekly: | 491 | case Event::Weekly: |
491 | cmdRepeat->setText( tr("Weekly...") ); | 492 | cmdRepeat->setText( tr("Weekly...") ); |
492 | break; | 493 | break; |
493 | case Event::MonthlyDay: | 494 | case Event::MonthlyDay: |
494 | case Event::MonthlyDate: | 495 | case Event::MonthlyDate: |
495 | cmdRepeat->setText( tr("Monthly...") ); | 496 | cmdRepeat->setText( tr("Monthly...") ); |
496 | break; | 497 | break; |
497 | case Event::Yearly: | 498 | case Event::Yearly: |
498 | cmdRepeat->setText( tr("Yearly...") ); | 499 | cmdRepeat->setText( tr("Yearly...") ); |
499 | break; | 500 | break; |
500 | default: | 501 | default: |
501 | cmdRepeat->setText( tr("No Repeat...") ); | 502 | cmdRepeat->setText( tr("No Repeat...") ); |
502 | } | 503 | } |
503 | } | 504 | } |
504 | 505 | ||
505 | void DateEntry::setAlarmEnabled( bool alarmPreset, int presetTime, Event::SoundTypeChoice sound ) | 506 | void DateEntry::setAlarmEnabled( bool alarmPreset, int presetTime, Event::SoundTypeChoice sound ) |
506 | { | 507 | { |
507 | checkAlarm->setChecked( alarmPreset ); | 508 | checkAlarm->setChecked( alarmPreset ); |
508 | spinAlarm->setValue( presetTime ); | 509 | spinAlarm->setValue( presetTime ); |
509 | if ( sound != Event::Silent ) | 510 | if ( sound != Event::Silent ) |
510 | comboSound->setCurrentItem( 1 ); | 511 | comboSound->setCurrentItem( 1 ); |
511 | else | 512 | else |
512 | comboSound->setCurrentItem( 0 ); | 513 | comboSound->setCurrentItem( 0 ); |
513 | } | 514 | } |
514 | 515 | ||
515 | void DateEntry::initCombos() | 516 | void DateEntry::initCombos() |
516 | { | 517 | { |
517 | /* | 518 | /* |
518 | comboStart->clear(); | 519 | comboStart->clear(); |
519 | comboEnd->clear(); | 520 | comboEnd->clear(); |
520 | if ( ampm ) { | 521 | if ( ampm ) { |
521 | for ( int i = 0; i < 24; i++ ) { | 522 | for ( int i = 0; i < 24; i++ ) { |
522 | if ( i == 0 ) { | 523 | if ( i == 0 ) { |
523 | comboStart->insertItem( "12:00 AM" ); | 524 | comboStart->insertItem( "12:00 AM" ); |
524 | comboStart->insertItem( "12:30 AM" ); | 525 | comboStart->insertItem( "12:30 AM" ); |
525 | comboEnd->insertItem( "12:00 AM" ); | 526 | comboEnd->insertItem( "12:00 AM" ); |
526 | comboEnd->insertItem( "12:30 AM" ); | 527 | comboEnd->insertItem( "12:30 AM" ); |
527 | } else if ( i == 12 ) { | 528 | } else if ( i == 12 ) { |
528 | comboStart->insertItem( "12:00 PM" ); | 529 | comboStart->insertItem( "12:00 PM" ); |
529 | comboStart->insertItem( "12:30 PM" ); | 530 | comboStart->insertItem( "12:30 PM" ); |
530 | comboEnd->insertItem( "12:00 PM" ); | 531 | comboEnd->insertItem( "12:00 PM" ); |
531 | comboEnd->insertItem( "12:30 PM" ); | 532 | comboEnd->insertItem( "12:30 PM" ); |
532 | } else if ( i > 12 ) { | 533 | } else if ( i > 12 ) { |
533 | comboStart->insertItem( QString::number( i - 12 ) + ":00 PM" ); | 534 | comboStart->insertItem( QString::number( i - 12 ) + ":00 PM" ); |
534 | comboStart->insertItem( QString::number( i - 12 ) + ":30 PM" ); | 535 | comboStart->insertItem( QString::number( i - 12 ) + ":30 PM" ); |
535 | comboEnd->insertItem( QString::number( i - 12 ) + ":00 PM" ); | 536 | comboEnd->insertItem( QString::number( i - 12 ) + ":00 PM" ); |
536 | comboEnd->insertItem( QString::number( i - 12 ) + ":30 PM" ); | 537 | comboEnd->insertItem( QString::number( i - 12 ) + ":30 PM" ); |
537 | } else { | 538 | } else { |
538 | comboStart->insertItem( QString::number( i) + ":00 AM" ); | 539 | comboStart->insertItem( QString::number( i) + ":00 AM" ); |
539 | comboStart->insertItem( QString::number( i ) + ":30 AM" ); | 540 | comboStart->insertItem( QString::number( i ) + ":30 AM" ); |
540 | comboEnd->insertItem( QString::number( i ) + ":00 AM" ); | 541 | comboEnd->insertItem( QString::number( i ) + ":00 AM" ); |
541 | comboEnd->insertItem( QString::number( i ) + ":30 AM" ); | 542 | comboEnd->insertItem( QString::number( i ) + ":30 AM" ); |
542 | } | 543 | } |
543 | } | 544 | } |
544 | } else { | 545 | } else { |
545 | for ( int i = 0; i < 24; i++ ) { | 546 | for ( int i = 0; i < 24; i++ ) { |
546 | if ( i < 10 ) { | 547 | if ( i < 10 ) { |
547 | comboStart->insertItem( QString("0") | 548 | comboStart->insertItem( QString("0") |
548 | + QString::number(i) + ":00" ); | 549 | + QString::number(i) + ":00" ); |
549 | comboStart->insertItem( QString("0") | 550 | comboStart->insertItem( QString("0") |
550 | + QString::number(i) + ":30" ); | 551 | + QString::number(i) + ":30" ); |
551 | comboEnd->insertItem( QString("0") | 552 | comboEnd->insertItem( QString("0") |
552 | + QString::number(i) + ":00" ); | 553 | + QString::number(i) + ":00" ); |
553 | comboEnd->insertItem( QString("0") | 554 | comboEnd->insertItem( QString("0") |
554 | + QString::number(i) + ":30" ); | 555 | + QString::number(i) + ":30" ); |
555 | } else { | 556 | } else { |
556 | comboStart->insertItem( QString::number(i) + ":00" ); | 557 | comboStart->insertItem( QString::number(i) + ":00" ); |
557 | comboStart->insertItem( QString::number(i) + ":30" ); | 558 | comboStart->insertItem( QString::number(i) + ":30" ); |
558 | comboEnd->insertItem( QString::number(i) + ":00" ); | 559 | comboEnd->insertItem( QString::number(i) + ":00" ); |
559 | comboEnd->insertItem( QString::number(i) + ":30" ); | 560 | comboEnd->insertItem( QString::number(i) + ":30" ); |
560 | } | 561 | } |
561 | } | 562 | } |
562 | } | 563 | } |
563 | */ | 564 | */ |
564 | } | 565 | } |
565 | 566 | ||
566 | void DateEntry::slotChangeClock( bool whichClock ) | 567 | void DateEntry::slotChangeClock( bool whichClock ) |
567 | { | 568 | { |
568 | ampm = whichClock; | 569 | ampm = whichClock; |
569 | initCombos(); | 570 | initCombos(); |
570 | setDates( QDateTime( startDate, startTime ), QDateTime( endDate, endTime ) ); | 571 | setDates( QDateTime( startDate, startTime ), QDateTime( endDate, endTime ) ); |
571 | } | 572 | } |
diff --git a/core/pim/datebook/noteentry.ui b/core/pim/datebook/noteentry.ui index ce3c4ad..0bea06e 100644 --- a/core/pim/datebook/noteentry.ui +++ b/core/pim/datebook/noteentry.ui | |||
@@ -1,68 +1,86 @@ | |||
1 | <!DOCTYPE UI><UI> | 1 | <!DOCTYPE UI><UI> |
2 | <class>NoteEntryBase</class> | 2 | <class>NoteEntryBase</class> |
3 | <widget> | 3 | <widget> |
4 | <class>QDialog</class> | 4 | <class>QDialog</class> |
5 | <property stdset="1"> | 5 | <property stdset="1"> |
6 | <name>name</name> | 6 | <name>name</name> |
7 | <cstring>NoteEntryBase</cstring> | 7 | <cstring>NoteEntryBase</cstring> |
8 | </property> | 8 | </property> |
9 | <property stdset="1"> | 9 | <property stdset="1"> |
10 | <name>geometry</name> | 10 | <name>geometry</name> |
11 | <rect> | 11 | <rect> |
12 | <x>0</x> | 12 | <x>0</x> |
13 | <y>0</y> | 13 | <y>0</y> |
14 | <width>465</width> | 14 | <width>465</width> |
15 | <height>500</height> | 15 | <height>500</height> |
16 | </rect> | 16 | </rect> |
17 | </property> | 17 | </property> |
18 | <property stdset="1"> | 18 | <property stdset="1"> |
19 | <name>caption</name> | 19 | <name>caption</name> |
20 | <string>Edit Note</string> | 20 | <string>Edit Note</string> |
21 | </property> | 21 | </property> |
22 | <property> | 22 | <property> |
23 | <name>layoutMargin</name> | 23 | <name>layoutMargin</name> |
24 | </property> | 24 | </property> |
25 | <property> | 25 | <property> |
26 | <name>layoutSpacing</name> | 26 | <name>layoutSpacing</name> |
27 | </property> | 27 | </property> |
28 | <vbox> | 28 | <vbox> |
29 | <property stdset="1"> | 29 | <property stdset="1"> |
30 | <name>margin</name> | 30 | <name>margin</name> |
31 | <number>2</number> | 31 | <number>2</number> |
32 | </property> | 32 | </property> |
33 | <property stdset="1"> | 33 | <property stdset="1"> |
34 | <name>spacing</name> | 34 | <name>spacing</name> |
35 | <number>0</number> | 35 | <number>0</number> |
36 | </property> | 36 | </property> |
37 | <widget> | 37 | <widget> |
38 | <class>QLabel</class> | 38 | <class>QLabel</class> |
39 | <property stdset="1"> | 39 | <property stdset="1"> |
40 | <name>name</name> | 40 | <name>name</name> |
41 | <cstring>eventLabel</cstring> | 41 | <cstring>eventLabel</cstring> |
42 | </property> | 42 | </property> |
43 | <property stdset="1"> | 43 | <property stdset="1"> |
44 | <name>text</name> | 44 | <name>text</name> |
45 | <string><b>1/10</b> Lunch</string> | 45 | <string><b>1/10</b> Lunch</string> |
46 | </property> | 46 | </property> |
47 | <property stdset="1"> | 47 | <property stdset="1"> |
48 | <name>alignment</name> | 48 | <name>alignment</name> |
49 | <set>AlignCenter</set> | 49 | <set>AlignCenter</set> |
50 | </property> | 50 | </property> |
51 | <property> | 51 | <property> |
52 | <name>hAlign</name> | 52 | <name>hAlign</name> |
53 | </property> | 53 | </property> |
54 | </widget> | 54 | </widget> |
55 | <widget> | 55 | <widget> |
56 | <class>QMultiLineEdit</class> | 56 | <class>ONoteEdit</class> |
57 | <property stdset="1"> | 57 | <property stdset="1"> |
58 | <name>name</name> | 58 | <name>name</name> |
59 | <cstring>note</cstring> | 59 | <cstring>note</cstring> |
60 | </property> | 60 | </property> |
61 | <property stdset="1"> | ||
62 | <name>wordWrap</name> | ||
63 | <enum>WidgetWidth</enum> | ||
64 | </property> | ||
65 | </widget> | 61 | </widget> |
66 | </vbox> | 62 | </vbox> |
67 | </widget> | 63 | </widget> |
64 | <customwidgets> | ||
65 | <customwidget> | ||
66 | <class>ONoteEdit</class> | ||
67 | <header location="local">onoteedit.h</header> | ||
68 | <sizehint> | ||
69 | <width>-1</width> | ||
70 | <height>-1</height> | ||
71 | </sizehint> | ||
72 | <container>0</container> | ||
73 | <sizepolicy> | ||
74 | <hordata>7</hordata> | ||
75 | <verdata>7</verdata> | ||
76 | </sizepolicy> | ||
77 | <pixmap>image0</pixmap> | ||
78 | </customwidget> | ||
79 | </customwidgets> | ||
80 | <images> | ||
81 | <image> | ||
82 | <name>image0</name> | ||
83 | <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1ddec44f503c0ae2a154410f53d0ed20e2bf6bdb656dd6861dd23d9a66591b0587fd1654235ebded6f0edcd53e419d87ae7b1f4f9b8f906d0bfe012317426a70b07bdc2f3ec77f8ed6b89559061a0343d06a124cc105596482585094bc0ae599b04646c9018926491b2205e140c485cace25755c175d0a967b622ff900b8cc9c7d29af594ea722d589167f813aa852ba07d94b9dce296e883fe7bb163f23896753</data> | ||
84 | </image> | ||
85 | </images> | ||
68 | </UI> | 86 | </UI> |
diff --git a/core/pim/datebook/noteentryimpl.cpp b/core/pim/datebook/noteentryimpl.cpp index 9e1abb9..0e45985 100644 --- a/core/pim/datebook/noteentryimpl.cpp +++ b/core/pim/datebook/noteentryimpl.cpp | |||
@@ -1,16 +1,17 @@ | |||
1 | #include "noteentryimpl.h" | 1 | #include "noteentryimpl.h" |
2 | #include "qstring.h" | 2 | #include "qstring.h" |
3 | #include "qmultilinedit.h" | 3 | #include "qmultilinedit.h" |
4 | #include "qlabel.h" | 4 | #include "qlabel.h" |
5 | #include "onoteedit.h" | ||
5 | 6 | ||
6 | NoteEntry::NoteEntry(const QString &title, const QString ¬eStr, | 7 | NoteEntry::NoteEntry(const QString &title, const QString ¬eStr, |
7 | QWidget* parent, const char* name, bool modal, | 8 | QWidget* parent, const char* name, bool modal, |
8 | WFlags fl) : | 9 | WFlags fl) : |
9 | NoteEntryBase(parent, name, modal, fl) { | 10 | NoteEntryBase(parent, name, modal, fl) { |
10 | 11 | ||
11 | 12 | ||
12 | eventLabel->setText(title); | 13 | eventLabel->setText(title); |
13 | note->setText(noteStr); | 14 | note->setText(noteStr); |
14 | int l=note->length(); | 15 | int l=note->length(); |
15 | note->setCursorPosition(l,l,false); | 16 | note->setCursorPosition(l,l,false); |
16 | } | 17 | } |
diff --git a/core/pim/datebook/onoteedit.cpp b/core/pim/datebook/onoteedit.cpp new file mode 100644 index 0000000..d66ad86 --- a/dev/null +++ b/core/pim/datebook/onoteedit.cpp | |||
@@ -0,0 +1,19 @@ | |||
1 | #include "onoteedit.h" | ||
2 | |||
3 | ONoteEdit::ONoteEdit (QWidget * parent, const char * name) : | ||
4 | QMultiLineEdit(parent,name) { | ||
5 | setDefaultTabStop(2); | ||
6 | setWordWrap(WidgetWidth); | ||
7 | } | ||
8 | |||
9 | // Copy indentation from previous line | ||
10 | void ONoteEdit::newLine() { | ||
11 | int l,c; | ||
12 | getCursorPosition(&l,&c); | ||
13 | QString s=textLine(l); | ||
14 | |||
15 | insert("\n"); | ||
16 | |||
17 | int i=0; | ||
18 | while (s[i]==' ' || s[i]=='\t') insert(QString(s[i])), i++; | ||
19 | } | ||
diff --git a/core/pim/datebook/onoteedit.h b/core/pim/datebook/onoteedit.h new file mode 100644 index 0000000..2f71d0d --- a/dev/null +++ b/core/pim/datebook/onoteedit.h | |||
@@ -0,0 +1,19 @@ | |||
1 | #ifndef ONOTEEDIT_H | ||
2 | #define ONOTEEDIT_H | ||
3 | |||
4 | #include <qmultilineedit.h> | ||
5 | |||
6 | class ONoteEdit: public QMultiLineEdit { | ||
7 | |||
8 | Q_OBJECT | ||
9 | |||
10 | public: | ||
11 | |||
12 | ONoteEdit (QWidget * parent=0, const char * name=0); | ||
13 | |||
14 | protected: | ||
15 | |||
16 | virtual void newLine (); | ||
17 | }; | ||
18 | |||
19 | #endif | ||