author | dwmw2 <dwmw2> | 2002-04-02 14:02:44 (UTC) |
---|---|---|
committer | dwmw2 <dwmw2> | 2002-04-02 14:02:44 (UTC) |
commit | 108f15e0121aca57d5828cf0f22285989d920bd7 (patch) (unidiff) | |
tree | 253c9bca48bb864b02428c72d4baf2d085579d9c | |
parent | 623ce8225b7f75755146601e2c8d7f1e7e9a65d0 (diff) | |
download | opie-108f15e0121aca57d5828cf0f22285989d920bd7.zip opie-108f15e0121aca57d5828cf0f22285989d920bd7.tar.gz opie-108f15e0121aca57d5828cf0f22285989d920bd7.tar.bz2 |
Remove #include <stdiostream.h>. It wasn't used, and isn't present in my gcc3
-rw-r--r-- | core/pim/datebook/dateentryimpl.cpp | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/core/pim/datebook/dateentryimpl.cpp b/core/pim/datebook/dateentryimpl.cpp index e563db0..403378e 100644 --- a/core/pim/datebook/dateentryimpl.cpp +++ b/core/pim/datebook/dateentryimpl.cpp | |||
@@ -1,239 +1,237 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include "dateentryimpl.h" | 21 | #include "dateentryimpl.h" |
22 | #include "repeatentry.h" | 22 | #include "repeatentry.h" |
23 | 23 | ||
24 | #include <qpe/qpeapplication.h> | 24 | #include <qpe/qpeapplication.h> |
25 | #include <qpe/categoryselect.h> | 25 | #include <qpe/categoryselect.h> |
26 | #include <qpe/datebookmonth.h> | 26 | #include <qpe/datebookmonth.h> |
27 | #include <qpe/global.h> | 27 | #include <qpe/global.h> |
28 | #include <qpe/timeconversion.h> | 28 | #include <qpe/timeconversion.h> |
29 | #include <qpe/timestring.h> | 29 | #include <qpe/timestring.h> |
30 | #include <qpe/tzselect.h> | 30 | #include <qpe/tzselect.h> |
31 | 31 | ||
32 | #include <qcheckbox.h> | 32 | #include <qcheckbox.h> |
33 | #include <qcombobox.h> | 33 | #include <qcombobox.h> |
34 | #include <qlayout.h> | 34 | #include <qlayout.h> |
35 | #include <qlineedit.h> | 35 | #include <qlineedit.h> |
36 | #include <qmultilineedit.h> | 36 | #include <qmultilineedit.h> |
37 | #include <qpopupmenu.h> | 37 | #include <qpopupmenu.h> |
38 | #include <qscrollview.h> | 38 | #include <qscrollview.h> |
39 | #include <qspinbox.h> | 39 | #include <qspinbox.h> |
40 | #include <qtoolbutton.h> | 40 | #include <qtoolbutton.h> |
41 | 41 | ||
42 | #include "timepicker.h" | 42 | #include "timepicker.h" |
43 | 43 | ||
44 | #include <stdlib.h> | 44 | #include <stdlib.h> |
45 | 45 | ||
46 | #include <stdiostream.h> | ||
47 | |||
48 | /* | 46 | /* |
49 | * Constructs a DateEntry which is a child of 'parent', with the | 47 | * Constructs a DateEntry which is a child of 'parent', with the |
50 | * name 'name' and widget flags set to 'f' | 48 | * name 'name' and widget flags set to 'f' |
51 | * | 49 | * |
52 | * The dialog will by default be modeless, unless you set 'modal' to | 50 | * The dialog will by default be modeless, unless you set 'modal' to |
53 | * TRUE to construct a modal dialog. | 51 | * TRUE to construct a modal dialog. |
54 | */ | 52 | */ |
55 | 53 | ||
56 | DateEntry::DateEntry( bool startOnMonday, const QDateTime &start, | 54 | DateEntry::DateEntry( bool startOnMonday, const QDateTime &start, |
57 | const QDateTime &end, bool whichClock, QWidget* parent, | 55 | const QDateTime &end, bool whichClock, QWidget* parent, |
58 | const char* name ) | 56 | const char* name ) |
59 | : DateEntryBase( parent, name ), | 57 | : DateEntryBase( parent, name ), |
60 | ampm( whichClock ), | 58 | ampm( whichClock ), |
61 | startWeekOnMonday( startOnMonday ) | 59 | startWeekOnMonday( startOnMonday ) |
62 | { | 60 | { |
63 | init(); | 61 | init(); |
64 | setDates(start,end); | 62 | setDates(start,end); |
65 | setFocusProxy(comboDescription); | 63 | setFocusProxy(comboDescription); |
66 | } | 64 | } |
67 | 65 | ||
68 | static void addOrPick( QComboBox* combo, const QString& t ) | 66 | static void addOrPick( QComboBox* combo, const QString& t ) |
69 | { | 67 | { |
70 | // Pick an item if one excists | 68 | // Pick an item if one excists |
71 | for (int i=0; i<combo->count(); i++) { | 69 | for (int i=0; i<combo->count(); i++) { |
72 | if ( combo->text(i) == t ) { | 70 | if ( combo->text(i) == t ) { |
73 | combo->setCurrentItem(i); | 71 | combo->setCurrentItem(i); |
74 | return; | 72 | return; |
75 | } | 73 | } |
76 | } | 74 | } |
77 | 75 | ||
78 | // Else add one | 76 | // Else add one |
79 | combo->insertItem(t); | 77 | combo->insertItem(t); |
80 | combo->setCurrentItem(combo->count()-1); | 78 | combo->setCurrentItem(combo->count()-1); |
81 | } | 79 | } |
82 | 80 | ||
83 | DateEntry::DateEntry( bool startOnMonday, const Event &event, bool whichClock, | 81 | DateEntry::DateEntry( bool startOnMonday, const Event &event, bool whichClock, |
84 | QWidget* parent, const char* name ) | 82 | QWidget* parent, const char* name ) |
85 | : DateEntryBase( parent, name ), | 83 | : DateEntryBase( parent, name ), |
86 | ampm( whichClock ), | 84 | ampm( whichClock ), |
87 | startWeekOnMonday( startOnMonday ) | 85 | startWeekOnMonday( startOnMonday ) |
88 | { | 86 | { |
89 | init(); | 87 | init(); |
90 | setDates(event.start(),event.end()); | 88 | setDates(event.start(),event.end()); |
91 | comboCategory->setCategories( event.categories(), "Calendar", tr("Calendar") ); | 89 | comboCategory->setCategories( event.categories(), "Calendar", tr("Calendar") ); |
92 | if(!event.description().isEmpty()) | 90 | if(!event.description().isEmpty()) |
93 | addOrPick( comboDescription, event.description() ); | 91 | addOrPick( comboDescription, event.description() ); |
94 | if(!event.location().isEmpty()) | 92 | if(!event.location().isEmpty()) |
95 | addOrPick( comboLocation, event.location() ); | 93 | addOrPick( comboLocation, event.location() ); |
96 | checkAlarm->setChecked( event.hasAlarm() ); | 94 | checkAlarm->setChecked( event.hasAlarm() ); |
97 | checkAllDay->setChecked( event.type() == Event::AllDay ); | 95 | checkAllDay->setChecked( event.type() == Event::AllDay ); |
98 | if(!event.notes().isEmpty()) | 96 | if(!event.notes().isEmpty()) |
99 | editNote->setText(event.notes()); | 97 | editNote->setText(event.notes()); |
100 | spinAlarm->setValue(event.alarmTime()); | 98 | spinAlarm->setValue(event.alarmTime()); |
101 | if ( event.alarmSound() != Event::Silent ) | 99 | if ( event.alarmSound() != Event::Silent ) |
102 | comboSound->setCurrentItem( 1 ); | 100 | comboSound->setCurrentItem( 1 ); |
103 | if ( event.hasRepeat() ) { | 101 | if ( event.hasRepeat() ) { |
104 | rp = event.repeatPattern(); | 102 | rp = event.repeatPattern(); |
105 | cmdRepeat->setText( tr("Repeat...") ); | 103 | cmdRepeat->setText( tr("Repeat...") ); |
106 | } | 104 | } |
107 | setRepeatLabel(); | 105 | setRepeatLabel(); |
108 | } | 106 | } |
109 | 107 | ||
110 | void DateEntry::setDates( const QDateTime& s, const QDateTime& e ) | 108 | void DateEntry::setDates( const QDateTime& s, const QDateTime& e ) |
111 | { | 109 | { |
112 | startDate = s.date(); | 110 | startDate = s.date(); |
113 | endDate = e.date(); | 111 | endDate = e.date(); |
114 | startTime = s.time(); | 112 | startTime = s.time(); |
115 | endTime = e.time(); | 113 | endTime = e.time(); |
116 | 114 | ||
117 | startDateChanged( s.date().year(), s.date().month(), s.date().day() ); | 115 | startDateChanged( s.date().year(), s.date().month(), s.date().day() ); |
118 | endDateChanged( e.date().year(), e.date().month(), e.date().day() ); | 116 | endDateChanged( e.date().year(), e.date().month(), e.date().day() ); |
119 | 117 | ||
120 | updateTimeEdit(true,true); | 118 | updateTimeEdit(true,true); |
121 | } | 119 | } |
122 | 120 | ||
123 | void DateEntry::updateTimeEdit(bool s, bool e) { | 121 | void DateEntry::updateTimeEdit(bool s, bool e) { |
124 | 122 | ||
125 | // Comboboxes | 123 | // Comboboxes |
126 | QString strStart, strEnd; | 124 | QString strStart, strEnd; |
127 | int shour, ehour; | 125 | int shour, ehour; |
128 | if ( ampm ) { | 126 | if ( ampm ) { |
129 | shour = startTime.hour(); | 127 | shour = startTime.hour(); |
130 | ehour = endTime.hour(); | 128 | ehour = endTime.hour(); |
131 | if ( shour >= 12 ) { | 129 | if ( shour >= 12 ) { |
132 | if ( shour > 12 ) | 130 | if ( shour > 12 ) |
133 | shour -= 12; | 131 | shour -= 12; |
134 | strStart.sprintf( "%d:%02d PM", shour, startTime.minute() ); | 132 | strStart.sprintf( "%d:%02d PM", shour, startTime.minute() ); |
135 | } else { | 133 | } else { |
136 | if ( shour == 0 ) | 134 | if ( shour == 0 ) |
137 | shour = 12; | 135 | shour = 12; |
138 | strStart.sprintf( "%d:%02d AM", shour, startTime.minute() ); | 136 | strStart.sprintf( "%d:%02d AM", shour, startTime.minute() ); |
139 | } | 137 | } |
140 | if ( ehour == 24 && endTime.minute() == 0 ) { | 138 | if ( ehour == 24 && endTime.minute() == 0 ) { |
141 | strEnd = "11:59 PM"; // or "midnight" | 139 | strEnd = "11:59 PM"; // or "midnight" |
142 | } else if ( ehour >= 12 ) { | 140 | } else if ( ehour >= 12 ) { |
143 | if ( ehour > 12 ) | 141 | if ( ehour > 12 ) |
144 | ehour -= 12; | 142 | ehour -= 12; |
145 | strEnd.sprintf( "%d:%02d PM", ehour, endTime.minute() ); | 143 | strEnd.sprintf( "%d:%02d PM", ehour, endTime.minute() ); |
146 | } else { | 144 | } else { |
147 | if ( ehour == 0 ) | 145 | if ( ehour == 0 ) |
148 | ehour = 12; | 146 | ehour = 12; |
149 | strEnd.sprintf( "%d:%02d AM", ehour, endTime.minute() ); | 147 | strEnd.sprintf( "%d:%02d AM", ehour, endTime.minute() ); |
150 | } | 148 | } |
151 | } else { | 149 | } else { |
152 | strStart.sprintf( "%02d:%02d", startTime.hour(), startTime.minute() ); | 150 | strStart.sprintf( "%02d:%02d", startTime.hour(), startTime.minute() ); |
153 | strEnd.sprintf( "%02d:%02d", endTime.hour(), endTime.minute() ); | 151 | strEnd.sprintf( "%02d:%02d", endTime.hour(), endTime.minute() ); |
154 | } | 152 | } |
155 | 153 | ||
156 | if (s) comboStart->setText(strStart); | 154 | if (s) comboStart->setText(strStart); |
157 | if (e) comboEnd->setText(strEnd); | 155 | if (e) comboEnd->setText(strEnd); |
158 | } | 156 | } |
159 | 157 | ||
160 | void DateEntry::init() | 158 | void DateEntry::init() |
161 | { | 159 | { |
162 | comboDescription->setInsertionPolicy(QComboBox::AtCurrent); | 160 | comboDescription->setInsertionPolicy(QComboBox::AtCurrent); |
163 | comboLocation->setInsertionPolicy(QComboBox::AtCurrent); | 161 | comboLocation->setInsertionPolicy(QComboBox::AtCurrent); |
164 | 162 | ||
165 | initCombos(); | 163 | initCombos(); |
166 | QPopupMenu *m1 = new QPopupMenu( this ); | 164 | QPopupMenu *m1 = new QPopupMenu( this ); |
167 | startPicker = new DateBookMonth( m1, 0, TRUE ); | 165 | startPicker = new DateBookMonth( m1, 0, TRUE ); |
168 | m1->insertItem( startPicker ); | 166 | m1->insertItem( startPicker ); |
169 | buttonStart->setPopup( m1 ); | 167 | buttonStart->setPopup( m1 ); |
170 | connect( startPicker, SIGNAL( dateClicked( int, int, int ) ), | 168 | connect( startPicker, SIGNAL( dateClicked( int, int, int ) ), |
171 | this, SLOT( startDateChanged( int, int, int ) ) ); | 169 | this, SLOT( startDateChanged( int, int, int ) ) ); |
172 | 170 | ||
173 | //Let start button change both start and end dates | 171 | //Let start button change both start and end dates |
174 | connect( startPicker, SIGNAL( dateClicked( int, int, int ) ), | 172 | connect( startPicker, SIGNAL( dateClicked( int, int, int ) ), |
175 | this, SLOT( endDateChanged( int, int, int ) ) ); | 173 | this, SLOT( endDateChanged( int, int, int ) ) ); |
176 | connect( qApp, SIGNAL( clockChanged( bool ) ), | 174 | connect( qApp, SIGNAL( clockChanged( bool ) ), |
177 | this, SLOT( slotChangeClock( bool ) ) ); | 175 | this, SLOT( slotChangeClock( bool ) ) ); |
178 | connect( qApp, SIGNAL(weekChanged(bool)), | 176 | connect( qApp, SIGNAL(weekChanged(bool)), |
179 | this, SLOT(slotChangeStartOfWeek(bool)) ); | 177 | this, SLOT(slotChangeStartOfWeek(bool)) ); |
180 | 178 | ||
181 | QPopupMenu *m2 = new QPopupMenu( this ); | 179 | QPopupMenu *m2 = new QPopupMenu( this ); |
182 | endPicker = new DateBookMonth( m2, 0, TRUE ); | 180 | endPicker = new DateBookMonth( m2, 0, TRUE ); |
183 | m2->insertItem( endPicker ); | 181 | m2->insertItem( endPicker ); |
184 | buttonEnd->setPopup( m2 ); | 182 | buttonEnd->setPopup( m2 ); |
185 | connect( endPicker, SIGNAL( dateClicked( int, int, int ) ), | 183 | connect( endPicker, SIGNAL( dateClicked( int, int, int ) ), |
186 | this, SLOT( endDateChanged( int, int, int ) ) ); | 184 | this, SLOT( endDateChanged( int, int, int ) ) ); |
187 | 185 | ||
188 | connect(timePickerStart, SIGNAL( timeChanged(const QTime &) ), | 186 | connect(timePickerStart, SIGNAL( timeChanged(const QTime &) ), |
189 | this, SLOT( startTimePicked(const QTime &) )); | 187 | this, SLOT( startTimePicked(const QTime &) )); |
190 | editNote->setFixedVisibleLines(3); | 188 | editNote->setFixedVisibleLines(3); |
191 | } | 189 | } |
192 | 190 | ||
193 | /* | 191 | /* |
194 | * Destroys the object and frees any allocated resources | 192 | * Destroys the object and frees any allocated resources |
195 | */ | 193 | */ |
196 | DateEntry::~DateEntry() | 194 | DateEntry::~DateEntry() |
197 | { | 195 | { |
198 | // no need to delete child widgets, Qt does it all for us | 196 | // no need to delete child widgets, Qt does it all for us |
199 | //cout << "Del: " << comboStart->currentText() << endl; | 197 | //cout << "Del: " << comboStart->currentText() << endl; |
200 | } | 198 | } |
201 | 199 | ||
202 | /* | 200 | /* |
203 | * public slot | 201 | * public slot |
204 | */ | 202 | */ |
205 | void DateEntry::endDateChanged( int y, int m, int d ) | 203 | void DateEntry::endDateChanged( int y, int m, int d ) |
206 | { | 204 | { |
207 | endDate.setYMD( y, m, d ); | 205 | endDate.setYMD( y, m, d ); |
208 | if ( endDate < startDate ) { | 206 | if ( endDate < startDate ) { |
209 | endDate = startDate; | 207 | endDate = startDate; |
210 | } | 208 | } |
211 | 209 | ||
212 | buttonEnd->setText( TimeString::shortDate( endDate ) ); | 210 | buttonEnd->setText( TimeString::shortDate( endDate ) ); |
213 | 211 | ||
214 | endPicker->setDate( endDate.year(), endDate.month(), endDate.day() ); | 212 | endPicker->setDate( endDate.year(), endDate.month(), endDate.day() ); |
215 | } | 213 | } |
216 | 214 | ||
217 | static QTime parseTime( const QString& s, bool ampm ) | 215 | static QTime parseTime( const QString& s, bool ampm ) |
218 | { | 216 | { |
219 | QTime tmpTime; | 217 | QTime tmpTime; |
220 | QStringList l = QStringList::split( ':', s ); | 218 | QStringList l = QStringList::split( ':', s ); |
221 | int hour = l[0].toInt(); | 219 | int hour = l[0].toInt(); |
222 | if ( ampm ) { | 220 | if ( ampm ) { |
223 | int i=0; | 221 | int i=0; |
224 | while (i<int(l[1].length()) && l[1][i]>='0' && l[1][i]<='9') | 222 | while (i<int(l[1].length()) && l[1][i]>='0' && l[1][i]<='9') |
225 | i++; | 223 | i++; |
226 | QString digits = l[1].left(i); | 224 | QString digits = l[1].left(i); |
227 | if ( l[1].contains( "PM", FALSE ) ) { | 225 | if ( l[1].contains( "PM", FALSE ) ) { |
228 | if ( hour != 12 ) | 226 | if ( hour != 12 ) |
229 | hour += 12; | 227 | hour += 12; |
230 | } else { | 228 | } else { |
231 | if ( hour == 12 ) | 229 | if ( hour == 12 ) |
232 | hour = 0; | 230 | hour = 0; |
233 | } | 231 | } |
234 | l[1] = digits; | 232 | l[1] = digits; |
235 | } | 233 | } |
236 | int minute = l[1].toInt(); | 234 | int minute = l[1].toInt(); |
237 | if ( minute > 59 ) | 235 | if ( minute > 59 ) |
238 | minute = 59; | 236 | minute = 59; |
239 | else if ( minute < 0 ) | 237 | else if ( minute < 0 ) |