-rw-r--r-- | korganizer/datenavigator.cpp | 15 | ||||
-rw-r--r-- | korganizer/datenavigator.h | 3 | ||||
-rw-r--r-- | korganizer/komonthview.cpp | 8 | ||||
-rw-r--r-- | korganizer/komonthview.h | 3 | ||||
-rw-r--r-- | korganizer/koprefs.cpp | 1 | ||||
-rw-r--r-- | korganizer/koprefs.h | 1 | ||||
-rw-r--r-- | korganizer/koviewmanager.cpp | 62 | ||||
-rw-r--r-- | korganizer/koviewmanager.h | 2 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 12 | ||||
-rw-r--r-- | korganizer/navigatorbar.cpp | 26 | ||||
-rw-r--r-- | korganizer/navigatorbar.h | 4 |
11 files changed, 120 insertions, 17 deletions
diff --git a/korganizer/datenavigator.cpp b/korganizer/datenavigator.cpp index 8b7c993..b0eac51 100644 --- a/korganizer/datenavigator.cpp +++ b/korganizer/datenavigator.cpp | |||
@@ -1,300 +1,315 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include "datenavigator.h" | 24 | #include "datenavigator.h" |
25 | 25 | ||
26 | #include "koglobals.h" | 26 | #include "koglobals.h" |
27 | 27 | ||
28 | #include <kcalendarsystem.h> | 28 | #include <kcalendarsystem.h> |
29 | 29 | ||
30 | #include <kdebug.h> | 30 | #include <kdebug.h> |
31 | #include <kglobal.h> | 31 | #include <kglobal.h> |
32 | #include <klocale.h> | 32 | #include <klocale.h> |
33 | 33 | ||
34 | using namespace KCal; | 34 | using namespace KCal; |
35 | 35 | ||
36 | DateNavigator::DateNavigator( QObject *parent, const char *name , KOViewManager * v) | 36 | DateNavigator::DateNavigator( QObject *parent, const char *name , KOViewManager * v) |
37 | : QObject( parent, name ) | 37 | : QObject( parent, name ) |
38 | { | 38 | { |
39 | mViewManager = v; | 39 | mViewManager = v; |
40 | mSelectedDates.append( QDate::currentDate() ); | 40 | mSelectedDates.append( QDate::currentDate() ); |
41 | } | 41 | } |
42 | 42 | ||
43 | DateNavigator::~DateNavigator() | 43 | DateNavigator::~DateNavigator() |
44 | { | 44 | { |
45 | } | 45 | } |
46 | 46 | ||
47 | void DateNavigator::slotMonthSelect( int m ) | 47 | void DateNavigator::slotMonthSelect( int m ) |
48 | { | 48 | { |
49 | QDate firstSelected = mSelectedDates.first(); | 49 | QDate firstSelected = mSelectedDates.first(); |
50 | int weekDay = firstSelected.dayOfWeek(); | 50 | int weekDay = firstSelected.dayOfWeek(); |
51 | int diff = m - firstSelected.month() ; | 51 | int diff = m - firstSelected.month() ; |
52 | firstSelected = KOGlobals::self()->calendarSystem()->addMonths( firstSelected, diff ); | 52 | firstSelected = KOGlobals::self()->calendarSystem()->addMonths( firstSelected, diff ); |
53 | 53 | ||
54 | if ( mSelectedDates.first().day() == 1 && mSelectedDates.count() > 27 ) | 54 | if ( mSelectedDates.first().day() == 1 && mSelectedDates.count() > 27 ) |
55 | selectMonthByDate( firstSelected ); | 55 | selectMonthByDate( firstSelected ); |
56 | else | 56 | else |
57 | selectWeekByDay( weekDay, firstSelected ); | 57 | selectWeekByDay( weekDay, firstSelected ); |
58 | 58 | ||
59 | } | 59 | } |
60 | 60 | ||
61 | void DateNavigator::slotDaySelect( QDate d ) | 61 | void DateNavigator::slotDaySelect( QDate d ) |
62 | { | 62 | { |
63 | QDate firstSelected = mSelectedDates.first(); | 63 | QDate firstSelected = mSelectedDates.first(); |
64 | int weekDay = firstSelected.dayOfWeek(); | 64 | int weekDay = firstSelected.dayOfWeek(); |
65 | //int diff = firstSelected.daysTo( d ) ; | 65 | //int diff = firstSelected.daysTo( d ) ; |
66 | firstSelected = firstSelected.addDays( firstSelected .daysTo( d ) ); | 66 | firstSelected = firstSelected.addDays( firstSelected .daysTo( d ) ); |
67 | 67 | ||
68 | selectWeekByDay( weekDay, firstSelected ); | 68 | selectWeekByDay( weekDay, firstSelected ); |
69 | 69 | ||
70 | } | 70 | } |
71 | 71 | ||
72 | void DateNavigator::selectMonthByDate( const QDate & firstSelected ) | 72 | void DateNavigator::selectMonthByDate( const QDate & firstSelected ) |
73 | { | 73 | { |
74 | 74 | ||
75 | int monthDay = firstSelected.day(); | 75 | int monthDay = firstSelected.day(); |
76 | QDate date = firstSelected.addDays( 1-monthDay ); | 76 | QDate date = firstSelected.addDays( 1-monthDay ); |
77 | selectDates( date , date.daysInMonth ()); | 77 | selectDates( date , date.daysInMonth ()); |
78 | 78 | ||
79 | } | 79 | } |
80 | void DateNavigator::selectMonth() | 80 | void DateNavigator::selectMonth() |
81 | { | 81 | { |
82 | 82 | ||
83 | QDate date =mSelectedDates.first(); | 83 | QDate date =mSelectedDates.first(); |
84 | selectMonthByDate( date ); | 84 | selectMonthByDate( date ); |
85 | } | 85 | } |
86 | void DateNavigator::selectMonthFromMonthview() | ||
87 | { | ||
88 | |||
89 | QDate date =mSelectedDates.first().addDays( 7 ); | ||
90 | selectMonthByDate( date ); | ||
91 | } | ||
86 | 92 | ||
87 | DateList DateNavigator::selectedDates() | 93 | DateList DateNavigator::selectedDates() |
88 | { | 94 | { |
89 | return mSelectedDates; | 95 | return mSelectedDates; |
90 | } | 96 | } |
91 | 97 | ||
92 | int DateNavigator::datesCount() const | 98 | int DateNavigator::datesCount() const |
93 | { | 99 | { |
94 | return mSelectedDates.count(); | 100 | return mSelectedDates.count(); |
95 | } | 101 | } |
96 | 102 | ||
97 | void DateNavigator::selectDates( const DateList& dateList ) | 103 | void DateNavigator::selectDates( const DateList& dateList ) |
98 | { | 104 | { |
99 | if (dateList.count() > 0) { | 105 | if (dateList.count() > 0) { |
100 | mSelectedDates = dateList; | 106 | mSelectedDates = dateList; |
101 | emitSelected(); | 107 | emitSelected(); |
102 | } | 108 | } |
103 | } | 109 | } |
104 | 110 | ||
105 | void DateNavigator::selectDate( const QDate &date ) | 111 | void DateNavigator::selectDate( const QDate &date ) |
106 | { | 112 | { |
107 | QDate d = date; | 113 | QDate d = date; |
108 | 114 | ||
109 | if ( !d.isValid() ) { | 115 | if ( !d.isValid() ) { |
110 | d = QDate::currentDate(); | 116 | d = QDate::currentDate(); |
111 | } | 117 | } |
112 | 118 | ||
113 | mSelectedDates.clear(); | 119 | mSelectedDates.clear(); |
114 | mSelectedDates.append( d ); | 120 | mSelectedDates.append( d ); |
115 | 121 | ||
116 | emitSelected(); | 122 | emitSelected(); |
117 | } | 123 | } |
118 | 124 | ||
119 | void DateNavigator::selectDates( int count ) | 125 | void DateNavigator::selectDates( int count ) |
120 | { | 126 | { |
121 | 127 | ||
122 | QDate d = mSelectedDates.first(); | 128 | QDate d = mSelectedDates.first(); |
123 | selectDates( d, count ); | 129 | selectDates( d, count ); |
124 | } | 130 | } |
125 | 131 | ||
126 | void DateNavigator::selectDates( const QDate &d, int count ) | 132 | void DateNavigator::selectDates( const QDate &d, int count ) |
127 | { | 133 | { |
128 | DateList dates; | 134 | DateList dates; |
129 | 135 | ||
130 | int i; | 136 | int i; |
131 | for( i = 0; i < count; ++i ) { | 137 | for( i = 0; i < count; ++i ) { |
132 | dates.append( d.addDays( i ) ); | 138 | dates.append( d.addDays( i ) ); |
133 | } | 139 | } |
134 | 140 | ||
135 | mSelectedDates = dates; | 141 | mSelectedDates = dates; |
136 | 142 | ||
137 | emitSelected(); | 143 | emitSelected(); |
138 | } | 144 | } |
139 | 145 | ||
140 | void DateNavigator::selectWeekByDay( int weekDay, const QDate &d ) | 146 | void DateNavigator::selectWeekByDay( int weekDay, const QDate &d ) |
141 | { | 147 | { |
142 | // qDebug("selectWeekByDay( %d %s ", weekDay, d.toString().latin1()); | 148 | // qDebug("selectWeekByDay( %d %s ", weekDay, d.toString().latin1()); |
143 | int dateCount = mSelectedDates.count(); | 149 | int dateCount = mSelectedDates.count(); |
144 | bool weekStart = ( weekDay == KGlobal::locale()->weekStartDay() ); | 150 | bool weekStart = ( weekDay == KGlobal::locale()->weekStartDay() ); |
145 | if ( weekDay == 1 && dateCount == 5 ) selectWorkWeek( d ); | 151 | if ( weekDay == 1 && dateCount == 5 ) selectWorkWeek( d ); |
146 | else if ( weekStart && dateCount == 7 ) selectWeek( d ); | 152 | else if ( weekStart && dateCount == 7 ) selectWeek( d ); |
147 | else selectDates( d, dateCount ); | 153 | else selectDates( d, dateCount ); |
148 | } | 154 | } |
149 | 155 | ||
150 | void DateNavigator::selectWeek() | 156 | void DateNavigator::selectWeek() |
151 | { | 157 | { |
152 | QDate d = mSelectedDates.first(); | 158 | QDate d = mSelectedDates.first(); |
153 | selectWeek( d ); | 159 | selectWeek( d ); |
154 | } | 160 | } |
155 | void DateNavigator::selectWeek( int num ) | 161 | void DateNavigator::selectWeek( int num ) |
156 | { | 162 | { |
157 | int year = mSelectedDates.first().year(); | 163 | int year = mSelectedDates.first().year(); |
158 | QDate d = QDate ( year, 1,1); | 164 | QDate d = QDate ( year, 1,1); |
159 | while ( d.dayOfWeek() != 4 ) | 165 | while ( d.dayOfWeek() != 4 ) |
160 | d = d.addDays( 1 ); | 166 | d = d.addDays( 1 ); |
161 | selectWeek( d.addDays ( (num-1) *7 ) ); | 167 | selectWeek( d.addDays ( (num-1) *7 ) ); |
162 | } | 168 | } |
163 | void DateNavigator::selectWeekFromMonthView( int num ) | 169 | void DateNavigator::selectWeekFromMonthView( int num ) |
164 | { | 170 | { |
165 | int year = mSelectedDates.first().year(); | 171 | int year = mSelectedDates.first().year(); |
166 | if ( mSelectedDates.first().dayOfYear() > 300 && num < 10 ) | 172 | if ( mSelectedDates.first().dayOfYear() > 300 && num < 10 ) |
167 | ++year; | 173 | ++year; |
168 | if ( mSelectedDates.first().dayOfYear() < 70 && num > 40 ) | 174 | if ( mSelectedDates.first().dayOfYear() < 70 && num > 40 ) |
169 | --year; | 175 | --year; |
170 | QDate d = QDate ( year, 1,1); | 176 | QDate d = QDate ( year, 1,1); |
171 | while ( d.dayOfWeek() != 4 ) | 177 | while ( d.dayOfWeek() != 4 ) |
172 | d = d.addDays( 1 ); | 178 | d = d.addDays( 1 ); |
173 | selectWeek( d.addDays ( (num-1) *7 ) ); | 179 | selectWeek( d.addDays ( (num-1) *7 ) ); |
174 | } | 180 | } |
175 | void DateNavigator::selectWeek( const QDate &d ) | 181 | void DateNavigator::selectWeek( const QDate &d ) |
176 | { | 182 | { |
177 | int dayOfWeek = KOGlobals::self()->calendarSystem()->dayOfWeek( d ); | 183 | int dayOfWeek = KOGlobals::self()->calendarSystem()->dayOfWeek( d ); |
178 | 184 | ||
179 | int weekStart = KGlobal::locale()->weekStartDay(); | 185 | int weekStart = KGlobal::locale()->weekStartDay(); |
180 | QDate firstDate = d.addDays( weekStart - dayOfWeek ); | 186 | QDate firstDate = d.addDays( weekStart - dayOfWeek ); |
181 | 187 | ||
182 | if ( weekStart != 1 && dayOfWeek < weekStart ) { | 188 | if ( weekStart != 1 && dayOfWeek < weekStart ) { |
183 | firstDate = firstDate.addDays(-7 ); | 189 | firstDate = firstDate.addDays(-7 ); |
184 | } | 190 | } |
185 | 191 | ||
186 | 192 | ||
187 | selectDates( firstDate, 7 ); | 193 | selectDates( firstDate, 7 ); |
188 | } | 194 | } |
189 | 195 | ||
190 | void DateNavigator::selectWorkWeek() | 196 | void DateNavigator::selectWorkWeek() |
191 | { | 197 | { |
192 | QDate d = mSelectedDates.first(); | 198 | QDate d = mSelectedDates.first(); |
193 | selectWorkWeek( d ); | 199 | selectWorkWeek( d ); |
194 | } | 200 | } |
195 | 201 | ||
196 | void DateNavigator::selectWorkWeek( const QDate &d ) | 202 | void DateNavigator::selectWorkWeek( const QDate &d ) |
197 | { | 203 | { |
198 | int dayOfWeek = KOGlobals::self()->calendarSystem()->dayOfWeek( d ); | 204 | int dayOfWeek = KOGlobals::self()->calendarSystem()->dayOfWeek( d ); |
199 | 205 | ||
200 | QDate firstDate = d.addDays( 1 - dayOfWeek ); | 206 | QDate firstDate = d.addDays( 1 - dayOfWeek ); |
201 | 207 | ||
202 | int weekStart = KGlobal::locale()->weekStartDay(); | 208 | int weekStart = KGlobal::locale()->weekStartDay(); |
203 | if ( weekStart != 1 && dayOfWeek >= weekStart ) { | 209 | if ( weekStart != 1 && dayOfWeek >= weekStart ) { |
204 | firstDate = firstDate.addDays( 7 ); | 210 | firstDate = firstDate.addDays( 7 ); |
205 | } | 211 | } |
206 | 212 | ||
207 | selectDates( firstDate, 5 ); | 213 | selectDates( firstDate, 5 ); |
208 | } | 214 | } |
209 | 215 | ||
210 | void DateNavigator::selectTodayMonth() | 216 | void DateNavigator::selectTodayMonth() |
211 | { | 217 | { |
212 | QDate date = QDate::currentDate().addDays( 1-QDate::currentDate().day() ); | 218 | QDate date = QDate::currentDate().addDays( 1-QDate::currentDate().day() ); |
213 | selectDates( date , date.daysInMonth ()); | 219 | selectDates( date , date.daysInMonth ()); |
214 | 220 | ||
215 | } | 221 | } |
216 | void DateNavigator::selectToday() | 222 | void DateNavigator::selectToday() |
217 | { | 223 | { |
218 | QDate d = QDate::currentDate(); | 224 | QDate d = QDate::currentDate(); |
219 | 225 | ||
220 | int dateCount = mSelectedDates.count(); | 226 | int dateCount = mSelectedDates.count(); |
221 | if ( dateCount == 5 && d.dayOfWeek() < 6 ) selectWorkWeek( d ); | 227 | if ( dateCount == 5 && d.dayOfWeek() < 6 ) selectWorkWeek( d ); |
222 | else if ( dateCount == 7 ) selectWeek( d ); | 228 | else if ( dateCount == 7 ) selectWeek( d ); |
223 | else selectDates( d, dateCount ); | 229 | else selectDates( d, dateCount ); |
224 | } | 230 | } |
225 | 231 | ||
226 | void DateNavigator::selectPreviousYear() | 232 | void DateNavigator::selectPreviousYear() |
227 | { | 233 | { |
228 | QDate firstSelected = mSelectedDates.first(); | 234 | QDate firstSelected = mSelectedDates.first(); |
229 | int weekDay = firstSelected.dayOfWeek(); | 235 | int weekDay = firstSelected.dayOfWeek(); |
230 | firstSelected = KOGlobals::self()->calendarSystem()->addYears( firstSelected, -1 ); | 236 | firstSelected = KOGlobals::self()->calendarSystem()->addYears( firstSelected, -1 ); |
231 | 237 | ||
232 | selectWeekByDay( weekDay, firstSelected ); | 238 | selectWeekByDay( weekDay, firstSelected ); |
233 | } | 239 | } |
234 | 240 | ||
235 | void DateNavigator::selectPreviousMonth() | 241 | void DateNavigator::selectPreviousMonth() |
236 | { | 242 | { |
237 | QDate firstSelected = mSelectedDates.first(); | 243 | QDate firstSelected = mSelectedDates.first(); |
238 | int weekDay = firstSelected.dayOfWeek(); | 244 | int weekDay = firstSelected.dayOfWeek(); |
239 | firstSelected = KOGlobals::self()->calendarSystem()->addMonths( firstSelected, -1 ); | 245 | firstSelected = KOGlobals::self()->calendarSystem()->addMonths( firstSelected, -1 ); |
240 | 246 | ||
241 | 247 | ||
242 | if ( mSelectedDates.first().day() == 1 && mSelectedDates.count() > 27 ) | 248 | if ( mSelectedDates.first().day() == 1 && mSelectedDates.count() > 27 ) |
243 | selectMonthByDate( firstSelected ); | 249 | selectMonthByDate( firstSelected ); |
244 | else | 250 | else |
245 | selectWeekByDay( weekDay, firstSelected ); | 251 | selectWeekByDay( weekDay, firstSelected ); |
246 | } | 252 | } |
247 | 253 | ||
248 | void DateNavigator::selectNextMonth() | 254 | void DateNavigator::selectNextMonth() |
249 | { | 255 | { |
250 | QDate firstSelected = mSelectedDates.first(); | 256 | QDate firstSelected = mSelectedDates.first(); |
251 | int weekDay = firstSelected.dayOfWeek(); | 257 | int weekDay = firstSelected.dayOfWeek(); |
252 | 258 | ||
253 | firstSelected = KOGlobals::self()->calendarSystem()->addMonths( firstSelected, 1 ); | 259 | firstSelected = KOGlobals::self()->calendarSystem()->addMonths( firstSelected, 1 ); |
254 | 260 | ||
255 | if ( mSelectedDates.first().day() == 1 && mSelectedDates.count() > 27 ) | 261 | if ( mSelectedDates.first().day() == 1 && mSelectedDates.count() > 27 ) |
256 | selectMonthByDate( firstSelected ); | 262 | selectMonthByDate( firstSelected ); |
257 | else | 263 | else |
258 | selectWeekByDay( weekDay, firstSelected ); | 264 | selectWeekByDay( weekDay, firstSelected ); |
259 | 265 | ||
260 | } | 266 | } |
267 | void DateNavigator::selectPreviousWeek() | ||
268 | { | ||
269 | selectDates( mSelectedDates.first().addDays( -7 ), datesCount() ); | ||
270 | } | ||
271 | |||
272 | void DateNavigator::selectNextWeek() | ||
273 | { | ||
274 | selectDates( mSelectedDates.first().addDays( 7 ), datesCount() ); | ||
275 | } | ||
261 | 276 | ||
262 | void DateNavigator::selectNextYear() | 277 | void DateNavigator::selectNextYear() |
263 | { | 278 | { |
264 | QDate firstSelected = mSelectedDates.first(); | 279 | QDate firstSelected = mSelectedDates.first(); |
265 | int weekDay = firstSelected.dayOfWeek(); | 280 | int weekDay = firstSelected.dayOfWeek(); |
266 | firstSelected = KOGlobals::self()->calendarSystem()->addYears( firstSelected, 1 ); | 281 | firstSelected = KOGlobals::self()->calendarSystem()->addYears( firstSelected, 1 ); |
267 | 282 | ||
268 | selectWeekByDay( weekDay, firstSelected ); | 283 | selectWeekByDay( weekDay, firstSelected ); |
269 | } | 284 | } |
270 | 285 | ||
271 | void DateNavigator::selectPrevious() | 286 | void DateNavigator::selectPrevious() |
272 | { | 287 | { |
273 | int offset = -7; | 288 | int offset = -7; |
274 | if ( datesCount() == 1 ) { | 289 | if ( datesCount() == 1 ) { |
275 | offset = -1; | 290 | offset = -1; |
276 | } | 291 | } |
277 | if ( mViewManager ) | 292 | if ( mViewManager ) |
278 | if ( mViewManager->showsNextDays() ) | 293 | if ( mViewManager->showsNextDays() ) |
279 | offset = -datesCount(); | 294 | offset = -datesCount(); |
280 | selectDates( mSelectedDates.first().addDays( offset ), datesCount() ); | 295 | selectDates( mSelectedDates.first().addDays( offset ), datesCount() ); |
281 | } | 296 | } |
282 | 297 | ||
283 | void DateNavigator::selectNext() | 298 | void DateNavigator::selectNext() |
284 | { | 299 | { |
285 | int offset = 7; | 300 | int offset = 7; |
286 | if ( datesCount() == 1 ) { | 301 | if ( datesCount() == 1 ) { |
287 | offset = 1; | 302 | offset = 1; |
288 | } | 303 | } |
289 | if ( mViewManager ) | 304 | if ( mViewManager ) |
290 | if ( mViewManager->showsNextDays() ) | 305 | if ( mViewManager->showsNextDays() ) |
291 | offset = datesCount(); | 306 | offset = datesCount(); |
292 | selectDates( mSelectedDates.first().addDays( offset ), datesCount() ); | 307 | selectDates( mSelectedDates.first().addDays( offset ), datesCount() ); |
293 | } | 308 | } |
294 | 309 | ||
295 | void DateNavigator::emitSelected() | 310 | void DateNavigator::emitSelected() |
296 | { | 311 | { |
297 | emit datesSelected( mSelectedDates ); | 312 | emit datesSelected( mSelectedDates ); |
298 | } | 313 | } |
299 | 314 | ||
300 | //#include "datenavigator.moc" | 315 | //#include "datenavigator.moc" |
diff --git a/korganizer/datenavigator.h b/korganizer/datenavigator.h index 4265e84..9742d41 100644 --- a/korganizer/datenavigator.h +++ b/korganizer/datenavigator.h | |||
@@ -1,91 +1,94 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | #ifndef DATENAVIGATOR_H | 23 | #ifndef DATENAVIGATOR_H |
24 | #define DATENAVIGATOR_H | 24 | #define DATENAVIGATOR_H |
25 | 25 | ||
26 | #include <libkcal/incidencebase.h> | 26 | #include <libkcal/incidencebase.h> |
27 | 27 | ||
28 | #include <qobject.h> | 28 | #include <qobject.h> |
29 | #include "koviewmanager.h" | 29 | #include "koviewmanager.h" |
30 | 30 | ||
31 | /** | 31 | /** |
32 | This class controls date navigation. All requests to move the views to another | 32 | This class controls date navigation. All requests to move the views to another |
33 | date are sent to the DateNavigator. The DateNavigator processes the new | 33 | date are sent to the DateNavigator. The DateNavigator processes the new |
34 | selection of dates and emits the required signals for the views. | 34 | selection of dates and emits the required signals for the views. |
35 | */ | 35 | */ |
36 | class DateNavigator : public QObject | 36 | class DateNavigator : public QObject |
37 | { | 37 | { |
38 | Q_OBJECT | 38 | Q_OBJECT |
39 | public: | 39 | public: |
40 | DateNavigator( QObject *parent = 0, const char *name = 0 , KOViewManager * v = 0); | 40 | DateNavigator( QObject *parent = 0, const char *name = 0 , KOViewManager * v = 0); |
41 | ~DateNavigator(); | 41 | ~DateNavigator(); |
42 | 42 | ||
43 | KCal::DateList selectedDates(); | 43 | KCal::DateList selectedDates(); |
44 | 44 | ||
45 | int datesCount() const; | 45 | int datesCount() const; |
46 | 46 | ||
47 | public slots: | 47 | public slots: |
48 | void selectDates( const KCal::DateList & ); | 48 | void selectDates( const KCal::DateList & ); |
49 | void selectDate( const QDate & ); | 49 | void selectDate( const QDate & ); |
50 | 50 | ||
51 | void selectDates( int count ); | 51 | void selectDates( int count ); |
52 | void selectDates( const QDate &, int count ); | 52 | void selectDates( const QDate &, int count ); |
53 | 53 | ||
54 | void selectWeek(); | 54 | void selectWeek(); |
55 | void selectWeek( int weeknum ); | 55 | void selectWeek( int weeknum ); |
56 | void selectWeekFromMonthView( int weeknum ); | 56 | void selectWeekFromMonthView( int weeknum ); |
57 | void selectWeek( const QDate & ); | 57 | void selectWeek( const QDate & ); |
58 | 58 | ||
59 | void selectWorkWeek(); | 59 | void selectWorkWeek(); |
60 | void selectWorkWeek( const QDate & ); | 60 | void selectWorkWeek( const QDate & ); |
61 | 61 | ||
62 | void selectWeekByDay( int weekDay, const QDate & ); | 62 | void selectWeekByDay( int weekDay, const QDate & ); |
63 | 63 | ||
64 | void selectToday(); | 64 | void selectToday(); |
65 | void selectTodayMonth(); | 65 | void selectTodayMonth(); |
66 | 66 | ||
67 | void selectPreviousYear(); | 67 | void selectPreviousYear(); |
68 | void selectPreviousMonth(); | 68 | void selectPreviousMonth(); |
69 | void selectNextMonth(); | 69 | void selectNextMonth(); |
70 | void selectPreviousWeek(); | ||
71 | void selectNextWeek(); | ||
70 | void selectNextYear(); | 72 | void selectNextYear(); |
71 | 73 | ||
72 | void selectMonth(); | 74 | void selectMonth(); |
75 | void selectMonthFromMonthview(); | ||
73 | void selectMonthByDate( const QDate & ); | 76 | void selectMonthByDate( const QDate & ); |
74 | 77 | ||
75 | void selectPrevious(); | 78 | void selectPrevious(); |
76 | void selectNext(); | 79 | void selectNext(); |
77 | void slotMonthSelect( int ); | 80 | void slotMonthSelect( int ); |
78 | void slotDaySelect( QDate d ); | 81 | void slotDaySelect( QDate d ); |
79 | 82 | ||
80 | signals: | 83 | signals: |
81 | void datesSelected( const KCal::DateList & ); | 84 | void datesSelected( const KCal::DateList & ); |
82 | 85 | ||
83 | protected: | 86 | protected: |
84 | void emitSelected(); | 87 | void emitSelected(); |
85 | 88 | ||
86 | private: | 89 | private: |
87 | KOViewManager * mViewManager; | 90 | KOViewManager * mViewManager; |
88 | KCal::DateList mSelectedDates; | 91 | KCal::DateList mSelectedDates; |
89 | }; | 92 | }; |
90 | 93 | ||
91 | #endif | 94 | #endif |
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index d0380e3..f9bc1ca 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -1,1613 +1,1615 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include <qpopupmenu.h> | 20 | #include <qpopupmenu.h> |
21 | #include <qfont.h> | 21 | #include <qfont.h> |
22 | #include <qfontmetrics.h> | 22 | #include <qfontmetrics.h> |
23 | #include <qkeycode.h> | 23 | #include <qkeycode.h> |
24 | #include <qhbox.h> | 24 | #include <qhbox.h> |
25 | #include <qvbox.h> | 25 | #include <qvbox.h> |
26 | #include <qwidgetstack.h> | 26 | #include <qwidgetstack.h> |
27 | #include <qpushbutton.h> | 27 | #include <qpushbutton.h> |
28 | #include <qtooltip.h> | 28 | #include <qtooltip.h> |
29 | #include <qpainter.h> | 29 | #include <qpainter.h> |
30 | #include <qtimer.h> | 30 | #include <qtimer.h> |
31 | #include <qwhatsthis.h> | 31 | #include <qwhatsthis.h> |
32 | #ifndef DESKTOP_VERSION | 32 | #ifndef DESKTOP_VERSION |
33 | #include <qpe/qpeapplication.h> | 33 | #include <qpe/qpeapplication.h> |
34 | #else | 34 | #else |
35 | #include <qapplication.h> | 35 | #include <qapplication.h> |
36 | #endif | 36 | #endif |
37 | 37 | ||
38 | #include <kdebug.h> | 38 | #include <kdebug.h> |
39 | #include <klocale.h> | 39 | #include <klocale.h> |
40 | #include <kglobal.h> | 40 | #include <kglobal.h> |
41 | #include <kconfig.h> | 41 | #include <kconfig.h> |
42 | #include <kiconloader.h> | 42 | #include <kiconloader.h> |
43 | 43 | ||
44 | #include <kcalendarsystem.h> | 44 | #include <kcalendarsystem.h> |
45 | 45 | ||
46 | #ifndef KORG_NOPRINTER | 46 | #ifndef KORG_NOPRINTER |
47 | #include "calprinter.h" | 47 | #include "calprinter.h" |
48 | #endif | 48 | #endif |
49 | #include "koprefs.h" | 49 | #include "koprefs.h" |
50 | #ifndef KORG_NOPLUGINS | 50 | #ifndef KORG_NOPLUGINS |
51 | #include "kocore.h" | 51 | #include "kocore.h" |
52 | #endif | 52 | #endif |
53 | #include "koglobals.h" | 53 | #include "koglobals.h" |
54 | #include <libkcal/kincidenceformatter.h> | 54 | #include <libkcal/kincidenceformatter.h> |
55 | 55 | ||
56 | #include "komonthview.h" | 56 | #include "komonthview.h" |
57 | 57 | ||
58 | #define PIXMAP_SIZE 5 | 58 | #define PIXMAP_SIZE 5 |
59 | #ifdef DESKTOP_VERSION | 59 | #ifdef DESKTOP_VERSION |
60 | QToolTipGroup *MonthViewCell::mToolTipGroup = 0; | 60 | QToolTipGroup *MonthViewCell::mToolTipGroup = 0; |
61 | #endif | 61 | #endif |
62 | class KNOWhatsThis :public QWhatsThis | 62 | class KNOWhatsThis :public QWhatsThis |
63 | { | 63 | { |
64 | public: | 64 | public: |
65 | KNOWhatsThis( KNoScrollListBox* sbox ) : QWhatsThis( sbox ), _wid( sbox) { }; | 65 | KNOWhatsThis( KNoScrollListBox* sbox ) : QWhatsThis( sbox ), _wid( sbox) { }; |
66 | //~KNOWhatsThis( ) {qDebug("~KNOWhatsThis( ) "); }; | 66 | //~KNOWhatsThis( ) {qDebug("~KNOWhatsThis( ) "); }; |
67 | 67 | ||
68 | protected: | 68 | protected: |
69 | virtual QString text( const QPoint& p) | 69 | virtual QString text( const QPoint& p) |
70 | { | 70 | { |
71 | return _wid->getWhatsThisText(p) ; | 71 | return _wid->getWhatsThisText(p) ; |
72 | }; | 72 | }; |
73 | private: | 73 | private: |
74 | KNoScrollListBox* _wid; | 74 | KNoScrollListBox* _wid; |
75 | 75 | ||
76 | }; | 76 | }; |
77 | 77 | ||
78 | 78 | ||
79 | KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name) | 79 | KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name) |
80 | : QListBox(parent, name, WRepaintNoErase) | 80 | : QListBox(parent, name, WRepaintNoErase) |
81 | { | 81 | { |
82 | #ifndef DESKTOP_VERSION | 82 | #ifndef DESKTOP_VERSION |
83 | QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); | 83 | QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); |
84 | #endif | 84 | #endif |
85 | mWT = new KNOWhatsThis(this); | 85 | mWT = new KNOWhatsThis(this); |
86 | } | 86 | } |
87 | KNoScrollListBox::~KNoScrollListBox() | 87 | KNoScrollListBox::~KNoScrollListBox() |
88 | { | 88 | { |
89 | 89 | ||
90 | } | 90 | } |
91 | QString KNoScrollListBox::getWhatsThisText(QPoint p) | 91 | QString KNoScrollListBox::getWhatsThisText(QPoint p) |
92 | { | 92 | { |
93 | QListBoxItem* item = itemAt ( p ); | 93 | QListBoxItem* item = itemAt ( p ); |
94 | if ( ! item ) { | 94 | if ( ! item ) { |
95 | return i18n("Click in the cell\nto add an event!"); | 95 | return i18n("Click in the cell\nto add an event!"); |
96 | } | 96 | } |
97 | return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence()); | 97 | return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence()); |
98 | } | 98 | } |
99 | void KNoScrollListBox::keyPressEvent(QKeyEvent *e) | 99 | void KNoScrollListBox::keyPressEvent(QKeyEvent *e) |
100 | { | 100 | { |
101 | 101 | ||
102 | switch(e->key()) { | 102 | switch(e->key()) { |
103 | case Key_Right: | 103 | case Key_Right: |
104 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 104 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
105 | { | 105 | { |
106 | e->ignore(); | 106 | e->ignore(); |
107 | return; | 107 | return; |
108 | } | 108 | } |
109 | scrollBy(10,0); | 109 | scrollBy(10,0); |
110 | break; | 110 | break; |
111 | case Key_Left: | 111 | case Key_Left: |
112 | if (e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 112 | if (e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
113 | { | 113 | { |
114 | e->ignore(); | 114 | e->ignore(); |
115 | return; | 115 | return; |
116 | } | 116 | } |
117 | scrollBy(-10,0); | 117 | scrollBy(-10,0); |
118 | break; | 118 | break; |
119 | case Key_Up: | 119 | case Key_Up: |
120 | if( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { | 120 | if( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { |
121 | e->ignore(); | 121 | e->ignore(); |
122 | break; | 122 | break; |
123 | } | 123 | } |
124 | setCurrentItem((currentItem()+count()-1)%count()); | 124 | setCurrentItem((currentItem()+count()-1)%count()); |
125 | if(!itemVisible(currentItem())) { | 125 | if(!itemVisible(currentItem())) { |
126 | if((unsigned int) currentItem() == (count()-1)) { | 126 | if((unsigned int) currentItem() == (count()-1)) { |
127 | setTopItem(currentItem()-numItemsVisible()+1); | 127 | setTopItem(currentItem()-numItemsVisible()+1); |
128 | } else { | 128 | } else { |
129 | setTopItem(topItem()-1); | 129 | setTopItem(topItem()-1); |
130 | } | 130 | } |
131 | } | 131 | } |
132 | break; | 132 | break; |
133 | case Key_Down: | 133 | case Key_Down: |
134 | if(e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { | 134 | if(e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { |
135 | e->ignore(); | 135 | e->ignore(); |
136 | break; | 136 | break; |
137 | } | 137 | } |
138 | setCurrentItem((currentItem()+1)%count()); | 138 | setCurrentItem((currentItem()+1)%count()); |
139 | if(!itemVisible(currentItem())) { | 139 | if(!itemVisible(currentItem())) { |
140 | if(currentItem() == 0) { | 140 | if(currentItem() == 0) { |
141 | setTopItem(0); | 141 | setTopItem(0); |
142 | } else { | 142 | } else { |
143 | setTopItem(topItem()+1); | 143 | setTopItem(topItem()+1); |
144 | } | 144 | } |
145 | } | 145 | } |
146 | break; | 146 | break; |
147 | case Key_I: | 147 | case Key_I: |
148 | QTimer::singleShot( 11, this, SLOT ( oneDown() ) ); | 148 | QTimer::singleShot( 11, this, SLOT ( oneDown() ) ); |
149 | e->ignore(); | 149 | e->ignore(); |
150 | break; | 150 | break; |
151 | case Key_Shift: | 151 | case Key_Shift: |
152 | emit shiftDown(); | 152 | emit shiftDown(); |
153 | break; | 153 | break; |
154 | default: | 154 | default: |
155 | e->ignore(); | 155 | e->ignore(); |
156 | break; | 156 | break; |
157 | } | 157 | } |
158 | } | 158 | } |
159 | 159 | ||
160 | void KNoScrollListBox::oneDown() | 160 | void KNoScrollListBox::oneDown() |
161 | { | 161 | { |
162 | setCurrentItem((currentItem()+1)%count()); | 162 | setCurrentItem((currentItem()+1)%count()); |
163 | if(!itemVisible(currentItem())) { | 163 | if(!itemVisible(currentItem())) { |
164 | if(currentItem() == 0) { | 164 | if(currentItem() == 0) { |
165 | setTopItem(0); | 165 | setTopItem(0); |
166 | } else { | 166 | } else { |
167 | setTopItem(topItem()+1); | 167 | setTopItem(topItem()+1); |
168 | } | 168 | } |
169 | } | 169 | } |
170 | } | 170 | } |
171 | void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e) | 171 | void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e) |
172 | { | 172 | { |
173 | switch(e->key()) { | 173 | switch(e->key()) { |
174 | case Key_Shift: | 174 | case Key_Shift: |
175 | emit shiftUp(); | 175 | emit shiftUp(); |
176 | break; | 176 | break; |
177 | default: | 177 | default: |
178 | break; | 178 | break; |
179 | } | 179 | } |
180 | } | 180 | } |
181 | 181 | ||
182 | void KNoScrollListBox::mousePressEvent(QMouseEvent *e) | 182 | void KNoScrollListBox::mousePressEvent(QMouseEvent *e) |
183 | { | 183 | { |
184 | QListBox::mousePressEvent(e); | 184 | QListBox::mousePressEvent(e); |
185 | 185 | ||
186 | if(e->button() == RightButton) { | 186 | if(e->button() == RightButton) { |
187 | emit rightClick(); | 187 | emit rightClick(); |
188 | } | 188 | } |
189 | } | 189 | } |
190 | 190 | ||
191 | MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s) | 191 | MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s) |
192 | : QListBoxItem() | 192 | : QListBoxItem() |
193 | { | 193 | { |
194 | setText( s ); | 194 | setText( s ); |
195 | 195 | ||
196 | mIncidence = incidence; | 196 | mIncidence = incidence; |
197 | mDate = qd; | 197 | mDate = qd; |
198 | // QWhatsThis::add(this,KIncidenceFormatter::instance()->getFormattedText( mIncidence )); | 198 | // QWhatsThis::add(this,KIncidenceFormatter::instance()->getFormattedText( mIncidence )); |
199 | mRecur = false; | 199 | mRecur = false; |
200 | mAlarm = false; | 200 | mAlarm = false; |
201 | mReply = false; | 201 | mReply = false; |
202 | mInfo = false; | 202 | mInfo = false; |
203 | } | 203 | } |
204 | 204 | ||
205 | void MonthViewItem::paint(QPainter *p) | 205 | void MonthViewItem::paint(QPainter *p) |
206 | { | 206 | { |
207 | #if QT_VERSION >= 0x030000 | 207 | #if QT_VERSION >= 0x030000 |
208 | bool sel = isSelected(); | 208 | bool sel = isSelected(); |
209 | #else | 209 | #else |
210 | bool sel = selected(); | 210 | bool sel = selected(); |
211 | #endif | 211 | #endif |
212 | 212 | ||
213 | 213 | ||
214 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) | 214 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) |
215 | { | 215 | { |
216 | p->setBackgroundColor( palette().color( QPalette::Normal, \ | 216 | p->setBackgroundColor( palette().color( QPalette::Normal, \ |
217 | sel ? QColorGroup::Highlight : QColorGroup::Background ) ); | 217 | sel ? QColorGroup::Highlight : QColorGroup::Background ) ); |
218 | p->eraseRect( 0, 0, listBox()->maxItemWidth(), height( listBox() ) ); | 218 | p->eraseRect( 0, 0, listBox()->maxItemWidth(), height( listBox() ) ); |
219 | } | 219 | } |
220 | int x = 1; | 220 | int x = 1; |
221 | int y = 3;//(height() - mRecurPixmap.height()) /2; | 221 | int y = 3;//(height() - mRecurPixmap.height()) /2; |
222 | int size = PIXMAP_SIZE; | 222 | int size = PIXMAP_SIZE; |
223 | if ( QApplication::desktop()->width() < 300 ) | 223 | if ( QApplication::desktop()->width() < 300 ) |
224 | size = 3; | 224 | size = 3; |
225 | if ( KOPrefs::instance()->mMonthShowIcons ) { | 225 | if ( KOPrefs::instance()->mMonthShowIcons ) { |
226 | if ( mInfo ) { | 226 | if ( mInfo ) { |
227 | p->fillRect ( x, y,size,size, Qt::darkGreen ); | 227 | p->fillRect ( x, y,size,size, Qt::darkGreen ); |
228 | x += size + 1; | 228 | x += size + 1; |
229 | } | 229 | } |
230 | if ( mRecur ) { | 230 | if ( mRecur ) { |
231 | p->fillRect ( x, y,size,size, Qt::blue ); | 231 | p->fillRect ( x, y,size,size, Qt::blue ); |
232 | x += size + 1; | 232 | x += size + 1; |
233 | } | 233 | } |
234 | if ( mAlarm ) { | 234 | if ( mAlarm ) { |
235 | p->fillRect ( x, y,size,size, Qt::red ); | 235 | p->fillRect ( x, y,size,size, Qt::red ); |
236 | x += size + 1; | 236 | x += size + 1; |
237 | } | 237 | } |
238 | if ( mReply ) { | 238 | if ( mReply ) { |
239 | p->fillRect ( x, y,size,size, Qt::yellow ); | 239 | p->fillRect ( x, y,size,size, Qt::yellow ); |
240 | x += size + 1; | 240 | x += size + 1; |
241 | } | 241 | } |
242 | } | 242 | } |
243 | QFontMetrics fm = p->fontMetrics(); | 243 | QFontMetrics fm = p->fontMetrics(); |
244 | int yPos; | 244 | int yPos; |
245 | int pmheight = size; | 245 | int pmheight = size; |
246 | if( pmheight < fm.height() ) | 246 | if( pmheight < fm.height() ) |
247 | yPos = fm.ascent() + fm.leading()/2; | 247 | yPos = fm.ascent() + fm.leading()/2; |
248 | else | 248 | else |
249 | yPos = pmheight/2 - fm.height()/2 + fm.ascent(); | 249 | yPos = pmheight/2 - fm.height()/2 + fm.ascent(); |
250 | p->setPen( palette().color( QPalette::Normal, sel ? \ | 250 | p->setPen( palette().color( QPalette::Normal, sel ? \ |
251 | QColorGroup::HighlightedText : QColorGroup::Foreground ) ); | 251 | QColorGroup::HighlightedText : QColorGroup::Foreground ) ); |
252 | p->drawText( x, yPos, text() ); | 252 | p->drawText( x, yPos, text() ); |
253 | if ( mIncidence->cancelled() ) { | 253 | if ( mIncidence->cancelled() ) { |
254 | int wid = fm.width( text() ); | 254 | int wid = fm.width( text() ); |
255 | p->drawLine( x, yPos- fm.height()/2+3,x+wid, yPos- fm.height()/2 +3); | 255 | p->drawLine( x, yPos- fm.height()/2+3,x+wid, yPos- fm.height()/2 +3); |
256 | } | 256 | } |
257 | 257 | ||
258 | } | 258 | } |
259 | 259 | ||
260 | int MonthViewItem::height(const QListBox *lb) const | 260 | int MonthViewItem::height(const QListBox *lb) const |
261 | { | 261 | { |
262 | return lb->fontMetrics().lineSpacing()+1; | 262 | return lb->fontMetrics().lineSpacing()+1; |
263 | } | 263 | } |
264 | 264 | ||
265 | int MonthViewItem::width(const QListBox *lb) const | 265 | int MonthViewItem::width(const QListBox *lb) const |
266 | { | 266 | { |
267 | int size = PIXMAP_SIZE; | 267 | int size = PIXMAP_SIZE; |
268 | if ( QApplication::desktop()->width() < 300 ) | 268 | if ( QApplication::desktop()->width() < 300 ) |
269 | size = 3; | 269 | size = 3; |
270 | int x = 1; | 270 | int x = 1; |
271 | if ( mInfo ) { | 271 | if ( mInfo ) { |
272 | x += size + 1; | 272 | x += size + 1; |
273 | } | 273 | } |
274 | if( mRecur ) { | 274 | if( mRecur ) { |
275 | x += size+1; | 275 | x += size+1; |
276 | } | 276 | } |
277 | if( mAlarm ) { | 277 | if( mAlarm ) { |
278 | x += size+1; | 278 | x += size+1; |
279 | } | 279 | } |
280 | if( mReply ) { | 280 | if( mReply ) { |
281 | x += size+1; | 281 | x += size+1; |
282 | } | 282 | } |
283 | 283 | ||
284 | return( x + lb->fontMetrics().width( text() ) + 1 ); | 284 | return( x + lb->fontMetrics().width( text() ) + 1 ); |
285 | } | 285 | } |
286 | 286 | ||
287 | 287 | ||
288 | MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par ) | 288 | MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par ) |
289 | : QWidget( par ), | 289 | : QWidget( par ), |
290 | mMonthView( parent ) | 290 | mMonthView( parent ) |
291 | { | 291 | { |
292 | 292 | ||
293 | QVBoxLayout *topLayout = new QVBoxLayout( this ); | 293 | QVBoxLayout *topLayout = new QVBoxLayout( this ); |
294 | 294 | ||
295 | // mLabel = new QLabel( this );QPushButton | 295 | // mLabel = new QLabel( this );QPushButton |
296 | mLabel = new QPushButton( this ); | 296 | mLabel = new QPushButton( this ); |
297 | //mLabel->setFrameStyle( QFrame::Panel | QFrame::Plain ); | 297 | //mLabel->setFrameStyle( QFrame::Panel | QFrame::Plain ); |
298 | //mLabel->setLineWidth( 1 ); | 298 | //mLabel->setLineWidth( 1 ); |
299 | //mLabel->setAlignment( AlignCenter ); | 299 | //mLabel->setAlignment( AlignCenter ); |
300 | mLabel->setFlat( true ); | 300 | mLabel->setFlat( true ); |
301 | mLabel->setFocusPolicy(NoFocus); | 301 | mLabel->setFocusPolicy(NoFocus); |
302 | mItemList = new KNoScrollListBox( this ); | 302 | mItemList = new KNoScrollListBox( this ); |
303 | mItemList->setMinimumSize( 10, 10 ); | 303 | mItemList->setMinimumSize( 10, 10 ); |
304 | mItemList->setFrameStyle( QFrame::Panel | QFrame::Plain ); | 304 | mItemList->setFrameStyle( QFrame::Panel | QFrame::Plain ); |
305 | mItemList->setLineWidth( 1 ); | 305 | mItemList->setLineWidth( 1 ); |
306 | topLayout->addWidget( mItemList ); | 306 | topLayout->addWidget( mItemList ); |
307 | mLabel->raise(); | 307 | mLabel->raise(); |
308 | // QColor( 0,0,255 ) QColor( 160,1600,255 ) | 308 | // QColor( 0,0,255 ) QColor( 160,1600,255 ) |
309 | mStandardPalette = palette(); | 309 | mStandardPalette = palette(); |
310 | mStandardPalette.setColor(QColorGroup::Base, mStandardPalette.color( QPalette::Normal, QColorGroup::Background ) ); | 310 | mStandardPalette.setColor(QColorGroup::Base, mStandardPalette.color( QPalette::Normal, QColorGroup::Background ) ); |
311 | 311 | ||
312 | enableScrollBars( false ); | 312 | enableScrollBars( false ); |
313 | updateConfig(); | 313 | updateConfig(); |
314 | //connect( mLabel, SIGNAL( clicked( )), SLOT( newEvent() )); | 314 | //connect( mLabel, SIGNAL( clicked( )), SLOT( newEvent() )); |
315 | connect( mLabel, SIGNAL( clicked( )), SLOT( showDay() )); | 315 | connect( mLabel, SIGNAL( clicked( )), SLOT( showDay() )); |
316 | connect( mItemList, SIGNAL( doubleClicked( QListBoxItem *) ), | 316 | connect( mItemList, SIGNAL( doubleClicked( QListBoxItem *) ), |
317 | SLOT( defaultAction( QListBoxItem * ) ) ); | 317 | SLOT( defaultAction( QListBoxItem * ) ) ); |
318 | connect( mItemList, SIGNAL( rightButtonPressed( QListBoxItem *, | 318 | connect( mItemList, SIGNAL( rightButtonPressed( QListBoxItem *, |
319 | const QPoint &) ), | 319 | const QPoint &) ), |
320 | SLOT( contextMenu( QListBoxItem * ) ) ); | 320 | SLOT( contextMenu( QListBoxItem * ) ) ); |
321 | connect( mItemList, SIGNAL( highlighted( QListBoxItem *) ), | 321 | connect( mItemList, SIGNAL( highlighted( QListBoxItem *) ), |
322 | SLOT( selection( QListBoxItem * ) ) ); | 322 | SLOT( selection( QListBoxItem * ) ) ); |
323 | connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), | 323 | connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), |
324 | SLOT( cellClicked( QListBoxItem * ) ) ); | 324 | SLOT( cellClicked( QListBoxItem * ) ) ); |
325 | connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), | 325 | connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), |
326 | SLOT( selection( QListBoxItem * ) ) ); | 326 | SLOT( selection( QListBoxItem * ) ) ); |
327 | } | 327 | } |
328 | #ifdef DESKTOP_VERSION | 328 | #ifdef DESKTOP_VERSION |
329 | QToolTipGroup *MonthViewCell::toolTipGroup() | 329 | QToolTipGroup *MonthViewCell::toolTipGroup() |
330 | { | 330 | { |
331 | if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); | 331 | if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); |
332 | return mToolTipGroup; | 332 | return mToolTipGroup; |
333 | } | 333 | } |
334 | #endif | 334 | #endif |
335 | 335 | ||
336 | void MonthViewCell::setDate( const QDate &date ) | 336 | void MonthViewCell::setDate( const QDate &date ) |
337 | { | 337 | { |
338 | // kdDebug() << "MonthViewCell::setDate(): " << date.toString() << endl; | 338 | // kdDebug() << "MonthViewCell::setDate(): " << date.toString() << endl; |
339 | mDate = date; | 339 | mDate = date; |
340 | 340 | ||
341 | 341 | ||
342 | 342 | ||
343 | //resizeEvent( 0 ); | 343 | //resizeEvent( 0 ); |
344 | } | 344 | } |
345 | 345 | ||
346 | QDate MonthViewCell::date() const | 346 | QDate MonthViewCell::date() const |
347 | { | 347 | { |
348 | return mDate; | 348 | return mDate; |
349 | } | 349 | } |
350 | 350 | ||
351 | void MonthViewCell::setPrimary( bool primary ) | 351 | void MonthViewCell::setPrimary( bool primary ) |
352 | { | 352 | { |
353 | mPrimary = primary; | 353 | mPrimary = primary; |
354 | //setMyPalette(); | 354 | //setMyPalette(); |
355 | } | 355 | } |
356 | void MonthViewCell::setMyPalette() | 356 | void MonthViewCell::setMyPalette() |
357 | { | 357 | { |
358 | 358 | ||
359 | if ( mHoliday) { | 359 | if ( mHoliday) { |
360 | setPalette( mHolidayPalette ); | 360 | setPalette( mHolidayPalette ); |
361 | } else { | 361 | } else { |
362 | if ( mPrimary ) { | 362 | if ( mPrimary ) { |
363 | setPalette( mPrimaryPalette ); | 363 | setPalette( mPrimaryPalette ); |
364 | } else { | 364 | } else { |
365 | setPalette( mNonPrimaryPalette ); | 365 | setPalette( mNonPrimaryPalette ); |
366 | } | 366 | } |
367 | } | 367 | } |
368 | QPalette pal = palette(); | 368 | QPalette pal = palette(); |
369 | 369 | ||
370 | mLabel->setPalette( QPalette ( pal.color( QPalette::Normal,QColorGroup::Base),pal.color(QPalette::Normal,QColorGroup::Base ) )); | 370 | mLabel->setPalette( QPalette ( pal.color( QPalette::Normal,QColorGroup::Base),pal.color(QPalette::Normal,QColorGroup::Base ) )); |
371 | } | 371 | } |
372 | QPalette MonthViewCell::getPalette () | 372 | QPalette MonthViewCell::getPalette () |
373 | { | 373 | { |
374 | if ( !KOPrefs::instance()->mMonthViewUsesDayColors ) | 374 | if ( !KOPrefs::instance()->mMonthViewUsesDayColors ) |
375 | return mStandardPalette; | 375 | return mStandardPalette; |
376 | if ( mHoliday) { | 376 | if ( mHoliday) { |
377 | return mHolidayPalette ; | 377 | return mHolidayPalette ; |
378 | } else { | 378 | } else { |
379 | if ( mPrimary ) { | 379 | if ( mPrimary ) { |
380 | return mPrimaryPalette ; | 380 | return mPrimaryPalette ; |
381 | } | 381 | } |
382 | } | 382 | } |
383 | return mNonPrimaryPalette; | 383 | return mNonPrimaryPalette; |
384 | } | 384 | } |
385 | bool MonthViewCell::isPrimary() const | 385 | bool MonthViewCell::isPrimary() const |
386 | { | 386 | { |
387 | return mPrimary; | 387 | return mPrimary; |
388 | } | 388 | } |
389 | 389 | ||
390 | void MonthViewCell::setHoliday( bool holiday ) | 390 | void MonthViewCell::setHoliday( bool holiday ) |
391 | { | 391 | { |
392 | mHoliday = holiday; | 392 | mHoliday = holiday; |
393 | //setMyPalette(); | 393 | //setMyPalette(); |
394 | } | 394 | } |
395 | 395 | ||
396 | void MonthViewCell::setHoliday( const QString &holiday ) | 396 | void MonthViewCell::setHoliday( const QString &holiday ) |
397 | { | 397 | { |
398 | mHolidayString = holiday; | 398 | mHolidayString = holiday; |
399 | 399 | ||
400 | if ( !holiday.isEmpty() ) { | 400 | if ( !holiday.isEmpty() ) { |
401 | setHoliday( true ); | 401 | setHoliday( true ); |
402 | } | 402 | } |
403 | } | 403 | } |
404 | void MonthViewCell::keyPressEvent ( QKeyEvent * e ) | 404 | void MonthViewCell::keyPressEvent ( QKeyEvent * e ) |
405 | { | 405 | { |
406 | 406 | ||
407 | e->ignore(); | 407 | e->ignore(); |
408 | 408 | ||
409 | } | 409 | } |
410 | 410 | ||
411 | void MonthViewCell::startUpdateCell() | 411 | void MonthViewCell::startUpdateCell() |
412 | { | 412 | { |
413 | 413 | ||
414 | mItemList->setFocusPolicy(NoFocus); | 414 | mItemList->setFocusPolicy(NoFocus); |
415 | if ( !mMonthView->isUpdatePossible() ) | 415 | if ( !mMonthView->isUpdatePossible() ) |
416 | return; | 416 | return; |
417 | 417 | ||
418 | /* | 418 | /* |
419 | if ( !isVisible() ){ | 419 | if ( !isVisible() ){ |
420 | return; | 420 | return; |
421 | } | 421 | } |
422 | */ | 422 | */ |
423 | // qDebug("MonthViewCell::updateCell() "); | 423 | // qDebug("MonthViewCell::updateCell() "); |
424 | setPrimary( mDate.month()%2 ); | 424 | setPrimary( mDate.month()%2 ); |
425 | setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays); | 425 | setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays); |
426 | if ( mDate == QDate::currentDate() ) { | 426 | if ( mDate == QDate::currentDate() ) { |
427 | mItemList->setLineWidth( 3 ); | 427 | mItemList->setLineWidth( 3 ); |
428 | } else { | 428 | } else { |
429 | mItemList->setLineWidth( 1 ); | 429 | mItemList->setLineWidth( 1 ); |
430 | } | 430 | } |
431 | mItemList->clear(); | 431 | mItemList->clear(); |
432 | 432 | ||
433 | #ifdef DESKTOP_VERSION | 433 | #ifdef DESKTOP_VERSION |
434 | QToolTip::remove(this); | 434 | QToolTip::remove(this); |
435 | #endif | 435 | #endif |
436 | mToolTip = ""; | 436 | mToolTip = ""; |
437 | //qApp->processEvents(); | 437 | //qApp->processEvents(); |
438 | if ( !mHolidayString.isEmpty() ) { | 438 | if ( !mHolidayString.isEmpty() ) { |
439 | MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString ); | 439 | MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString ); |
440 | item->setPalette( mHolidayPalette ); | 440 | item->setPalette( mHolidayPalette ); |
441 | mItemList->insertItem( item ); | 441 | mItemList->insertItem( item ); |
442 | mToolTip += mHolidayString+"\n"; | 442 | mToolTip += mHolidayString+"\n"; |
443 | } | 443 | } |
444 | } | 444 | } |
445 | 445 | ||
446 | void MonthViewCell::insertEvent(Event *event) | 446 | void MonthViewCell::insertEvent(Event *event) |
447 | { | 447 | { |
448 | 448 | ||
449 | mItemList->setFocusPolicy(WheelFocus); | 449 | mItemList->setFocusPolicy(WheelFocus); |
450 | if ( !(event->doesRecur() == Recurrence::rNone) ) { | 450 | if ( !(event->doesRecur() == Recurrence::rNone) ) { |
451 | if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily ) | 451 | if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily ) |
452 | return; | 452 | return; |
453 | else | 453 | else |
454 | if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly ) | 454 | if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly ) |
455 | return; | 455 | return; |
456 | } | 456 | } |
457 | 457 | ||
458 | if ( event->categories().contains("Holiday") || | 458 | if ( event->categories().contains("Holiday") || |
459 | event->categories().contains(i18n("Holiday"))) { | 459 | event->categories().contains(i18n("Holiday"))) { |
460 | setHoliday( true ); | 460 | setHoliday( true ); |
461 | if ( mDate.dayOfWeek() == 7 ) | 461 | if ( mDate.dayOfWeek() == 7 ) |
462 | mItemList->setLineWidth( 3 ); | 462 | mItemList->setLineWidth( 3 ); |
463 | } | 463 | } |
464 | QString text; | 464 | QString text; |
465 | if (event->isMultiDay()) { | 465 | if (event->isMultiDay()) { |
466 | QString prefix = "<->"; | 466 | QString prefix = "<->"; |
467 | if ( event->doesRecur() ) { | 467 | if ( event->doesRecur() ) { |
468 | if ( event->recursOn( mDate) ) | 468 | if ( event->recursOn( mDate) ) |
469 | prefix ="->" ; | 469 | prefix ="->" ; |
470 | else { | 470 | else { |
471 | int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); | 471 | int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); |
472 | if ( event->recursOn( mDate.addDays( -days)) ) | 472 | if ( event->recursOn( mDate.addDays( -days)) ) |
473 | prefix ="<-" ; | 473 | prefix ="<-" ; |
474 | } | 474 | } |
475 | 475 | ||
476 | } else { | 476 | } else { |
477 | if (mDate == event->dtStart().date()) { | 477 | if (mDate == event->dtStart().date()) { |
478 | prefix ="->" ; | 478 | prefix ="->" ; |
479 | } else if (mDate == event->dtEnd().date()) { | 479 | } else if (mDate == event->dtEnd().date()) { |
480 | prefix ="<-" ; | 480 | prefix ="<-" ; |
481 | } | 481 | } |
482 | } | 482 | } |
483 | if ( !event->doesFloat() ) { | 483 | if ( !event->doesFloat() ) { |
484 | if ( mDate == event->dtStart().date () ) | 484 | if ( mDate == event->dtStart().date () ) |
485 | prefix += KGlobal::locale()->formatTime(event->dtStart().time())+" "; | 485 | prefix += KGlobal::locale()->formatTime(event->dtStart().time())+" "; |
486 | else if ( mDate == event->dtEnd().date () ) | 486 | else if ( mDate == event->dtEnd().date () ) |
487 | prefix += KGlobal::locale()->formatTime(event->dtEnd().time())+" "; | 487 | prefix += KGlobal::locale()->formatTime(event->dtEnd().time())+" "; |
488 | 488 | ||
489 | } | 489 | } |
490 | text = prefix + event->summary(); | 490 | text = prefix + event->summary(); |
491 | mToolTip += text; | 491 | mToolTip += text; |
492 | } else { | 492 | } else { |
493 | if (event->doesFloat()) { | 493 | if (event->doesFloat()) { |
494 | text = event->summary(); | 494 | text = event->summary(); |
495 | mToolTip += text; | 495 | mToolTip += text; |
496 | } | 496 | } |
497 | else { | 497 | else { |
498 | text = KGlobal::locale()->formatTime(event->dtStart().time()); | 498 | text = KGlobal::locale()->formatTime(event->dtStart().time()); |
499 | text += " " + event->summary(); | 499 | text += " " + event->summary(); |
500 | mToolTip += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); | 500 | mToolTip += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); |
501 | } | 501 | } |
502 | } | 502 | } |
503 | 503 | ||
504 | MonthViewItem *item = new MonthViewItem( event, mDate, text ); | 504 | MonthViewItem *item = new MonthViewItem( event, mDate, text ); |
505 | QPalette pal; | 505 | QPalette pal; |
506 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { | 506 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { |
507 | QStringList categories = event->categories(); | 507 | QStringList categories = event->categories(); |
508 | QString cat = categories.first(); | 508 | QString cat = categories.first(); |
509 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { | 509 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { |
510 | pal = getPalette(); | 510 | pal = getPalette(); |
511 | if (cat.isEmpty()) { | 511 | if (cat.isEmpty()) { |
512 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); | 512 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); |
513 | } else { | 513 | } else { |
514 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); | 514 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); |
515 | } | 515 | } |
516 | 516 | ||
517 | } else { | 517 | } else { |
518 | if (cat.isEmpty()) { | 518 | if (cat.isEmpty()) { |
519 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); | 519 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); |
520 | } else { | 520 | } else { |
521 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); | 521 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); |
522 | } | 522 | } |
523 | } | 523 | } |
524 | 524 | ||
525 | } else { | 525 | } else { |
526 | pal = mStandardPalette ; | 526 | pal = mStandardPalette ; |
527 | } | 527 | } |
528 | item->setPalette( pal ); | 528 | item->setPalette( pal ); |
529 | item->setRecur( event->recurrence()->doesRecur() ); | 529 | item->setRecur( event->recurrence()->doesRecur() ); |
530 | item->setAlarm( event->isAlarmEnabled() ); | 530 | item->setAlarm( event->isAlarmEnabled() ); |
531 | item->setMoreInfo( event->description().length() > 0 ); | 531 | item->setMoreInfo( event->description().length() > 0 ); |
532 | #ifdef DESKTOP_VERSION | 532 | #ifdef DESKTOP_VERSION |
533 | Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails, | 533 | Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails, |
534 | KOPrefs::instance()->email()); | 534 | KOPrefs::instance()->email()); |
535 | if ( me != 0 ) { | 535 | if ( me != 0 ) { |
536 | if ( me->status() == Attendee::NeedsAction && me->RSVP()) | 536 | if ( me->status() == Attendee::NeedsAction && me->RSVP()) |
537 | item->setReply(true); | 537 | item->setReply(true); |
538 | else | 538 | else |
539 | item->setReply(false); | 539 | item->setReply(false); |
540 | } else | 540 | } else |
541 | item->setReply(false); | 541 | item->setReply(false); |
542 | #endif | 542 | #endif |
543 | mItemList->insertItem( item ); | 543 | mItemList->insertItem( item ); |
544 | mToolTip += "\n"; | 544 | mToolTip += "\n"; |
545 | } | 545 | } |
546 | void MonthViewCell::insertTodo(Todo *todo) | 546 | void MonthViewCell::insertTodo(Todo *todo) |
547 | { | 547 | { |
548 | mItemList->setFocusPolicy(WheelFocus); | 548 | mItemList->setFocusPolicy(WheelFocus); |
549 | QString text; | 549 | QString text; |
550 | if (todo->hasDueDate()) { | 550 | if (todo->hasDueDate()) { |
551 | if (!todo->doesFloat()) { | 551 | if (!todo->doesFloat()) { |
552 | text += KGlobal::locale()->formatTime(todo->dtDue().time()); | 552 | text += KGlobal::locale()->formatTime(todo->dtDue().time()); |
553 | text += " "; | 553 | text += " "; |
554 | } | 554 | } |
555 | } | 555 | } |
556 | text += i18n("T: %1").arg(todo->summary()); | 556 | text += i18n("T: %1").arg(todo->summary()); |
557 | 557 | ||
558 | MonthViewItem *item = new MonthViewItem( todo, mDate, text ); | 558 | MonthViewItem *item = new MonthViewItem( todo, mDate, text ); |
559 | //item->setPalette( mStandardPalette ); | 559 | //item->setPalette( mStandardPalette ); |
560 | QPalette pal; | 560 | QPalette pal; |
561 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { | 561 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { |
562 | QStringList categories = todo->categories(); | 562 | QStringList categories = todo->categories(); |
563 | QString cat = categories.first(); | 563 | QString cat = categories.first(); |
564 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { | 564 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { |
565 | pal = getPalette(); | 565 | pal = getPalette(); |
566 | if (cat.isEmpty()) { | 566 | if (cat.isEmpty()) { |
567 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); | 567 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); |
568 | } else { | 568 | } else { |
569 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); | 569 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); |
570 | } | 570 | } |
571 | 571 | ||
572 | } else { | 572 | } else { |
573 | if (cat.isEmpty()) { | 573 | if (cat.isEmpty()) { |
574 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); | 574 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); |
575 | } else { | 575 | } else { |
576 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); | 576 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); |
577 | } | 577 | } |
578 | } | 578 | } |
579 | 579 | ||
580 | } else { | 580 | } else { |
581 | pal = mStandardPalette ; | 581 | pal = mStandardPalette ; |
582 | } | 582 | } |
583 | item->setPalette( pal ); | 583 | item->setPalette( pal ); |
584 | item->setRecur( todo->recurrence()->doesRecur() ); | 584 | item->setRecur( todo->recurrence()->doesRecur() ); |
585 | item->setAlarm( todo->isAlarmEnabled() ); | 585 | item->setAlarm( todo->isAlarmEnabled() ); |
586 | item->setMoreInfo( todo->description().length() > 0 ); | 586 | item->setMoreInfo( todo->description().length() > 0 ); |
587 | mItemList->insertItem( item ); | 587 | mItemList->insertItem( item ); |
588 | mToolTip += text+"\n"; | 588 | mToolTip += text+"\n"; |
589 | } | 589 | } |
590 | void MonthViewCell::finishUpdateCell() | 590 | void MonthViewCell::finishUpdateCell() |
591 | { | 591 | { |
592 | #ifdef DESKTOP_VERSION | 592 | #ifdef DESKTOP_VERSION |
593 | if (mToolTip != "") | 593 | if (mToolTip != "") |
594 | QToolTip::add(this,mToolTip,toolTipGroup(),""); | 594 | QToolTip::add(this,mToolTip,toolTipGroup(),""); |
595 | #endif | 595 | #endif |
596 | mItemList->sort(); | 596 | mItemList->sort(); |
597 | //setMyPalette(); | 597 | //setMyPalette(); |
598 | setMyPalette(); | 598 | setMyPalette(); |
599 | QString text; | 599 | QString text; |
600 | bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; | 600 | bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; |
601 | if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { | 601 | if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { |
602 | text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " "; | 602 | text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " "; |
603 | mLabel->resize( mLabelBigSize ); | 603 | mLabel->resize( mLabelBigSize ); |
604 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); | 604 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); |
605 | } else { | 605 | } else { |
606 | mLabel->resize( mLabelSize ); | 606 | mLabel->resize( mLabelSize ); |
607 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); | 607 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); |
608 | } | 608 | } |
609 | 609 | ||
610 | mLabel->setText( text ); | 610 | mLabel->setText( text ); |
611 | resizeEvent( 0 ); | 611 | resizeEvent( 0 ); |
612 | } | 612 | } |
613 | void MonthViewCell::updateCell() | 613 | void MonthViewCell::updateCell() |
614 | { | 614 | { |
615 | qDebug("MonthViewCell::updateCell() "); | 615 | qDebug("MonthViewCell::updateCell() "); |
616 | if ( !mMonthView->isUpdatePossible() ) | 616 | if ( !mMonthView->isUpdatePossible() ) |
617 | return; | 617 | return; |
618 | startUpdateCell(); | 618 | startUpdateCell(); |
619 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); | 619 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); |
620 | QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); | 620 | QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); |
621 | Event *event; | 621 | Event *event; |
622 | for( event = events.first(); event; event = events.next() ) { // for event | 622 | for( event = events.first(); event; event = events.next() ) { // for event |
623 | insertEvent(event); | 623 | insertEvent(event); |
624 | } | 624 | } |
625 | // insert due todos | 625 | // insert due todos |
626 | QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate ); | 626 | QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate ); |
627 | Todo *todo; | 627 | Todo *todo; |
628 | for(todo = todos.first(); todo; todo = todos.next()) { | 628 | for(todo = todos.first(); todo; todo = todos.next()) { |
629 | insertTodo( todo ); | 629 | insertTodo( todo ); |
630 | } | 630 | } |
631 | finishUpdateCell(); | 631 | finishUpdateCell(); |
632 | // if ( isVisible()) | 632 | // if ( isVisible()) |
633 | //qApp->processEvents(); | 633 | //qApp->processEvents(); |
634 | } | 634 | } |
635 | 635 | ||
636 | void MonthViewCell::updateConfig( bool bigFont ) // = false | 636 | void MonthViewCell::updateConfig( bool bigFont ) // = false |
637 | { | 637 | { |
638 | 638 | ||
639 | if ( bigFont ) { | 639 | if ( bigFont ) { |
640 | QFont fo = KOPrefs::instance()->mMonthViewFont; | 640 | QFont fo = KOPrefs::instance()->mMonthViewFont; |
641 | int ps = fo.pointSize() + 2; | 641 | int ps = fo.pointSize() + 2; |
642 | if ( ps < 18 ) | 642 | if ( ps < 18 ) |
643 | ps += 2; | 643 | ps += 2; |
644 | fo.setPointSize( ps ); | 644 | fo.setPointSize( ps ); |
645 | setFont( fo ); | 645 | setFont( fo ); |
646 | } else | 646 | } else |
647 | setFont( KOPrefs::instance()->mMonthViewFont ); | 647 | setFont( KOPrefs::instance()->mMonthViewFont ); |
648 | 648 | ||
649 | QFontMetrics fm( font() ); | 649 | QFontMetrics fm( font() ); |
650 | mLabelSize = fm.size( 0, "30" ) + QSize( 4, 2 ); | 650 | mLabelSize = fm.size( 0, "30" ) + QSize( 4, 2 ); |
651 | mLabelBigSize = fm.size( 0, "Mag 30" ) + QSize( 2, 2 ); | 651 | mLabelBigSize = fm.size( 0, "Mag 30" ) + QSize( 2, 2 ); |
652 | mHolidayPalette = mStandardPalette; | 652 | mHolidayPalette = mStandardPalette; |
653 | mPrimaryPalette = mStandardPalette; | 653 | mPrimaryPalette = mStandardPalette; |
654 | mNonPrimaryPalette = mStandardPalette; | 654 | mNonPrimaryPalette = mStandardPalette; |
655 | if ( KOPrefs::instance()->mMonthViewUsesDayColors ) { | 655 | if ( KOPrefs::instance()->mMonthViewUsesDayColors ) { |
656 | mHolidayPalette.setColor(QColorGroup::Base, KOPrefs::instance()->mMonthViewHolidayColor ); | 656 | mHolidayPalette.setColor(QColorGroup::Base, KOPrefs::instance()->mMonthViewHolidayColor ); |
657 | mHolidayPalette.setColor(QColorGroup::Background, KOPrefs::instance()->mMonthViewHolidayColor ); | 657 | mHolidayPalette.setColor(QColorGroup::Background, KOPrefs::instance()->mMonthViewHolidayColor ); |
658 | mHolidayPalette.setColor(QColorGroup::Foreground, KOPrefs::instance()->mMonthViewHolidayColor.dark()); | 658 | mHolidayPalette.setColor(QColorGroup::Foreground, KOPrefs::instance()->mMonthViewHolidayColor.dark()); |
659 | mPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewOddColor.dark()); | 659 | mPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewOddColor.dark()); |
660 | mPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewOddColor); | 660 | mPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewOddColor); |
661 | mPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewOddColor); | 661 | mPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewOddColor); |
662 | mNonPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewEvenColor.dark()); | 662 | mNonPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewEvenColor.dark()); |
663 | mNonPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewEvenColor); | 663 | mNonPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewEvenColor); |
664 | mNonPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewEvenColor); | 664 | mNonPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewEvenColor); |
665 | } | 665 | } |
666 | //updateCell(); | 666 | //updateCell(); |
667 | } | 667 | } |
668 | 668 | ||
669 | void MonthViewCell::enableScrollBars( bool enabled ) | 669 | void MonthViewCell::enableScrollBars( bool enabled ) |
670 | { | 670 | { |
671 | if ( enabled ) { | 671 | if ( enabled ) { |
672 | mItemList->setVScrollBarMode(QScrollView::Auto); | 672 | mItemList->setVScrollBarMode(QScrollView::Auto); |
673 | mItemList->setHScrollBarMode(QScrollView::Auto); | 673 | mItemList->setHScrollBarMode(QScrollView::Auto); |
674 | } else { | 674 | } else { |
675 | mItemList->setVScrollBarMode(QScrollView::AlwaysOff); | 675 | mItemList->setVScrollBarMode(QScrollView::AlwaysOff); |
676 | mItemList->setHScrollBarMode(QScrollView::AlwaysOff); | 676 | mItemList->setHScrollBarMode(QScrollView::AlwaysOff); |
677 | } | 677 | } |
678 | } | 678 | } |
679 | 679 | ||
680 | Incidence *MonthViewCell::selectedIncidence() | 680 | Incidence *MonthViewCell::selectedIncidence() |
681 | { | 681 | { |
682 | int index = mItemList->currentItem(); | 682 | int index = mItemList->currentItem(); |
683 | if ( index < 0 ) return 0; | 683 | if ( index < 0 ) return 0; |
684 | 684 | ||
685 | MonthViewItem *item = | 685 | MonthViewItem *item = |
686 | static_cast<MonthViewItem *>( mItemList->item( index ) ); | 686 | static_cast<MonthViewItem *>( mItemList->item( index ) ); |
687 | 687 | ||
688 | if ( !item ) return 0; | 688 | if ( !item ) return 0; |
689 | 689 | ||
690 | return item->incidence(); | 690 | return item->incidence(); |
691 | } | 691 | } |
692 | 692 | ||
693 | QDate MonthViewCell::selectedIncidenceDate() | 693 | QDate MonthViewCell::selectedIncidenceDate() |
694 | { | 694 | { |
695 | QDate qd; | 695 | QDate qd; |
696 | int index = mItemList->currentItem(); | 696 | int index = mItemList->currentItem(); |
697 | if ( index < 0 ) return qd; | 697 | if ( index < 0 ) return qd; |
698 | 698 | ||
699 | MonthViewItem *item = | 699 | MonthViewItem *item = |
700 | static_cast<MonthViewItem *>( mItemList->item( index ) ); | 700 | static_cast<MonthViewItem *>( mItemList->item( index ) ); |
701 | 701 | ||
702 | if ( !item ) return qd; | 702 | if ( !item ) return qd; |
703 | 703 | ||
704 | return item->incidenceDate(); | 704 | return item->incidenceDate(); |
705 | } | 705 | } |
706 | 706 | ||
707 | void MonthViewCell::deselect() | 707 | void MonthViewCell::deselect() |
708 | { | 708 | { |
709 | mItemList->clearSelection(); | 709 | mItemList->clearSelection(); |
710 | enableScrollBars( false ); | 710 | enableScrollBars( false ); |
711 | // updateCell(); | 711 | // updateCell(); |
712 | } | 712 | } |
713 | void MonthViewCell::select() | 713 | void MonthViewCell::select() |
714 | { | 714 | { |
715 | ;// updateCell(); | 715 | ;// updateCell(); |
716 | } | 716 | } |
717 | 717 | ||
718 | void MonthViewCell::resizeEvent ( QResizeEvent * ) | 718 | void MonthViewCell::resizeEvent ( QResizeEvent * ) |
719 | { | 719 | { |
720 | if ( !mMonthView->isUpdatePossible() ) | 720 | if ( !mMonthView->isUpdatePossible() ) |
721 | return; | 721 | return; |
722 | 722 | ||
723 | int size = height() - mLabel->height() - 2; | 723 | int size = height() - mLabel->height() - 2; |
724 | if ( size > 0 ) | 724 | if ( size > 0 ) |
725 | mItemList->verticalScrollBar()->setMaximumHeight( size ); | 725 | mItemList->verticalScrollBar()->setMaximumHeight( size ); |
726 | size = width() - mLabel->width() -2; | 726 | size = width() - mLabel->width() -2; |
727 | if ( size > 0 ) | 727 | if ( size > 0 ) |
728 | mItemList->horizontalScrollBar()->setMaximumWidth( size ); | 728 | mItemList->horizontalScrollBar()->setMaximumWidth( size ); |
729 | mLabel->move( width()-mItemList->lineWidth() - mLabel->width(), height()-mItemList->lineWidth() - mLabel->height() ); | 729 | mLabel->move( width()-mItemList->lineWidth() - mLabel->width(), height()-mItemList->lineWidth() - mLabel->height() ); |
730 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); | 730 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); |
731 | } | 731 | } |
732 | 732 | ||
733 | void MonthViewCell::defaultAction( QListBoxItem *item ) | 733 | void MonthViewCell::defaultAction( QListBoxItem *item ) |
734 | { | 734 | { |
735 | if ( !item ) return; | 735 | if ( !item ) return; |
736 | 736 | ||
737 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); | 737 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); |
738 | Incidence *incidence = eventItem->incidence(); | 738 | Incidence *incidence = eventItem->incidence(); |
739 | if ( incidence ) mMonthView->defaultAction( incidence ); | 739 | if ( incidence ) mMonthView->defaultAction( incidence ); |
740 | } | 740 | } |
741 | void MonthViewCell::showDay() | 741 | void MonthViewCell::showDay() |
742 | { | 742 | { |
743 | emit showDaySignal( date() ); | 743 | emit showDaySignal( date() ); |
744 | } | 744 | } |
745 | void MonthViewCell::newEvent() | 745 | void MonthViewCell::newEvent() |
746 | { | 746 | { |
747 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); | 747 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); |
748 | emit newEventSignal( dt ); | 748 | emit newEventSignal( dt ); |
749 | } | 749 | } |
750 | void MonthViewCell::cellClicked( QListBoxItem *item ) | 750 | void MonthViewCell::cellClicked( QListBoxItem *item ) |
751 | { | 751 | { |
752 | static QListBoxItem * lastClicked = 0; | 752 | static QListBoxItem * lastClicked = 0; |
753 | if ( item == 0 ) { | 753 | if ( item == 0 ) { |
754 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); | 754 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); |
755 | emit newEventSignal( dt ); | 755 | emit newEventSignal( dt ); |
756 | return; | 756 | return; |
757 | } | 757 | } |
758 | /* | 758 | /* |
759 | if ( lastClicked ) | 759 | if ( lastClicked ) |
760 | if ( ! item ) { | 760 | if ( ! item ) { |
761 | if ( lastClicked->listBox() != item->listBox() ) | 761 | if ( lastClicked->listBox() != item->listBox() ) |
762 | lastClicked->listBox()->clearSelection(); | 762 | lastClicked->listBox()->clearSelection(); |
763 | } | 763 | } |
764 | */ | 764 | */ |
765 | 765 | ||
766 | mMonthView->setSelectedCell( this ); | 766 | mMonthView->setSelectedCell( this ); |
767 | if( KOPrefs::instance()->mEnableMonthScroll || KOPrefs::instance()->mMonthViewWeek ) enableScrollBars( true ); | 767 | if( KOPrefs::instance()->mEnableMonthScroll || KOPrefs::instance()->mMonthViewWeek ) enableScrollBars( true ); |
768 | select(); | 768 | select(); |
769 | } | 769 | } |
770 | 770 | ||
771 | void MonthViewCell::contextMenu( QListBoxItem *item ) | 771 | void MonthViewCell::contextMenu( QListBoxItem *item ) |
772 | { | 772 | { |
773 | if ( !item ) return; | 773 | if ( !item ) return; |
774 | 774 | ||
775 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); | 775 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); |
776 | Incidence *incidence = eventItem->incidence(); | 776 | Incidence *incidence = eventItem->incidence(); |
777 | if ( incidence ) mMonthView->showContextMenu( incidence ); | 777 | if ( incidence ) mMonthView->showContextMenu( incidence ); |
778 | } | 778 | } |
779 | 779 | ||
780 | void MonthViewCell::selection( QListBoxItem *item ) | 780 | void MonthViewCell::selection( QListBoxItem *item ) |
781 | { | 781 | { |
782 | if ( !item ) return; | 782 | if ( !item ) return; |
783 | 783 | ||
784 | mMonthView->setSelectedCell( this ); | 784 | mMonthView->setSelectedCell( this ); |
785 | } | 785 | } |
786 | 786 | ||
787 | 787 | ||
788 | // ******************************************************************************* | 788 | // ******************************************************************************* |
789 | // ******************************************************************************* | 789 | // ******************************************************************************* |
790 | // ******************************************************************************* | 790 | // ******************************************************************************* |
791 | 791 | ||
792 | 792 | ||
793 | KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) | 793 | KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) |
794 | : KOEventView( calendar, parent, name ), | 794 | : KOEventView( calendar, parent, name ), |
795 | mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ), | 795 | mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ), |
796 | mWidthLongDayLabel( 0 ), mSelectedCell( 0 ) | 796 | mWidthLongDayLabel( 0 ), mSelectedCell( 0 ) |
797 | { | 797 | { |
798 | mShortDayLabelsM = false; | 798 | mShortDayLabelsM = false; |
799 | mShortDayLabelsW = false; | 799 | mShortDayLabelsW = false; |
800 | skipResize = false; | 800 | skipResize = false; |
801 | clPending = true; | 801 | clPending = true; |
802 | mNavigatorBar = new NavigatorBar( QDate::currentDate(), this, "useBigPixmaps" ); | 802 | mNavigatorBar = new NavigatorBar( QDate::currentDate(), this, "useBigPixmaps" ); |
803 | mWidStack = new QWidgetStack( this ); | 803 | mWidStack = new QWidgetStack( this ); |
804 | QVBoxLayout* hb = new QVBoxLayout( this ); | 804 | QVBoxLayout* hb = new QVBoxLayout( this ); |
805 | mMonthView = new QWidget( mWidStack ); | 805 | mMonthView = new QWidget( mWidStack ); |
806 | mWeekView = new QWidget( mWidStack ); | 806 | mWeekView = new QWidget( mWidStack ); |
807 | #if QT_VERSION >= 0x030000 | 807 | #if QT_VERSION >= 0x030000 |
808 | mWidStack->addWidget(mMonthView ); | 808 | mWidStack->addWidget(mMonthView ); |
809 | mWidStack->addWidget(mWeekView ); | 809 | mWidStack->addWidget(mWeekView ); |
810 | #else | 810 | #else |
811 | mWidStack->addWidget( mMonthView, 1 ); | 811 | mWidStack->addWidget( mMonthView, 1 ); |
812 | mWidStack->addWidget( mWeekView , 1 ); | 812 | mWidStack->addWidget( mWeekView , 1 ); |
813 | #endif | 813 | #endif |
814 | hb->addWidget( mNavigatorBar ); | 814 | hb->addWidget( mNavigatorBar ); |
815 | hb->addWidget( mWidStack ); | 815 | hb->addWidget( mWidStack ); |
816 | mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); | 816 | mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); |
817 | mShowWeekView = KOPrefs::instance()->mMonthViewWeek; | 817 | mShowWeekView = KOPrefs::instance()->mMonthViewWeek; |
818 | if ( mShowWeekView ) | 818 | if ( mShowWeekView ) |
819 | mWeekStartsMonday = true; | 819 | mWeekStartsMonday = true; |
820 | updatePossible = false; | 820 | updatePossible = false; |
821 | //updatePossible = true; | 821 | //updatePossible = true; |
822 | mCells.setAutoDelete( true ); | 822 | mCells.setAutoDelete( true ); |
823 | mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; | 823 | mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; |
824 | mDayLabels.resize( mDaysPerWeek ); | 824 | mDayLabels.resize( mDaysPerWeek ); |
825 | mDayLabelsW.resize( mDaysPerWeek ); | 825 | mDayLabelsW.resize( mDaysPerWeek ); |
826 | QFont bfont = font(); | 826 | QFont bfont = font(); |
827 | if ( QApplication::desktop()->width() < 650 ) { | 827 | if ( QApplication::desktop()->width() < 650 ) { |
828 | bfont.setPointSize( bfont.pointSize() - 2 ); | 828 | bfont.setPointSize( bfont.pointSize() - 2 ); |
829 | } | 829 | } |
830 | bfont.setBold( true ); | 830 | bfont.setBold( true ); |
831 | int i; | 831 | int i; |
832 | 832 | ||
833 | for( i = 0; i < mDaysPerWeek; i++ ) { | 833 | for( i = 0; i < mDaysPerWeek; i++ ) { |
834 | QLabel *label = new QLabel( mMonthView ); | 834 | QLabel *label = new QLabel( mMonthView ); |
835 | label->setFont(bfont); | 835 | label->setFont(bfont); |
836 | label->setFrameStyle(QFrame::Panel|QFrame::Raised); | 836 | label->setFrameStyle(QFrame::Panel|QFrame::Raised); |
837 | label->setLineWidth(1); | 837 | label->setLineWidth(1); |
838 | label->setAlignment(AlignCenter); | 838 | label->setAlignment(AlignCenter); |
839 | mDayLabels.insert( i, label ); | 839 | mDayLabels.insert( i, label ); |
840 | label = new QLabel( mWeekView ); | 840 | label = new QLabel( mWeekView ); |
841 | label->setFont(bfont); | 841 | label->setFont(bfont); |
842 | label->setFrameStyle(QFrame::Panel|QFrame::Raised); | 842 | label->setFrameStyle(QFrame::Panel|QFrame::Raised); |
843 | label->setLineWidth(1); | 843 | label->setLineWidth(1); |
844 | label->setAlignment(AlignCenter); | 844 | label->setAlignment(AlignCenter); |
845 | mDayLabelsW.insert( i, label ); | 845 | mDayLabelsW.insert( i, label ); |
846 | } | 846 | } |
847 | 847 | ||
848 | bfont.setBold( false ); | 848 | bfont.setBold( false ); |
849 | mWeekLabels.resize( mNumWeeks+1 ); | 849 | mWeekLabels.resize( mNumWeeks+1 ); |
850 | mWeekLabelsW.resize( 2 ); | 850 | mWeekLabelsW.resize( 2 ); |
851 | for( i = 0; i < mNumWeeks+1; i++ ) { | 851 | for( i = 0; i < mNumWeeks+1; i++ ) { |
852 | KOWeekButton *label = new KOWeekButton( mMonthView ); | 852 | KOWeekButton *label = new KOWeekButton( mMonthView ); |
853 | label->setFocusPolicy(NoFocus); | 853 | label->setFocusPolicy(NoFocus); |
854 | label->setFont(bfont); | 854 | label->setFont(bfont); |
855 | connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); | 855 | connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); |
856 | label->setFlat(true); | 856 | label->setFlat(true); |
857 | QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); | 857 | QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); |
858 | //label->setFrameStyle(QFrame::Panel|QFrame::Raised); | 858 | //label->setFrameStyle(QFrame::Panel|QFrame::Raised); |
859 | //label->setLineWidth(1); | 859 | //label->setLineWidth(1); |
860 | //label->setAlignment(AlignCenter); | 860 | //label->setAlignment(AlignCenter); |
861 | mWeekLabels.insert( i, label ); | 861 | mWeekLabels.insert( i, label ); |
862 | } | 862 | } |
863 | mWeekLabels[mNumWeeks]->setText( i18n("W")); | 863 | mWeekLabels[mNumWeeks]->setText( i18n("W")); |
864 | QWhatsThis::add(mWeekLabels[mNumWeeks],i18n("Click on this to\nselect week number")); | 864 | QWhatsThis::add(mWeekLabels[mNumWeeks],i18n("Click on this to\nselect week number")); |
865 | 865 | ||
866 | for( i = 0; i < 1+1; i++ ) { | 866 | for( i = 0; i < 1+1; i++ ) { |
867 | KOWeekButton *label = new KOWeekButton( mWeekView ); | 867 | KOWeekButton *label = new KOWeekButton( mWeekView ); |
868 | label->setFocusPolicy(NoFocus); | 868 | label->setFocusPolicy(NoFocus); |
869 | label->setFont(bfont); | 869 | label->setFont(bfont); |
870 | connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); | 870 | connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); |
871 | label->setFlat(true); | 871 | label->setFlat(true); |
872 | QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); | 872 | QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); |
873 | //label->setFrameStyle(QFrame::Panel|QFrame::Raised); | 873 | //label->setFrameStyle(QFrame::Panel|QFrame::Raised); |
874 | //label->setLineWidth(1); | 874 | //label->setLineWidth(1); |
875 | //label->setAlignment(AlignCenter); | 875 | //label->setAlignment(AlignCenter); |
876 | mWeekLabelsW.insert( i, label ); | 876 | mWeekLabelsW.insert( i, label ); |
877 | } | 877 | } |
878 | mWeekLabelsW[1]->setText( i18n("W")); | 878 | mWeekLabelsW[1]->setText( i18n("W")); |
879 | 879 | ||
880 | 880 | ||
881 | int row, col; | 881 | int row, col; |
882 | mCells.resize( mNumCells ); | 882 | mCells.resize( mNumCells ); |
883 | for( row = 0; row < mNumWeeks; ++row ) { | 883 | for( row = 0; row < mNumWeeks; ++row ) { |
884 | for( col = 0; col < mDaysPerWeek; ++col ) { | 884 | for( col = 0; col < mDaysPerWeek; ++col ) { |
885 | MonthViewCell *cell = new MonthViewCell( this, mMonthView ); | 885 | MonthViewCell *cell = new MonthViewCell( this, mMonthView ); |
886 | mCells.insert( row * mDaysPerWeek + col, cell ); | 886 | mCells.insert( row * mDaysPerWeek + col, cell ); |
887 | 887 | ||
888 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), | 888 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), |
889 | SLOT( defaultAction( Incidence * ) ) ); | 889 | SLOT( defaultAction( Incidence * ) ) ); |
890 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), | 890 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), |
891 | SIGNAL( newEventSignal( QDateTime ) ) ); | 891 | SIGNAL( newEventSignal( QDateTime ) ) ); |
892 | connect( cell, SIGNAL( showDaySignal( QDate ) ), | 892 | connect( cell, SIGNAL( showDaySignal( QDate ) ), |
893 | SIGNAL( showDaySignal( QDate ) ) ); | 893 | SIGNAL( showDaySignal( QDate ) ) ); |
894 | } | 894 | } |
895 | } | 895 | } |
896 | mCellsW.resize( mDaysPerWeek ); | 896 | mCellsW.resize( mDaysPerWeek ); |
897 | for( col = 0; col < mDaysPerWeek; ++col ) { | 897 | for( col = 0; col < mDaysPerWeek; ++col ) { |
898 | MonthViewCell *cell = new MonthViewCell( this, mWeekView ); | 898 | MonthViewCell *cell = new MonthViewCell( this, mWeekView ); |
899 | mCellsW.insert( col, cell ); | 899 | mCellsW.insert( col, cell ); |
900 | 900 | ||
901 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), | 901 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), |
902 | SLOT( defaultAction( Incidence * ) ) ); | 902 | SLOT( defaultAction( Incidence * ) ) ); |
903 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), | 903 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), |
904 | SIGNAL( newEventSignal( QDateTime ) ) ); | 904 | SIGNAL( newEventSignal( QDateTime ) ) ); |
905 | connect( cell, SIGNAL( showDaySignal( QDate ) ), | 905 | connect( cell, SIGNAL( showDaySignal( QDate ) ), |
906 | SIGNAL( showDaySignal( QDate ) ) ); | 906 | SIGNAL( showDaySignal( QDate ) ) ); |
907 | cell->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont ); | 907 | cell->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont ); |
908 | } | 908 | } |
909 | 909 | ||
910 | //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) ); | 910 | //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) ); |
911 | mContextMenu = eventPopup(); | 911 | mContextMenu = eventPopup(); |
912 | // updateConfig(); //useless here... | 912 | // updateConfig(); //useless here... |
913 | // ... but we need mWidthLongDayLabel computed | 913 | // ... but we need mWidthLongDayLabel computed |
914 | QFontMetrics fontmetric(mDayLabels[0]->font()); | 914 | QFontMetrics fontmetric(mDayLabels[0]->font()); |
915 | mWidthLongDayLabel = 0; | 915 | mWidthLongDayLabel = 0; |
916 | for (int i = 0; i < 7; i++) { | 916 | for (int i = 0; i < 7; i++) { |
917 | int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); | 917 | int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); |
918 | if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; | 918 | if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; |
919 | } | 919 | } |
920 | 920 | ||
921 | //mWeekLabels[mNumWeeks]->setText( i18n("W")); | 921 | //mWeekLabels[mNumWeeks]->setText( i18n("W")); |
922 | 922 | ||
923 | #if 0 | 923 | #if 0 |
924 | if ( mShowWeekView ) | 924 | if ( mShowWeekView ) |
925 | mWidStack->raiseWidget( mWeekView ); | 925 | mWidStack->raiseWidget( mWeekView ); |
926 | else | 926 | else |
927 | mWidStack->raiseWidget( mMonthView ); | 927 | mWidStack->raiseWidget( mMonthView ); |
928 | #endif | 928 | #endif |
929 | 929 | ||
930 | emit incidenceSelected( 0 ); | 930 | emit incidenceSelected( 0 ); |
931 | #ifndef DESKTOP_VERSION | 931 | #ifndef DESKTOP_VERSION |
932 | resize( QApplication::desktop()->size() ); | 932 | resize( QApplication::desktop()->size() ); |
933 | #else | 933 | #else |
934 | resize(640, 480 ); | 934 | resize(640, 480 ); |
935 | updatePossible = true; | 935 | updatePossible = true; |
936 | #endif | 936 | #endif |
937 | computeLayout(); | 937 | computeLayout(); |
938 | 938 | ||
939 | if ( mShowWeekView ) | 939 | if ( mShowWeekView ) |
940 | mWidStack->raiseWidget( mWeekView ); | 940 | mWidStack->raiseWidget( mWeekView ); |
941 | else | 941 | else |
942 | mWidStack->raiseWidget( mMonthView ); | 942 | mWidStack->raiseWidget( mMonthView ); |
943 | } | 943 | } |
944 | 944 | ||
945 | KOMonthView::~KOMonthView() | 945 | KOMonthView::~KOMonthView() |
946 | { | 946 | { |
947 | delete mContextMenu; | 947 | delete mContextMenu; |
948 | } | 948 | } |
949 | 949 | ||
950 | void KOMonthView::selectInternalWeekNum ( int n ) | 950 | void KOMonthView::selectInternalWeekNum ( int n ) |
951 | { | 951 | { |
952 | switchView(); | 952 | switchView(); |
953 | emit selectWeekNum ( n ); | 953 | if ( !KOPrefs::instance()->mMonthViewWeek ) |
954 | emit selectMonth (); | ||
955 | else | ||
956 | emit selectWeekNum ( n ); | ||
954 | } | 957 | } |
955 | 958 | ||
956 | int KOMonthView::currentWeek() | 959 | int KOMonthView::currentWeek() |
957 | { | 960 | { |
958 | if ( mShowWeekView ) | 961 | if ( mShowWeekView ) |
959 | return mWeekLabelsW[0]->getWeekNum(); | 962 | return mWeekLabelsW[0]->getWeekNum(); |
960 | return mWeekLabels[0]->getWeekNum(); | 963 | return mWeekLabels[0]->getWeekNum(); |
961 | } | 964 | } |
962 | void KOMonthView::switchView() | 965 | void KOMonthView::switchView() |
963 | { | 966 | { |
964 | |||
965 | if ( selectedCell( ) ) | 967 | if ( selectedCell( ) ) |
966 | selectedCell()->deselect(); | 968 | selectedCell()->deselect(); |
967 | mShowWeekView = !mShowWeekView; | 969 | mShowWeekView = !mShowWeekView; |
968 | KOPrefs::instance()->mMonthViewWeek = mShowWeekView; | 970 | KOPrefs::instance()->mMonthViewWeek = mShowWeekView; |
969 | if ( clPending ) { | 971 | if ( clPending ) { |
970 | computeLayout(); | 972 | computeLayout(); |
971 | updateConfig(); | 973 | updateConfig(); |
972 | } | 974 | } |
973 | if ( mShowWeekView ) | 975 | if ( mShowWeekView ) |
974 | mWidStack->raiseWidget( mWeekView ); | 976 | mWidStack->raiseWidget( mWeekView ); |
975 | else | 977 | else |
976 | mWidStack->raiseWidget( mMonthView ); | 978 | mWidStack->raiseWidget( mMonthView ); |
977 | clPending = false; | 979 | clPending = false; |
978 | } | 980 | } |
979 | 981 | ||
980 | int KOMonthView::maxDatesHint() | 982 | int KOMonthView::maxDatesHint() |
981 | { | 983 | { |
982 | return mNumCells; | 984 | return mNumCells; |
983 | } | 985 | } |
984 | 986 | ||
985 | int KOMonthView::currentDateCount() | 987 | int KOMonthView::currentDateCount() |
986 | { | 988 | { |
987 | return mNumCells; | 989 | return mNumCells; |
988 | } | 990 | } |
989 | 991 | ||
990 | QPtrList<Incidence> KOMonthView::selectedIncidences() | 992 | QPtrList<Incidence> KOMonthView::selectedIncidences() |
991 | { | 993 | { |
992 | QPtrList<Incidence> selected; | 994 | QPtrList<Incidence> selected; |
993 | 995 | ||
994 | if ( mSelectedCell ) { | 996 | if ( mSelectedCell ) { |
995 | Incidence *incidence = mSelectedCell->selectedIncidence(); | 997 | Incidence *incidence = mSelectedCell->selectedIncidence(); |
996 | if ( incidence ) selected.append( incidence ); | 998 | if ( incidence ) selected.append( incidence ); |
997 | } | 999 | } |
998 | 1000 | ||
999 | return selected; | 1001 | return selected; |
1000 | } | 1002 | } |
1001 | 1003 | ||
1002 | DateList KOMonthView::selectedDates() | 1004 | DateList KOMonthView::selectedDates() |
1003 | { | 1005 | { |
1004 | DateList selected; | 1006 | DateList selected; |
1005 | 1007 | ||
1006 | if ( mSelectedCell ) { | 1008 | if ( mSelectedCell ) { |
1007 | QDate qd = mSelectedCell->selectedIncidenceDate(); | 1009 | QDate qd = mSelectedCell->selectedIncidenceDate(); |
1008 | if ( qd.isValid() ) selected.append( qd ); | 1010 | if ( qd.isValid() ) selected.append( qd ); |
1009 | } | 1011 | } |
1010 | 1012 | ||
1011 | return selected; | 1013 | return selected; |
1012 | } | 1014 | } |
1013 | 1015 | ||
1014 | void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd, | 1016 | void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd, |
1015 | const QDate &td) | 1017 | const QDate &td) |
1016 | { | 1018 | { |
1017 | #ifndef KORG_NOPRINTER | 1019 | #ifndef KORG_NOPRINTER |
1018 | calPrinter->preview(CalPrinter::Month, fd, td); | 1020 | calPrinter->preview(CalPrinter::Month, fd, td); |
1019 | #endif | 1021 | #endif |
1020 | } | 1022 | } |
1021 | 1023 | ||
1022 | void KOMonthView::updateConfig() | 1024 | void KOMonthView::updateConfig() |
1023 | { | 1025 | { |
1024 | 1026 | ||
1025 | mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); | 1027 | mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); |
1026 | 1028 | ||
1027 | if ( mShowWeekView ) { | 1029 | if ( mShowWeekView ) { |
1028 | mWeekStartsMonday = true; | 1030 | mWeekStartsMonday = true; |
1029 | } | 1031 | } |
1030 | QFontMetrics fontmetric(mDayLabels[0]->font()); | 1032 | QFontMetrics fontmetric(mDayLabels[0]->font()); |
1031 | mWidthLongDayLabel = 0; | 1033 | mWidthLongDayLabel = 0; |
1032 | 1034 | ||
1033 | for (int i = 0; i < 7; i++) { | 1035 | for (int i = 0; i < 7; i++) { |
1034 | int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); | 1036 | int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); |
1035 | if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; | 1037 | if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; |
1036 | } | 1038 | } |
1037 | bool temp = mShowSatSunComp ; | 1039 | bool temp = mShowSatSunComp ; |
1038 | mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; | 1040 | mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; |
1039 | if ( ! mShowWeekView ) { | 1041 | if ( ! mShowWeekView ) { |
1040 | if ( temp != KOPrefs::instance()->mMonthViewSatSunTog ) | 1042 | if ( temp != KOPrefs::instance()->mMonthViewSatSunTog ) |
1041 | computeLayout(); | 1043 | computeLayout(); |
1042 | } | 1044 | } |
1043 | updateDayLabels(); | 1045 | updateDayLabels(); |
1044 | //qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks); | 1046 | //qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks); |
1045 | //int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks; | 1047 | //int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks; |
1046 | //resizeEvent( 0 ); | 1048 | //resizeEvent( 0 ); |
1047 | for (uint i = 0; i < mCells.count(); ++i) { | 1049 | for (uint i = 0; i < mCells.count(); ++i) { |
1048 | mCells[i]->updateConfig(); | 1050 | mCells[i]->updateConfig(); |
1049 | } | 1051 | } |
1050 | 1052 | ||
1051 | for (uint i = 0; i < mCellsW.count(); ++i) { | 1053 | for (uint i = 0; i < mCellsW.count(); ++i) { |
1052 | mCellsW[i]->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont); | 1054 | mCellsW[i]->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont); |
1053 | } | 1055 | } |
1054 | #ifdef DESKTOP_VERSION | 1056 | #ifdef DESKTOP_VERSION |
1055 | MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips); | 1057 | MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips); |
1056 | #endif | 1058 | #endif |
1057 | updateView(); | 1059 | updateView(); |
1058 | } | 1060 | } |
1059 | 1061 | ||
1060 | void KOMonthView::updateDayLabels() | 1062 | void KOMonthView::updateDayLabels() |
1061 | { | 1063 | { |
1062 | 1064 | ||
1063 | QPtrVector<QLabel> *mDayLabelsT; | 1065 | QPtrVector<QLabel> *mDayLabelsT; |
1064 | 1066 | ||
1065 | mDayLabelsT = &mDayLabelsW; | 1067 | mDayLabelsT = &mDayLabelsW; |
1066 | for (int i = 0; i < 7; i++) { | 1068 | for (int i = 0; i < 7; i++) { |
1067 | if (mWeekStartsMonday) { | 1069 | if (mWeekStartsMonday) { |
1068 | bool show = mShortDayLabelsW; | 1070 | bool show = mShortDayLabelsW; |
1069 | if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) | 1071 | if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) |
1070 | show = true; | 1072 | show = true; |
1071 | (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); | 1073 | (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); |
1072 | } else { | 1074 | } else { |
1073 | if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabelsW)); | 1075 | if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabelsW)); |
1074 | else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabelsW)); | 1076 | else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabelsW)); |
1075 | 1077 | ||
1076 | } | 1078 | } |
1077 | } | 1079 | } |
1078 | mDayLabelsT = &mDayLabels; | 1080 | mDayLabelsT = &mDayLabels; |
1079 | for (int i = 0; i < 7; i++) { | 1081 | for (int i = 0; i < 7; i++) { |
1080 | if (mWeekStartsMonday) { | 1082 | if (mWeekStartsMonday) { |
1081 | bool show = mShortDayLabelsM; | 1083 | bool show = mShortDayLabelsM; |
1082 | if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) | 1084 | if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) |
1083 | show = true; | 1085 | show = true; |
1084 | (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); | 1086 | (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); |
1085 | } else { | 1087 | } else { |
1086 | if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabelsM)); | 1088 | if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabelsM)); |
1087 | else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabelsM)); | 1089 | else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabelsM)); |
1088 | 1090 | ||
1089 | } | 1091 | } |
1090 | } | 1092 | } |
1091 | 1093 | ||
1092 | } | 1094 | } |
1093 | 1095 | ||
1094 | void KOMonthView::showDates(const QDate &start, const QDate &) | 1096 | void KOMonthView::showDates(const QDate &start, const QDate &) |
1095 | { | 1097 | { |
1096 | // kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl; | 1098 | // kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl; |
1097 | 1099 | ||
1098 | QPtrVector<MonthViewCell> *cells; | 1100 | QPtrVector<MonthViewCell> *cells; |
1099 | QPtrVector<QLabel> *dayLabels; | 1101 | QPtrVector<QLabel> *dayLabels; |
1100 | QPtrVector<KOWeekButton> *weekLabels; | 1102 | QPtrVector<KOWeekButton> *weekLabels; |
1101 | int weekNum = 6; | 1103 | int weekNum = 6; |
1102 | if ( mShowWeekView ) { | 1104 | if ( mShowWeekView ) { |
1103 | weekNum = 1; | 1105 | weekNum = 1; |
1104 | cells = &mCellsW; | 1106 | cells = &mCellsW; |
1105 | dayLabels = &mDayLabelsW; | 1107 | dayLabels = &mDayLabelsW; |
1106 | weekLabels = &mWeekLabelsW; | 1108 | weekLabels = &mWeekLabelsW; |
1107 | } else { | 1109 | } else { |
1108 | cells = &mCells; | 1110 | cells = &mCells; |
1109 | dayLabels = &mDayLabels; | 1111 | dayLabels = &mDayLabels; |
1110 | weekLabels = &mWeekLabels; | 1112 | weekLabels = &mWeekLabels; |
1111 | } | 1113 | } |
1112 | 1114 | ||
1113 | mStartDate = start; | 1115 | mStartDate = start; |
1114 | 1116 | ||
1115 | int startWeekDay = mWeekStartsMonday ? 1 : 7; | 1117 | int startWeekDay = mWeekStartsMonday ? 1 : 7; |
1116 | 1118 | ||
1117 | while( KOGlobals::self()->calendarSystem()->dayOfWeek(mStartDate) != startWeekDay ) { | 1119 | while( KOGlobals::self()->calendarSystem()->dayOfWeek(mStartDate) != startWeekDay ) { |
1118 | mStartDate = mStartDate.addDays( -1 ); | 1120 | mStartDate = mStartDate.addDays( -1 ); |
1119 | } | 1121 | } |
1120 | 1122 | ||
1121 | bool primary = false; | 1123 | bool primary = false; |
1122 | uint i; | 1124 | uint i; |
1123 | for( i = 0; i < (*cells).size(); ++i ) { | 1125 | for( i = 0; i < (*cells).size(); ++i ) { |
1124 | QDate date = mStartDate.addDays( i ); | 1126 | QDate date = mStartDate.addDays( i ); |
1125 | (*cells)[i]->setDate( date ); | 1127 | (*cells)[i]->setDate( date ); |
1126 | 1128 | ||
1127 | #ifndef KORG_NOPLUGINS | 1129 | #ifndef KORG_NOPLUGINS |
1128 | // add holiday, if present | 1130 | // add holiday, if present |
1129 | QString hstring(KOCore::self()->holiday(date)); | 1131 | QString hstring(KOCore::self()->holiday(date)); |
1130 | (*cells)[i]->setHoliday( hstring ); | 1132 | (*cells)[i]->setHoliday( hstring ); |
1131 | #endif | 1133 | #endif |
1132 | 1134 | ||
1133 | } | 1135 | } |
1134 | QDate date = mStartDate.addDays( mWeekStartsMonday ? 3 : 4 ); | 1136 | QDate date = mStartDate.addDays( mWeekStartsMonday ? 3 : 4 ); |
1135 | for( i = 0; i < weekNum; ++i ) { | 1137 | for( i = 0; i < weekNum; ++i ) { |
1136 | int wno; | 1138 | int wno; |
1137 | // remember, according to ISO 8601, the first week of the year is the | 1139 | // remember, according to ISO 8601, the first week of the year is the |
1138 | // first week that contains a thursday. Thus we must subtract off 4, | 1140 | // first week that contains a thursday. Thus we must subtract off 4, |
1139 | // not just 1. | 1141 | // not just 1. |
1140 | int dayOfYear = date.dayOfYear(); | 1142 | int dayOfYear = date.dayOfYear(); |
1141 | if (dayOfYear % 7 != 0) | 1143 | if (dayOfYear % 7 != 0) |
1142 | wno = dayOfYear / 7 + 1; | 1144 | wno = dayOfYear / 7 + 1; |
1143 | else | 1145 | else |
1144 | wno =dayOfYear / 7; | 1146 | wno =dayOfYear / 7; |
1145 | (*weekLabels)[i]->setWeekNum( wno ); | 1147 | (*weekLabels)[i]->setWeekNum( wno ); |
1146 | date = date.addDays( 7 ); | 1148 | date = date.addDays( 7 ); |
1147 | } | 1149 | } |
1148 | updateView(); | 1150 | updateView(); |
1149 | } | 1151 | } |
1150 | 1152 | ||
1151 | void KOMonthView::showEvents(QPtrList<Event>) | 1153 | void KOMonthView::showEvents(QPtrList<Event>) |
1152 | { | 1154 | { |
1153 | qDebug("KOMonthView::selectEvents is not implemented yet. "); | 1155 | qDebug("KOMonthView::selectEvents is not implemented yet. "); |
1154 | } | 1156 | } |
1155 | 1157 | ||
1156 | void KOMonthView::changeEventDisplay(Event *, int) | 1158 | void KOMonthView::changeEventDisplay(Event *, int) |
1157 | { | 1159 | { |
1158 | // this should be re-written to be much more efficient, but this | 1160 | // this should be re-written to be much more efficient, but this |
1159 | // quick-and-dirty-hack gets the job done for right now. | 1161 | // quick-and-dirty-hack gets the job done for right now. |
1160 | updateView(); | 1162 | updateView(); |
1161 | } | 1163 | } |
1162 | 1164 | ||
1163 | void KOMonthView::updateView() | 1165 | void KOMonthView::updateView() |
1164 | { | 1166 | { |
1165 | 1167 | ||
1166 | if ( !updatePossible ) | 1168 | if ( !updatePossible ) |
1167 | return; | 1169 | return; |
1168 | //QTime ti; | 1170 | //QTime ti; |
1169 | //ti.start(); | 1171 | //ti.start(); |
1170 | QPtrVector<MonthViewCell> *cells; | 1172 | QPtrVector<MonthViewCell> *cells; |
1171 | if ( mShowWeekView ) { | 1173 | if ( mShowWeekView ) { |
1172 | cells = &mCellsW; | 1174 | cells = &mCellsW; |
1173 | } else { | 1175 | } else { |
1174 | cells = &mCells; | 1176 | cells = &mCells; |
1175 | } | 1177 | } |
1176 | #if 1 | 1178 | #if 1 |
1177 | int i; | 1179 | int i; |
1178 | int timeSpan = (*cells).size()-1; | 1180 | int timeSpan = (*cells).size()-1; |
1179 | if ( KOPrefs::instance()->mMonthViewWeek ) | 1181 | if ( KOPrefs::instance()->mMonthViewWeek ) |
1180 | timeSpan = 6; | 1182 | timeSpan = 6; |
1181 | for( i = 0; i < timeSpan + 1; ++i ) { | 1183 | for( i = 0; i < timeSpan + 1; ++i ) { |
1182 | (*cells)[i]->startUpdateCell(); | 1184 | (*cells)[i]->startUpdateCell(); |
1183 | } | 1185 | } |
1184 | 1186 | ||
1185 | QPtrList<Event> events = calendar()->events(); | 1187 | QPtrList<Event> events = calendar()->events(); |
1186 | Event *event; | 1188 | Event *event; |
1187 | QDateTime dt; | 1189 | QDateTime dt; |
1188 | bool ok; | 1190 | bool ok; |
1189 | QDate endDate = mStartDate.addDays( timeSpan ); | 1191 | QDate endDate = mStartDate.addDays( timeSpan ); |
1190 | for( event = events.first(); event; event = events.next() ) { // for event | 1192 | for( event = events.first(); event; event = events.next() ) { // for event |
1191 | if ( event->doesRecur() ) { | 1193 | if ( event->doesRecur() ) { |
1192 | bool last; | 1194 | bool last; |
1193 | QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last ); | 1195 | QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last ); |
1194 | QDateTime incidenceEnd; | 1196 | QDateTime incidenceEnd; |
1195 | int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() ); | 1197 | int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() ); |
1196 | bool invalid = false; | 1198 | bool invalid = false; |
1197 | while( true ) { | 1199 | while( true ) { |
1198 | if ( incidenceStart.isValid() ) { | 1200 | if ( incidenceStart.isValid() ) { |
1199 | incidenceEnd = incidenceStart.addDays( eventlen ); | 1201 | incidenceEnd = incidenceStart.addDays( eventlen ); |
1200 | int st = incidenceStart.date().daysTo( endDate ); | 1202 | int st = incidenceStart.date().daysTo( endDate ); |
1201 | if ( st >= 0 ) { // start before timeend | 1203 | if ( st >= 0 ) { // start before timeend |
1202 | int end = mStartDate.daysTo( incidenceEnd.date() ); | 1204 | int end = mStartDate.daysTo( incidenceEnd.date() ); |
1203 | if ( end >= 0 ) { // end after timestart --- got one! | 1205 | if ( end >= 0 ) { // end after timestart --- got one! |
1204 | //normalize | 1206 | //normalize |
1205 | st = timeSpan - st; | 1207 | st = timeSpan - st; |
1206 | if ( st < 0 ) st = 0; | 1208 | if ( st < 0 ) st = 0; |
1207 | if ( end > timeSpan ) end = timeSpan; | 1209 | if ( end > timeSpan ) end = timeSpan; |
1208 | int iii; | 1210 | int iii; |
1209 | //qDebug("found %s %d %d ",event->summary().latin1(), st, end ); | 1211 | //qDebug("found %s %d %d ",event->summary().latin1(), st, end ); |
1210 | for ( iii = st;iii<= end;++iii) | 1212 | for ( iii = st;iii<= end;++iii) |
1211 | (*cells)[iii]->insertEvent( event ); | 1213 | (*cells)[iii]->insertEvent( event ); |
1212 | } | 1214 | } |
1213 | } | 1215 | } |
1214 | } else { | 1216 | } else { |
1215 | if ( invalid ) | 1217 | if ( invalid ) |
1216 | break; | 1218 | break; |
1217 | invalid = true; | 1219 | invalid = true; |
1218 | //qDebug("invalid %s", event->summary().latin1()); | 1220 | //qDebug("invalid %s", event->summary().latin1()); |
1219 | incidenceStart = QDateTime( mStartDate ).addSecs( -2 );; | 1221 | incidenceStart = QDateTime( mStartDate ).addSecs( -2 );; |
1220 | } | 1222 | } |
1221 | if ( last ) | 1223 | if ( last ) |
1222 | break; | 1224 | break; |
1223 | bool ok; | 1225 | bool ok; |
1224 | incidenceStart = event->getNextOccurence( incidenceStart.addSecs( 1 ) ,&ok ); | 1226 | incidenceStart = event->getNextOccurence( incidenceStart.addSecs( 1 ) ,&ok ); |
1225 | if ( ! ok ) | 1227 | if ( ! ok ) |
1226 | break; | 1228 | break; |
1227 | if ( incidenceStart.date() > endDate ) | 1229 | if ( incidenceStart.date() > endDate ) |
1228 | break; | 1230 | break; |
1229 | } | 1231 | } |
1230 | } else { // no recur | 1232 | } else { // no recur |
1231 | int st = event->dtStart().date().daysTo( endDate ); | 1233 | int st = event->dtStart().date().daysTo( endDate ); |
1232 | if ( st >= 0 ) { // start before timeend | 1234 | if ( st >= 0 ) { // start before timeend |
1233 | int end = mStartDate.daysTo( event->dtEnd().date() ); | 1235 | int end = mStartDate.daysTo( event->dtEnd().date() ); |
1234 | if ( end >= 0 ) { // end after timestart --- got one! | 1236 | if ( end >= 0 ) { // end after timestart --- got one! |
1235 | //normalize | 1237 | //normalize |
1236 | st = timeSpan - st; | 1238 | st = timeSpan - st; |
1237 | if ( st < 0 ) st = 0; | 1239 | if ( st < 0 ) st = 0; |
1238 | if ( end > timeSpan ) end = timeSpan; | 1240 | if ( end > timeSpan ) end = timeSpan; |
1239 | int iii; | 1241 | int iii; |
1240 | for ( iii = st;iii<= end;++iii) | 1242 | for ( iii = st;iii<= end;++iii) |
1241 | (*cells)[iii]->insertEvent( event ); | 1243 | (*cells)[iii]->insertEvent( event ); |
1242 | } | 1244 | } |
1243 | } | 1245 | } |
1244 | } | 1246 | } |
1245 | } | 1247 | } |
1246 | // insert due todos | 1248 | // insert due todos |
1247 | QPtrList<Todo> todos = calendar()->todos( ); | 1249 | QPtrList<Todo> todos = calendar()->todos( ); |
1248 | Todo *todo; | 1250 | Todo *todo; |
1249 | for(todo = todos.first(); todo; todo = todos.next()) { | 1251 | for(todo = todos.first(); todo; todo = todos.next()) { |
1250 | //insertTodo( todo ); | 1252 | //insertTodo( todo ); |
1251 | if ( todo->hasDueDate() ) { | 1253 | if ( todo->hasDueDate() ) { |
1252 | int day = mStartDate.daysTo( todo->dtDue().date() ); | 1254 | int day = mStartDate.daysTo( todo->dtDue().date() ); |
1253 | if ( day >= 0 && day < timeSpan + 1) { | 1255 | if ( day >= 0 && day < timeSpan + 1) { |
1254 | (*cells)[day]->insertTodo( todo ); | 1256 | (*cells)[day]->insertTodo( todo ); |
1255 | } | 1257 | } |
1256 | } | 1258 | } |
1257 | } | 1259 | } |
1258 | 1260 | ||
1259 | for( i = 0; i < timeSpan+1; ++i ) { | 1261 | for( i = 0; i < timeSpan+1; ++i ) { |
1260 | (*cells)[i]->finishUpdateCell(); | 1262 | (*cells)[i]->finishUpdateCell(); |
1261 | } | 1263 | } |
1262 | processSelectionChange(); | 1264 | processSelectionChange(); |
1263 | (*cells)[0]->setFocus(); | 1265 | (*cells)[0]->setFocus(); |
1264 | 1266 | ||
1265 | 1267 | ||
1266 | #else | 1268 | #else |
1267 | // old code | 1269 | // old code |
1268 | //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "); | 1270 | //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "); |
1269 | int i; | 1271 | int i; |
1270 | for( i = 0; i < (*cells).count(); ++i ) { | 1272 | for( i = 0; i < (*cells).count(); ++i ) { |
1271 | (*cells)[i]->updateCell(); | 1273 | (*cells)[i]->updateCell(); |
1272 | } | 1274 | } |
1273 | 1275 | ||
1274 | //qDebug("KOMonthView::updateView() "); | 1276 | //qDebug("KOMonthView::updateView() "); |
1275 | processSelectionChange(); | 1277 | processSelectionChange(); |
1276 | // qDebug("---------------------------------------------------------------------+ "); | 1278 | // qDebug("---------------------------------------------------------------------+ "); |
1277 | (*cells)[0]->setFocus(); | 1279 | (*cells)[0]->setFocus(); |
1278 | #endif | 1280 | #endif |
1279 | 1281 | ||
1280 | //qDebug("update time %d ", ti.elapsed()); | 1282 | //qDebug("update time %d ", ti.elapsed()); |
1281 | } | 1283 | } |
1282 | 1284 | ||
1283 | void KOMonthView::resizeEvent(QResizeEvent * e) | 1285 | void KOMonthView::resizeEvent(QResizeEvent * e) |
1284 | { | 1286 | { |
1285 | //qDebug("KOMonthView::resizeEvent %d %d -- %d %d ", e->size().width(), e->size().height(), e->oldSize().width(), e->oldSize().height()); | 1287 | //qDebug("KOMonthView::resizeEvent %d %d -- %d %d ", e->size().width(), e->size().height(), e->oldSize().width(), e->oldSize().height()); |
1286 | computeLayout(); | 1288 | computeLayout(); |
1287 | clPending = true; | 1289 | clPending = true; |
1288 | if ( mShowWeekView ) | 1290 | if ( mShowWeekView ) |
1289 | mCellsW[0]->setFocus(); | 1291 | mCellsW[0]->setFocus(); |
1290 | else | 1292 | else |
1291 | mCells[0]->setFocus(); | 1293 | mCells[0]->setFocus(); |
1292 | } | 1294 | } |
1293 | void KOMonthView::computeLayoutWeek() | 1295 | void KOMonthView::computeLayoutWeek() |
1294 | { | 1296 | { |
1295 | static int lastWid = 0; | 1297 | static int lastWid = 0; |
1296 | static int lastHei = 0; | 1298 | static int lastHei = 0; |
1297 | int daysToShow; | 1299 | int daysToShow; |
1298 | bool combinedSatSun = false; | 1300 | bool combinedSatSun = false; |
1299 | if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { | 1301 | if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { |
1300 | daysToShow = 6; | 1302 | daysToShow = 6; |
1301 | combinedSatSun = true; | 1303 | combinedSatSun = true; |
1302 | } | 1304 | } |
1303 | int tWid = topLevelWidget()->size().width(); | 1305 | int tWid = topLevelWidget()->size().width(); |
1304 | int tHei = topLevelWidget()->size().height(); | 1306 | int tHei = topLevelWidget()->size().height(); |
1305 | 1307 | ||
1306 | int wid = width();//e | 1308 | int wid = width();//e |
1307 | int hei = height()-1-mNavigatorBar->height(); | 1309 | int hei = height()-1-mNavigatorBar->height(); |
1308 | 1310 | ||
1309 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) | 1311 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) |
1310 | return; | 1312 | return; |
1311 | 1313 | ||
1312 | if ( lastWid == width() && lastHei == height() ) | 1314 | if ( lastWid == width() && lastHei == height() ) |
1313 | return; | 1315 | return; |
1314 | lastWid = width(); | 1316 | lastWid = width(); |
1315 | lastHei = height(); | 1317 | lastHei = height(); |
1316 | 1318 | ||
1317 | 1319 | ||
1318 | if ( wid < hei ) | 1320 | if ( wid < hei ) |
1319 | daysToShow = 2; | 1321 | daysToShow = 2; |
1320 | else | 1322 | else |
1321 | daysToShow = 3; | 1323 | daysToShow = 3; |
1322 | mShowSatSunComp = true; | 1324 | mShowSatSunComp = true; |
1323 | combinedSatSun = true; | 1325 | combinedSatSun = true; |
1324 | 1326 | ||
1325 | //qDebug("KOMonthView::computeLayout() WWW ------------------------------------ "); | 1327 | //qDebug("KOMonthView::computeLayout() WWW ------------------------------------ "); |
1326 | QFontMetrics fm ( mWeekLabels[0]->font() ); | 1328 | QFontMetrics fm ( mWeekLabels[0]->font() ); |
1327 | int weeklabelwid = fm.width( "888" ); | 1329 | int weeklabelwid = fm.width( "888" ); |
1328 | wid -= weeklabelwid; | 1330 | wid -= weeklabelwid; |
1329 | 1331 | ||
1330 | int colWid = wid / daysToShow; | 1332 | int colWid = wid / daysToShow; |
1331 | int lastCol = wid - ( colWid*6 ); | 1333 | int lastCol = wid - ( colWid*6 ); |
1332 | int dayLabelHei = mDayLabelsW[0]->sizeHint().height(); | 1334 | int dayLabelHei = mDayLabelsW[0]->sizeHint().height(); |
1333 | int cellHei = (hei - (5- daysToShow )*dayLabelHei) /(5- daysToShow ); | 1335 | int cellHei = (hei - (5- daysToShow )*dayLabelHei) /(5- daysToShow ); |
1334 | int colModulo = wid % daysToShow; | 1336 | int colModulo = wid % daysToShow; |
1335 | int rowModulo = (hei- (5- daysToShow )*dayLabelHei) % daysToShow-1; | 1337 | int rowModulo = (hei- (5- daysToShow )*dayLabelHei) % daysToShow-1; |
1336 | //qDebug("rowmod %d ", rowModulo); | 1338 | //qDebug("rowmod %d ", rowModulo); |
1337 | int i; | 1339 | int i; |
1338 | int x,y,w,h; | 1340 | int x,y,w,h; |
1339 | x= 0; | 1341 | x= 0; |
1340 | y= 0; | 1342 | y= 0; |
1341 | w = colWid; | 1343 | w = colWid; |
1342 | h = dayLabelHei ; | 1344 | h = dayLabelHei ; |
1343 | for ( i = 0; i < 7; i++) { | 1345 | for ( i = 0; i < 7; i++) { |
1344 | if ( i && !( i % daysToShow) && i < 6) { | 1346 | if ( i && !( i % daysToShow) && i < 6) { |
1345 | y += hei/(5-daysToShow); | 1347 | y += hei/(5-daysToShow); |
1346 | x = 0; | 1348 | x = 0; |
1347 | w = colWid; | 1349 | w = colWid; |
1348 | } | 1350 | } |
1349 | if ( ((i) % daysToShow) >= daysToShow-colModulo ) { | 1351 | if ( ((i) % daysToShow) >= daysToShow-colModulo ) { |
1350 | ++w; | 1352 | ++w; |
1351 | } | 1353 | } |
1352 | if ( i >= 5 ) { | 1354 | if ( i >= 5 ) { |
1353 | mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,w/2+w%2,h); | 1355 | mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,w/2+w%2,h); |
1354 | x -= (w/2 ); | 1356 | x -= (w/2 ); |
1355 | } | 1357 | } |
1356 | else | 1358 | else |
1357 | mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,w,h); | 1359 | mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,w,h); |
1358 | x += w; | 1360 | x += w; |
1359 | } | 1361 | } |
1360 | x= 0; | 1362 | x= 0; |
1361 | y= dayLabelHei; | 1363 | y= dayLabelHei; |
1362 | w = colWid; | 1364 | w = colWid; |
1363 | h = cellHei; | 1365 | h = cellHei; |
1364 | for ( i = 0; i < mCellsW.count(); ++i) { | 1366 | for ( i = 0; i < mCellsW.count(); ++i) { |
1365 | if ( i > 6 ) { | 1367 | if ( i > 6 ) { |
1366 | mCellsW[i]->hide(); | 1368 | mCellsW[i]->hide(); |
1367 | continue; | 1369 | continue; |
1368 | } | 1370 | } |
1369 | 1371 | ||
1370 | w = colWid; | 1372 | w = colWid; |
1371 | if ( ((i) % daysToShow) >= daysToShow-colModulo ) { | 1373 | if ( ((i) % daysToShow) >= daysToShow-colModulo ) { |
1372 | ++w; | 1374 | ++w; |
1373 | } | 1375 | } |
1374 | if ( i == (daysToShow-1-rowModulo)*7) | 1376 | if ( i == (daysToShow-1-rowModulo)*7) |
1375 | ++h; | 1377 | ++h; |
1376 | 1378 | ||
1377 | if ( i >= 5 ) { | 1379 | if ( i >= 5 ) { |
1378 | if ( i ==5 ) { | 1380 | if ( i ==5 ) { |
1379 | mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h/2 ); | 1381 | mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h/2 ); |
1380 | x -= w ;y += h/2; | 1382 | x -= w ;y += h/2; |
1381 | } else { | 1383 | } else { |
1382 | if ( ((i-1) % daysToShow) >= daysToShow-colModulo ) { | 1384 | if ( ((i-1) % daysToShow) >= daysToShow-colModulo ) { |
1383 | ++w; | 1385 | ++w; |
1384 | } | 1386 | } |
1385 | mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 ); | 1387 | mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 ); |
1386 | y -= h/2; | 1388 | y -= h/2; |
1387 | } | 1389 | } |
1388 | } else | 1390 | } else |
1389 | mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h ); | 1391 | mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h ); |
1390 | 1392 | ||
1391 | 1393 | ||
1392 | x += w; | 1394 | x += w; |
1393 | if ( x + w/2 > wid ) { | 1395 | if ( x + w/2 > wid ) { |
1394 | x = 0; | 1396 | x = 0; |
1395 | y += h+dayLabelHei ; | 1397 | y += h+dayLabelHei ; |
1396 | } | 1398 | } |
1397 | } | 1399 | } |
1398 | y= dayLabelHei; | 1400 | y= dayLabelHei; |
1399 | h = cellHei ; | 1401 | h = cellHei ; |
1400 | mWeekLabelsW[0]->setGeometry( 0,y,weeklabelwid,hei-dayLabelHei); | 1402 | mWeekLabelsW[0]->setGeometry( 0,y,weeklabelwid,hei-dayLabelHei); |
1401 | mWeekLabelsW[1]->setGeometry( 0,0,weeklabelwid,dayLabelHei); | 1403 | mWeekLabelsW[1]->setGeometry( 0,0,weeklabelwid,dayLabelHei); |
1402 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); | 1404 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); |
1403 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); | 1405 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); |
1404 | mShortDayLabelsW = mDayLabelsW[0]->width()-2 < mWidthLongDayLabel ; | 1406 | mShortDayLabelsW = mDayLabelsW[0]->width()-2 < mWidthLongDayLabel ; |
1405 | updateDayLabels(); | 1407 | updateDayLabels(); |
1406 | //bool forceUpdate = !updatePossible; | 1408 | //bool forceUpdate = !updatePossible; |
1407 | updatePossible = true; | 1409 | updatePossible = true; |
1408 | //mWeekLabels[mNumWeeks]->setText( i18n("M")); | 1410 | //mWeekLabels[mNumWeeks]->setText( i18n("M")); |
1409 | //if ( forceUpdate ) | 1411 | //if ( forceUpdate ) |
1410 | // updateView(); | 1412 | // updateView(); |
1411 | } | 1413 | } |
1412 | void KOMonthView::computeLayout() | 1414 | void KOMonthView::computeLayout() |
1413 | { | 1415 | { |
1414 | 1416 | ||
1415 | 1417 | ||
1416 | static int lastWid = 0; | 1418 | static int lastWid = 0; |
1417 | static int lastHei = 0; | 1419 | static int lastHei = 0; |
1418 | 1420 | ||
1419 | if ( mShowWeekView ){ | 1421 | if ( mShowWeekView ){ |
1420 | computeLayoutWeek(); | 1422 | computeLayoutWeek(); |
1421 | return; | 1423 | return; |
1422 | } | 1424 | } |
1423 | int daysToShow = 7; | 1425 | int daysToShow = 7; |
1424 | bool combinedSatSun = false; | 1426 | bool combinedSatSun = false; |
1425 | if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { | 1427 | if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { |
1426 | daysToShow = 6; | 1428 | daysToShow = 6; |
1427 | combinedSatSun = true; | 1429 | combinedSatSun = true; |
1428 | } | 1430 | } |
1429 | int tWid = topLevelWidget()->size().width(); | 1431 | int tWid = topLevelWidget()->size().width(); |
1430 | int tHei = topLevelWidget()->size().height(); | 1432 | int tHei = topLevelWidget()->size().height(); |
1431 | 1433 | ||
1432 | int wid = width();//e | 1434 | int wid = width();//e |
1433 | int hei = height()-1-mNavigatorBar->height(); | 1435 | int hei = height()-1-mNavigatorBar->height(); |
1434 | 1436 | ||
1435 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) { | 1437 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) { |
1436 | return; | 1438 | return; |
1437 | } | 1439 | } |
1438 | if ( lastWid == width() && lastHei == height() ){ | 1440 | if ( lastWid == width() && lastHei == height() ){ |
1439 | return; | 1441 | return; |
1440 | } | 1442 | } |
1441 | 1443 | ||
1442 | lastWid = width(); | 1444 | lastWid = width(); |
1443 | lastHei = height(); | 1445 | lastHei = height(); |
1444 | //qDebug("KOMonthView::computeLayout() MMM ------------------------------------ "); | 1446 | //qDebug("KOMonthView::computeLayout() MMM ------------------------------------ "); |
1445 | QFontMetrics fm ( mWeekLabels[0]->font() ); | 1447 | QFontMetrics fm ( mWeekLabels[0]->font() ); |
1446 | int weeklabelwid = fm.width( "888" ); | 1448 | int weeklabelwid = fm.width( "888" ); |
1447 | wid -= weeklabelwid; | 1449 | wid -= weeklabelwid; |
1448 | 1450 | ||
1449 | int colWid = wid / daysToShow; | 1451 | int colWid = wid / daysToShow; |
1450 | int lastCol = wid - ( colWid*6 ); | 1452 | int lastCol = wid - ( colWid*6 ); |
1451 | int dayLabelHei = mDayLabels[0]->sizeHint().height(); | 1453 | int dayLabelHei = mDayLabels[0]->sizeHint().height(); |
1452 | int cellHei = (hei - dayLabelHei) /6; | 1454 | int cellHei = (hei - dayLabelHei) /6; |
1453 | int colModulo = wid % daysToShow; | 1455 | int colModulo = wid % daysToShow; |
1454 | int rowModulo = (hei- dayLabelHei) % 6; | 1456 | int rowModulo = (hei- dayLabelHei) % 6; |
1455 | //qDebug("rowmod %d ", rowModulo); | 1457 | //qDebug("rowmod %d ", rowModulo); |
1456 | int i; | 1458 | int i; |
1457 | int x,y,w,h; | 1459 | int x,y,w,h; |
1458 | x= 0; | 1460 | x= 0; |
1459 | y= 0; | 1461 | y= 0; |
1460 | w = colWid; | 1462 | w = colWid; |
1461 | h = dayLabelHei ; | 1463 | h = dayLabelHei ; |
1462 | for ( i = 0; i < 7; i++) { | 1464 | for ( i = 0; i < 7; i++) { |
1463 | if ( i == daysToShow-colModulo ) | 1465 | if ( i == daysToShow-colModulo ) |
1464 | ++w; | 1466 | ++w; |
1465 | if ( combinedSatSun ) { | 1467 | if ( combinedSatSun ) { |
1466 | if ( i >= daysToShow-1 ) { | 1468 | if ( i >= daysToShow-1 ) { |
1467 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2,h); | 1469 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2,h); |
1468 | x -= w/2 ; | 1470 | x -= w/2 ; |
1469 | } | 1471 | } |
1470 | else | 1472 | else |
1471 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); | 1473 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); |
1472 | } else | 1474 | } else |
1473 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); | 1475 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); |
1474 | x += w; | 1476 | x += w; |
1475 | } | 1477 | } |
1476 | x= 0; | 1478 | x= 0; |
1477 | y= dayLabelHei; | 1479 | y= dayLabelHei; |
1478 | w = colWid; | 1480 | w = colWid; |
1479 | h = cellHei ; | 1481 | h = cellHei ; |
1480 | for ( i = 0; i < mCells.count(); ++i) { | 1482 | for ( i = 0; i < mCells.count(); ++i) { |
1481 | //qDebug("iii %d ", i); | 1483 | //qDebug("iii %d ", i); |
1482 | w = colWid; | 1484 | w = colWid; |
1483 | if ( ((i) % 7) >= 7-colModulo ) { | 1485 | if ( ((i) % 7) >= 7-colModulo ) { |
1484 | ++w; | 1486 | ++w; |
1485 | } | 1487 | } |
1486 | if ( i == (6-rowModulo)*7) | 1488 | if ( i == (6-rowModulo)*7) |
1487 | ++h; | 1489 | ++h; |
1488 | if ( combinedSatSun ) { | 1490 | if ( combinedSatSun ) { |
1489 | if ( (i)%7 >= daysToShow-1 ) { | 1491 | if ( (i)%7 >= daysToShow-1 ) { |
1490 | if ( (i)%7 == daysToShow-1 ) { | 1492 | if ( (i)%7 == daysToShow-1 ) { |
1491 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h/2 ); | 1493 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h/2 ); |
1492 | x -= w ;y += h/2; | 1494 | x -= w ;y += h/2; |
1493 | } else { | 1495 | } else { |
1494 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 ); | 1496 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 ); |
1495 | y -= h/2; | 1497 | y -= h/2; |
1496 | } | 1498 | } |
1497 | } else | 1499 | } else |
1498 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); | 1500 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); |
1499 | 1501 | ||
1500 | } | 1502 | } |
1501 | else | 1503 | else |
1502 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); | 1504 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); |
1503 | x += w; | 1505 | x += w; |
1504 | if ( x + w/2 > wid ) { | 1506 | if ( x + w/2 > wid ) { |
1505 | x = 0; | 1507 | x = 0; |
1506 | y += h; | 1508 | y += h; |
1507 | } | 1509 | } |
1508 | } | 1510 | } |
1509 | y= dayLabelHei; | 1511 | y= dayLabelHei; |
1510 | h = cellHei ; | 1512 | h = cellHei ; |
1511 | for ( i = 0; i < 6; i++) { | 1513 | for ( i = 0; i < 6; i++) { |
1512 | if ( i == (6-rowModulo)) | 1514 | if ( i == (6-rowModulo)) |
1513 | ++h; | 1515 | ++h; |
1514 | mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h); | 1516 | mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h); |
1515 | y += h; | 1517 | y += h; |
1516 | } | 1518 | } |
1517 | mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); | 1519 | mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); |
1518 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); | 1520 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); |
1519 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); | 1521 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); |
1520 | mShortDayLabelsM = mDayLabels[0]->width()-2 < mWidthLongDayLabel ; | 1522 | mShortDayLabelsM = mDayLabels[0]->width()-2 < mWidthLongDayLabel ; |
1521 | updateDayLabels(); | 1523 | updateDayLabels(); |
1522 | //bool forceUpdate = !updatePossible; | 1524 | //bool forceUpdate = !updatePossible; |
1523 | updatePossible = true; | 1525 | updatePossible = true; |
1524 | //mWeekLabels[mNumWeeks]->setText( i18n("W")); | 1526 | //mWeekLabels[mNumWeeks]->setText( i18n("W")); |
1525 | } | 1527 | } |
1526 | 1528 | ||
1527 | void KOMonthView::showContextMenu( Incidence *incidence ) | 1529 | void KOMonthView::showContextMenu( Incidence *incidence ) |
1528 | { | 1530 | { |
1529 | mContextMenu->showIncidencePopup(incidence); | 1531 | mContextMenu->showIncidencePopup(incidence); |
1530 | /* | 1532 | /* |
1531 | if( incidence && incidence->type() == "Event" ) { | 1533 | if( incidence && incidence->type() == "Event" ) { |
1532 | Event *event = static_cast<Event *>(incidence); | 1534 | Event *event = static_cast<Event *>(incidence); |
1533 | mContextMenu->showEventPopup(event); | 1535 | mContextMenu->showEventPopup(event); |
1534 | } else { | 1536 | } else { |
1535 | kdDebug() << "MonthView::showContextMenu(): cast failed." << endl; | 1537 | kdDebug() << "MonthView::showContextMenu(): cast failed." << endl; |
1536 | } | 1538 | } |
1537 | */ | 1539 | */ |
1538 | } | 1540 | } |
1539 | MonthViewCell * KOMonthView::selectedCell( ) | 1541 | MonthViewCell * KOMonthView::selectedCell( ) |
1540 | { | 1542 | { |
1541 | return mSelectedCell; | 1543 | return mSelectedCell; |
1542 | } | 1544 | } |
1543 | void KOMonthView::setSelectedCell( MonthViewCell *cell ) | 1545 | void KOMonthView::setSelectedCell( MonthViewCell *cell ) |
1544 | { | 1546 | { |
1545 | // qDebug("KOMonthView::setSelectedCell "); | 1547 | // qDebug("KOMonthView::setSelectedCell "); |
1546 | if ( mSelectedCell && mSelectedCell != cell ) { | 1548 | if ( mSelectedCell && mSelectedCell != cell ) { |
1547 | MonthViewCell * mvc = mSelectedCell; | 1549 | MonthViewCell * mvc = mSelectedCell; |
1548 | mSelectedCell = cell; | 1550 | mSelectedCell = cell; |
1549 | mvc->deselect(); | 1551 | mvc->deselect(); |
1550 | } else | 1552 | } else |
1551 | mSelectedCell = cell; | 1553 | mSelectedCell = cell; |
1552 | // if ( mSelectedCell ) | 1554 | // if ( mSelectedCell ) |
1553 | // mSelectedCell->select(); | 1555 | // mSelectedCell->select(); |
1554 | if ( !mSelectedCell ) | 1556 | if ( !mSelectedCell ) |
1555 | emit incidenceSelected( 0 ); | 1557 | emit incidenceSelected( 0 ); |
1556 | else | 1558 | else |
1557 | emit incidenceSelected( mSelectedCell->selectedIncidence() ); | 1559 | emit incidenceSelected( mSelectedCell->selectedIncidence() ); |
1558 | } | 1560 | } |
1559 | 1561 | ||
1560 | void KOMonthView::processSelectionChange() | 1562 | void KOMonthView::processSelectionChange() |
1561 | { | 1563 | { |
1562 | QPtrList<Incidence> incidences = selectedIncidences(); | 1564 | QPtrList<Incidence> incidences = selectedIncidences(); |
1563 | if (incidences.count() > 0) { | 1565 | if (incidences.count() > 0) { |
1564 | emit incidenceSelected( incidences.first() ); | 1566 | emit incidenceSelected( incidences.first() ); |
1565 | } else { | 1567 | } else { |
1566 | emit incidenceSelected( 0 ); | 1568 | emit incidenceSelected( 0 ); |
1567 | } | 1569 | } |
1568 | } | 1570 | } |
1569 | 1571 | ||
1570 | void KOMonthView::clearSelection() | 1572 | void KOMonthView::clearSelection() |
1571 | { | 1573 | { |
1572 | if ( mSelectedCell ) { | 1574 | if ( mSelectedCell ) { |
1573 | mSelectedCell->deselect(); | 1575 | mSelectedCell->deselect(); |
1574 | mSelectedCell = 0; | 1576 | mSelectedCell = 0; |
1575 | } | 1577 | } |
1576 | } | 1578 | } |
1577 | void KOMonthView::keyPressEvent ( QKeyEvent * e ) | 1579 | void KOMonthView::keyPressEvent ( QKeyEvent * e ) |
1578 | { | 1580 | { |
1579 | //qDebug("KOMonthView::keyPressEvent "); | 1581 | //qDebug("KOMonthView::keyPressEvent "); |
1580 | switch(e->key()) { | 1582 | switch(e->key()) { |
1581 | case Key_Up: | 1583 | case Key_Up: |
1582 | { | 1584 | { |
1583 | emit prevMonth(); | 1585 | emit prevMonth(); |
1584 | if ( mShowWeekView ) | 1586 | if ( mShowWeekView ) |
1585 | mCellsW[0]->setFocus(); | 1587 | mCellsW[0]->setFocus(); |
1586 | else | 1588 | else |
1587 | mCells[0]->setFocus(); | 1589 | mCells[0]->setFocus(); |
1588 | } | 1590 | } |
1589 | e->accept(); | 1591 | e->accept(); |
1590 | break; | 1592 | break; |
1591 | case Key_Down: | 1593 | case Key_Down: |
1592 | { | 1594 | { |
1593 | emit nextMonth(); | 1595 | emit nextMonth(); |
1594 | if ( mShowWeekView ) | 1596 | if ( mShowWeekView ) |
1595 | mCellsW[0]->setFocus(); | 1597 | mCellsW[0]->setFocus(); |
1596 | else | 1598 | else |
1597 | mCells[0]->setFocus(); | 1599 | mCells[0]->setFocus(); |
1598 | 1600 | ||
1599 | } | 1601 | } |
1600 | e->accept(); | 1602 | e->accept(); |
1601 | break; | 1603 | break; |
1602 | case Key_Return: | 1604 | case Key_Return: |
1603 | case Key_Enter: | 1605 | case Key_Enter: |
1604 | { | 1606 | { |
1605 | selectInternalWeekNum ( currentWeek() ); | 1607 | selectInternalWeekNum ( currentWeek() ); |
1606 | } | 1608 | } |
1607 | e->accept(); | 1609 | e->accept(); |
1608 | break; | 1610 | break; |
1609 | default: | 1611 | default: |
1610 | e->ignore(); | 1612 | e->ignore(); |
1611 | break; | 1613 | break; |
1612 | } | 1614 | } |
1613 | } | 1615 | } |
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h index 03f9dc6..2f6f5dc 100644 --- a/korganizer/komonthview.h +++ b/korganizer/komonthview.h | |||
@@ -1,298 +1,299 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #ifndef _KOMONTHVIEW_H | 20 | #ifndef _KOMONTHVIEW_H |
21 | #define _KOMONTHVIEW_H | 21 | #define _KOMONTHVIEW_H |
22 | 22 | ||
23 | #include <qlabel.h> | 23 | #include <qlabel.h> |
24 | #include <qframe.h> | 24 | #include <qframe.h> |
25 | #include <qdatetime.h> | 25 | #include <qdatetime.h> |
26 | #include <qlistbox.h> | 26 | #include <qlistbox.h> |
27 | #include <qpoint.h> | 27 | #include <qpoint.h> |
28 | #include <qwidgetstack.h> | 28 | #include <qwidgetstack.h> |
29 | #include <qlayout.h> | 29 | #include <qlayout.h> |
30 | #include <qintdict.h> | 30 | #include <qintdict.h> |
31 | #include <qpushbutton.h> | 31 | #include <qpushbutton.h> |
32 | #include <qvaluelist.h> | 32 | #include <qvaluelist.h> |
33 | #include <qptrvector.h> | 33 | #include <qptrvector.h> |
34 | 34 | ||
35 | #include <libkcal/calendar.h> | 35 | #include <libkcal/calendar.h> |
36 | #include <libkcal/event.h> | 36 | #include <libkcal/event.h> |
37 | 37 | ||
38 | #include "koeventview.h" | 38 | #include "koeventview.h" |
39 | #include "navigatorbar.h" | 39 | #include "navigatorbar.h" |
40 | 40 | ||
41 | #ifdef DESKTOP_VERSION | 41 | #ifdef DESKTOP_VERSION |
42 | class QToolTipGroup; | 42 | class QToolTipGroup; |
43 | #endif | 43 | #endif |
44 | 44 | ||
45 | class KNOWhatsThis; | 45 | class KNOWhatsThis; |
46 | class KOWeekButton : public QPushButton | 46 | class KOWeekButton : public QPushButton |
47 | { | 47 | { |
48 | Q_OBJECT | 48 | Q_OBJECT |
49 | public: | 49 | public: |
50 | KOWeekButton( QWidget *parent=0, const char *name=0 ) : | 50 | KOWeekButton( QWidget *parent=0, const char *name=0 ) : |
51 | QPushButton( parent, name) | 51 | QPushButton( parent, name) |
52 | { | 52 | { |
53 | connect( this, SIGNAL( clicked() ), | 53 | connect( this, SIGNAL( clicked() ), |
54 | SLOT( bottonClicked() )); | 54 | SLOT( bottonClicked() )); |
55 | mNumber = -1; | 55 | mNumber = -1; |
56 | } | 56 | } |
57 | void setWeekNum ( int num ) {mNumber = num; setText( QString::number ( num ));} | 57 | void setWeekNum ( int num ) {mNumber = num; setText( QString::number ( num ));} |
58 | int getWeekNum() { return mNumber;} | 58 | int getWeekNum() { return mNumber;} |
59 | signals: | 59 | signals: |
60 | void selectWeekNum ( int ); | 60 | void selectWeekNum ( int ); |
61 | private: | 61 | private: |
62 | int mNumber; | 62 | int mNumber; |
63 | private slots : | 63 | private slots : |
64 | void bottonClicked() { if ( mNumber > 0 ) emit selectWeekNum ( mNumber ); } | 64 | void bottonClicked() { if ( mNumber > 0 ) emit selectWeekNum ( mNumber ); } |
65 | }; | 65 | }; |
66 | 66 | ||
67 | class KNoScrollListBox: public QListBox | 67 | class KNoScrollListBox: public QListBox |
68 | { | 68 | { |
69 | Q_OBJECT | 69 | Q_OBJECT |
70 | public: | 70 | public: |
71 | KNoScrollListBox(QWidget *parent=0, const char *name=0); | 71 | KNoScrollListBox(QWidget *parent=0, const char *name=0); |
72 | ~KNoScrollListBox(); | 72 | ~KNoScrollListBox(); |
73 | QString getWhatsThisText(QPoint p) ; | 73 | QString getWhatsThisText(QPoint p) ; |
74 | 74 | ||
75 | signals: | 75 | signals: |
76 | void shiftDown(); | 76 | void shiftDown(); |
77 | void shiftUp(); | 77 | void shiftUp(); |
78 | void rightClick(); | 78 | void rightClick(); |
79 | 79 | ||
80 | protected slots: | 80 | protected slots: |
81 | void oneDown(); | 81 | void oneDown(); |
82 | void keyPressEvent(QKeyEvent *); | 82 | void keyPressEvent(QKeyEvent *); |
83 | void keyReleaseEvent(QKeyEvent *); | 83 | void keyReleaseEvent(QKeyEvent *); |
84 | void mousePressEvent(QMouseEvent *); | 84 | void mousePressEvent(QMouseEvent *); |
85 | 85 | ||
86 | private: | 86 | private: |
87 | KNOWhatsThis * mWT; | 87 | KNOWhatsThis * mWT; |
88 | }; | 88 | }; |
89 | 89 | ||
90 | 90 | ||
91 | class MonthViewItem: public QListBoxItem | 91 | class MonthViewItem: public QListBoxItem |
92 | { | 92 | { |
93 | public: | 93 | public: |
94 | MonthViewItem( Incidence *, QDate qd, const QString & title ); | 94 | MonthViewItem( Incidence *, QDate qd, const QString & title ); |
95 | 95 | ||
96 | void setRecur(bool on) { mRecur = on; } | 96 | void setRecur(bool on) { mRecur = on; } |
97 | void setAlarm(bool on) { mAlarm = on; } | 97 | void setAlarm(bool on) { mAlarm = on; } |
98 | void setReply(bool on) { mReply = on; } | 98 | void setReply(bool on) { mReply = on; } |
99 | void setMoreInfo(bool on) { mInfo = on; } | 99 | void setMoreInfo(bool on) { mInfo = on; } |
100 | 100 | ||
101 | 101 | ||
102 | void setPalette(const QPalette &p) { mPalette = p; } | 102 | void setPalette(const QPalette &p) { mPalette = p; } |
103 | QPalette palette() const { return mPalette; } | 103 | QPalette palette() const { return mPalette; } |
104 | 104 | ||
105 | Incidence *incidence() const { return mIncidence; } | 105 | Incidence *incidence() const { return mIncidence; } |
106 | QDate incidenceDate() { return mDate; } | 106 | QDate incidenceDate() { return mDate; } |
107 | 107 | ||
108 | protected: | 108 | protected: |
109 | virtual void paint(QPainter *); | 109 | virtual void paint(QPainter *); |
110 | virtual int height(const QListBox *) const; | 110 | virtual int height(const QListBox *) const; |
111 | virtual int width(const QListBox *) const; | 111 | virtual int width(const QListBox *) const; |
112 | 112 | ||
113 | private: | 113 | private: |
114 | bool mRecur; | 114 | bool mRecur; |
115 | bool mAlarm; | 115 | bool mAlarm; |
116 | bool mReply; | 116 | bool mReply; |
117 | bool mInfo; | 117 | bool mInfo; |
118 | 118 | ||
119 | QPalette mPalette; | 119 | QPalette mPalette; |
120 | QDate mDate; | 120 | QDate mDate; |
121 | 121 | ||
122 | Incidence *mIncidence; | 122 | Incidence *mIncidence; |
123 | }; | 123 | }; |
124 | 124 | ||
125 | 125 | ||
126 | class KOMonthView; | 126 | class KOMonthView; |
127 | 127 | ||
128 | class MonthViewCell : public QWidget | 128 | class MonthViewCell : public QWidget |
129 | { | 129 | { |
130 | Q_OBJECT | 130 | Q_OBJECT |
131 | public: | 131 | public: |
132 | MonthViewCell(KOMonthView *,QWidget* ); | 132 | MonthViewCell(KOMonthView *,QWidget* ); |
133 | 133 | ||
134 | void setDate( const QDate & ); | 134 | void setDate( const QDate & ); |
135 | QDate date() const; | 135 | QDate date() const; |
136 | 136 | ||
137 | void setPrimary( bool ); | 137 | void setPrimary( bool ); |
138 | bool isPrimary() const; | 138 | bool isPrimary() const; |
139 | 139 | ||
140 | void setHoliday( bool ); | 140 | void setHoliday( bool ); |
141 | void setHoliday( const QString & ); | 141 | void setHoliday( const QString & ); |
142 | 142 | ||
143 | void updateCell(); | 143 | void updateCell(); |
144 | void startUpdateCell(); | 144 | void startUpdateCell(); |
145 | void finishUpdateCell(); | 145 | void finishUpdateCell(); |
146 | void insertEvent(Event *); | 146 | void insertEvent(Event *); |
147 | void insertTodo(Todo *); | 147 | void insertTodo(Todo *); |
148 | 148 | ||
149 | void updateConfig( bool bigFont = false ); | 149 | void updateConfig( bool bigFont = false ); |
150 | 150 | ||
151 | void enableScrollBars( bool ); | 151 | void enableScrollBars( bool ); |
152 | 152 | ||
153 | Incidence *selectedIncidence(); | 153 | Incidence *selectedIncidence(); |
154 | QDate selectedIncidenceDate(); | 154 | QDate selectedIncidenceDate(); |
155 | 155 | ||
156 | void deselect(); | 156 | void deselect(); |
157 | void select(); | 157 | void select(); |
158 | 158 | ||
159 | #ifdef DESKTOP_VERSION | 159 | #ifdef DESKTOP_VERSION |
160 | static QToolTipGroup *toolTipGroup(); | 160 | static QToolTipGroup *toolTipGroup(); |
161 | #endif | 161 | #endif |
162 | signals: | 162 | signals: |
163 | void defaultAction( Incidence * ); | 163 | void defaultAction( Incidence * ); |
164 | void newEventSignal( QDateTime ); | 164 | void newEventSignal( QDateTime ); |
165 | void showDaySignal( QDate ); | 165 | void showDaySignal( QDate ); |
166 | 166 | ||
167 | protected: | 167 | protected: |
168 | QString mToolTip; | 168 | QString mToolTip; |
169 | void resizeEvent( QResizeEvent * ); | 169 | void resizeEvent( QResizeEvent * ); |
170 | 170 | ||
171 | protected slots: | 171 | protected slots: |
172 | void defaultAction( QListBoxItem * ); | 172 | void defaultAction( QListBoxItem * ); |
173 | void contextMenu( QListBoxItem * ); | 173 | void contextMenu( QListBoxItem * ); |
174 | void selection( QListBoxItem * ); | 174 | void selection( QListBoxItem * ); |
175 | void cellClicked( QListBoxItem * ); | 175 | void cellClicked( QListBoxItem * ); |
176 | void newEvent(); | 176 | void newEvent(); |
177 | void showDay(); | 177 | void showDay(); |
178 | 178 | ||
179 | private: | 179 | private: |
180 | KOMonthView *mMonthView; | 180 | KOMonthView *mMonthView; |
181 | 181 | ||
182 | QDate mDate; | 182 | QDate mDate; |
183 | bool mPrimary; | 183 | bool mPrimary; |
184 | bool mHoliday; | 184 | bool mHoliday; |
185 | QString mHolidayString; | 185 | QString mHolidayString; |
186 | 186 | ||
187 | //QLabel *mLabel; | 187 | //QLabel *mLabel; |
188 | QPushButton *mLabel; | 188 | QPushButton *mLabel; |
189 | QListBox *mItemList; | 189 | QListBox *mItemList; |
190 | #ifdef DESKTOP_VERSION | 190 | #ifdef DESKTOP_VERSION |
191 | static QToolTipGroup *mToolTipGroup; | 191 | static QToolTipGroup *mToolTipGroup; |
192 | #endif | 192 | #endif |
193 | QSize mLabelSize; | 193 | QSize mLabelSize; |
194 | QSize mLabelBigSize; | 194 | QSize mLabelBigSize; |
195 | QPalette mHolidayPalette; | 195 | QPalette mHolidayPalette; |
196 | QPalette mStandardPalette; | 196 | QPalette mStandardPalette; |
197 | QPalette mPrimaryPalette; | 197 | QPalette mPrimaryPalette; |
198 | QPalette mNonPrimaryPalette; | 198 | QPalette mNonPrimaryPalette; |
199 | void setMyPalette(); | 199 | void setMyPalette(); |
200 | QPalette getPalette (); | 200 | QPalette getPalette (); |
201 | void keyPressEvent ( QKeyEvent * ) ; | 201 | void keyPressEvent ( QKeyEvent * ) ; |
202 | 202 | ||
203 | }; | 203 | }; |
204 | 204 | ||
205 | 205 | ||
206 | class KOMonthView: public KOEventView | 206 | class KOMonthView: public KOEventView |
207 | { | 207 | { |
208 | Q_OBJECT | 208 | Q_OBJECT |
209 | public: | 209 | public: |
210 | KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 ); | 210 | KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 ); |
211 | ~KOMonthView(); | 211 | ~KOMonthView(); |
212 | 212 | ||
213 | /** Returns maximum number of days supported by the komonthview */ | 213 | /** Returns maximum number of days supported by the komonthview */ |
214 | virtual int maxDatesHint(); | 214 | virtual int maxDatesHint(); |
215 | 215 | ||
216 | /** Returns number of currently shown dates. */ | 216 | /** Returns number of currently shown dates. */ |
217 | virtual int currentDateCount(); | 217 | virtual int currentDateCount(); |
218 | 218 | ||
219 | /** returns the currently selected events */ | 219 | /** returns the currently selected events */ |
220 | virtual QPtrList<Incidence> selectedIncidences(); | 220 | virtual QPtrList<Incidence> selectedIncidences(); |
221 | 221 | ||
222 | /** returns dates of the currently selected events */ | 222 | /** returns dates of the currently selected events */ |
223 | virtual DateList selectedDates(); | 223 | virtual DateList selectedDates(); |
224 | 224 | ||
225 | virtual void printPreview(CalPrinter *calPrinter, | 225 | virtual void printPreview(CalPrinter *calPrinter, |
226 | const QDate &, const QDate &); | 226 | const QDate &, const QDate &); |
227 | bool isMonthView() { return true; } | 227 | bool isMonthView() { return true; } |
228 | bool isUpdatePossible() { return updatePossible; } | 228 | bool isUpdatePossible() { return updatePossible; } |
229 | 229 | ||
230 | MonthViewCell * selectedCell(); | 230 | MonthViewCell * selectedCell(); |
231 | bool skipResize; | 231 | bool skipResize; |
232 | NavigatorBar* navigatorBar() { return mNavigatorBar ;} | 232 | NavigatorBar* navigatorBar() { return mNavigatorBar ;} |
233 | public slots: | 233 | public slots: |
234 | virtual void updateView(); | 234 | virtual void updateView(); |
235 | virtual void updateConfig(); | 235 | virtual void updateConfig(); |
236 | virtual void showDates(const QDate &start, const QDate &end); | 236 | virtual void showDates(const QDate &start, const QDate &end); |
237 | virtual void showEvents(QPtrList<Event> eventList); | 237 | virtual void showEvents(QPtrList<Event> eventList); |
238 | 238 | ||
239 | void changeEventDisplay(Event *, int); | 239 | void changeEventDisplay(Event *, int); |
240 | 240 | ||
241 | void clearSelection(); | 241 | void clearSelection(); |
242 | 242 | ||
243 | void showContextMenu( Incidence * ); | 243 | void showContextMenu( Incidence * ); |
244 | 244 | ||
245 | void setSelectedCell( MonthViewCell * ); | 245 | void setSelectedCell( MonthViewCell * ); |
246 | void switchView(); | ||
246 | 247 | ||
247 | protected slots: | 248 | protected slots: |
248 | void selectInternalWeekNum ( int ); | 249 | void selectInternalWeekNum ( int ); |
249 | void switchView(); | ||
250 | void processSelectionChange(); | 250 | void processSelectionChange(); |
251 | signals: | 251 | signals: |
252 | void nextMonth(); | 252 | void nextMonth(); |
253 | void prevMonth(); | 253 | void prevMonth(); |
254 | void selectWeekNum ( int ); | 254 | void selectWeekNum ( int ); |
255 | void selectMonth (); | ||
255 | void showDaySignal( QDate ); | 256 | void showDaySignal( QDate ); |
256 | protected: | 257 | protected: |
257 | void resizeEvent(QResizeEvent *); | 258 | void resizeEvent(QResizeEvent *); |
258 | void viewChanged(); | 259 | void viewChanged(); |
259 | void updateDayLabels(); | 260 | void updateDayLabels(); |
260 | 261 | ||
261 | private: | 262 | private: |
262 | NavigatorBar* mNavigatorBar; | 263 | NavigatorBar* mNavigatorBar; |
263 | int currentWeek(); | 264 | int currentWeek(); |
264 | bool clPending; | 265 | bool clPending; |
265 | QWidgetStack * mWidStack; | 266 | QWidgetStack * mWidStack; |
266 | QWidget* mMonthView; | 267 | QWidget* mMonthView; |
267 | QWidget* mWeekView; | 268 | QWidget* mWeekView; |
268 | bool mShowWeekView; | 269 | bool mShowWeekView; |
269 | bool updatePossible; | 270 | bool updatePossible; |
270 | int mDaysPerWeek; | 271 | int mDaysPerWeek; |
271 | int mNumWeeks; | 272 | int mNumWeeks; |
272 | int mNumCells; | 273 | int mNumCells; |
273 | bool mWeekStartsMonday; | 274 | bool mWeekStartsMonday; |
274 | bool mShowSatSunComp; | 275 | bool mShowSatSunComp; |
275 | void computeLayout(); | 276 | void computeLayout(); |
276 | void computeLayoutWeek(); | 277 | void computeLayoutWeek(); |
277 | 278 | ||
278 | QPtrVector<MonthViewCell> mCells; | 279 | QPtrVector<MonthViewCell> mCells; |
279 | QPtrVector<QLabel> mDayLabels; | 280 | QPtrVector<QLabel> mDayLabels; |
280 | QPtrVector<KOWeekButton> mWeekLabels; | 281 | QPtrVector<KOWeekButton> mWeekLabels; |
281 | QPtrVector<MonthViewCell> mCellsW; | 282 | QPtrVector<MonthViewCell> mCellsW; |
282 | QPtrVector<QLabel> mDayLabelsW; | 283 | QPtrVector<QLabel> mDayLabelsW; |
283 | QPtrVector<KOWeekButton> mWeekLabelsW; | 284 | QPtrVector<KOWeekButton> mWeekLabelsW; |
284 | 285 | ||
285 | bool mShortDayLabelsM; | 286 | bool mShortDayLabelsM; |
286 | bool mShortDayLabelsW; | 287 | bool mShortDayLabelsW; |
287 | int mWidthLongDayLabel; | 288 | int mWidthLongDayLabel; |
288 | 289 | ||
289 | QDate mStartDate; | 290 | QDate mStartDate; |
290 | 291 | ||
291 | MonthViewCell *mSelectedCell; | 292 | MonthViewCell *mSelectedCell; |
292 | 293 | ||
293 | KOEventPopupMenu *mContextMenu; | 294 | KOEventPopupMenu *mContextMenu; |
294 | void keyPressEvent ( QKeyEvent * ) ; | 295 | void keyPressEvent ( QKeyEvent * ) ; |
295 | 296 | ||
296 | }; | 297 | }; |
297 | 298 | ||
298 | #endif | 299 | #endif |
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp index 7efb6a6..5efc247 100644 --- a/korganizer/koprefs.cpp +++ b/korganizer/koprefs.cpp | |||
@@ -1,484 +1,485 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <time.h> | 24 | #include <time.h> |
25 | #ifndef _WIN32_ | 25 | #ifndef _WIN32_ |
26 | #include <unistd.h> | 26 | #include <unistd.h> |
27 | #endif | 27 | #endif |
28 | #include <qdir.h> | 28 | #include <qdir.h> |
29 | #include <qtextstream.h> | 29 | #include <qtextstream.h> |
30 | #include <qtextcodec.h> | 30 | #include <qtextcodec.h> |
31 | #include <qstring.h> | 31 | #include <qstring.h> |
32 | #include <qregexp.h> | 32 | #include <qregexp.h> |
33 | #include <qfont.h> | 33 | #include <qfont.h> |
34 | #include <qcolor.h> | 34 | #include <qcolor.h> |
35 | #include <qstringlist.h> | 35 | #include <qstringlist.h> |
36 | #include <stdlib.h> | 36 | #include <stdlib.h> |
37 | 37 | ||
38 | #include <kglobal.h> | 38 | #include <kglobal.h> |
39 | #include <kglobalsettings.h> | 39 | #include <kglobalsettings.h> |
40 | #include <kconfig.h> | 40 | #include <kconfig.h> |
41 | #include <klocale.h> | 41 | #include <klocale.h> |
42 | #include <kdebug.h> | 42 | #include <kdebug.h> |
43 | #include <kemailsettings.h> | 43 | #include <kemailsettings.h> |
44 | #include <kstaticdeleter.h> | 44 | #include <kstaticdeleter.h> |
45 | #include <libkdepim/kpimglobalprefs.h> | 45 | #include <libkdepim/kpimglobalprefs.h> |
46 | 46 | ||
47 | #include "koprefs.h" | 47 | #include "koprefs.h" |
48 | #include "mainwindow.h" | 48 | #include "mainwindow.h" |
49 | 49 | ||
50 | KOPrefs *KOPrefs::mInstance = 0; | 50 | KOPrefs *KOPrefs::mInstance = 0; |
51 | static KStaticDeleter<KOPrefs> insd; | 51 | static KStaticDeleter<KOPrefs> insd; |
52 | 52 | ||
53 | KOPrefs::KOPrefs() : | 53 | KOPrefs::KOPrefs() : |
54 | KPimPrefs("korganizerrc") | 54 | KPimPrefs("korganizerrc") |
55 | { | 55 | { |
56 | mCategoryColors.setAutoDelete(true); | 56 | mCategoryColors.setAutoDelete(true); |
57 | fillMailDefaults(); | 57 | fillMailDefaults(); |
58 | mDefaultCategoryColor = QColor(175,210,255);//196,196,196); | 58 | mDefaultCategoryColor = QColor(175,210,255);//196,196,196); |
59 | QColor defaultHolidayColor = QColor(255,0,0); | 59 | QColor defaultHolidayColor = QColor(255,0,0); |
60 | QColor defaultHighlightColor = QColor(129,112,255);//64,64,255); | 60 | QColor defaultHighlightColor = QColor(129,112,255);//64,64,255); |
61 | QColor defaultAgendaBgColor = QColor(239,241,169);//128,128,128); | 61 | QColor defaultAgendaBgColor = QColor(239,241,169);//128,128,128); |
62 | QColor defaultWorkingHoursColor = QColor(170,223,150);//160,160,160); | 62 | QColor defaultWorkingHoursColor = QColor(170,223,150);//160,160,160); |
63 | QColor defaultTodoDueTodayColor = QColor(255,220,100); | 63 | QColor defaultTodoDueTodayColor = QColor(255,220,100); |
64 | QColor defaultTodoOverdueColor = QColor(255,153,125); | 64 | QColor defaultTodoOverdueColor = QColor(255,153,125); |
65 | 65 | ||
66 | 66 | ||
67 | KPrefs::setCurrentGroup("General"); | 67 | KPrefs::setCurrentGroup("General"); |
68 | 68 | ||
69 | 69 | ||
70 | addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); | 70 | addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); |
71 | 71 | ||
72 | addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true); | 72 | addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true); |
73 | addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true); | 73 | addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true); |
74 | addItemBool("ShowIconSearch",&mShowIconSearch,true); | 74 | addItemBool("ShowIconSearch",&mShowIconSearch,true); |
75 | addItemBool("ShowIconList",&mShowIconList,true); | 75 | addItemBool("ShowIconList",&mShowIconList,true); |
76 | addItemBool("ShowIconDay1",&mShowIconDay1,true); | 76 | addItemBool("ShowIconDay1",&mShowIconDay1,true); |
77 | addItemBool("ShowIconDay5",&mShowIconDay5,true); | 77 | addItemBool("ShowIconDay5",&mShowIconDay5,true); |
78 | addItemBool("ShowIconDay6",&mShowIconDay6,true); | ||
78 | addItemBool("ShowIconDay7",&mShowIconDay7,true); | 79 | addItemBool("ShowIconDay7",&mShowIconDay7,true); |
79 | addItemBool("ShowIconMonth",&mShowIconMonth,true); | 80 | addItemBool("ShowIconMonth",&mShowIconMonth,true); |
80 | addItemBool("ShowIconTodoview",&mShowIconTodoview,true); | 81 | addItemBool("ShowIconTodoview",&mShowIconTodoview,true); |
81 | addItemBool("ShowIconBackFast",&mShowIconBackFast,true); | 82 | addItemBool("ShowIconBackFast",&mShowIconBackFast,true); |
82 | addItemBool("ShowIconBack",&mShowIconBack,true); | 83 | addItemBool("ShowIconBack",&mShowIconBack,true); |
83 | addItemBool("ShowIconToday",&mShowIconToday,true); | 84 | addItemBool("ShowIconToday",&mShowIconToday,true); |
84 | addItemBool("ShowIconForward",&mShowIconForward,true); | 85 | addItemBool("ShowIconForward",&mShowIconForward,true); |
85 | addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true); | 86 | addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true); |
86 | addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,true); | 87 | addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,true); |
87 | addItemBool("ShowIconNextDays",&mShowIconNextDays,true); | 88 | addItemBool("ShowIconNextDays",&mShowIconNextDays,true); |
88 | addItemBool("ShowIconNext",&mShowIconNext,true); | 89 | addItemBool("ShowIconNext",&mShowIconNext,true); |
89 | addItemBool("ShowIconJournal",&mShowIconJournal,true); | 90 | addItemBool("ShowIconJournal",&mShowIconJournal,true); |
90 | addItemBool("ShowIconStretch",&mShowIconStretch,true); | 91 | addItemBool("ShowIconStretch",&mShowIconStretch,true); |
91 | addItemInt("LastLoadedLanguage",&mOldLanguage,0); | 92 | addItemInt("LastLoadedLanguage",&mOldLanguage,0); |
92 | 93 | ||
93 | addItemBool("AskForQuit",&mAskForQuit,false); | 94 | addItemBool("AskForQuit",&mAskForQuit,false); |
94 | 95 | ||
95 | #ifndef DESKTOP_VERSION | 96 | #ifndef DESKTOP_VERSION |
96 | addItemBool("ShowFullMenu",&mShowFullMenu,false); | 97 | addItemBool("ShowFullMenu",&mShowFullMenu,false); |
97 | #else | 98 | #else |
98 | addItemBool("ShowFullMenu",&mShowFullMenu,true); | 99 | addItemBool("ShowFullMenu",&mShowFullMenu,true); |
99 | #endif | 100 | #endif |
100 | addItemBool("ToolBarHor",&mToolBarHor, true ); | 101 | addItemBool("ToolBarHor",&mToolBarHor, true ); |
101 | addItemBool("ToolBarUp",&mToolBarUp, false ); | 102 | addItemBool("ToolBarUp",&mToolBarUp, false ); |
102 | addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false ); | 103 | addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false ); |
103 | addItemInt("Whats Next Days",&mWhatsNextDays,3); | 104 | addItemInt("Whats Next Days",&mWhatsNextDays,3); |
104 | addItemInt("Whats Next Prios",&mWhatsNextPrios,1); | 105 | addItemInt("Whats Next Prios",&mWhatsNextPrios,1); |
105 | 106 | ||
106 | addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true); | 107 | addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true); |
107 | addItemBool("ShowTimeInAgenda",&mShowTimeInAgenda,true); | 108 | addItemBool("ShowTimeInAgenda",&mShowTimeInAgenda,true); |
108 | addItemBool("HideNonStartedTodos",&mHideNonStartedTodos,false); | 109 | addItemBool("HideNonStartedTodos",&mHideNonStartedTodos,false); |
109 | addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true); | 110 | addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true); |
110 | addItemInt("AllDay Size",&mAllDaySize,28); | 111 | addItemInt("AllDay Size",&mAllDaySize,28); |
111 | QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav"; | 112 | QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav"; |
112 | addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm ); | 113 | addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm ); |
113 | 114 | ||
114 | addItemStringList("LocationDefaults",&mLocationDefaults ); | 115 | addItemStringList("LocationDefaults",&mLocationDefaults ); |
115 | addItemStringList("EventSummary User",&mEventSummaryUser); | 116 | addItemStringList("EventSummary User",&mEventSummaryUser); |
116 | addItemStringList("TodoSummary User",&mTodoSummaryUser); | 117 | addItemStringList("TodoSummary User",&mTodoSummaryUser); |
117 | 118 | ||
118 | addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); | 119 | addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); |
119 | addItemBool("Enable Project View",&mEnableProjectView,false); | 120 | addItemBool("Enable Project View",&mEnableProjectView,false); |
120 | addItemBool("Auto Save",&mAutoSave,false); | 121 | addItemBool("Auto Save",&mAutoSave,false); |
121 | addItemInt("Auto Save Interval",&mAutoSaveInterval,3); | 122 | addItemInt("Auto Save Interval",&mAutoSaveInterval,3); |
122 | addItemBool("Confirm Deletes",&mConfirm,true); | 123 | addItemBool("Confirm Deletes",&mConfirm,true); |
123 | addItemString("Archive File",&mArchiveFile); | 124 | addItemString("Archive File",&mArchiveFile); |
124 | addItemString("Html Export File",&mHtmlExportFile, | 125 | addItemString("Html Export File",&mHtmlExportFile, |
125 | QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html")); | 126 | QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html")); |
126 | addItemBool("Html With Save",&mHtmlWithSave,false); | 127 | addItemBool("Html With Save",&mHtmlWithSave,false); |
127 | 128 | ||
128 | KPrefs::setCurrentGroup("Personal Settings"); | 129 | KPrefs::setCurrentGroup("Personal Settings"); |
129 | 130 | ||
130 | addItemInt("Mail Client",&mMailClient,MailClientKMail); | 131 | addItemInt("Mail Client",&mMailClient,MailClientKMail); |
131 | addItemBool("Use Control Center Email",&mEmailControlCenter,false); | 132 | addItemBool("Use Control Center Email",&mEmailControlCenter,false); |
132 | addItemBool("Bcc",&mBcc,false); | 133 | addItemBool("Bcc",&mBcc,false); |
133 | 134 | ||
134 | KPrefs::setCurrentGroup("Time & Date"); | 135 | KPrefs::setCurrentGroup("Time & Date"); |
135 | 136 | ||
136 | 137 | ||
137 | addItemInt("Default Start Time",&mStartTime,10); | 138 | addItemInt("Default Start Time",&mStartTime,10); |
138 | addItemInt("Default Duration",&mDefaultDuration,2); | 139 | addItemInt("Default Duration",&mDefaultDuration,2); |
139 | addItemInt("Default Alarm Time",&mAlarmTime,3); | 140 | addItemInt("Default Alarm Time",&mAlarmTime,3); |
140 | KPrefs::setCurrentGroup("AlarmSettings"); | 141 | KPrefs::setCurrentGroup("AlarmSettings"); |
141 | addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20); | 142 | addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20); |
142 | addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7); | 143 | addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7); |
143 | addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5); | 144 | addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5); |
144 | addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3); | 145 | addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3); |
145 | 146 | ||
146 | 147 | ||
147 | KPrefs::setCurrentGroup("Calendar"); | 148 | KPrefs::setCurrentGroup("Calendar"); |
148 | 149 | ||
149 | addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar); | 150 | addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar); |
150 | 151 | ||
151 | KPrefs::setCurrentGroup("Fonts"); | 152 | KPrefs::setCurrentGroup("Fonts"); |
152 | // qDebug(" KPrefs::setCurrentGroup(Fonts); "); | 153 | // qDebug(" KPrefs::setCurrentGroup(Fonts); "); |
153 | addItemFont("TimeBar Font",&mTimeBarFont,KGlobalSettings::generalFont() ); | 154 | addItemFont("TimeBar Font",&mTimeBarFont,KGlobalSettings::generalFont() ); |
154 | addItemFont("MonthView Font",&mMonthViewFont,KGlobalSettings::generalFont()); | 155 | addItemFont("MonthView Font",&mMonthViewFont,KGlobalSettings::generalFont()); |
155 | addItemFont("AgendaView Font",&mAgendaViewFont,KGlobalSettings::generalFont()); | 156 | addItemFont("AgendaView Font",&mAgendaViewFont,KGlobalSettings::generalFont()); |
156 | addItemFont("MarcusBains Font",&mMarcusBainsFont,KGlobalSettings::generalFont()); | 157 | addItemFont("MarcusBains Font",&mMarcusBainsFont,KGlobalSettings::generalFont()); |
157 | addItemFont("TimeLabels Font",&mTimeLabelsFont,KGlobalSettings::generalFont()); | 158 | addItemFont("TimeLabels Font",&mTimeLabelsFont,KGlobalSettings::generalFont()); |
158 | addItemFont("TodoView Font",&mTodoViewFont,KGlobalSettings::generalFont()); | 159 | addItemFont("TodoView Font",&mTodoViewFont,KGlobalSettings::generalFont()); |
159 | addItemFont("ListView Font",&mListViewFont,KGlobalSettings::generalFont()); | 160 | addItemFont("ListView Font",&mListViewFont,KGlobalSettings::generalFont()); |
160 | addItemFont("DateNavigator Font",&mDateNavigatorFont,KGlobalSettings::generalFont()); | 161 | addItemFont("DateNavigator Font",&mDateNavigatorFont,KGlobalSettings::generalFont()); |
161 | addItemFont("EditBox Font",&mEditBoxFont,KGlobalSettings::generalFont()); | 162 | addItemFont("EditBox Font",&mEditBoxFont,KGlobalSettings::generalFont()); |
162 | addItemFont("JournalView Font",&mJornalViewFont,KGlobalSettings::generalFont()); | 163 | addItemFont("JournalView Font",&mJornalViewFont,KGlobalSettings::generalFont()); |
163 | addItemFont("WhatsNextView Font",&mWhatsNextFont,KGlobalSettings::generalFont()); | 164 | addItemFont("WhatsNextView Font",&mWhatsNextFont,KGlobalSettings::generalFont()); |
164 | addItemFont("EventView Font",&mEventViewFont,KGlobalSettings::generalFont()); | 165 | addItemFont("EventView Font",&mEventViewFont,KGlobalSettings::generalFont()); |
165 | 166 | ||
166 | KPrefs::setCurrentGroup("RemoteSyncing"); | 167 | KPrefs::setCurrentGroup("RemoteSyncing"); |
167 | addItemString("ActiveSyncPort",&mActiveSyncPort,"9197" ); | 168 | addItemString("ActiveSyncPort",&mActiveSyncPort,"9197" ); |
168 | addItemString("ActiveSyncIP",&mActiveSyncIP,"192.168.0.40" ); | 169 | addItemString("ActiveSyncIP",&mActiveSyncIP,"192.168.0.40" ); |
169 | addItemBool("ShowSyncEvents",&mShowSyncEvents,false); | 170 | addItemBool("ShowSyncEvents",&mShowSyncEvents,false); |
170 | addItemInt("LastSyncTime",&mLastSyncTime,0); | 171 | addItemInt("LastSyncTime",&mLastSyncTime,0); |
171 | 172 | ||
172 | #ifdef _WIN32_ | 173 | #ifdef _WIN32_ |
173 | QString hdp= locateLocal("data","korganizer")+"\\\\"; | 174 | QString hdp= locateLocal("data","korganizer")+"\\\\"; |
174 | #else | 175 | #else |
175 | QString hdp= locateLocal("data","korganizer")+"/"; | 176 | QString hdp= locateLocal("data","korganizer")+"/"; |
176 | #endif | 177 | #endif |
177 | 178 | ||
178 | KPrefs::setCurrentGroup("LoadSaveFileNames"); | 179 | KPrefs::setCurrentGroup("LoadSaveFileNames"); |
179 | 180 | ||
180 | addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" ); | 181 | addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" ); |
181 | addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" ); | 182 | addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" ); |
182 | addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" ); | 183 | addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" ); |
183 | addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" ); | 184 | addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" ); |
184 | 185 | ||
185 | 186 | ||
186 | KPrefs::setCurrentGroup("Locale"); | 187 | KPrefs::setCurrentGroup("Locale"); |
187 | addItemBool("ShortDateInViewer",&mShortDateInViewer,false); | 188 | addItemBool("ShortDateInViewer",&mShortDateInViewer,false); |
188 | 189 | ||
189 | 190 | ||
190 | KPrefs::setCurrentGroup("Colors"); | 191 | KPrefs::setCurrentGroup("Colors"); |
191 | addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor); | 192 | addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor); |
192 | addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor); | 193 | addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor); |
193 | addItemColor("Event Color",&mEventColor,mDefaultCategoryColor); | 194 | addItemColor("Event Color",&mEventColor,mDefaultCategoryColor); |
194 | addItemColor("Todo done Color",&mTodoDoneColor,QColor(111,255,115) ); | 195 | addItemColor("Todo done Color",&mTodoDoneColor,QColor(111,255,115) ); |
195 | addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor); | 196 | addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor); |
196 | addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor); | 197 | addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor); |
197 | addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor); | 198 | addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor); |
198 | addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor); | 199 | addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor); |
199 | addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 )); | 200 | addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 )); |
200 | addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 )); | 201 | addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 )); |
201 | addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 )); | 202 | addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 )); |
202 | addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true); | 203 | addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true); |
203 | addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true); | 204 | addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true); |
204 | addItemBool("MonthViewWeek",&mMonthViewWeek,false); | 205 | addItemBool("MonthViewWeek",&mMonthViewWeek,false); |
205 | addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false); | 206 | addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false); |
206 | addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 )); | 207 | addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 )); |
207 | addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 )); | 208 | addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 )); |
208 | addItemBool("UseAppColors",&mUseAppColors,false); | 209 | addItemBool("UseAppColors",&mUseAppColors,false); |
209 | 210 | ||
210 | 211 | ||
211 | 212 | ||
212 | KPrefs::setCurrentGroup("Views"); | 213 | KPrefs::setCurrentGroup("Views"); |
213 | addItemBool("Show Date Navigator",&mShowDateNavigator,true); | 214 | addItemBool("Show Date Navigator",&mShowDateNavigator,true); |
214 | addItemInt("Hour Size",&mHourSize,8); | 215 | addItemInt("Hour Size",&mHourSize,8); |
215 | addItemBool("Show Daily Recurrences",&mDailyRecur,true); | 216 | addItemBool("Show Daily Recurrences",&mDailyRecur,true); |
216 | addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true); | 217 | addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true); |
217 | addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true); | 218 | addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true); |
218 | addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true); | 219 | addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true); |
219 | addItemBool("ShowShortMonthName",&mMonthShowShort,false); | 220 | addItemBool("ShowShortMonthName",&mMonthShowShort,false); |
220 | addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true); | 221 | addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true); |
221 | #ifdef DESKTOP_VERION | 222 | #ifdef DESKTOP_VERION |
222 | addItemBool("Enable ToolTips",&mEnableToolTips,true); | 223 | addItemBool("Enable ToolTips",&mEnableToolTips,true); |
223 | #else | 224 | #else |
224 | addItemBool("Enable ToolTips",&mEnableToolTips,false); | 225 | addItemBool("Enable ToolTips",&mEnableToolTips,false); |
225 | #endif | 226 | #endif |
226 | addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false); | 227 | addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false); |
227 | addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false); | 228 | addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false); |
228 | addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true); | 229 | addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true); |
229 | addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true); | 230 | addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true); |
230 | addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,true); | 231 | addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,true); |
231 | addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false); | 232 | addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false); |
232 | addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false); | 233 | addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false); |
233 | addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true); | 234 | addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true); |
234 | addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true); | 235 | addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true); |
235 | addItemBool("WNViewShowsParents",&mWNViewShowsParents,true);; | 236 | addItemBool("WNViewShowsParents",&mWNViewShowsParents,true);; |
236 | addItemBool("WNViewShowsPast",&mWNViewShowsPast,true); | 237 | addItemBool("WNViewShowsPast",&mWNViewShowsPast,true); |
237 | addItemBool("WNViewShowLocation",&mWNViewShowLocation,false); | 238 | addItemBool("WNViewShowLocation",&mWNViewShowLocation,false); |
238 | addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false); | 239 | addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false); |
239 | addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true); | 240 | addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true); |
240 | addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false); | 241 | addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false); |
241 | addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false); | 242 | addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false); |
242 | addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,true); | 243 | addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,true); |
243 | addItemBool("MonthViewUsesBigFont",&mMonthViewUsesBigFont,true); | 244 | addItemBool("MonthViewUsesBigFont",&mMonthViewUsesBigFont,true); |
244 | addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false); | 245 | addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false); |
245 | addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false); | 246 | addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false); |
246 | #ifdef DESKTOP_VERSION | 247 | #ifdef DESKTOP_VERSION |
247 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true); | 248 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true); |
248 | #else | 249 | #else |
249 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false); | 250 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false); |
250 | #endif | 251 | #endif |
251 | addItemInt("Day Begins",&mDayBegins,7); | 252 | addItemInt("Day Begins",&mDayBegins,7); |
252 | addItemInt("Working Hours Start",&mWorkingHoursStart,8); | 253 | addItemInt("Working Hours Start",&mWorkingHoursStart,8); |
253 | addItemInt("Working Hours End",&mWorkingHoursEnd,17); | 254 | addItemInt("Working Hours End",&mWorkingHoursEnd,17); |
254 | addItemBool("Exclude Holidays",&mExcludeHolidays,true); | 255 | addItemBool("Exclude Holidays",&mExcludeHolidays,true); |
255 | addItemBool("Exclude Saturdays",&mExcludeSaturdays,true); | 256 | addItemBool("Exclude Saturdays",&mExcludeSaturdays,true); |
256 | 257 | ||
257 | addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false); | 258 | addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false); |
258 | addItemBool("Full View Month",&mFullViewMonth,true); | 259 | addItemBool("Full View Month",&mFullViewMonth,true); |
259 | addItemBool("Full View Todo",&mFullViewTodo,true); | 260 | addItemBool("Full View Todo",&mFullViewTodo,true); |
260 | addItemBool("Quick Todo",&mEnableQuickTodo,false); | 261 | addItemBool("Quick Todo",&mEnableQuickTodo,false); |
261 | 262 | ||
262 | addItemInt("Next X Days",&mNextXDays,3); | 263 | addItemInt("Next X Days",&mNextXDays,3); |
263 | 264 | ||
264 | KPrefs::setCurrentGroup("Printer"); | 265 | KPrefs::setCurrentGroup("Printer"); |
265 | 266 | ||
266 | KPrefs::setCurrentGroup("Layout"); | 267 | KPrefs::setCurrentGroup("Layout"); |
267 | 268 | ||
268 | addItemBool("CompactDialogs",&mCompactDialogs,false); | 269 | addItemBool("CompactDialogs",&mCompactDialogs,false); |
269 | addItemBool("VerticalScreen",&mVerticalScreen,true); | 270 | addItemBool("VerticalScreen",&mVerticalScreen,true); |
270 | 271 | ||
271 | KPrefs::setCurrentGroup("KOrganizer Plugins"); | 272 | KPrefs::setCurrentGroup("KOrganizer Plugins"); |
272 | 273 | ||
273 | addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays"); | 274 | addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays"); |
274 | 275 | ||
275 | KPrefs::setCurrentGroup("Group Scheduling"); | 276 | KPrefs::setCurrentGroup("Group Scheduling"); |
276 | 277 | ||
277 | addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail); | 278 | addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail); |
278 | addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend); | 279 | addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend); |
279 | addItemStringList("AdditionalMails",&mAdditionalMails,""); | 280 | addItemStringList("AdditionalMails",&mAdditionalMails,""); |
280 | addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto); | 281 | addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto); |
281 | addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto); | 282 | addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto); |
282 | addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto); | 283 | addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto); |
283 | addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto); | 284 | addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto); |
284 | addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto); | 285 | addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto); |
285 | 286 | ||
286 | KPrefs::setCurrentGroup( "Editors" ); | 287 | KPrefs::setCurrentGroup( "Editors" ); |
287 | 288 | ||
288 | addItemStringList( "EventTemplates", &mEventTemplates ); | 289 | addItemStringList( "EventTemplates", &mEventTemplates ); |
289 | addItemStringList( "TodoTemplates", &mTodoTemplates ); | 290 | addItemStringList( "TodoTemplates", &mTodoTemplates ); |
290 | 291 | ||
291 | addItemInt("DestinationPolicy",&mDestination,standardDestination); | 292 | addItemInt("DestinationPolicy",&mDestination,standardDestination); |
292 | 293 | ||
293 | 294 | ||
294 | 295 | ||
295 | } | 296 | } |
296 | 297 | ||
297 | 298 | ||
298 | KOPrefs::~KOPrefs() | 299 | KOPrefs::~KOPrefs() |
299 | { | 300 | { |
300 | if (mInstance == this) | 301 | if (mInstance == this) |
301 | mInstance = insd.setObject(0); | 302 | mInstance = insd.setObject(0); |
302 | 303 | ||
303 | //qDebug("KOPrefs::~KOPrefs() "); | 304 | //qDebug("KOPrefs::~KOPrefs() "); |
304 | } | 305 | } |
305 | 306 | ||
306 | 307 | ||
307 | KOPrefs *KOPrefs::instance() | 308 | KOPrefs *KOPrefs::instance() |
308 | { | 309 | { |
309 | if (!mInstance) { | 310 | if (!mInstance) { |
310 | mInstance = insd.setObject(new KOPrefs()); | 311 | mInstance = insd.setObject(new KOPrefs()); |
311 | mInstance->readConfig(); | 312 | mInstance->readConfig(); |
312 | } | 313 | } |
313 | 314 | ||
314 | return mInstance; | 315 | return mInstance; |
315 | } | 316 | } |
316 | 317 | ||
317 | void KOPrefs::usrSetDefaults() | 318 | void KOPrefs::usrSetDefaults() |
318 | { | 319 | { |
319 | 320 | ||
320 | } | 321 | } |
321 | 322 | ||
322 | void KOPrefs::fillMailDefaults() | 323 | void KOPrefs::fillMailDefaults() |
323 | { | 324 | { |
324 | if (mName.isEmpty()) mName = i18n("Anonymous"); | 325 | if (mName.isEmpty()) mName = i18n("Anonymous"); |
325 | if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere"); | 326 | if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere"); |
326 | } | 327 | } |
327 | 328 | ||
328 | void KOPrefs::setTimeZoneIdDefault() | 329 | void KOPrefs::setTimeZoneIdDefault() |
329 | { | 330 | { |
330 | ; | 331 | ; |
331 | } | 332 | } |
332 | 333 | ||
333 | void KOPrefs::setAllDefaults() | 334 | void KOPrefs::setAllDefaults() |
334 | { | 335 | { |
335 | setCategoryDefaults(); | 336 | setCategoryDefaults(); |
336 | mEventSummaryUser = getDefaultList() ; | 337 | mEventSummaryUser = getDefaultList() ; |
337 | mTodoSummaryUser = getDefaultList() ; | 338 | mTodoSummaryUser = getDefaultList() ; |
338 | mLocationDefaults = getLocationDefaultList(); | 339 | mLocationDefaults = getLocationDefaultList(); |
339 | } | 340 | } |
340 | 341 | ||
341 | void KOPrefs::setCategoryDefaults() | 342 | void KOPrefs::setCategoryDefaults() |
342 | { | 343 | { |
343 | mCustomCategories.clear(); | 344 | mCustomCategories.clear(); |
344 | mCustomCategories = getDefaultList(); | 345 | mCustomCategories = getDefaultList(); |
345 | 346 | ||
346 | QStringList::Iterator it; | 347 | QStringList::Iterator it; |
347 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { | 348 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { |
348 | setCategoryColor(*it,mDefaultCategoryColor); | 349 | setCategoryColor(*it,mDefaultCategoryColor); |
349 | } | 350 | } |
350 | } | 351 | } |
351 | QStringList KOPrefs::getLocationDefaultList() | 352 | QStringList KOPrefs::getLocationDefaultList() |
352 | { | 353 | { |
353 | QStringList retval ; | 354 | QStringList retval ; |
354 | retval << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach") | 355 | retval << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach") |
355 | << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") | 356 | << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") |
356 | << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten") | 357 | << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten") |
357 | << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ; | 358 | << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ; |
358 | // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") | 359 | // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") |
359 | 360 | ||
360 | retval.sort(); | 361 | retval.sort(); |
361 | return retval; | 362 | return retval; |
362 | } | 363 | } |
363 | QStringList KOPrefs::getDefaultList() | 364 | QStringList KOPrefs::getDefaultList() |
364 | { | 365 | { |
365 | QStringList retval ; | 366 | QStringList retval ; |
366 | retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Business Travel") << i18n("Cinema") << i18n("Customer") | 367 | retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Business Travel") << i18n("Cinema") << i18n("Customer") |
367 | << i18n("Break")<< i18n("Breakfast")<< i18n("Competition")<< i18n("Dinner") | 368 | << i18n("Break")<< i18n("Breakfast")<< i18n("Competition")<< i18n("Dinner") |
368 | << i18n("Education")<< i18n("Family") << i18n("Favorites") << i18n("Festival")<< i18n("Fishing")<< i18n("Flight") << i18n("Gifts") | 369 | << i18n("Education")<< i18n("Family") << i18n("Favorites") << i18n("Festival")<< i18n("Fishing")<< i18n("Flight") << i18n("Gifts") |
369 | << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") << i18n("Hiking") << i18n("Hunting") << i18n("Key Customer") << i18n("Kids") | 370 | << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") << i18n("Hiking") << i18n("Hunting") << i18n("Key Customer") << i18n("Kids") |
370 | << i18n("Lunch") << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner")<< i18n("Party") << i18n("Personal") << i18n("Personal Travel") | 371 | << i18n("Lunch") << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner")<< i18n("Party") << i18n("Personal") << i18n("Personal Travel") |
371 | << i18n("PHB") << i18n("Phone Calls") << i18n("Projects") << i18n("Recurring") << i18n("School") << i18n("Shopping") | 372 | << i18n("PHB") << i18n("Phone Calls") << i18n("Projects") << i18n("Recurring") << i18n("School") << i18n("Shopping") |
372 | << i18n("Speach") << i18n("Special Occasion") << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV")<< i18n("University") | 373 | << i18n("Speach") << i18n("Special Occasion") << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV")<< i18n("University") |
373 | << i18n("Vacation") << i18n("VIP") << i18n("SyncEvent") ; | 374 | << i18n("Vacation") << i18n("VIP") << i18n("SyncEvent") ; |
374 | retval.sort(); | 375 | retval.sort(); |
375 | //qDebug("cat %s ", retval.join("-").latin1()); | 376 | //qDebug("cat %s ", retval.join("-").latin1()); |
376 | return retval; | 377 | return retval; |
377 | } | 378 | } |
378 | 379 | ||
379 | void KOPrefs::usrReadConfig() | 380 | void KOPrefs::usrReadConfig() |
380 | { | 381 | { |
381 | config()->setGroup("General"); | 382 | config()->setGroup("General"); |
382 | 383 | ||
383 | //qDebug("KOPrefs::usrReadConfig() "); | 384 | //qDebug("KOPrefs::usrReadConfig() "); |
384 | mCustomCategories = config()->readListEntry("Custom Categories"); | 385 | mCustomCategories = config()->readListEntry("Custom Categories"); |
385 | mOldLoadedLanguage = mOldLanguage ; | 386 | mOldLoadedLanguage = mOldLanguage ; |
386 | mOldLanguage = KPimGlobalPrefs::instance()->mPreferredLanguage; | 387 | mOldLanguage = KPimGlobalPrefs::instance()->mPreferredLanguage; |
387 | if (mLocationDefaults.isEmpty()) { | 388 | if (mLocationDefaults.isEmpty()) { |
388 | mLocationDefaults = getLocationDefaultList(); | 389 | mLocationDefaults = getLocationDefaultList(); |
389 | } | 390 | } |
390 | 391 | ||
391 | if (mEventSummaryUser.isEmpty()) { | 392 | if (mEventSummaryUser.isEmpty()) { |
392 | mEventSummaryUser = getDefaultList() ; | 393 | mEventSummaryUser = getDefaultList() ; |
393 | } | 394 | } |
394 | if (mTodoSummaryUser.isEmpty()) { | 395 | if (mTodoSummaryUser.isEmpty()) { |
395 | mTodoSummaryUser = getDefaultList() ; | 396 | mTodoSummaryUser = getDefaultList() ; |
396 | } | 397 | } |
397 | 398 | ||
398 | if (mCustomCategories.isEmpty()) setCategoryDefaults(); | 399 | if (mCustomCategories.isEmpty()) setCategoryDefaults(); |
399 | 400 | ||
400 | config()->setGroup("Personal Settings"); | 401 | config()->setGroup("Personal Settings"); |
401 | mName = config()->readEntry("user_name",""); | 402 | mName = config()->readEntry("user_name",""); |
402 | mEmail = config()->readEntry("user_email",""); | 403 | mEmail = config()->readEntry("user_email",""); |
403 | fillMailDefaults(); | 404 | fillMailDefaults(); |
404 | 405 | ||
405 | config()->setGroup("Category Colors"); | 406 | config()->setGroup("Category Colors"); |
406 | QStringList::Iterator it; | 407 | QStringList::Iterator it; |
407 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { | 408 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { |
408 | setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor)); | 409 | setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor)); |
409 | 410 | ||
410 | } | 411 | } |
411 | 412 | ||
412 | KPimPrefs::usrReadConfig(); | 413 | KPimPrefs::usrReadConfig(); |
413 | } | 414 | } |
414 | 415 | ||
415 | 416 | ||
416 | void KOPrefs::usrWriteConfig() | 417 | void KOPrefs::usrWriteConfig() |
417 | { | 418 | { |
418 | config()->setGroup("General"); | 419 | config()->setGroup("General"); |
419 | config()->writeEntry("Custom Categories",mCustomCategories); | 420 | config()->writeEntry("Custom Categories",mCustomCategories); |
420 | 421 | ||
421 | config()->setGroup("Personal Settings"); | 422 | config()->setGroup("Personal Settings"); |
422 | config()->writeEntry("user_name",mName); | 423 | config()->writeEntry("user_name",mName); |
423 | config()->writeEntry("user_email",mEmail); | 424 | config()->writeEntry("user_email",mEmail); |
424 | 425 | ||
425 | config()->setGroup("Category Colors"); | 426 | config()->setGroup("Category Colors"); |
426 | QDictIterator<QColor> it(mCategoryColors); | 427 | QDictIterator<QColor> it(mCategoryColors); |
427 | while (it.current()) { | 428 | while (it.current()) { |
428 | config()->writeEntry(it.currentKey(),*(it.current())); | 429 | config()->writeEntry(it.currentKey(),*(it.current())); |
429 | ++it; | 430 | ++it; |
430 | } | 431 | } |
431 | 432 | ||
432 | 433 | ||
433 | KPimPrefs::usrWriteConfig(); | 434 | KPimPrefs::usrWriteConfig(); |
434 | } | 435 | } |
435 | 436 | ||
436 | void KOPrefs::setCategoryColor(QString cat,const QColor & color) | 437 | void KOPrefs::setCategoryColor(QString cat,const QColor & color) |
437 | { | 438 | { |
438 | mCategoryColors.replace(cat,new QColor(color)); | 439 | mCategoryColors.replace(cat,new QColor(color)); |
439 | } | 440 | } |
440 | 441 | ||
441 | QColor *KOPrefs::categoryColor(QString cat) | 442 | QColor *KOPrefs::categoryColor(QString cat) |
442 | { | 443 | { |
443 | QColor *color = 0; | 444 | QColor *color = 0; |
444 | 445 | ||
445 | if (!cat.isEmpty()) color = mCategoryColors[cat]; | 446 | if (!cat.isEmpty()) color = mCategoryColors[cat]; |
446 | 447 | ||
447 | if (color) return color; | 448 | if (color) return color; |
448 | else return &mDefaultCategoryColor; | 449 | else return &mDefaultCategoryColor; |
449 | } | 450 | } |
450 | 451 | ||
451 | void KOPrefs::setFullName(const QString &name) | 452 | void KOPrefs::setFullName(const QString &name) |
452 | { | 453 | { |
453 | mName = name; | 454 | mName = name; |
454 | } | 455 | } |
455 | 456 | ||
456 | void KOPrefs::setEmail(const QString &email) | 457 | void KOPrefs::setEmail(const QString &email) |
457 | { | 458 | { |
458 | //qDebug(" KOPrefs::setEmai*********** %s",email.latin1() ); | 459 | //qDebug(" KOPrefs::setEmai*********** %s",email.latin1() ); |
459 | mEmail = email; | 460 | mEmail = email; |
460 | } | 461 | } |
461 | 462 | ||
462 | QString KOPrefs::fullName() | 463 | QString KOPrefs::fullName() |
463 | { | 464 | { |
464 | if (mEmailControlCenter) { | 465 | if (mEmailControlCenter) { |
465 | KEMailSettings settings; | 466 | KEMailSettings settings; |
466 | return settings.getSetting(KEMailSettings::RealName); | 467 | return settings.getSetting(KEMailSettings::RealName); |
467 | } else { | 468 | } else { |
468 | return mName; | 469 | return mName; |
469 | } | 470 | } |
470 | } | 471 | } |
471 | 472 | ||
472 | QString KOPrefs::email() | 473 | QString KOPrefs::email() |
473 | { | 474 | { |
474 | if (mEmailControlCenter) { | 475 | if (mEmailControlCenter) { |
475 | KEMailSettings settings; | 476 | KEMailSettings settings; |
476 | return settings.getSetting(KEMailSettings::EmailAddress); | 477 | return settings.getSetting(KEMailSettings::EmailAddress); |
477 | } else { | 478 | } else { |
478 | return mEmail; | 479 | return mEmail; |
479 | } | 480 | } |
480 | } | 481 | } |
481 | KConfig* KOPrefs::getConfig() | 482 | KConfig* KOPrefs::getConfig() |
482 | { | 483 | { |
483 | return config(); | 484 | return config(); |
484 | } | 485 | } |
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h index fa69d52..e300067 100644 --- a/korganizer/koprefs.h +++ b/korganizer/koprefs.h | |||
@@ -1,283 +1,284 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | #ifndef KOPREFS_H | 23 | #ifndef KOPREFS_H |
24 | #define KOPREFS_H | 24 | #define KOPREFS_H |
25 | 25 | ||
26 | 26 | ||
27 | #include <libkdepim/kpimprefs.h> | 27 | #include <libkdepim/kpimprefs.h> |
28 | #include <qdict.h> | 28 | #include <qdict.h> |
29 | 29 | ||
30 | class KConfig; | 30 | class KConfig; |
31 | class QFont; | 31 | class QFont; |
32 | class QColor; | 32 | class QColor; |
33 | class QStringList; | 33 | class QStringList; |
34 | 34 | ||
35 | class KOPrefs : public KPimPrefs | 35 | class KOPrefs : public KPimPrefs |
36 | { | 36 | { |
37 | public: | 37 | public: |
38 | enum { FormatVCalendar, FormatICalendar }; | 38 | enum { FormatVCalendar, FormatICalendar }; |
39 | enum { MailClientKMail, MailClientSendmail }; | 39 | enum { MailClientKMail, MailClientSendmail }; |
40 | enum { IMIPDummy, IMIPKMail }; | 40 | enum { IMIPDummy, IMIPKMail }; |
41 | enum { IMIPOutbox, IMIPdirectsend }; | 41 | enum { IMIPOutbox, IMIPdirectsend }; |
42 | enum { neverAuto, addressbookAuto, selectedAuto }; | 42 | enum { neverAuto, addressbookAuto, selectedAuto }; |
43 | enum { standardDestination, askDestination }; | 43 | enum { standardDestination, askDestination }; |
44 | 44 | ||
45 | virtual ~KOPrefs(); | 45 | virtual ~KOPrefs(); |
46 | 46 | ||
47 | /** Get instance of KOPrefs. It is made sure that there is only one | 47 | /** Get instance of KOPrefs. It is made sure that there is only one |
48 | instance. */ | 48 | instance. */ |
49 | static KOPrefs *instance(); | 49 | static KOPrefs *instance(); |
50 | 50 | ||
51 | /** Set preferences to default values */ | 51 | /** Set preferences to default values */ |
52 | void usrSetDefaults(); | 52 | void usrSetDefaults(); |
53 | 53 | ||
54 | /** Read preferences from config file */ | 54 | /** Read preferences from config file */ |
55 | void usrReadConfig(); | 55 | void usrReadConfig(); |
56 | 56 | ||
57 | /** Write preferences to config file */ | 57 | /** Write preferences to config file */ |
58 | void usrWriteConfig(); | 58 | void usrWriteConfig(); |
59 | void setCategoryDefaults(); | 59 | void setCategoryDefaults(); |
60 | void setAllDefaults(); | 60 | void setAllDefaults(); |
61 | 61 | ||
62 | protected: | 62 | protected: |
63 | void setTimeZoneIdDefault(); | 63 | void setTimeZoneIdDefault(); |
64 | 64 | ||
65 | /** Fill empty mail fields with default values. */ | 65 | /** Fill empty mail fields with default values. */ |
66 | void fillMailDefaults(); | 66 | void fillMailDefaults(); |
67 | 67 | ||
68 | private: | 68 | private: |
69 | /** Constructor disabled for public. Use instance() to create a KOPrefs | 69 | /** Constructor disabled for public. Use instance() to create a KOPrefs |
70 | object. */ | 70 | object. */ |
71 | KOPrefs(); | 71 | KOPrefs(); |
72 | 72 | ||
73 | static KOPrefs *mInstance; | 73 | static KOPrefs *mInstance; |
74 | QStringList getDefaultList(); | 74 | QStringList getDefaultList(); |
75 | QStringList getLocationDefaultList(); | 75 | QStringList getLocationDefaultList(); |
76 | public: | 76 | public: |
77 | // preferences data | 77 | // preferences data |
78 | KConfig* getConfig(); | 78 | KConfig* getConfig(); |
79 | void setFullName(const QString &); | 79 | void setFullName(const QString &); |
80 | QString fullName(); | 80 | QString fullName(); |
81 | void setEmail(const QString &); | 81 | void setEmail(const QString &); |
82 | QString email(); | 82 | QString email(); |
83 | 83 | ||
84 | QString mAdditional; | 84 | QString mAdditional; |
85 | 85 | ||
86 | bool mEmailControlCenter; | 86 | bool mEmailControlCenter; |
87 | 87 | ||
88 | bool mBcc; | 88 | bool mBcc; |
89 | bool mAutoSave; | 89 | bool mAutoSave; |
90 | int mAutoSaveInterval; | 90 | int mAutoSaveInterval; |
91 | bool mConfirm; | 91 | bool mConfirm; |
92 | 92 | ||
93 | bool mEnableGroupScheduling; | 93 | bool mEnableGroupScheduling; |
94 | bool mEnableProjectView; | 94 | bool mEnableProjectView; |
95 | 95 | ||
96 | int mDefaultFormat; | 96 | int mDefaultFormat; |
97 | int mMailClient; | 97 | int mMailClient; |
98 | 98 | ||
99 | int mStartTime; | 99 | int mStartTime; |
100 | int mDefaultDuration; | 100 | int mDefaultDuration; |
101 | int mAlarmTime; | 101 | int mAlarmTime; |
102 | 102 | ||
103 | int mWorkingHoursStart; | 103 | int mWorkingHoursStart; |
104 | int mWorkingHoursEnd; | 104 | int mWorkingHoursEnd; |
105 | bool mExcludeHolidays; | 105 | bool mExcludeHolidays; |
106 | bool mExcludeSaturdays; | 106 | bool mExcludeSaturdays; |
107 | bool mMarcusBainsShowSeconds; | 107 | bool mMarcusBainsShowSeconds; |
108 | 108 | ||
109 | QFont mTimeBarFont; | 109 | QFont mTimeBarFont; |
110 | QFont mMonthViewFont; | 110 | QFont mMonthViewFont; |
111 | QFont mAgendaViewFont; | 111 | QFont mAgendaViewFont; |
112 | QFont mMarcusBainsFont; | 112 | QFont mMarcusBainsFont; |
113 | QFont mTimeLabelsFont; | 113 | QFont mTimeLabelsFont; |
114 | QFont mTodoViewFont; | 114 | QFont mTodoViewFont; |
115 | QFont mListViewFont; | 115 | QFont mListViewFont; |
116 | QFont mDateNavigatorFont; | 116 | QFont mDateNavigatorFont; |
117 | QFont mEditBoxFont; | 117 | QFont mEditBoxFont; |
118 | QFont mJornalViewFont; | 118 | QFont mJornalViewFont; |
119 | QFont mWhatsNextFont; | 119 | QFont mWhatsNextFont; |
120 | QFont mEventViewFont; | 120 | QFont mEventViewFont; |
121 | 121 | ||
122 | 122 | ||
123 | 123 | ||
124 | 124 | ||
125 | QColor mHolidayColor; | 125 | QColor mHolidayColor; |
126 | QColor mHighlightColor; | 126 | QColor mHighlightColor; |
127 | QColor mEventColor; | 127 | QColor mEventColor; |
128 | QColor mTodoDoneColor; | 128 | QColor mTodoDoneColor; |
129 | QColor mAgendaBgColor; | 129 | QColor mAgendaBgColor; |
130 | QColor mWorkingHoursColor; | 130 | QColor mWorkingHoursColor; |
131 | QColor mTodoDueTodayColor; | 131 | QColor mTodoDueTodayColor; |
132 | QColor mTodoOverdueColor; | 132 | QColor mTodoOverdueColor; |
133 | QColor mMonthViewEvenColor; | 133 | QColor mMonthViewEvenColor; |
134 | QColor mMonthViewOddColor; | 134 | QColor mMonthViewOddColor; |
135 | QColor mMonthViewHolidayColor; | 135 | QColor mMonthViewHolidayColor; |
136 | bool mMonthViewUsesDayColors; | 136 | bool mMonthViewUsesDayColors; |
137 | bool mMonthViewSatSunTog; | 137 | bool mMonthViewSatSunTog; |
138 | bool mMonthViewWeek; | 138 | bool mMonthViewWeek; |
139 | QColor mAppColor1; | 139 | QColor mAppColor1; |
140 | QColor mAppColor2; | 140 | QColor mAppColor2; |
141 | bool mUseAppColors; | 141 | bool mUseAppColors; |
142 | 142 | ||
143 | int mDayBegins; | 143 | int mDayBegins; |
144 | int mHourSize; | 144 | int mHourSize; |
145 | int mAllDaySize; | 145 | int mAllDaySize; |
146 | bool mShowFullMenu; | 146 | bool mShowFullMenu; |
147 | bool mDailyRecur; | 147 | bool mDailyRecur; |
148 | bool mWeeklyRecur; | 148 | bool mWeeklyRecur; |
149 | bool mMonthDailyRecur; | 149 | bool mMonthDailyRecur; |
150 | bool mMonthWeeklyRecur; | 150 | bool mMonthWeeklyRecur; |
151 | bool mMonthShowIcons; | 151 | bool mMonthShowIcons; |
152 | bool mMonthShowShort; | 152 | bool mMonthShowShort; |
153 | bool mEnableToolTips; | 153 | bool mEnableToolTips; |
154 | bool mEnableMonthScroll; | 154 | bool mEnableMonthScroll; |
155 | bool mFullViewMonth; | 155 | bool mFullViewMonth; |
156 | bool mMonthViewUsesCategoryColor; | 156 | bool mMonthViewUsesCategoryColor; |
157 | bool mFullViewTodo; | 157 | bool mFullViewTodo; |
158 | bool mShowCompletedTodo; | 158 | bool mShowCompletedTodo; |
159 | bool mMarcusBainsEnabled; | 159 | bool mMarcusBainsEnabled; |
160 | int mNextXDays; | 160 | int mNextXDays; |
161 | int mWhatsNextDays; | 161 | int mWhatsNextDays; |
162 | int mWhatsNextPrios; | 162 | int mWhatsNextPrios; |
163 | bool mEnableQuickTodo; | 163 | bool mEnableQuickTodo; |
164 | 164 | ||
165 | bool mCompactDialogs; | 165 | bool mCompactDialogs; |
166 | bool mVerticalScreen; | 166 | bool mVerticalScreen; |
167 | 167 | ||
168 | bool mShowIconNewTodo; | 168 | bool mShowIconNewTodo; |
169 | bool mShowIconNewEvent; | 169 | bool mShowIconNewEvent; |
170 | bool mShowIconSearch; | 170 | bool mShowIconSearch; |
171 | bool mShowIconList; | 171 | bool mShowIconList; |
172 | bool mShowIconDay1; | 172 | bool mShowIconDay1; |
173 | bool mShowIconDay5; | 173 | bool mShowIconDay5; |
174 | bool mShowIconDay6; | ||
174 | bool mShowIconDay7; | 175 | bool mShowIconDay7; |
175 | bool mShowIconMonth; | 176 | bool mShowIconMonth; |
176 | bool mShowIconTodoview; | 177 | bool mShowIconTodoview; |
177 | bool mShowIconBackFast; | 178 | bool mShowIconBackFast; |
178 | bool mShowIconBack; | 179 | bool mShowIconBack; |
179 | bool mShowIconToday; | 180 | bool mShowIconToday; |
180 | bool mShowIconForward; | 181 | bool mShowIconForward; |
181 | bool mShowIconForwardFast; | 182 | bool mShowIconForwardFast; |
182 | bool mShowIconWhatsThis; | 183 | bool mShowIconWhatsThis; |
183 | bool mShowIconNextDays; | 184 | bool mShowIconNextDays; |
184 | bool mShowIconNext; | 185 | bool mShowIconNext; |
185 | bool mShowIconJournal; | 186 | bool mShowIconJournal; |
186 | 187 | ||
187 | bool mShowIconStretch; | 188 | bool mShowIconStretch; |
188 | 189 | ||
189 | bool mToolBarHor; | 190 | bool mToolBarHor; |
190 | bool mToolBarUp; | 191 | bool mToolBarUp; |
191 | bool mToolBarMiniIcons; | 192 | bool mToolBarMiniIcons; |
192 | 193 | ||
193 | bool mAskForQuit; | 194 | bool mAskForQuit; |
194 | bool mUsePassWd; | 195 | bool mUsePassWd; |
195 | bool mShowSyncEvents; | 196 | bool mShowSyncEvents; |
196 | bool mShowTodoInAgenda; | 197 | bool mShowTodoInAgenda; |
197 | bool mShowTimeInAgenda; | 198 | bool mShowTimeInAgenda; |
198 | bool mHideNonStartedTodos; | 199 | bool mHideNonStartedTodos; |
199 | 200 | ||
200 | int mLastSyncTime; | 201 | int mLastSyncTime; |
201 | void setCategoryColor(QString cat,const QColor & color); | 202 | void setCategoryColor(QString cat,const QColor & color); |
202 | QColor *categoryColor(QString cat); | 203 | QColor *categoryColor(QString cat); |
203 | 204 | ||
204 | QString mArchiveFile; | 205 | QString mArchiveFile; |
205 | QString mHtmlExportFile; | 206 | QString mHtmlExportFile; |
206 | bool mHtmlWithSave; | 207 | bool mHtmlWithSave; |
207 | 208 | ||
208 | QStringList mSelectedPlugins; | 209 | QStringList mSelectedPlugins; |
209 | 210 | ||
210 | QString mLastImportFile; | 211 | QString mLastImportFile; |
211 | QString mLastVcalFile; | 212 | QString mLastVcalFile; |
212 | QString mLastSaveFile; | 213 | QString mLastSaveFile; |
213 | QString mLastLoadFile; | 214 | QString mLastLoadFile; |
214 | 215 | ||
215 | 216 | ||
216 | QString mDefaultAlarmFile; | 217 | QString mDefaultAlarmFile; |
217 | int mIMIPScheduler; | 218 | int mIMIPScheduler; |
218 | int mIMIPSend; | 219 | int mIMIPSend; |
219 | QStringList mAdditionalMails; | 220 | QStringList mAdditionalMails; |
220 | int mIMIPAutoRefresh; | 221 | int mIMIPAutoRefresh; |
221 | int mIMIPAutoInsertReply; | 222 | int mIMIPAutoInsertReply; |
222 | int mIMIPAutoInsertRequest; | 223 | int mIMIPAutoInsertRequest; |
223 | int mIMIPAutoFreeBusy; | 224 | int mIMIPAutoFreeBusy; |
224 | int mIMIPAutoFreeBusyReply; | 225 | int mIMIPAutoFreeBusyReply; |
225 | 226 | ||
226 | QStringList mTodoTemplates; | 227 | QStringList mTodoTemplates; |
227 | QStringList mEventTemplates; | 228 | QStringList mEventTemplates; |
228 | 229 | ||
229 | int mDestination; | 230 | int mDestination; |
230 | 231 | ||
231 | 232 | ||
232 | bool mEditOnDoubleClick; | 233 | bool mEditOnDoubleClick; |
233 | bool mViewChangeHoldFullscreen; | 234 | bool mViewChangeHoldFullscreen; |
234 | bool mViewChangeHoldNonFullscreen; | 235 | bool mViewChangeHoldNonFullscreen; |
235 | bool mCenterOnCurrentTime; | 236 | bool mCenterOnCurrentTime; |
236 | bool mSetTimeToDayStartAt; | 237 | bool mSetTimeToDayStartAt; |
237 | bool mHighlightCurrentDay; | 238 | bool mHighlightCurrentDay; |
238 | bool mUseHighlightLightColor; | 239 | bool mUseHighlightLightColor; |
239 | bool mListViewMonthTimespan; | 240 | bool mListViewMonthTimespan; |
240 | bool mWNViewShowsParents; | 241 | bool mWNViewShowsParents; |
241 | bool mWNViewShowsPast; | 242 | bool mWNViewShowsPast; |
242 | bool mWNViewShowLocation; | 243 | bool mWNViewShowLocation; |
243 | bool mTodoViewShowsPercentage; | 244 | bool mTodoViewShowsPercentage; |
244 | bool mTodoViewUsesCatColors; | 245 | bool mTodoViewUsesCatColors; |
245 | bool mMonthViewUsesBigFont; | 246 | bool mMonthViewUsesBigFont; |
246 | bool mTodoViewUsesSmallFont; | 247 | bool mTodoViewUsesSmallFont; |
247 | bool mTodoViewUsesForegroundColor; | 248 | bool mTodoViewUsesForegroundColor; |
248 | bool mMonthViewUsesForegroundColor; | 249 | bool mMonthViewUsesForegroundColor; |
249 | 250 | ||
250 | bool mHightlightDateTimeEdit; | 251 | bool mHightlightDateTimeEdit; |
251 | bool mShortDateInViewer; | 252 | bool mShortDateInViewer; |
252 | 253 | ||
253 | bool mShowDateNavigator; | 254 | bool mShowDateNavigator; |
254 | 255 | ||
255 | QStringList mLocationDefaults; | 256 | QStringList mLocationDefaults; |
256 | QStringList mEventSummaryUser; | 257 | QStringList mEventSummaryUser; |
257 | QStringList mTodoSummaryUser; | 258 | QStringList mTodoSummaryUser; |
258 | 259 | ||
259 | bool mUseInternalAlarmNotification; | 260 | bool mUseInternalAlarmNotification; |
260 | int mAlarmPlayBeeps; | 261 | int mAlarmPlayBeeps; |
261 | int mAlarmSuspendTime; | 262 | int mAlarmSuspendTime; |
262 | int mAlarmSuspendCount; | 263 | int mAlarmSuspendCount; |
263 | int mAlarmBeepInterval; | 264 | int mAlarmBeepInterval; |
264 | int mOldLanguage; | 265 | int mOldLanguage; |
265 | int mOldLoadedLanguage; | 266 | int mOldLoadedLanguage; |
266 | 267 | ||
267 | 268 | ||
268 | QString mActiveSyncPort; | 269 | QString mActiveSyncPort; |
269 | QString mActiveSyncIP; | 270 | QString mActiveSyncIP; |
270 | 271 | ||
271 | private: | 272 | private: |
272 | QDict<QColor> mCategoryColors; | 273 | QDict<QColor> mCategoryColors; |
273 | QColor mDefaultCategoryColor; | 274 | QColor mDefaultCategoryColor; |
274 | 275 | ||
275 | QFont mDefaultTimeBarFont; | 276 | QFont mDefaultTimeBarFont; |
276 | QFont mDefaultViewFont; | 277 | QFont mDefaultViewFont; |
277 | QFont mDefaultMonthViewFont; | 278 | QFont mDefaultMonthViewFont; |
278 | 279 | ||
279 | QString mName; | 280 | QString mName; |
280 | QString mEmail; | 281 | QString mEmail; |
281 | }; | 282 | }; |
282 | 283 | ||
283 | #endif | 284 | #endif |
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp index f8f6c1d..e22f096 100644 --- a/korganizer/koviewmanager.cpp +++ b/korganizer/koviewmanager.cpp | |||
@@ -1,674 +1,714 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | 3 | ||
4 | Copyright (c) 2001 | 4 | Copyright (c) 2001 |
5 | Cornelius Schumacher <schumacher@kde.org> | 5 | Cornelius Schumacher <schumacher@kde.org> |
6 | 6 | ||
7 | This program is free software; you can redistribute it and/or modify | 7 | This program is free software; you can redistribute it and/or modify |
8 | it under the terms of the GNU General Public License as published by | 8 | it under the terms of the GNU General Public License as published by |
9 | the Free Software Foundation; either version 2 of the License, or | 9 | the Free Software Foundation; either version 2 of the License, or |
10 | (at your option) any later version. | 10 | (at your option) any later version. |
11 | 11 | ||
12 | This program is distributed in the hope that it will be useful, | 12 | This program is distributed in the hope that it will be useful, |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the | 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the |
15 | GNU General Public License for more details. | 15 | GNU General Public License for more details. |
16 | 16 | ||
17 | You should have received a copy of the GNU General Public License | 17 | You should have received a copy of the GNU General Public License |
18 | along with this program; if not, write to the Free Software | 18 | along with this program; if not, write to the Free Software |
19 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 19 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
20 | 20 | ||
21 | As a special exception, permission is given to link this program | 21 | As a special exception, permission is given to link this program |
22 | with any edition of Qt, and distribute the resulting executable, | 22 | with any edition of Qt, and distribute the resulting executable, |
23 | without including the source code for Qt in the source distribution. | 23 | without including the source code for Qt in the source distribution. |
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include <qwidgetstack.h> | 26 | #include <qwidgetstack.h> |
27 | 27 | ||
28 | #include <kconfig.h> | 28 | #include <kconfig.h> |
29 | #include <kglobal.h> | 29 | #include <kglobal.h> |
30 | #ifndef DESKTOP_VERSION | 30 | #ifndef DESKTOP_VERSION |
31 | #include <qpe/qpeapplication.h> | 31 | #include <qpe/qpeapplication.h> |
32 | #else | 32 | #else |
33 | #include <qapplication.h> | 33 | #include <qapplication.h> |
34 | #endif | 34 | #endif |
35 | #include <qdatetime.h> | 35 | #include <qdatetime.h> |
36 | #include "calendarview.h" | 36 | #include "calendarview.h" |
37 | #include "datenavigator.h" | 37 | #include "datenavigator.h" |
38 | #include "kotodoview.h" | 38 | #include "kotodoview.h" |
39 | #include "koagendaview.h" | 39 | #include "koagendaview.h" |
40 | #include "kodialogmanager.h" | 40 | #include "kodialogmanager.h" |
41 | #include "komonthview.h" | 41 | #include "komonthview.h" |
42 | #include "kolistview.h" | 42 | #include "kolistview.h" |
43 | #include "kowhatsnextview.h" | 43 | #include "kowhatsnextview.h" |
44 | #include "kojournalview.h" | 44 | #include "kojournalview.h" |
45 | #include "kotimespanview.h" | 45 | #include "kotimespanview.h" |
46 | #include "koprefs.h" | 46 | #include "koprefs.h" |
47 | #include "navigatorbar.h" | 47 | #include "navigatorbar.h" |
48 | #include "kdatenavigator.h" | 48 | #include "kdatenavigator.h" |
49 | 49 | ||
50 | #include "koviewmanager.h" | 50 | #include "koviewmanager.h" |
51 | //extern bool externFlagMonthviewBlockPainting; | 51 | //extern bool externFlagMonthviewBlockPainting; |
52 | 52 | ||
53 | //bool globalFlagBlockPainting = false; | 53 | //bool globalFlagBlockPainting = false; |
54 | int globalFlagBlockAgenda = 0; | 54 | int globalFlagBlockAgenda = 0; |
55 | int globalFlagBlockLabel = 0; | 55 | int globalFlagBlockLabel = 0; |
56 | int globalFlagBlockAgendaItemPaint = 1; | 56 | int globalFlagBlockAgendaItemPaint = 1; |
57 | int globalFlagBlockAgendaItemUpdate = 1; | 57 | int globalFlagBlockAgendaItemUpdate = 1; |
58 | 58 | ||
59 | 59 | ||
60 | KOViewManager::KOViewManager( CalendarView *mainView ) : | 60 | KOViewManager::KOViewManager( CalendarView *mainView ) : |
61 | QObject(), mMainView( mainView ) | 61 | QObject(), mMainView( mainView ) |
62 | { | 62 | { |
63 | mCurrentView = 0; | 63 | mCurrentView = 0; |
64 | 64 | ||
65 | mWhatsNextView = 0; | 65 | mWhatsNextView = 0; |
66 | mTodoView = 0; | 66 | mTodoView = 0; |
67 | mAgendaView = 0; | 67 | mAgendaView = 0; |
68 | mMonthView = 0; | 68 | mMonthView = 0; |
69 | mListView = 0; | 69 | mListView = 0; |
70 | mJournalView = 0; | 70 | mJournalView = 0; |
71 | mTimeSpanView = 0; | 71 | mTimeSpanView = 0; |
72 | mCurrentAgendaView = 0 ; | 72 | mCurrentAgendaView = 0 ; |
73 | mFlagShowNextxDays = false; | 73 | mFlagShowNextxDays = false; |
74 | } | 74 | } |
75 | 75 | ||
76 | KOViewManager::~KOViewManager() | 76 | KOViewManager::~KOViewManager() |
77 | { | 77 | { |
78 | } | 78 | } |
79 | 79 | ||
80 | 80 | ||
81 | KOrg::BaseView *KOViewManager::currentView() | 81 | KOrg::BaseView *KOViewManager::currentView() |
82 | { | 82 | { |
83 | return mCurrentView; | 83 | return mCurrentView; |
84 | } | 84 | } |
85 | 85 | ||
86 | void KOViewManager::readSettings(KConfig *config) | 86 | void KOViewManager::readSettings(KConfig *config) |
87 | { | 87 | { |
88 | config->setGroup("General"); | 88 | config->setGroup("General"); |
89 | QString view = config->readEntry("Current View"); | 89 | QString view = config->readEntry("Current View"); |
90 | if (view == "WhatsNext") showWhatsNextView(); | 90 | if (view == "WhatsNext") showWhatsNextView(); |
91 | else if (view == "Month") showMonthView(); | 91 | else if (view == "Month") { |
92 | if ( KOPrefs::instance()->mMonthViewWeek ) | ||
93 | showMonthView(); | ||
94 | else | ||
95 | showMonthViewWeek(); | ||
96 | } | ||
92 | else if (view == "List") showListView(); | 97 | else if (view == "List") showListView(); |
93 | else if (view == "Journal") showJournalView(); | 98 | else if (view == "Journal") showJournalView(); |
94 | else if (view == "TimeSpan") showTimeSpanView(); | 99 | else if (view == "TimeSpan") showTimeSpanView(); |
95 | else if (view == "Todo") showTodoView(); | 100 | else if (view == "Todo") showTodoView(); |
96 | else { | 101 | else { |
97 | config->setGroup( "Views" ); | 102 | config->setGroup( "Views" ); |
98 | int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); | 103 | int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); |
99 | mCurrentAgendaView = dateCount; | 104 | mCurrentAgendaView = dateCount; |
100 | showAgendaView(); | 105 | showAgendaView(); |
101 | mCurrentAgendaView = dateCount; | 106 | mCurrentAgendaView = dateCount; |
102 | #ifdef DESKTOP_VERSION | 107 | #ifdef DESKTOP_VERSION |
103 | QTimer::singleShot( 1000, mAgendaView, SLOT ( setInitStartHour() ) ); | 108 | QTimer::singleShot( 1000, mAgendaView, SLOT ( setInitStartHour() ) ); |
104 | #endif | 109 | #endif |
105 | } | 110 | } |
106 | } | 111 | } |
107 | 112 | ||
108 | void KOViewManager::showDateView( int view, QDate date) | 113 | void KOViewManager::showDateView( int view, QDate date) |
109 | { | 114 | { |
110 | static int lastMode = 0; | 115 | static int lastMode = 0; |
111 | static int lastCount = 0; | 116 | static int lastCount = 0; |
112 | static bool lastNDMode = false; | 117 | static bool lastNDMode = false; |
113 | static QDate lastDate; | 118 | static QDate lastDate; |
114 | //qDebug("date %d %s", view, date.toString().latin1()); | 119 | //qDebug("date %d %s", view, date.toString().latin1()); |
115 | 120 | ||
116 | if (view != 9) | 121 | if (view != 9) |
117 | lastMode = 0; | 122 | lastMode = 0; |
118 | //qDebug("%d %d ", lastNDMode, mFlagShowNextxDays ); | 123 | //qDebug("%d %d ", lastNDMode, mFlagShowNextxDays ); |
119 | bool savemFlagShowNextxDays = mFlagShowNextxDays; | 124 | bool savemFlagShowNextxDays = mFlagShowNextxDays; |
120 | mFlagShowNextxDays = false; | 125 | mFlagShowNextxDays = false; |
121 | if ( view == 3 ) { | 126 | if ( view == 3 ) { |
122 | //mCurrentAgendaView = 1 ; | 127 | //mCurrentAgendaView = 1 ; |
123 | lastDate = mMainView->dateNavigator()->selectedDates().first(); | 128 | lastDate = mMainView->dateNavigator()->selectedDates().first(); |
124 | lastCount = mMainView->dateNavigator()->selectedDates().count(); | 129 | lastCount = mMainView->dateNavigator()->selectedDates().count(); |
125 | lastNDMode = savemFlagShowNextxDays; | 130 | lastNDMode = savemFlagShowNextxDays; |
126 | mMainView->showDay( date ); | 131 | mMainView->showDay( date ); |
127 | lastMode = 1; | 132 | lastMode = 1; |
128 | } else if (view == 4 ) { | 133 | } else if (view == 4 ) { |
129 | mCurrentAgendaView = 7 ; | 134 | mCurrentAgendaView = 7 ; |
130 | mMainView->dateNavigator()->selectDates( date, 7 ); | 135 | mMainView->dateNavigator()->selectDates( date, 7 ); |
131 | } else if (view == 5 ) { | 136 | } else if (view == 5 ) { |
132 | mCurrentAgendaView = 14 ; | 137 | mCurrentAgendaView = 14 ; |
133 | mMainView->dateNavigator()->selectDates( date, 14); | 138 | mMainView->dateNavigator()->selectDates( date, 14); |
134 | } else if (view == 6 ) { | 139 | } else if (view == 6 ) { |
135 | //mMainView->dateNavigator()->selectDates( date, 7 ); | 140 | //mMainView->dateNavigator()->selectDates( date, 7 ); |
136 | showMonthView(); | 141 | showMonthView(); |
137 | } else if (view == 7 ) { | 142 | } else if (view == 7 ) { |
138 | mMainView->dateNavigator()->selectDate( date ); | 143 | mMainView->dateNavigator()->selectDate( date ); |
139 | showJournalView(); | 144 | showJournalView(); |
140 | } else if (view == 8 ) { | 145 | } else if (view == 8 ) { |
141 | globalFlagBlockAgenda = 1; | 146 | globalFlagBlockAgenda = 1; |
142 | if ( mCurrentAgendaView != 3 ) | 147 | if ( mCurrentAgendaView != 3 ) |
143 | mCurrentAgendaView = -1; | 148 | mCurrentAgendaView = -1; |
144 | showAgendaView(KOPrefs::instance()->mFullViewMonth); | 149 | showAgendaView(KOPrefs::instance()->mFullViewMonth); |
145 | globalFlagBlockAgenda = 2; | 150 | globalFlagBlockAgenda = 2; |
146 | mMainView->dateNavigator()->selectDates( date , | 151 | mMainView->dateNavigator()->selectDates( date , |
147 | KOPrefs::instance()->mNextXDays ); | 152 | KOPrefs::instance()->mNextXDays ); |
148 | mFlagShowNextxDays = true; | 153 | mFlagShowNextxDays = true; |
149 | mCurrentAgendaView = 3 ; | 154 | mCurrentAgendaView = 3 ; |
150 | } if (view == 9) { // return behaviour, for getting back from mode == 3 (single day mode ) | 155 | } if (view == 9) { // return behaviour, for getting back from mode == 3 (single day mode ) |
151 | if ( lastMode ) { | 156 | if ( lastMode ) { |
152 | mCurrentAgendaView = lastCount ; | 157 | mCurrentAgendaView = lastCount ; |
153 | mMainView->dateNavigator()->selectDates( lastDate, lastCount); | 158 | mMainView->dateNavigator()->selectDates( lastDate, lastCount); |
154 | mFlagShowNextxDays = lastNDMode; | 159 | mFlagShowNextxDays = lastNDMode; |
155 | if ( mFlagShowNextxDays ) { | 160 | if ( mFlagShowNextxDays ) { |
156 | mCurrentAgendaView = 3 ; | 161 | mCurrentAgendaView = 3 ; |
157 | } | 162 | } |
158 | } else | 163 | } else |
159 | showWeekView(); | 164 | showWeekView(); |
160 | } else if (view == 10) { | 165 | } else if (view == 10) { |
161 | mMainView->dateNavigator()->selectDates( date,mMainView->dateNavigator()->selectedDates().count() ); | 166 | mMainView->dateNavigator()->selectDates( date,mMainView->dateNavigator()->selectedDates().count() ); |
162 | } | 167 | } |
163 | } | 168 | } |
164 | 169 | ||
165 | 170 | ||
166 | 171 | ||
167 | void KOViewManager::writeSettings(KConfig *config) | 172 | void KOViewManager::writeSettings(KConfig *config) |
168 | { | 173 | { |
169 | config->setGroup("General"); | 174 | config->setGroup("General"); |
170 | 175 | ||
171 | QString view; | 176 | QString view; |
172 | if (mCurrentView == mWhatsNextView) view = "WhatsNext"; | 177 | if (mCurrentView == mWhatsNextView) view = "WhatsNext"; |
173 | else if (mCurrentView == mMonthView) view = "Month"; | 178 | else if (mCurrentView == mMonthView) view = "Month"; |
174 | else if (mCurrentView == mListView) view = "List"; | 179 | else if (mCurrentView == mListView) view = "List"; |
175 | else if (mCurrentView == mJournalView) view = "Journal"; | 180 | else if (mCurrentView == mJournalView) view = "Journal"; |
176 | else if (mCurrentView == mTimeSpanView) view = "TimeSpan"; | 181 | else if (mCurrentView == mTimeSpanView) view = "TimeSpan"; |
177 | else if (mCurrentView == mTodoView) view = "Todo"; | 182 | else if (mCurrentView == mTodoView) view = "Todo"; |
178 | else view = "Agenda"; | 183 | else view = "Agenda"; |
179 | 184 | ||
180 | config->writeEntry("Current View",view); | 185 | config->writeEntry("Current View",view); |
181 | 186 | ||
182 | if (mAgendaView) { | 187 | if (mAgendaView) { |
183 | mAgendaView->writeSettings(config); | 188 | mAgendaView->writeSettings(config); |
184 | } | 189 | } |
185 | if (mTimeSpanView) { | 190 | if (mTimeSpanView) { |
186 | mTimeSpanView->writeSettings(config); | 191 | mTimeSpanView->writeSettings(config); |
187 | } | 192 | } |
188 | if (mListView) { | 193 | if (mListView) { |
189 | mListView->writeSettings(config); | 194 | mListView->writeSettings(config); |
190 | } | 195 | } |
191 | if (mTodoView) { | 196 | if (mTodoView) { |
192 | mTodoView->saveLayout(config,"Todo View"); | 197 | mTodoView->saveLayout(config,"Todo View"); |
193 | } | 198 | } |
194 | } | 199 | } |
195 | 200 | ||
196 | void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) | 201 | void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) |
197 | { | 202 | { |
198 | 203 | ||
199 | //mFlagShowNextxDays = false; | 204 | //mFlagShowNextxDays = false; |
200 | //if(view == mCurrentView) return; | 205 | //if(view == mCurrentView) return; |
201 | if ( view == 0 ) { | 206 | if ( view == 0 ) { |
202 | view = mCurrentView; | 207 | view = mCurrentView; |
203 | if ( view == 0 ) | 208 | if ( view == 0 ) |
204 | return; | 209 | return; |
205 | } | 210 | } |
206 | bool full = fullScreen; | 211 | bool full = fullScreen; |
207 | if(view == mCurrentView && view != mWhatsNextView ) { | 212 | if(view == mCurrentView && view != mWhatsNextView ) { |
208 | if ( mCurrentAgendaView < 0 ) | 213 | if ( mCurrentAgendaView < 0 ) |
209 | return; | 214 | return; |
210 | full = mMainView->leftFrame()->isVisible(); | 215 | if ( view != mMonthView ) |
216 | full = mMainView->leftFrame()->isVisible(); | ||
211 | } else { | 217 | } else { |
212 | if ( view == mMonthView && mMonthView) | 218 | if ( view == mMonthView && mMonthView) |
213 | ;//mMonthView->skipResize = true ; | 219 | ;//mMonthView->skipResize = true ; |
214 | mCurrentView = view; | 220 | mCurrentView = view; |
215 | // bool full = fullScreen; | 221 | // bool full = fullScreen; |
216 | bool isFull = !mMainView->leftFrame()->isVisible(); | 222 | bool isFull = !mMainView->leftFrame()->isVisible(); |
217 | if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen ) | 223 | if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen ) |
218 | full = true; | 224 | full = true; |
219 | if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen ) | 225 | if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen ) |
220 | full = false; | 226 | full = false; |
221 | } | 227 | } |
222 | if ( mAgendaView ) mAgendaView->deleteSelectedDateTime(); | 228 | if ( mAgendaView ) mAgendaView->deleteSelectedDateTime(); |
223 | //raiseCurrentView( full ); | 229 | //raiseCurrentView( full ); |
224 | mMainView->processIncidenceSelection( 0 ); | 230 | mMainView->processIncidenceSelection( 0 ); |
225 | //mMainView->updateView(); | 231 | //mMainView->updateView(); |
226 | raiseCurrentView( full, true ); | 232 | raiseCurrentView( full, true ); |
227 | mMainView->adaptNavigationUnits(); | 233 | mMainView->adaptNavigationUnits(); |
228 | } | 234 | } |
229 | 235 | ||
230 | void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView ) | 236 | void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView ) |
231 | { | 237 | { |
232 | mCurrentAgendaView = 0; | 238 | mCurrentAgendaView = 0; |
233 | if ( fullScreen ) { | 239 | if ( fullScreen ) { |
234 | mMainView->leftFrame()->hide(); | 240 | mMainView->leftFrame()->hide(); |
235 | } else { | 241 | } else { |
236 | mMainView->leftFrame()->show(); | 242 | mMainView->leftFrame()->show(); |
237 | } | 243 | } |
238 | emit signalFullScreen( !fullScreen ); | 244 | emit signalFullScreen( !fullScreen ); |
239 | if ( callUpdateView ) | 245 | if ( callUpdateView ) |
240 | mMainView->updateView(); | 246 | mMainView->updateView(); |
241 | 247 | ||
242 | if ( globalFlagBlockAgenda == 5 ) { | 248 | if ( globalFlagBlockAgenda == 5 ) { |
243 | globalFlagBlockAgenda = 4; | 249 | globalFlagBlockAgenda = 4; |
244 | globalFlagBlockAgendaItemPaint = 1; | 250 | globalFlagBlockAgendaItemPaint = 1; |
245 | } | 251 | } |
246 | mMainView->viewStack()->raiseWidget(mCurrentView); | 252 | mMainView->viewStack()->raiseWidget(mCurrentView); |
247 | if ( globalFlagBlockAgenda == 4 ) { | 253 | if ( globalFlagBlockAgenda == 4 ) { |
248 | if ( mCurrentView == mAgendaView ) { | 254 | if ( mCurrentView == mAgendaView ) { |
249 | //globalFlagBlockAgenda =1 ; | 255 | //globalFlagBlockAgenda =1 ; |
250 | if ( KOPrefs::instance()->mSetTimeToDayStartAt ) | 256 | if ( KOPrefs::instance()->mSetTimeToDayStartAt ) |
251 | mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins ); | 257 | mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins ); |
252 | else if ( KOPrefs::instance()->mCenterOnCurrentTime ) | 258 | else if ( KOPrefs::instance()->mCenterOnCurrentTime ) |
253 | mAgendaView->setStartHour( QTime::currentTime ().hour() ); | 259 | mAgendaView->setStartHour( QTime::currentTime ().hour() ); |
254 | qApp->processEvents(); | 260 | qApp->processEvents(); |
255 | //qDebug("qApp->processEvents() "); | 261 | //qDebug("qApp->processEvents() "); |
256 | globalFlagBlockAgenda = 0; | 262 | globalFlagBlockAgenda = 0; |
257 | mAgendaView->repaintAgenda(); | 263 | mAgendaView->repaintAgenda(); |
258 | 264 | ||
259 | } | 265 | } |
260 | globalFlagBlockAgenda = 0; | 266 | globalFlagBlockAgenda = 0; |
261 | } | 267 | } |
262 | emit signalAgendaView( mCurrentView == mAgendaView ); | 268 | emit signalAgendaView( mCurrentView == mAgendaView ); |
263 | //qDebug("raiseCurrentView ende "); | 269 | //qDebug("raiseCurrentView ende "); |
264 | 270 | ||
265 | } | 271 | } |
266 | 272 | ||
267 | void KOViewManager::updateView() | 273 | void KOViewManager::updateView() |
268 | { | 274 | { |
269 | // qDebug("KOViewManager::updateView() "); | 275 | // qDebug("KOViewManager::updateView() "); |
270 | // if we are updating mTodoView, we get endless recursion | 276 | // if we are updating mTodoView, we get endless recursion |
271 | if ( mTodoView == mCurrentView ) | 277 | if ( mTodoView == mCurrentView ) |
272 | return; | 278 | return; |
273 | if ( mCurrentView ) mCurrentView->updateView(); | 279 | if ( mCurrentView ) mCurrentView->updateView(); |
274 | 280 | ||
275 | } | 281 | } |
276 | 282 | ||
277 | void KOViewManager::updateView(const QDate &start, const QDate &end) | 283 | void KOViewManager::updateView(const QDate &start, const QDate &end) |
278 | { | 284 | { |
279 | // kdDebug() << "KOViewManager::updateView()" << endl; | 285 | // kdDebug() << "KOViewManager::updateView()" << endl; |
280 | 286 | ||
281 | if (mCurrentView) mCurrentView->showDates(start, end); | 287 | if (mCurrentView) mCurrentView->showDates(start, end); |
282 | 288 | ||
283 | if (mTodoView && mTodoView == mCurrentView ) mTodoView->updateView(); | 289 | if (mTodoView && mTodoView == mCurrentView ) mTodoView->updateView(); |
284 | } | 290 | } |
285 | 291 | ||
286 | 292 | ||
287 | void KOViewManager::updateWNview() | 293 | void KOViewManager::updateWNview() |
288 | { | 294 | { |
289 | if ( mCurrentView == mWhatsNextView && mWhatsNextView ) | 295 | if ( mCurrentView == mWhatsNextView && mWhatsNextView ) |
290 | mWhatsNextView->updateView(); | 296 | mWhatsNextView->updateView(); |
291 | 297 | ||
292 | } | 298 | } |
293 | void KOViewManager::showWhatsNextView() | 299 | void KOViewManager::showWhatsNextView() |
294 | { | 300 | { |
295 | if (!mWhatsNextView) { | 301 | if (!mWhatsNextView) { |
296 | mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(), | 302 | mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(), |
297 | "KOViewManager::WhatsNextView"); | 303 | "KOViewManager::WhatsNextView"); |
298 | mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog()); | 304 | mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog()); |
299 | connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig())); | 305 | connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig())); |
300 | addView(mWhatsNextView); | 306 | addView(mWhatsNextView); |
301 | connect(this, SIGNAL( printWNV() ), | 307 | connect(this, SIGNAL( printWNV() ), |
302 | mWhatsNextView, SLOT( printMe() ) ); | 308 | mWhatsNextView, SLOT( printMe() ) ); |
303 | } | 309 | } |
304 | globalFlagBlockAgenda = 1; | 310 | globalFlagBlockAgenda = 1; |
305 | showView(mWhatsNextView, true ); | 311 | showView(mWhatsNextView, true ); |
306 | //mWhatsNextView->updateView(); | 312 | //mWhatsNextView->updateView(); |
307 | 313 | ||
308 | } | 314 | } |
309 | 315 | ||
310 | void KOViewManager::showListView() | 316 | void KOViewManager::showListView() |
311 | { | 317 | { |
312 | if (!mListView) { | 318 | if (!mListView) { |
313 | mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView"); | 319 | mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView"); |
314 | addView(mListView); | 320 | addView(mListView); |
315 | 321 | ||
316 | connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)), | 322 | connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)), |
317 | mMainView, SLOT(showIncidence(Incidence *))); | 323 | mMainView, SLOT(showIncidence(Incidence *))); |
318 | connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)), | 324 | connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)), |
319 | mMainView, SLOT(editIncidence(Incidence *))); | 325 | mMainView, SLOT(editIncidence(Incidence *))); |
320 | connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)), | 326 | connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)), |
321 | mMainView, SLOT(deleteIncidence(Incidence *))); | 327 | mMainView, SLOT(deleteIncidence(Incidence *))); |
322 | connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ), | 328 | connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ), |
323 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); | 329 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); |
324 | connect( mListView, SIGNAL( signalNewEvent() ), | 330 | connect( mListView, SIGNAL( signalNewEvent() ), |
325 | mMainView, SLOT( newEvent() ) ); | 331 | mMainView, SLOT( newEvent() ) ); |
326 | connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig())); | 332 | connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig())); |
327 | connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), | 333 | connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), |
328 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); | 334 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); |
329 | connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), | 335 | connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), |
330 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); | 336 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); |
331 | connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ), | 337 | connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ), |
332 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); | 338 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); |
333 | connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ), | 339 | connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ), |
334 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); | 340 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); |
335 | } | 341 | } |
336 | // bool temp = mFlagShowNextxDays; | 342 | // bool temp = mFlagShowNextxDays; |
337 | //globalFlagBlockPainting = true; | 343 | //globalFlagBlockPainting = true; |
338 | globalFlagBlockAgenda = 1; | 344 | globalFlagBlockAgenda = 1; |
339 | if ( KOPrefs::instance()->mListViewMonthTimespan ) { | 345 | if ( KOPrefs::instance()->mListViewMonthTimespan ) { |
340 | mMainView->setBlockShowDates( true ); | 346 | mMainView->setBlockShowDates( true ); |
341 | mMainView->dateNavigator()->selectMonth(); | 347 | mMainView->dateNavigator()->selectMonth(); |
342 | mMainView->setBlockShowDates( false ); | 348 | mMainView->setBlockShowDates( false ); |
343 | } | 349 | } |
344 | showView(mListView, KOPrefs::instance()->mFullViewTodo); | 350 | showView(mListView, KOPrefs::instance()->mFullViewTodo); |
345 | //mFlagShowNextxDays = temp; | 351 | //mFlagShowNextxDays = temp; |
346 | } | 352 | } |
347 | 353 | ||
348 | void KOViewManager::showAgendaView( bool fullScreen ) | 354 | void KOViewManager::showAgendaView( bool fullScreen ) |
349 | { | 355 | { |
350 | 356 | ||
351 | mMainView->dialogManager()->hideSearchDialog(); | 357 | mMainView->dialogManager()->hideSearchDialog(); |
352 | // qDebug("KOViewManager::showAgendaView "); | 358 | // qDebug("KOViewManager::showAgendaView "); |
353 | bool full; | 359 | bool full; |
354 | full = fullScreen; | 360 | full = fullScreen; |
355 | if (!mAgendaView) { | 361 | if (!mAgendaView) { |
356 | full = false; | 362 | full = false; |
357 | mAgendaView = new KOAgendaView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::AgendaView"); | 363 | mAgendaView = new KOAgendaView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::AgendaView"); |
358 | addView(mAgendaView); | 364 | addView(mAgendaView); |
359 | #ifndef DESKTOP_VERSION | 365 | #ifndef DESKTOP_VERSION |
360 | QPEApplication::setStylusOperation( mAgendaView, QPEApplication::RightOnHold ); | 366 | QPEApplication::setStylusOperation( mAgendaView, QPEApplication::RightOnHold ); |
361 | #endif | 367 | #endif |
362 | connect( mAgendaView, SIGNAL( incidenceChanged(Incidence *, int )), | 368 | connect( mAgendaView, SIGNAL( incidenceChanged(Incidence *, int )), |
363 | mMainView, SLOT( changeIncidenceDisplay( Incidence *, int ) )); | 369 | mMainView, SLOT( changeIncidenceDisplay( Incidence *, int ) )); |
364 | 370 | ||
365 | // SIGNALS/SLOTS FOR DAY/WEEK VIEW | 371 | // SIGNALS/SLOTS FOR DAY/WEEK VIEW |
366 | 372 | ||
367 | connect(mAgendaView,SIGNAL(showDateView( int, QDate )),SLOT(showDateView( int, QDate ))); | 373 | connect(mAgendaView,SIGNAL(showDateView( int, QDate )),SLOT(showDateView( int, QDate ))); |
368 | 374 | ||
369 | connect(mAgendaView,SIGNAL(newTodoSignal(QDateTime,bool)), | 375 | connect(mAgendaView,SIGNAL(newTodoSignal(QDateTime,bool)), |
370 | mMainView, SLOT(newTodoDateTime(QDateTime,bool))); | 376 | mMainView, SLOT(newTodoDateTime(QDateTime,bool))); |
371 | connect(mAgendaView,SIGNAL(newEventSignal(QDateTime)), | 377 | connect(mAgendaView,SIGNAL(newEventSignal(QDateTime)), |
372 | mMainView, SLOT(newEvent(QDateTime))); | 378 | mMainView, SLOT(newEvent(QDateTime))); |
373 | connect(mAgendaView,SIGNAL(newEventSignal(QDateTime,QDateTime)), | 379 | connect(mAgendaView,SIGNAL(newEventSignal(QDateTime,QDateTime)), |
374 | mMainView, SLOT(newEvent(QDateTime,QDateTime))); | 380 | mMainView, SLOT(newEvent(QDateTime,QDateTime))); |
375 | connect(mAgendaView,SIGNAL(newEventSignal(QDate)), | 381 | connect(mAgendaView,SIGNAL(newEventSignal(QDate)), |
376 | mMainView, SLOT(newEvent(QDate))); | 382 | mMainView, SLOT(newEvent(QDate))); |
377 | 383 | ||
378 | connect(mAgendaView, SIGNAL(editIncidenceSignal(Incidence *)), | 384 | connect(mAgendaView, SIGNAL(editIncidenceSignal(Incidence *)), |
379 | mMainView, SLOT(editIncidence(Incidence *))); | 385 | mMainView, SLOT(editIncidence(Incidence *))); |
380 | connect(mAgendaView, SIGNAL(showIncidenceSignal(Incidence *)), | 386 | connect(mAgendaView, SIGNAL(showIncidenceSignal(Incidence *)), |
381 | mMainView, SLOT(showIncidence(Incidence *))); | 387 | mMainView, SLOT(showIncidence(Incidence *))); |
382 | connect(mAgendaView, SIGNAL(deleteIncidenceSignal(Incidence *)), | 388 | connect(mAgendaView, SIGNAL(deleteIncidenceSignal(Incidence *)), |
383 | mMainView, SLOT(deleteIncidence(Incidence *))); | 389 | mMainView, SLOT(deleteIncidence(Incidence *))); |
384 | 390 | ||
385 | connect( mAgendaView, SIGNAL( incidenceSelected( Incidence * ) ), | 391 | connect( mAgendaView, SIGNAL( incidenceSelected( Incidence * ) ), |
386 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); | 392 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); |
387 | 393 | ||
388 | connect(mAgendaView, SIGNAL( toggleExpand() ), | 394 | connect(mAgendaView, SIGNAL( toggleExpand() ), |
389 | mMainView, SLOT( toggleExpand() ) ); | 395 | mMainView, SLOT( toggleExpand() ) ); |
390 | 396 | ||
391 | connect(mMainView, SIGNAL( calendarViewExpanded( bool ) ), | 397 | connect(mMainView, SIGNAL( calendarViewExpanded( bool ) ), |
392 | mAgendaView, SLOT( setExpandedButton( bool ) ) ); | 398 | mAgendaView, SLOT( setExpandedButton( bool ) ) ); |
393 | connect( mAgendaView, SIGNAL( cloneIncidenceSignal(Incidence *) ), | 399 | connect( mAgendaView, SIGNAL( cloneIncidenceSignal(Incidence *) ), |
394 | mMainView, SLOT(cloneIncidence(Incidence *) ) ) ; | 400 | mMainView, SLOT(cloneIncidence(Incidence *) ) ) ; |
395 | connect( mAgendaView, SIGNAL( cancelIncidenceSignal(Incidence *) ), | 401 | connect( mAgendaView, SIGNAL( cancelIncidenceSignal(Incidence *) ), |
396 | mMainView, SLOT(cancelIncidence(Incidence *) ) ) ; | 402 | mMainView, SLOT(cancelIncidence(Incidence *) ) ) ; |
397 | connect(mMainView, SIGNAL(configChanged()), mAgendaView, SLOT(updateConfig())); | 403 | connect(mMainView, SIGNAL(configChanged()), mAgendaView, SLOT(updateConfig())); |
398 | connect( mMainView, SIGNAL( todoModified( Todo *, int )), mAgendaView, | 404 | connect( mMainView, SIGNAL( todoModified( Todo *, int )), mAgendaView, |
399 | SLOT( updateTodo( Todo *, int ) ) ); | 405 | SLOT( updateTodo( Todo *, int ) ) ); |
400 | connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )), | 406 | connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )), |
401 | mMainView, SIGNAL( todoModified( Todo *, int ))); | 407 | mMainView, SIGNAL( todoModified( Todo *, int ))); |
402 | connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ), | 408 | connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ), |
403 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); | 409 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); |
404 | connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ), | 410 | connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ), |
405 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); | 411 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); |
406 | connect( mAgendaView, SIGNAL( selectWeekNum( int ) ), | 412 | connect( mAgendaView, SIGNAL( selectWeekNum( int ) ), |
407 | mMainView->dateNavigator(), SLOT ( selectWeek( int ) ) ); | 413 | mMainView->dateNavigator(), SLOT ( selectWeek( int ) ) ); |
408 | mAgendaView->readSettings(); | 414 | mAgendaView->readSettings(); |
409 | mAgendaView->updateConfig(); | 415 | mAgendaView->updateConfig(); |
410 | } | 416 | } |
411 | 417 | ||
412 | showView( mAgendaView, full); | 418 | showView( mAgendaView, full); |
413 | 419 | ||
414 | } | 420 | } |
415 | 421 | ||
416 | void KOViewManager::showDayView() | 422 | void KOViewManager::showDayView() |
417 | { | 423 | { |
418 | mFlagShowNextxDays = false; | 424 | mFlagShowNextxDays = false; |
419 | globalFlagBlockLabel = 1; | 425 | globalFlagBlockLabel = 1; |
420 | globalFlagBlockAgenda = 1; | 426 | globalFlagBlockAgenda = 1; |
421 | if ( mCurrentAgendaView != 1 ) | 427 | if ( mCurrentAgendaView != 1 ) |
422 | mCurrentAgendaView = -1; | 428 | mCurrentAgendaView = -1; |
423 | showAgendaView(); | 429 | showAgendaView(); |
424 | qApp->processEvents(); | 430 | qApp->processEvents(); |
425 | globalFlagBlockAgenda = 2; | 431 | globalFlagBlockAgenda = 2; |
426 | globalFlagBlockLabel = 0; | 432 | globalFlagBlockLabel = 0; |
427 | mMainView->dateNavigator()->selectDates( 1 ); | 433 | mMainView->dateNavigator()->selectDates( 1 ); |
428 | mCurrentAgendaView = 1 ; | 434 | mCurrentAgendaView = 1 ; |
429 | 435 | ||
430 | } | 436 | } |
431 | 437 | ||
432 | void KOViewManager::showWorkWeekView() | 438 | void KOViewManager::showWorkWeekView() |
433 | { | 439 | { |
434 | mFlagShowNextxDays = false; | 440 | mFlagShowNextxDays = false; |
435 | globalFlagBlockAgenda = 1; | 441 | globalFlagBlockAgenda = 1; |
436 | globalFlagBlockLabel = 1; | 442 | globalFlagBlockLabel = 1; |
437 | if ( mCurrentAgendaView != 5 ) | 443 | if ( mCurrentAgendaView != 5 ) |
438 | mCurrentAgendaView = -1; | 444 | mCurrentAgendaView = -1; |
439 | showAgendaView(); | 445 | showAgendaView(); |
440 | qApp->processEvents(); | 446 | qApp->processEvents(); |
441 | globalFlagBlockAgenda = 2; | 447 | globalFlagBlockAgenda = 2; |
442 | globalFlagBlockLabel = 0; | 448 | globalFlagBlockLabel = 0; |
443 | mMainView->dateNavigator()->selectWorkWeek(); | 449 | mMainView->dateNavigator()->selectWorkWeek(); |
444 | mCurrentAgendaView = 5 ; | 450 | mCurrentAgendaView = 5 ; |
445 | 451 | ||
446 | } | 452 | } |
447 | 453 | ||
448 | void KOViewManager::showWeekView() | 454 | void KOViewManager::showWeekView() |
449 | { | 455 | { |
450 | /* | 456 | /* |
451 | globalFlagBlockAgenda = 2; | 457 | globalFlagBlockAgenda = 2; |
452 | qDebug("4globalFlagBlockAgenda = 2; "); | 458 | qDebug("4globalFlagBlockAgenda = 2; "); |
453 | //globalFlagBlockPainting = true; | 459 | //globalFlagBlockPainting = true; |
454 | mMainView->dateNavigator()->selectWeek(); | 460 | mMainView->dateNavigator()->selectWeek(); |
455 | showAgendaView(); | 461 | showAgendaView(); |
456 | */ | 462 | */ |
457 | 463 | ||
458 | 464 | ||
459 | mFlagShowNextxDays = false; | 465 | mFlagShowNextxDays = false; |
460 | globalFlagBlockAgenda = 1; | 466 | globalFlagBlockAgenda = 1; |
461 | globalFlagBlockLabel = 1; | 467 | globalFlagBlockLabel = 1; |
462 | if ( mCurrentAgendaView != 7 ) | 468 | if ( mCurrentAgendaView != 7 ) |
463 | mCurrentAgendaView = -1; | 469 | mCurrentAgendaView = -1; |
464 | showAgendaView(); | 470 | showAgendaView(); |
465 | qApp->processEvents(); | 471 | qApp->processEvents(); |
466 | globalFlagBlockAgenda = 2; | 472 | globalFlagBlockAgenda = 2; |
467 | globalFlagBlockLabel = 0; | 473 | globalFlagBlockLabel = 0; |
468 | mMainView->dateNavigator()->selectWeek(); | 474 | mMainView->dateNavigator()->selectWeek(); |
469 | mCurrentAgendaView = 7 ; | 475 | mCurrentAgendaView = 7 ; |
470 | } | 476 | } |
471 | 477 | ||
472 | void KOViewManager::showNextXView() | 478 | void KOViewManager::showNextXView() |
473 | { | 479 | { |
474 | 480 | ||
475 | globalFlagBlockAgenda = 1; | 481 | globalFlagBlockAgenda = 1; |
476 | if ( mCurrentAgendaView != 3 ) | 482 | if ( mCurrentAgendaView != 3 ) |
477 | mCurrentAgendaView = -1; | 483 | mCurrentAgendaView = -1; |
478 | showAgendaView(KOPrefs::instance()->mFullViewMonth); | 484 | showAgendaView(KOPrefs::instance()->mFullViewMonth); |
479 | globalFlagBlockAgenda = 2; | 485 | globalFlagBlockAgenda = 2; |
480 | mMainView->dateNavigator()->selectDates( QDate::currentDate(), | 486 | mMainView->dateNavigator()->selectDates( QDate::currentDate(), |
481 | KOPrefs::instance()->mNextXDays ); | 487 | KOPrefs::instance()->mNextXDays ); |
482 | mFlagShowNextxDays = true; | 488 | mFlagShowNextxDays = true; |
483 | mCurrentAgendaView = 3 ; | 489 | mCurrentAgendaView = 3 ; |
484 | } | 490 | } |
485 | bool KOViewManager::showsNextDays() | 491 | bool KOViewManager::showsNextDays() |
486 | { | 492 | { |
487 | return mFlagShowNextxDays; | 493 | return mFlagShowNextxDays; |
488 | } | 494 | } |
489 | void KOViewManager::showMonthView() | 495 | void KOViewManager::createMonthView() |
490 | { | 496 | { |
491 | if (!mMonthView) { | 497 | if (!mMonthView) { |
492 | mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView"); | 498 | mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView"); |
493 | 499 | ||
494 | addView(mMonthView); | 500 | addView(mMonthView); |
495 | // mMonthView->show(); | 501 | // mMonthView->show(); |
496 | // SIGNALS/SLOTS FOR MONTH VIEW | 502 | // SIGNALS/SLOTS FOR MONTH VIEW |
497 | connect(mMonthView, SIGNAL(newEventSignal(QDateTime)), | 503 | connect(mMonthView, SIGNAL(newEventSignal(QDateTime)), |
498 | mMainView, SLOT(newEvent(QDateTime))); | 504 | mMainView, SLOT(newEvent(QDateTime))); |
499 | 505 | ||
500 | connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)), | 506 | connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)), |
501 | mMainView, SLOT(showIncidence(Incidence *))); | 507 | mMainView, SLOT(showIncidence(Incidence *))); |
502 | connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)), | 508 | connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)), |
503 | mMainView, SLOT(editIncidence(Incidence *))); | 509 | mMainView, SLOT(editIncidence(Incidence *))); |
504 | connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)), | 510 | connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)), |
505 | mMainView, SLOT(deleteIncidence(Incidence *))); | 511 | mMainView, SLOT(deleteIncidence(Incidence *))); |
506 | 512 | ||
507 | connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ), | 513 | connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ), |
508 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); | 514 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); |
509 | connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), | 515 | connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), |
510 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); | 516 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); |
511 | connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), | 517 | connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), |
512 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); | 518 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); |
513 | 519 | ||
514 | connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ), | 520 | connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ), |
515 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); | 521 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); |
516 | connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ), | 522 | connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ), |
517 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); | 523 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); |
518 | connect( mMonthView, SIGNAL( selectWeekNum( int ) ), | 524 | connect( mMonthView, SIGNAL( selectWeekNum( int ) ), |
519 | mMainView->dateNavigator(), SLOT ( selectWeekFromMonthView( int ) ) ); | 525 | mMainView->dateNavigator(), SLOT ( selectWeekFromMonthView( int ) ) ); |
526 | connect( mMonthView, SIGNAL( selectMonth() ), | ||
527 | mMainView->dateNavigator(), SLOT ( selectMonthFromMonthview() ) ); | ||
520 | connect( mMonthView, SIGNAL( showDaySignal( QDate ) ), | 528 | connect( mMonthView, SIGNAL( showDaySignal( QDate ) ), |
521 | mMainView, SLOT ( showDay( QDate ) ) ); | 529 | mMainView, SLOT ( showDay( QDate ) ) ); |
522 | connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig())); | 530 | connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig())); |
523 | connect( mMonthView, SIGNAL(nextMonth() ), | 531 | connect( mMonthView, SIGNAL(nextMonth() ), |
524 | mMonthView->navigatorBar(), SIGNAL(goNextMonth() ) ); | 532 | mMonthView->navigatorBar(), SIGNAL(goNextMonth() ) ); |
525 | connect( mMonthView, SIGNAL(prevMonth() ), | 533 | connect( mMonthView, SIGNAL(prevMonth() ), |
526 | mMonthView->navigatorBar(), SIGNAL(goPrevMonth() ) ); | 534 | mMonthView->navigatorBar(), SIGNAL(goPrevMonth() ) ); |
527 | connect( mMonthView->navigatorBar(), SIGNAL( goPrevYear() ), | 535 | connect( mMonthView->navigatorBar(), SIGNAL( goPrevYear() ), |
528 | mMainView->dateNavigator(), SLOT( selectPreviousYear() ) ); | 536 | mMainView->dateNavigator(), SLOT( selectPreviousYear() ) ); |
529 | connect( mMonthView->navigatorBar(), SIGNAL( goNextYear() ), | 537 | connect( mMonthView->navigatorBar(), SIGNAL( goNextYear() ), |
530 | mMainView->dateNavigator(), SLOT( selectNextYear() ) ); | 538 | mMainView->dateNavigator(), SLOT( selectNextYear() ) ); |
531 | connect( mMonthView->navigatorBar(), SIGNAL( goPrevMonth() ), | 539 | connect( mMonthView->navigatorBar(), SIGNAL( goPrevMonth() ), |
532 | mMainView->dateNavigator(), SLOT( selectPreviousMonth() ) ); | 540 | mMainView->dateNavigator(), SLOT( selectPreviousMonth() ) ); |
533 | connect( mMonthView->navigatorBar(), SIGNAL( goNextMonth() ), | 541 | connect( mMonthView->navigatorBar(), SIGNAL( goNextMonth() ), |
534 | mMainView->dateNavigator(), SLOT( selectNextMonth() ) ); | 542 | mMainView->dateNavigator(), SLOT( selectNextMonth() ) ); |
543 | connect( mMonthView->navigatorBar(), SIGNAL( goPrevWeek() ), | ||
544 | mMainView->dateNavigator(), SLOT( selectPreviousWeek() ) ); | ||
545 | connect( mMonthView->navigatorBar(), SIGNAL( goNextWeek() ), | ||
546 | mMainView->dateNavigator(), SLOT( selectNextWeek() ) ); | ||
535 | 547 | ||
536 | connect( mMainView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), | 548 | connect( mMainView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), |
537 | mMonthView->navigatorBar(), SLOT( selectDates( const KCal::DateList & ) ) ); | 549 | mMonthView->navigatorBar(), SLOT( selectDates( const KCal::DateList & ) ) ); |
538 | 550 | ||
539 | 551 | ||
540 | connect( mMonthView->navigatorBar(), SIGNAL( monthSelected ( int ) ), | 552 | connect( mMonthView->navigatorBar(), SIGNAL( monthSelected ( int ) ), |
541 | mMainView->dateNavigator(), SLOT( slotMonthSelect( int ) ) ); | 553 | mMainView->dateNavigator(), SLOT( slotMonthSelect( int ) ) ); |
542 | 554 | ||
543 | } | 555 | } |
556 | } | ||
557 | void KOViewManager::showMonthViewWeek() | ||
558 | { | ||
559 | createMonthView(); | ||
560 | bool full = true; | ||
561 | if ( mCurrentView == mMonthView) | ||
562 | full = mMainView->leftFrame()->isVisible(); | ||
563 | if ( !KOPrefs::instance()->mMonthViewWeek ) { | ||
564 | mMonthView->switchView(); | ||
565 | if ( KOPrefs::instance()->mViewChangeHoldNonFullscreen && mMainView->leftFrame()->isVisible() ) | ||
566 | full = false; | ||
567 | else | ||
568 | full = true; | ||
569 | } | ||
570 | mMainView->dateNavigator()->selectWeek(); | ||
571 | showView(mMonthView, full ); | ||
572 | } | ||
544 | 573 | ||
574 | void KOViewManager::showMonthView() | ||
575 | { | ||
576 | |||
577 | createMonthView(); | ||
545 | globalFlagBlockAgenda = 1; | 578 | globalFlagBlockAgenda = 1; |
546 | //mFlagShowNextxDays = false; | 579 | //mFlagShowNextxDays = false; |
547 | // if(mMonthView == mCurrentView) return; | 580 | bool full = true; |
548 | if ( KOPrefs::instance()->mMonthViewWeek ) | 581 | if ( mCurrentView == mMonthView) |
549 | mMainView->dateNavigator()->selectWeek(); | 582 | full = mMainView->leftFrame()->isVisible(); |
550 | else | 583 | // if(mMonthView == mCurrentView) return; |
551 | mMainView->dateNavigator()->selectMonth(); | 584 | if ( KOPrefs::instance()->mMonthViewWeek ) { |
585 | mMonthView->switchView(); | ||
586 | if ( KOPrefs::instance()->mViewChangeHoldNonFullscreen && mMainView->leftFrame()->isVisible() ) | ||
587 | full = false; | ||
588 | else | ||
589 | full = true; | ||
590 | } | ||
591 | mMainView->dateNavigator()->selectMonth(); | ||
552 | 592 | ||
553 | showView(mMonthView, true ); | 593 | showView(mMonthView, full ); |
554 | 594 | ||
555 | } | 595 | } |
556 | 596 | ||
557 | void KOViewManager::showTodoView() | 597 | void KOViewManager::showTodoView() |
558 | { | 598 | { |
559 | //mFlagShowNextxDays = false; | 599 | //mFlagShowNextxDays = false; |
560 | if ( !mTodoView ) { | 600 | if ( !mTodoView ) { |
561 | mTodoView = new KOTodoView( mMainView->calendar(), mMainView->viewStack(), | 601 | mTodoView = new KOTodoView( mMainView->calendar(), mMainView->viewStack(), |
562 | "KOViewManager::TodoView" ); | 602 | "KOViewManager::TodoView" ); |
563 | 603 | ||
564 | addView( mTodoView ); | 604 | addView( mTodoView ); |
565 | // QPEApplication::setStylusOperation( mTodoView, QPEApplication::RightOnHold ); | 605 | // QPEApplication::setStylusOperation( mTodoView, QPEApplication::RightOnHold ); |
566 | 606 | ||
567 | // SIGNALS/SLOTS FOR TODO VIEW | 607 | // SIGNALS/SLOTS FOR TODO VIEW |
568 | connect( mTodoView, SIGNAL( newTodoSignal() ), | 608 | connect( mTodoView, SIGNAL( newTodoSignal() ), |
569 | mMainView, SLOT( newTodo() ) ); | 609 | mMainView, SLOT( newTodo() ) ); |
570 | connect( mTodoView, SIGNAL( newSubTodoSignal( Todo * ) ), | 610 | connect( mTodoView, SIGNAL( newSubTodoSignal( Todo * ) ), |
571 | mMainView, SLOT( newSubTodo( Todo *) ) ); | 611 | mMainView, SLOT( newSubTodo( Todo *) ) ); |
572 | connect( mTodoView, SIGNAL( showTodoSignal( Todo *) ), | 612 | connect( mTodoView, SIGNAL( showTodoSignal( Todo *) ), |
573 | mMainView, SLOT( showTodo( Todo * ) ) ); | 613 | mMainView, SLOT( showTodo( Todo * ) ) ); |
574 | connect( mTodoView, SIGNAL( editTodoSignal( Todo * ) ), | 614 | connect( mTodoView, SIGNAL( editTodoSignal( Todo * ) ), |
575 | mMainView, SLOT( editTodo( Todo * ) ) ); | 615 | mMainView, SLOT( editTodo( Todo * ) ) ); |
576 | connect( mTodoView, SIGNAL( deleteTodoSignal( Todo * ) ), | 616 | connect( mTodoView, SIGNAL( deleteTodoSignal( Todo * ) ), |
577 | mMainView, SLOT( deleteTodo( Todo * ) ) ); | 617 | mMainView, SLOT( deleteTodo( Todo * ) ) ); |
578 | connect( mTodoView, SIGNAL( purgeCompletedSignal() ), | 618 | connect( mTodoView, SIGNAL( purgeCompletedSignal() ), |
579 | mMainView, SLOT( purgeCompleted() ) ); | 619 | mMainView, SLOT( purgeCompleted() ) ); |
580 | 620 | ||
581 | connect( mTodoView, SIGNAL( incidenceSelected( Incidence * ) ), | 621 | connect( mTodoView, SIGNAL( incidenceSelected( Incidence * ) ), |
582 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); | 622 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); |
583 | 623 | ||
584 | connect( mMainView, SIGNAL( configChanged() ), mTodoView, | 624 | connect( mMainView, SIGNAL( configChanged() ), mTodoView, |
585 | SLOT( updateConfig() ) ); | 625 | SLOT( updateConfig() ) ); |
586 | connect( mMainView, SIGNAL( todoModified( Todo *, int )), mTodoView, | 626 | connect( mMainView, SIGNAL( todoModified( Todo *, int )), mTodoView, |
587 | SLOT( updateTodo( Todo *, int ) ) ); | 627 | SLOT( updateTodo( Todo *, int ) ) ); |
588 | connect( mTodoView, SIGNAL( todoModifiedSignal( Todo *, int ) ), | 628 | connect( mTodoView, SIGNAL( todoModifiedSignal( Todo *, int ) ), |
589 | mMainView, SIGNAL ( todoModified( Todo *, int ) ) ); | 629 | mMainView, SIGNAL ( todoModified( Todo *, int ) ) ); |
590 | connect( mTodoView, SIGNAL( cloneTodoSignal( Incidence * ) ), | 630 | connect( mTodoView, SIGNAL( cloneTodoSignal( Incidence * ) ), |
591 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); | 631 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); |
592 | connect( mTodoView, SIGNAL( cancelTodoSignal( Incidence * ) ), | 632 | connect( mTodoView, SIGNAL( cancelTodoSignal( Incidence * ) ), |
593 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); | 633 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); |
594 | connect( mTodoView, SIGNAL( unparentTodoSignal( Todo * ) ), | 634 | connect( mTodoView, SIGNAL( unparentTodoSignal( Todo * ) ), |
595 | mMainView, SLOT ( todo_unsub( Todo * ) ) ); | 635 | mMainView, SLOT ( todo_unsub( Todo * ) ) ); |
596 | connect( mTodoView, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), | 636 | connect( mTodoView, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), |
597 | mMainView, SLOT ( todo_resub( Todo *, Todo *) ) ); | 637 | mMainView, SLOT ( todo_resub( Todo *, Todo *) ) ); |
598 | connect( mTodoView, SIGNAL( moveTodoSignal( Incidence * ) ), | 638 | connect( mTodoView, SIGNAL( moveTodoSignal( Incidence * ) ), |
599 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); | 639 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); |
600 | connect( mTodoView, SIGNAL( beamTodoSignal( Incidence * ) ), | 640 | connect( mTodoView, SIGNAL( beamTodoSignal( Incidence * ) ), |
601 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); | 641 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); |
602 | KConfig *config = KOGlobals::config(); | 642 | KConfig *config = KOGlobals::config(); |
603 | mTodoView->restoreLayout(config,"Todo View"); | 643 | mTodoView->restoreLayout(config,"Todo View"); |
604 | mTodoView->setNavigator( mMainView->dateNavigator() ); | 644 | mTodoView->setNavigator( mMainView->dateNavigator() ); |
605 | } | 645 | } |
606 | 646 | ||
607 | globalFlagBlockAgenda = 1; | 647 | globalFlagBlockAgenda = 1; |
608 | showView( mTodoView, true ); | 648 | showView( mTodoView, true ); |
609 | 649 | ||
610 | } | 650 | } |
611 | 651 | ||
612 | void KOViewManager::showJournalView() | 652 | void KOViewManager::showJournalView() |
613 | { | 653 | { |
614 | //mFlagShowNextxDays = false; | 654 | //mFlagShowNextxDays = false; |
615 | if (!mJournalView) { | 655 | if (!mJournalView) { |
616 | mJournalView = new KOJournalView(mMainView->calendar(),mMainView->viewStack(), | 656 | mJournalView = new KOJournalView(mMainView->calendar(),mMainView->viewStack(), |
617 | "KOViewManager::JournalView"); | 657 | "KOViewManager::JournalView"); |
618 | connect( mMainView, SIGNAL( configChanged() ), mJournalView, | 658 | connect( mMainView, SIGNAL( configChanged() ), mJournalView, |
619 | SLOT( updateConfig() ) ); | 659 | SLOT( updateConfig() ) ); |
620 | connect(mJournalView, SIGNAL(deleteJournal(Journal *) ), mMainView,SLOT(deleteJournal(Journal *)) ); | 660 | connect(mJournalView, SIGNAL(deleteJournal(Journal *) ), mMainView,SLOT(deleteJournal(Journal *)) ); |
621 | addView(mJournalView); | 661 | addView(mJournalView); |
622 | } | 662 | } |
623 | 663 | ||
624 | showView(mJournalView); | 664 | showView(mJournalView); |
625 | mMainView->dateNavigator()->selectDates( 1 ); | 665 | mMainView->dateNavigator()->selectDates( 1 ); |
626 | } | 666 | } |
627 | 667 | ||
628 | void KOViewManager::showTimeSpanView() | 668 | void KOViewManager::showTimeSpanView() |
629 | { | 669 | { |
630 | //mFlagShowNextxDays = false; | 670 | //mFlagShowNextxDays = false; |
631 | if (!mTimeSpanView) { | 671 | if (!mTimeSpanView) { |
632 | mTimeSpanView = new KOTimeSpanView(mMainView->calendar(),mMainView->viewStack(), | 672 | mTimeSpanView = new KOTimeSpanView(mMainView->calendar(),mMainView->viewStack(), |
633 | "KOViewManager::TimeSpanView"); | 673 | "KOViewManager::TimeSpanView"); |
634 | addView(mTimeSpanView); | 674 | addView(mTimeSpanView); |
635 | 675 | ||
636 | mTimeSpanView->readSettings(); | 676 | mTimeSpanView->readSettings(); |
637 | } | 677 | } |
638 | 678 | ||
639 | showView(mTimeSpanView); | 679 | showView(mTimeSpanView); |
640 | } | 680 | } |
641 | 681 | ||
642 | Incidence *KOViewManager::currentSelection() | 682 | Incidence *KOViewManager::currentSelection() |
643 | { | 683 | { |
644 | if (!mCurrentView) return 0; | 684 | if (!mCurrentView) return 0; |
645 | if ( mCurrentView == mListView ) { | 685 | if ( mCurrentView == mListView ) { |
646 | if ( mListView->currentItem() ) | 686 | if ( mListView->currentItem() ) |
647 | return mListView->currentItem(); | 687 | return mListView->currentItem(); |
648 | } | 688 | } |
649 | return mCurrentView->selectedIncidences().first(); | 689 | return mCurrentView->selectedIncidences().first(); |
650 | } | 690 | } |
651 | 691 | ||
652 | QDate KOViewManager::currentSelectionDate() | 692 | QDate KOViewManager::currentSelectionDate() |
653 | { | 693 | { |
654 | QDate qd; | 694 | QDate qd; |
655 | if (mCurrentView) { | 695 | if (mCurrentView) { |
656 | DateList qvl = mCurrentView->selectedDates(); | 696 | DateList qvl = mCurrentView->selectedDates(); |
657 | if (!qvl.isEmpty()) qd = qvl.first(); | 697 | if (!qvl.isEmpty()) qd = qvl.first(); |
658 | } | 698 | } |
659 | return qd; | 699 | return qd; |
660 | } | 700 | } |
661 | 701 | ||
662 | void KOViewManager::addView(KOrg::BaseView *view) | 702 | void KOViewManager::addView(KOrg::BaseView *view) |
663 | { | 703 | { |
664 | #if QT_VERSION >= 0x030000 | 704 | #if QT_VERSION >= 0x030000 |
665 | mMainView->viewStack()->addWidget( view ); | 705 | mMainView->viewStack()->addWidget( view ); |
666 | #else | 706 | #else |
667 | mMainView->viewStack()->addWidget( view, 1 ); | 707 | mMainView->viewStack()->addWidget( view, 1 ); |
668 | #endif | 708 | #endif |
669 | } | 709 | } |
670 | 710 | ||
671 | void KOViewManager::setDocumentId( const QString &id ) | 711 | void KOViewManager::setDocumentId( const QString &id ) |
672 | { | 712 | { |
673 | if (mTodoView) mTodoView->setDocumentId( id ); | 713 | if (mTodoView) mTodoView->setDocumentId( id ); |
674 | } | 714 | } |
diff --git a/korganizer/koviewmanager.h b/korganizer/koviewmanager.h index 66ab138..8f0bf82 100644 --- a/korganizer/koviewmanager.h +++ b/korganizer/koviewmanager.h | |||
@@ -1,118 +1,120 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2001 | 3 | Copyright (c) 2001 |
4 | Cornelius Schumacher <schumacher@kde.org> | 4 | Cornelius Schumacher <schumacher@kde.org> |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
7 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
8 | the Free Software Foundation; either version 2 of the License, or | 8 | the Free Software Foundation; either version 2 of the License, or |
9 | (at your option) any later version. | 9 | (at your option) any later version. |
10 | 10 | ||
11 | This program is distributed in the hope that it will be useful, | 11 | This program is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the |
14 | GNU General Public License for more details. | 14 | GNU General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU General Public License | 16 | You should have received a copy of the GNU General Public License |
17 | along with this program; if not, write to the Free Software | 17 | along with this program; if not, write to the Free Software |
18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
19 | 19 | ||
20 | As a special exception, permission is given to link this program | 20 | As a special exception, permission is given to link this program |
21 | with any edition of Qt, and distribute the resulting executable, | 21 | with any edition of Qt, and distribute the resulting executable, |
22 | without including the source code for Qt in the source distribution. | 22 | without including the source code for Qt in the source distribution. |
23 | */ | 23 | */ |
24 | #ifndef KOVIEWMANAGER_H | 24 | #ifndef KOVIEWMANAGER_H |
25 | #define KOVIEWMANAGER_H | 25 | #define KOVIEWMANAGER_H |
26 | 26 | ||
27 | #include <qobject.h> | 27 | #include <qobject.h> |
28 | 28 | ||
29 | #include <korganizer/baseview.h> | 29 | #include <korganizer/baseview.h> |
30 | 30 | ||
31 | class CalendarView; | 31 | class CalendarView; |
32 | 32 | ||
33 | class KOListView; | 33 | class KOListView; |
34 | class KOAgendaView; | 34 | class KOAgendaView; |
35 | class KOMonthView; | 35 | class KOMonthView; |
36 | class KOTimeSpanView; | 36 | class KOTimeSpanView; |
37 | class KOTodoView; | 37 | class KOTodoView; |
38 | class KOWhatsNextView; | 38 | class KOWhatsNextView; |
39 | class KOJournalView; | 39 | class KOJournalView; |
40 | 40 | ||
41 | using namespace KCal; | 41 | using namespace KCal; |
42 | 42 | ||
43 | /** | 43 | /** |
44 | This class manages the views of the calendar. It owns the objects and handles | 44 | This class manages the views of the calendar. It owns the objects and handles |
45 | creation and selection. | 45 | creation and selection. |
46 | */ | 46 | */ |
47 | class KOViewManager : public QObject | 47 | class KOViewManager : public QObject |
48 | { | 48 | { |
49 | Q_OBJECT | 49 | Q_OBJECT |
50 | public: | 50 | public: |
51 | KOViewManager( CalendarView * ); | 51 | KOViewManager( CalendarView * ); |
52 | virtual ~KOViewManager(); | 52 | virtual ~KOViewManager(); |
53 | 53 | ||
54 | /** changes the view to be the currently selected view */ | 54 | /** changes the view to be the currently selected view */ |
55 | void showView(KOrg::BaseView *, bool fullScreen = false ); | 55 | void showView(KOrg::BaseView *, bool fullScreen = false ); |
56 | void updateWNview(); | 56 | void updateWNview(); |
57 | void readSettings(KConfig *config); | 57 | void readSettings(KConfig *config); |
58 | void writeSettings(KConfig *config); | 58 | void writeSettings(KConfig *config); |
59 | bool showsNextDays(); | 59 | bool showsNextDays(); |
60 | /** Read which view was shown last from config file */ | 60 | /** Read which view was shown last from config file */ |
61 | void readCurrentView(KConfig *); | 61 | void readCurrentView(KConfig *); |
62 | /** Write which view is currently shown to config file */ | 62 | /** Write which view is currently shown to config file */ |
63 | void writeCurrentView(KConfig *); | 63 | void writeCurrentView(KConfig *); |
64 | 64 | ||
65 | KOrg::BaseView *currentView(); | 65 | KOrg::BaseView *currentView(); |
66 | 66 | ||
67 | void setDocumentId( const QString & ); | 67 | void setDocumentId( const QString & ); |
68 | 68 | ||
69 | void updateView( const QDate &start, const QDate &end ); | 69 | void updateView( const QDate &start, const QDate &end ); |
70 | 70 | ||
71 | void raiseCurrentView( bool fullScreen = false , bool updateView = false); | 71 | void raiseCurrentView( bool fullScreen = false , bool updateView = false); |
72 | 72 | ||
73 | void addView(KOrg::BaseView *); | 73 | void addView(KOrg::BaseView *); |
74 | 74 | ||
75 | Incidence *currentSelection(); | 75 | Incidence *currentSelection(); |
76 | QDate currentSelectionDate(); | 76 | QDate currentSelectionDate(); |
77 | 77 | ||
78 | KOAgendaView *agendaView() const { return mAgendaView; } | 78 | KOAgendaView *agendaView() const { return mAgendaView; } |
79 | 79 | ||
80 | signals: | 80 | signals: |
81 | void printWNV(); | 81 | void printWNV(); |
82 | void signalFullScreen( bool ); | 82 | void signalFullScreen( bool ); |
83 | void signalAgendaView( bool ); | 83 | void signalAgendaView( bool ); |
84 | public slots: | 84 | public slots: |
85 | void showDateView( int, QDate ); | 85 | void showDateView( int, QDate ); |
86 | void updateView(); | 86 | void updateView(); |
87 | void showWhatsNextView(); | 87 | void showWhatsNextView(); |
88 | void showListView(); | 88 | void showListView(); |
89 | void showAgendaView( bool fullScreen = false ); | 89 | void showAgendaView( bool fullScreen = false ); |
90 | void showDayView(); | 90 | void showDayView(); |
91 | void showWorkWeekView(); | 91 | void showWorkWeekView(); |
92 | void showWeekView(); | 92 | void showWeekView(); |
93 | void showNextXView(); | 93 | void showNextXView(); |
94 | void showMonthView(); | 94 | void showMonthView(); |
95 | void showMonthViewWeek(); | ||
95 | void showTodoView(); | 96 | void showTodoView(); |
96 | void showJournalView(); | 97 | void showJournalView(); |
97 | void showTimeSpanView(); | 98 | void showTimeSpanView(); |
98 | 99 | ||
99 | private: | 100 | private: |
101 | void createMonthView(); | ||
100 | CalendarView *mMainView; | 102 | CalendarView *mMainView; |
101 | 103 | ||
102 | int mCurrentAgendaView; | 104 | int mCurrentAgendaView; |
103 | KOAgendaView *mAgendaView; | 105 | KOAgendaView *mAgendaView; |
104 | KOListView *mListView; | 106 | KOListView *mListView; |
105 | KOMonthView *mMonthView; | 107 | KOMonthView *mMonthView; |
106 | KOTodoView *mTodoView; | 108 | KOTodoView *mTodoView; |
107 | KOWhatsNextView *mWhatsNextView; | 109 | KOWhatsNextView *mWhatsNextView; |
108 | KOJournalView *mJournalView; | 110 | KOJournalView *mJournalView; |
109 | KOTimeSpanView *mTimeSpanView; | 111 | KOTimeSpanView *mTimeSpanView; |
110 | 112 | ||
111 | KOrg::BaseView *mCurrentView; // currently active event view | 113 | KOrg::BaseView *mCurrentView; // currently active event view |
112 | 114 | ||
113 | int mAgendaViewMode; | 115 | int mAgendaViewMode; |
114 | bool mFlagShowNextxDays; | 116 | bool mFlagShowNextxDays; |
115 | 117 | ||
116 | }; | 118 | }; |
117 | 119 | ||
118 | #endif | 120 | #endif |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index ab0e4d6..16031b8 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -1,2074 +1,2086 @@ | |||
1 | #include <stdlib.h> | 1 | #include <stdlib.h> |
2 | 2 | ||
3 | #include <qaction.h> | 3 | #include <qaction.h> |
4 | #include <qpopupmenu.h> | 4 | #include <qpopupmenu.h> |
5 | #include <qpainter.h> | 5 | #include <qpainter.h> |
6 | #include <qwhatsthis.h> | 6 | #include <qwhatsthis.h> |
7 | #include <qpushbutton.h> | 7 | #include <qpushbutton.h> |
8 | #include <qmessagebox.h> | 8 | #include <qmessagebox.h> |
9 | #include <qlineedit.h> | 9 | #include <qlineedit.h> |
10 | #include <qtextcodec.h> | 10 | #include <qtextcodec.h> |
11 | #include <qfile.h> | 11 | #include <qfile.h> |
12 | #include <qdir.h> | 12 | #include <qdir.h> |
13 | #include <qapp.h> | 13 | #include <qapp.h> |
14 | #include <qfileinfo.h> | 14 | #include <qfileinfo.h> |
15 | #include <qlabel.h> | 15 | #include <qlabel.h> |
16 | #include <qspinbox.h> | 16 | #include <qspinbox.h> |
17 | #include <qcheckbox.h> | 17 | #include <qcheckbox.h> |
18 | #include <qmap.h> | 18 | #include <qmap.h> |
19 | #include <qwmatrix.h> | 19 | #include <qwmatrix.h> |
20 | #include <qtextbrowser.h> | 20 | #include <qtextbrowser.h> |
21 | #include <qtextstream.h> | 21 | #include <qtextstream.h> |
22 | #ifndef DESKTOP_VERSION | 22 | #ifndef DESKTOP_VERSION |
23 | #include <qpe/global.h> | 23 | #include <qpe/global.h> |
24 | #include <qpe/qpemenubar.h> | 24 | #include <qpe/qpemenubar.h> |
25 | #include <qpe/qpetoolbar.h> | 25 | #include <qpe/qpetoolbar.h> |
26 | #include <qpe/resource.h> | 26 | #include <qpe/resource.h> |
27 | #include <qpe/qpeapplication.h> | 27 | #include <qpe/qpeapplication.h> |
28 | #include <qtopia/alarmserver.h> | 28 | #include <qtopia/alarmserver.h> |
29 | #include <qtopia/qcopenvelope_qws.h> | 29 | #include <qtopia/qcopenvelope_qws.h> |
30 | #include <unistd.h> // for sleep | 30 | #include <unistd.h> // for sleep |
31 | #else | 31 | #else |
32 | #include <qmenubar.h> | 32 | #include <qmenubar.h> |
33 | #include <qtoolbar.h> | 33 | #include <qtoolbar.h> |
34 | #include <qapplication.h> | 34 | #include <qapplication.h> |
35 | //#include <resource.h> | 35 | //#include <resource.h> |
36 | 36 | ||
37 | #endif | 37 | #endif |
38 | #include <libkcal/calendarlocal.h> | 38 | #include <libkcal/calendarlocal.h> |
39 | #include <libkcal/todo.h> | 39 | #include <libkcal/todo.h> |
40 | #include <libkcal/phoneformat.h> | 40 | #include <libkcal/phoneformat.h> |
41 | #include <libkdepim/ksyncprofile.h> | 41 | #include <libkdepim/ksyncprofile.h> |
42 | #include <libkdepim/phoneaccess.h> | 42 | #include <libkdepim/phoneaccess.h> |
43 | #include <libkcal/kincidenceformatter.h> | 43 | #include <libkcal/kincidenceformatter.h> |
44 | #include <libkdepim/kpimglobalprefs.h> | 44 | #include <libkdepim/kpimglobalprefs.h> |
45 | 45 | ||
46 | #include "calendarview.h" | 46 | #include "calendarview.h" |
47 | #include "koviewmanager.h" | 47 | #include "koviewmanager.h" |
48 | #include "datenavigator.h" | 48 | #include "datenavigator.h" |
49 | #include "koagendaview.h" | 49 | #include "koagendaview.h" |
50 | #include "koagenda.h" | 50 | #include "koagenda.h" |
51 | #include "kodialogmanager.h" | 51 | #include "kodialogmanager.h" |
52 | #include "kdialogbase.h" | 52 | #include "kdialogbase.h" |
53 | #include "kapplication.h" | 53 | #include "kapplication.h" |
54 | #include "kofilterview.h" | 54 | #include "kofilterview.h" |
55 | #include "kstandarddirs.h" | 55 | #include "kstandarddirs.h" |
56 | #include "koprefs.h" | 56 | #include "koprefs.h" |
57 | #include "kfiledialog.h" | 57 | #include "kfiledialog.h" |
58 | #include "koglobals.h" | 58 | #include "koglobals.h" |
59 | #include "kglobal.h" | 59 | #include "kglobal.h" |
60 | #include "klocale.h" | 60 | #include "klocale.h" |
61 | #include "kconfig.h" | 61 | #include "kconfig.h" |
62 | #include "simplealarmclient.h" | 62 | #include "simplealarmclient.h" |
63 | #include "externalapphandler.h" | 63 | #include "externalapphandler.h" |
64 | 64 | ||
65 | using namespace KCal; | 65 | using namespace KCal; |
66 | #ifndef _WIN32_ | 66 | #ifndef _WIN32_ |
67 | #include <unistd.h> | 67 | #include <unistd.h> |
68 | #else | 68 | #else |
69 | #ifdef _OL_IMPORT_ | 69 | #ifdef _OL_IMPORT_ |
70 | #include "koimportoldialog.h" | 70 | #include "koimportoldialog.h" |
71 | #endif | 71 | #endif |
72 | #endif | 72 | #endif |
73 | #include "mainwindow.h" | 73 | #include "mainwindow.h" |
74 | 74 | ||
75 | 75 | ||
76 | class KOex2phonePrefs : public QDialog | 76 | class KOex2phonePrefs : public QDialog |
77 | { | 77 | { |
78 | public: | 78 | public: |
79 | KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : | 79 | KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : |
80 | QDialog( parent, name, true ) | 80 | QDialog( parent, name, true ) |
81 | { | 81 | { |
82 | setCaption( i18n("Export to phone options") ); | 82 | setCaption( i18n("Export to phone options") ); |
83 | QVBoxLayout* lay = new QVBoxLayout( this ); | 83 | QVBoxLayout* lay = new QVBoxLayout( this ); |
84 | lay->setSpacing( 3 ); | 84 | lay->setSpacing( 3 ); |
85 | lay->setMargin( 3 ); | 85 | lay->setMargin( 3 ); |
86 | QLabel *lab; | 86 | QLabel *lab; |
87 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); | 87 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); |
88 | lab->setAlignment (AlignHCenter ); | 88 | lab->setAlignment (AlignHCenter ); |
89 | QHBox* temphb; | 89 | QHBox* temphb; |
90 | temphb = new QHBox( this ); | 90 | temphb = new QHBox( this ); |
91 | new QLabel( i18n("I/O device: "), temphb ); | 91 | new QLabel( i18n("I/O device: "), temphb ); |
92 | mPhoneDevice = new QLineEdit( temphb); | 92 | mPhoneDevice = new QLineEdit( temphb); |
93 | lay->addWidget( temphb ); | 93 | lay->addWidget( temphb ); |
94 | temphb = new QHBox( this ); | 94 | temphb = new QHBox( this ); |
95 | new QLabel( i18n("Connection: "), temphb ); | 95 | new QLabel( i18n("Connection: "), temphb ); |
96 | mPhoneConnection = new QLineEdit( temphb); | 96 | mPhoneConnection = new QLineEdit( temphb); |
97 | lay->addWidget( temphb ); | 97 | lay->addWidget( temphb ); |
98 | temphb = new QHBox( this ); | 98 | temphb = new QHBox( this ); |
99 | new QLabel( i18n("Model(opt.): "), temphb ); | 99 | new QLabel( i18n("Model(opt.): "), temphb ); |
100 | mPhoneModel = new QLineEdit( temphb); | 100 | mPhoneModel = new QLineEdit( temphb); |
101 | lay->addWidget( temphb ); | 101 | lay->addWidget( temphb ); |
102 | mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); | 102 | mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); |
103 | mWriteBackFuture->setChecked( true ); | 103 | mWriteBackFuture->setChecked( true ); |
104 | lay->addWidget( mWriteBackFuture ); | 104 | lay->addWidget( mWriteBackFuture ); |
105 | temphb = new QHBox( this ); | 105 | temphb = new QHBox( this ); |
106 | new QLabel( i18n("Max. weeks in future: ") , temphb ); | 106 | new QLabel( i18n("Max. weeks in future: ") , temphb ); |
107 | mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); | 107 | mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); |
108 | mWriteBackFutureWeeks->setValue( 8 ); | 108 | mWriteBackFutureWeeks->setValue( 8 ); |
109 | lay->addWidget( temphb ); | 109 | lay->addWidget( temphb ); |
110 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); | 110 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); |
111 | lab->setAlignment (AlignHCenter ); | 111 | lab->setAlignment (AlignHCenter ); |
112 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); | 112 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); |
113 | lay->addWidget( ok ); | 113 | lay->addWidget( ok ); |
114 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 114 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
115 | lay->addWidget( cancel ); | 115 | lay->addWidget( cancel ); |
116 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 116 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
117 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 117 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
118 | resize( 220, 240 ); | 118 | resize( 220, 240 ); |
119 | qApp->processEvents(); | 119 | qApp->processEvents(); |
120 | int dw = QApplication::desktop()->width(); | 120 | int dw = QApplication::desktop()->width(); |
121 | int dh = QApplication::desktop()->height(); | 121 | int dh = QApplication::desktop()->height(); |
122 | move( (dw-width())/2, (dh - height() )/2 ); | 122 | move( (dw-width())/2, (dh - height() )/2 ); |
123 | } | 123 | } |
124 | 124 | ||
125 | public: | 125 | public: |
126 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; | 126 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; |
127 | QCheckBox* mWriteBackFuture; | 127 | QCheckBox* mWriteBackFuture; |
128 | QSpinBox* mWriteBackFutureWeeks; | 128 | QSpinBox* mWriteBackFutureWeeks; |
129 | }; | 129 | }; |
130 | 130 | ||
131 | int globalFlagBlockStartup; | 131 | int globalFlagBlockStartup; |
132 | MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : | 132 | MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : |
133 | QMainWindow( parent, name ) | 133 | QMainWindow( parent, name ) |
134 | { | 134 | { |
135 | 135 | ||
136 | mClosed = false; | 136 | mClosed = false; |
137 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; | 137 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; |
138 | QString confFile = locateLocal("config","korganizerrc"); | 138 | QString confFile = locateLocal("config","korganizerrc"); |
139 | QFileInfo finf ( confFile ); | 139 | QFileInfo finf ( confFile ); |
140 | bool showWarning = !finf.exists(); | 140 | bool showWarning = !finf.exists(); |
141 | setIcon(SmallIcon( "ko24" ) ); | 141 | setIcon(SmallIcon( "ko24" ) ); |
142 | mBlockAtStartup = true; | 142 | mBlockAtStartup = true; |
143 | mFlagKeyPressed = false; | 143 | mFlagKeyPressed = false; |
144 | setCaption("KOrganizer/Pi"); | 144 | setCaption("KOrganizer/Pi"); |
145 | KOPrefs *p = KOPrefs::instance(); | 145 | KOPrefs *p = KOPrefs::instance(); |
146 | KPimGlobalPrefs::instance()->setGlobalConfig(); | 146 | KPimGlobalPrefs::instance()->setGlobalConfig(); |
147 | if ( p->mHourSize > 22 ) | 147 | if ( p->mHourSize > 22 ) |
148 | p->mHourSize = 22; | 148 | p->mHourSize = 22; |
149 | QMainWindow::ToolBarDock tbd; | 149 | QMainWindow::ToolBarDock tbd; |
150 | if ( p->mToolBarHor ) { | 150 | if ( p->mToolBarHor ) { |
151 | if ( p->mToolBarUp ) | 151 | if ( p->mToolBarUp ) |
152 | tbd = Bottom; | 152 | tbd = Bottom; |
153 | else | 153 | else |
154 | tbd = Top; | 154 | tbd = Top; |
155 | } | 155 | } |
156 | else { | 156 | else { |
157 | if ( p->mToolBarUp ) | 157 | if ( p->mToolBarUp ) |
158 | tbd = Right; | 158 | tbd = Right; |
159 | else | 159 | else |
160 | tbd = Left; | 160 | tbd = Left; |
161 | } | 161 | } |
162 | if ( KOPrefs::instance()->mUseAppColors ) | 162 | if ( KOPrefs::instance()->mUseAppColors ) |
163 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); | 163 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); |
164 | globalFlagBlockStartup = 1; | 164 | globalFlagBlockStartup = 1; |
165 | iconToolBar = new QPEToolBar( this ); | 165 | iconToolBar = new QPEToolBar( this ); |
166 | addToolBar (iconToolBar , tbd ); | 166 | addToolBar (iconToolBar , tbd ); |
167 | mCalendarModifiedFlag = false; | 167 | mCalendarModifiedFlag = false; |
168 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); | 168 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); |
169 | splash->setAlignment ( AlignCenter ); | 169 | splash->setAlignment ( AlignCenter ); |
170 | setCentralWidget( splash ); | 170 | setCentralWidget( splash ); |
171 | #ifndef DESKTOP_VERSION | 171 | #ifndef DESKTOP_VERSION |
172 | showMaximized(); | 172 | showMaximized(); |
173 | #endif | 173 | #endif |
174 | 174 | ||
175 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); | 175 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); |
176 | setDefaultPreferences(); | 176 | setDefaultPreferences(); |
177 | mCalendar = new CalendarLocal(); | 177 | mCalendar = new CalendarLocal(); |
178 | mView = new CalendarView( mCalendar, this,"mCalendar " ); | 178 | mView = new CalendarView( mCalendar, this,"mCalendar " ); |
179 | mView->hide(); | 179 | mView->hide(); |
180 | //mView->resize(splash->size() ); | 180 | //mView->resize(splash->size() ); |
181 | initActions(); | 181 | initActions(); |
182 | mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); | 182 | mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); |
183 | mSyncManager->setBlockSave(false); | 183 | mSyncManager->setBlockSave(false); |
184 | mView->setSyncManager(mSyncManager); | 184 | mView->setSyncManager(mSyncManager); |
185 | #ifndef DESKTOP_VERSION | 185 | #ifndef DESKTOP_VERSION |
186 | iconToolBar->show(); | 186 | iconToolBar->show(); |
187 | qApp->processEvents(); | 187 | qApp->processEvents(); |
188 | #endif | 188 | #endif |
189 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); | 189 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); |
190 | int vh = height() ; | 190 | int vh = height() ; |
191 | int vw = width(); | 191 | int vw = width(); |
192 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); | 192 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); |
193 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { | 193 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { |
194 | vh -= iconToolBar->height(); | 194 | vh -= iconToolBar->height(); |
195 | } else { | 195 | } else { |
196 | vw -= iconToolBar->height(); | 196 | vw -= iconToolBar->height(); |
197 | } | 197 | } |
198 | //mView->setMaximumSize( splash->size() ); | 198 | //mView->setMaximumSize( splash->size() ); |
199 | //mView->resize( splash->size() ); | 199 | //mView->resize( splash->size() ); |
200 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 200 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
201 | mView->readSettings(); | 201 | mView->readSettings(); |
202 | bool newFile = false; | 202 | bool newFile = false; |
203 | if( !QFile::exists( defaultFileName() ) ) { | 203 | if( !QFile::exists( defaultFileName() ) ) { |
204 | QFileInfo finfo ( defaultFileName() ); | 204 | QFileInfo finfo ( defaultFileName() ); |
205 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); | 205 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); |
206 | qDebug("oldfile %s ", oldFile.latin1()); | 206 | qDebug("oldfile %s ", oldFile.latin1()); |
207 | QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; | 207 | QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; |
208 | finfo.setFile( oldFile ); | 208 | finfo.setFile( oldFile ); |
209 | if (finfo.exists() ) { | 209 | if (finfo.exists() ) { |
210 | KMessageBox::information( this, message); | 210 | KMessageBox::information( this, message); |
211 | mView->openCalendar( oldFile ); | 211 | mView->openCalendar( oldFile ); |
212 | qApp->processEvents(); | 212 | qApp->processEvents(); |
213 | } else { | 213 | } else { |
214 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); | 214 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); |
215 | finfo.setFile( oldFile ); | 215 | finfo.setFile( oldFile ); |
216 | if (finfo.exists() ) { | 216 | if (finfo.exists() ) { |
217 | KMessageBox::information( this, message); | 217 | KMessageBox::information( this, message); |
218 | mView->openCalendar( oldFile ); | 218 | mView->openCalendar( oldFile ); |
219 | qApp->processEvents(); | 219 | qApp->processEvents(); |
220 | } | 220 | } |
221 | } | 221 | } |
222 | mView->saveCalendar( defaultFileName() ); | 222 | mView->saveCalendar( defaultFileName() ); |
223 | newFile = true; | 223 | newFile = true; |
224 | } | 224 | } |
225 | 225 | ||
226 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 226 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
227 | mView->openCalendar( defaultFileName() ); | 227 | mView->openCalendar( defaultFileName() ); |
228 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 228 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
229 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); | 229 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); |
230 | 230 | ||
231 | if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { | 231 | if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { |
232 | KOPrefs::instance()->setAllDefaults(); | 232 | KOPrefs::instance()->setAllDefaults(); |
233 | int count = mView->addCategories(); | 233 | int count = mView->addCategories(); |
234 | } | 234 | } |
235 | processIncidenceSelection( 0 ); | 235 | processIncidenceSelection( 0 ); |
236 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), | 236 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), |
237 | SLOT( processIncidenceSelection( Incidence * ) ) ); | 237 | SLOT( processIncidenceSelection( Incidence * ) ) ); |
238 | connect( mView, SIGNAL( modifiedChanged( bool ) ), | 238 | connect( mView, SIGNAL( modifiedChanged( bool ) ), |
239 | SLOT( slotModifiedChanged( bool ) ) ); | 239 | SLOT( slotModifiedChanged( bool ) ) ); |
240 | 240 | ||
241 | 241 | ||
242 | connect( mView, SIGNAL( tempDisableBR(bool) ), | 242 | connect( mView, SIGNAL( tempDisableBR(bool) ), |
243 | SLOT( disableBR(bool) ) ); | 243 | SLOT( disableBR(bool) ) ); |
244 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); | 244 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); |
245 | mView->setModified( false ); | 245 | mView->setModified( false ); |
246 | mBlockAtStartup = false; | 246 | mBlockAtStartup = false; |
247 | mView->setModified( false ); | 247 | mView->setModified( false ); |
248 | setCentralWidget( mView ); | 248 | setCentralWidget( mView ); |
249 | globalFlagBlockStartup = 0; | 249 | globalFlagBlockStartup = 0; |
250 | mView->show(); | 250 | mView->show(); |
251 | delete splash; | 251 | delete splash; |
252 | if ( newFile ) | 252 | if ( newFile ) |
253 | mView->updateConfig(); | 253 | mView->updateConfig(); |
254 | // qApp->processEvents(); | 254 | // qApp->processEvents(); |
255 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 255 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
256 | //fillSyncMenu(); | 256 | //fillSyncMenu(); |
257 | 257 | ||
258 | 258 | ||
259 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); | 259 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); |
260 | connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); | 260 | connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); |
261 | connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); | 261 | connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); |
262 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); | 262 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); |
263 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); | 263 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); |
264 | mSyncManager->setDefaultFileName( sentSyncFile()); | 264 | mSyncManager->setDefaultFileName( sentSyncFile()); |
265 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); | 265 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); |
266 | mSyncManager->fillSyncMenu(); | 266 | mSyncManager->fillSyncMenu(); |
267 | 267 | ||
268 | 268 | ||
269 | 269 | ||
270 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); | 270 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); |
271 | if ( showWarning ) { | 271 | if ( showWarning ) { |
272 | KMessageBox::information( this, | 272 | KMessageBox::information( this, |
273 | "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); | 273 | "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); |
274 | qApp->processEvents(); | 274 | qApp->processEvents(); |
275 | mView->dialogManager()->showSyncOptions(); | 275 | mView->dialogManager()->showSyncOptions(); |
276 | } | 276 | } |
277 | 277 | ||
278 | //US listen for result adressed from Ka/Pi | 278 | //US listen for result adressed from Ka/Pi |
279 | #ifndef DESKTOP_VERSION | 279 | #ifndef DESKTOP_VERSION |
280 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); | 280 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); |
281 | #endif | 281 | #endif |
282 | #ifndef DESKTOP_VERSION | 282 | #ifndef DESKTOP_VERSION |
283 | infrared = 0; | 283 | infrared = 0; |
284 | #endif | 284 | #endif |
285 | updateWeek( mView->startDate() ); | 285 | updateWeek( mView->startDate() ); |
286 | connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), | 286 | connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), |
287 | SLOT( updateWeekNum( const KCal::DateList & ) ) ); | 287 | SLOT( updateWeekNum( const KCal::DateList & ) ) ); |
288 | mBRdisabled = false; | 288 | mBRdisabled = false; |
289 | //toggleBeamReceive(); | 289 | //toggleBeamReceive(); |
290 | } | 290 | } |
291 | MainWindow::~MainWindow() | 291 | MainWindow::~MainWindow() |
292 | { | 292 | { |
293 | //qDebug("MainWindow::~MainWindow() "); | 293 | //qDebug("MainWindow::~MainWindow() "); |
294 | //save toolbar location | 294 | //save toolbar location |
295 | delete mCalendar; | 295 | delete mCalendar; |
296 | delete mSyncManager; | 296 | delete mSyncManager; |
297 | #ifndef DESKTOP_VERSION | 297 | #ifndef DESKTOP_VERSION |
298 | if ( infrared ) | 298 | if ( infrared ) |
299 | delete infrared; | 299 | delete infrared; |
300 | #endif | 300 | #endif |
301 | 301 | ||
302 | 302 | ||
303 | } | 303 | } |
304 | 304 | ||
305 | void MainWindow::disableBR(bool b) | 305 | void MainWindow::disableBR(bool b) |
306 | { | 306 | { |
307 | #ifndef DESKTOP_VERSION | 307 | #ifndef DESKTOP_VERSION |
308 | if ( b ) { | 308 | if ( b ) { |
309 | if ( infrared ) { | 309 | if ( infrared ) { |
310 | toggleBeamReceive(); | 310 | toggleBeamReceive(); |
311 | mBRdisabled = true; | 311 | mBRdisabled = true; |
312 | } | 312 | } |
313 | mBRdisabled = true; | 313 | mBRdisabled = true; |
314 | } else { | 314 | } else { |
315 | if ( mBRdisabled ) { | 315 | if ( mBRdisabled ) { |
316 | mBRdisabled = false; | 316 | mBRdisabled = false; |
317 | //makes no sense,because other cal ap is probably running | 317 | //makes no sense,because other cal ap is probably running |
318 | // toggleBeamReceive(); | 318 | // toggleBeamReceive(); |
319 | } | 319 | } |
320 | } | 320 | } |
321 | #endif | 321 | #endif |
322 | 322 | ||
323 | } | 323 | } |
324 | bool MainWindow::beamReceiveEnabled() | 324 | bool MainWindow::beamReceiveEnabled() |
325 | { | 325 | { |
326 | #ifndef DESKTOP_VERSION | 326 | #ifndef DESKTOP_VERSION |
327 | return ( infrared != 0 ); | 327 | return ( infrared != 0 ); |
328 | #endif | 328 | #endif |
329 | return false; | 329 | return false; |
330 | } | 330 | } |
331 | 331 | ||
332 | void MainWindow::toggleBeamReceive() | 332 | void MainWindow::toggleBeamReceive() |
333 | { | 333 | { |
334 | if ( mBRdisabled ) | 334 | if ( mBRdisabled ) |
335 | return; | 335 | return; |
336 | #ifndef DESKTOP_VERSION | 336 | #ifndef DESKTOP_VERSION |
337 | if ( infrared ) { | 337 | if ( infrared ) { |
338 | qDebug("disable BeamReceive "); | 338 | qDebug("disable BeamReceive "); |
339 | delete infrared; | 339 | delete infrared; |
340 | infrared = 0; | 340 | infrared = 0; |
341 | brAction->setOn(false); | 341 | brAction->setOn(false); |
342 | return; | 342 | return; |
343 | } | 343 | } |
344 | qDebug("enable BeamReceive "); | 344 | qDebug("enable BeamReceive "); |
345 | brAction->setOn(true); | 345 | brAction->setOn(true); |
346 | infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; | 346 | infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; |
347 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); | 347 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); |
348 | #endif | 348 | #endif |
349 | } | 349 | } |
350 | void MainWindow::showMaximized () | 350 | void MainWindow::showMaximized () |
351 | { | 351 | { |
352 | #ifndef DESKTOP_VERSION | 352 | #ifndef DESKTOP_VERSION |
353 | if ( ! globalFlagBlockStartup ) | 353 | if ( ! globalFlagBlockStartup ) |
354 | if ( mClosed ) | 354 | if ( mClosed ) |
355 | mView->goToday(); | 355 | mView->goToday(); |
356 | #endif | 356 | #endif |
357 | QWidget::showMaximized () ; | 357 | QWidget::showMaximized () ; |
358 | mClosed = false; | 358 | mClosed = false; |
359 | } | 359 | } |
360 | void MainWindow::closeEvent( QCloseEvent* ce ) | 360 | void MainWindow::closeEvent( QCloseEvent* ce ) |
361 | { | 361 | { |
362 | 362 | ||
363 | 363 | ||
364 | 364 | ||
365 | if ( ! KOPrefs::instance()->mAskForQuit ) { | 365 | if ( ! KOPrefs::instance()->mAskForQuit ) { |
366 | saveOnClose(); | 366 | saveOnClose(); |
367 | mClosed = true; | 367 | mClosed = true; |
368 | ce->accept(); | 368 | ce->accept(); |
369 | return; | 369 | return; |
370 | 370 | ||
371 | } | 371 | } |
372 | 372 | ||
373 | switch( QMessageBox::information( this, "KO/Pi", | 373 | switch( QMessageBox::information( this, "KO/Pi", |
374 | i18n("Do you really want\nto close KO/Pi?"), | 374 | i18n("Do you really want\nto close KO/Pi?"), |
375 | i18n("Close"), i18n("No"), | 375 | i18n("Close"), i18n("No"), |
376 | 0, 0 ) ) { | 376 | 0, 0 ) ) { |
377 | case 0: | 377 | case 0: |
378 | saveOnClose(); | 378 | saveOnClose(); |
379 | mClosed = true; | 379 | mClosed = true; |
380 | ce->accept(); | 380 | ce->accept(); |
381 | break; | 381 | break; |
382 | case 1: | 382 | case 1: |
383 | ce->ignore(); | 383 | ce->ignore(); |
384 | break; | 384 | break; |
385 | case 2: | 385 | case 2: |
386 | 386 | ||
387 | default: | 387 | default: |
388 | break; | 388 | break; |
389 | } | 389 | } |
390 | 390 | ||
391 | 391 | ||
392 | } | 392 | } |
393 | 393 | ||
394 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) | 394 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) |
395 | { | 395 | { |
396 | QDataStream stream( data, IO_ReadOnly ); | 396 | QDataStream stream( data, IO_ReadOnly ); |
397 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); | 397 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); |
398 | //QString datamess; | 398 | //QString datamess; |
399 | //qDebug("message "); | 399 | //qDebug("message "); |
400 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); | 400 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); |
401 | 401 | ||
402 | if ( cmsg == "setDocument(QString)" ) { | 402 | if ( cmsg == "setDocument(QString)" ) { |
403 | QDataStream stream( data, IO_ReadOnly ); | 403 | QDataStream stream( data, IO_ReadOnly ); |
404 | QString fileName; | 404 | QString fileName; |
405 | stream >> fileName; | 405 | stream >> fileName; |
406 | //qDebug("filename %s ", fileName.latin1()); | 406 | //qDebug("filename %s ", fileName.latin1()); |
407 | showMaximized(); | 407 | showMaximized(); |
408 | raise(); | 408 | raise(); |
409 | KOPrefs::instance()->mLastSyncedLocalFile = fileName ; | 409 | KOPrefs::instance()->mLastSyncedLocalFile = fileName ; |
410 | mSyncManager->slotSyncMenu( 1002 ); | 410 | mSyncManager->slotSyncMenu( 1002 ); |
411 | return; | 411 | return; |
412 | } | 412 | } |
413 | 413 | ||
414 | if ( cmsg == "-writeFile" ) { | 414 | if ( cmsg == "-writeFile" ) { |
415 | // I made from the "-writeFile" an "-writeAlarm" | 415 | // I made from the "-writeFile" an "-writeAlarm" |
416 | mView->viewManager()->showWhatsNextView(); | 416 | mView->viewManager()->showWhatsNextView(); |
417 | mCalendar->checkAlarmForIncidence( 0, true); | 417 | mCalendar->checkAlarmForIncidence( 0, true); |
418 | showMaximized(); | 418 | showMaximized(); |
419 | raise(); | 419 | raise(); |
420 | return; | 420 | return; |
421 | 421 | ||
422 | } | 422 | } |
423 | if ( cmsg == "-writeFileSilent" ) { | 423 | if ( cmsg == "-writeFileSilent" ) { |
424 | // I made from the "-writeFile" an "-writeAlarm" | 424 | // I made from the "-writeFile" an "-writeAlarm" |
425 | // mView->viewManager()->showWhatsNextView(); | 425 | // mView->viewManager()->showWhatsNextView(); |
426 | mCalendar->checkAlarmForIncidence( 0, true); | 426 | mCalendar->checkAlarmForIncidence( 0, true); |
427 | //showMaximized(); | 427 | //showMaximized(); |
428 | //raise(); | 428 | //raise(); |
429 | hide(); | 429 | hide(); |
430 | return; | 430 | return; |
431 | } | 431 | } |
432 | if ( cmsg == "-newCountdown" ) { | 432 | if ( cmsg == "-newCountdown" ) { |
433 | qDebug("newCountdown "); | 433 | qDebug("newCountdown "); |
434 | 434 | ||
435 | } | 435 | } |
436 | QString msg ; | 436 | QString msg ; |
437 | QString allmsg = cmsg; | 437 | QString allmsg = cmsg; |
438 | while ( allmsg.length() > 0 ) { | 438 | while ( allmsg.length() > 0 ) { |
439 | int nextC = allmsg.find( "-", 1 ); | 439 | int nextC = allmsg.find( "-", 1 ); |
440 | if ( nextC == -1 ) { | 440 | if ( nextC == -1 ) { |
441 | msg = allmsg; | 441 | msg = allmsg; |
442 | allmsg = ""; | 442 | allmsg = ""; |
443 | } else{ | 443 | } else{ |
444 | msg = allmsg.left( nextC ); | 444 | msg = allmsg.left( nextC ); |
445 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); | 445 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); |
446 | } | 446 | } |
447 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); | 447 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); |
448 | if ( msg == "-newEvent" ) { | 448 | if ( msg == "-newEvent" ) { |
449 | mView->newEvent(); | 449 | mView->newEvent(); |
450 | } | 450 | } |
451 | if ( msg == "-newTodo" ) { | 451 | if ( msg == "-newTodo" ) { |
452 | mView->newTodo(); | 452 | mView->newTodo(); |
453 | 453 | ||
454 | } | 454 | } |
455 | if ( msg == "-showWN" ) { | 455 | if ( msg == "-showWN" ) { |
456 | mView->viewManager()->showWhatsNextView(); | 456 | mView->viewManager()->showWhatsNextView(); |
457 | } | 457 | } |
458 | if ( msg == "-showTodo" ) { | 458 | if ( msg == "-showTodo" ) { |
459 | mView->viewManager()->showTodoView(); | 459 | mView->viewManager()->showTodoView(); |
460 | } | 460 | } |
461 | if ( msg == "-showList" ) { | 461 | if ( msg == "-showList" ) { |
462 | mView->viewManager()->showListView(); | 462 | mView->viewManager()->showListView(); |
463 | } | 463 | } |
464 | else if ( msg == "-showDay" ) { | 464 | else if ( msg == "-showDay" ) { |
465 | mView->viewManager()->showDayView(); | 465 | mView->viewManager()->showDayView(); |
466 | } | 466 | } |
467 | else if ( msg == "-showWWeek" ) { | 467 | else if ( msg == "-showWWeek" ) { |
468 | mView->viewManager()->showWorkWeekView(); | 468 | mView->viewManager()->showWorkWeekView(); |
469 | } | 469 | } |
470 | else if ( msg == "-ringSync" ) { | 470 | else if ( msg == "-ringSync" ) { |
471 | mSyncManager->multiSync( false ); | 471 | mSyncManager->multiSync( false ); |
472 | } | 472 | } |
473 | else if ( msg == "-showWeek" ) { | 473 | else if ( msg == "-showWeek" ) { |
474 | mView->viewManager()->showWeekView(); | 474 | mView->viewManager()->showWeekView(); |
475 | } | 475 | } |
476 | else if ( msg == "-showTodo" ) { | 476 | else if ( msg == "-showTodo" ) { |
477 | mView->viewManager()->showTodoView(); | 477 | mView->viewManager()->showTodoView(); |
478 | } | 478 | } |
479 | else if ( msg == "-showJournal" ) { | 479 | else if ( msg == "-showJournal" ) { |
480 | mView->dateNavigator()->selectDates( 1 ); | 480 | mView->dateNavigator()->selectDates( 1 ); |
481 | mView->dateNavigator()->selectToday(); | 481 | mView->dateNavigator()->selectToday(); |
482 | mView->viewManager()->showJournalView(); | 482 | mView->viewManager()->showJournalView(); |
483 | } | 483 | } |
484 | else if ( msg == "-showKO" ) { | 484 | else if ( msg == "-showKO" ) { |
485 | mView->viewManager()->showNextXView(); | 485 | mView->viewManager()->showNextXView(); |
486 | } | 486 | } |
487 | else if ( msg == "-showWNext" || msg == "nextView()" ) { | 487 | else if ( msg == "-showWNext" || msg == "nextView()" ) { |
488 | mView->viewManager()->showWhatsNextView(); | 488 | mView->viewManager()->showWhatsNextView(); |
489 | } | 489 | } |
490 | else if ( msg == "-showNextXView" ) { | 490 | else if ( msg == "-showNextXView" ) { |
491 | mView->viewManager()->showNextXView(); | 491 | mView->viewManager()->showNextXView(); |
492 | } | 492 | } |
493 | 493 | ||
494 | 494 | ||
495 | } | 495 | } |
496 | 496 | ||
497 | showMaximized(); | 497 | showMaximized(); |
498 | raise(); | 498 | raise(); |
499 | } | 499 | } |
500 | 500 | ||
501 | QPixmap MainWindow::loadPixmap( QString name ) | 501 | QPixmap MainWindow::loadPixmap( QString name ) |
502 | { | 502 | { |
503 | return SmallIcon( name ); | 503 | return SmallIcon( name ); |
504 | 504 | ||
505 | } | 505 | } |
506 | void MainWindow::initActions() | 506 | void MainWindow::initActions() |
507 | { | 507 | { |
508 | //KOPrefs::instance()->mShowFullMenu | 508 | //KOPrefs::instance()->mShowFullMenu |
509 | iconToolBar->clear(); | 509 | iconToolBar->clear(); |
510 | KOPrefs *p = KOPrefs::instance(); | 510 | KOPrefs *p = KOPrefs::instance(); |
511 | //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); | 511 | //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); |
512 | 512 | ||
513 | QPopupMenu *viewMenu = new QPopupMenu( this ); | 513 | QPopupMenu *viewMenu = new QPopupMenu( this ); |
514 | QPopupMenu *actionMenu = new QPopupMenu( this ); | 514 | QPopupMenu *actionMenu = new QPopupMenu( this ); |
515 | QPopupMenu *importMenu = new QPopupMenu( this ); | 515 | QPopupMenu *importMenu = new QPopupMenu( this ); |
516 | selectFilterMenu = new QPopupMenu( this ); | 516 | selectFilterMenu = new QPopupMenu( this ); |
517 | selectFilterMenu->setCheckable( true ); | 517 | selectFilterMenu->setCheckable( true ); |
518 | syncMenu = new QPopupMenu( this ); | 518 | syncMenu = new QPopupMenu( this ); |
519 | configureAgendaMenu = new QPopupMenu( this ); | 519 | configureAgendaMenu = new QPopupMenu( this ); |
520 | configureToolBarMenu = new QPopupMenu( this ); | 520 | configureToolBarMenu = new QPopupMenu( this ); |
521 | QPopupMenu *helpMenu = new QPopupMenu( this ); | 521 | QPopupMenu *helpMenu = new QPopupMenu( this ); |
522 | if ( KOPrefs::instance()->mShowFullMenu ) { | 522 | if ( KOPrefs::instance()->mShowFullMenu ) { |
523 | QMenuBar *menuBar1; | 523 | QMenuBar *menuBar1; |
524 | menuBar1 = menuBar(); | 524 | menuBar1 = menuBar(); |
525 | menuBar1->insertItem( i18n("File"), importMenu ); | 525 | menuBar1->insertItem( i18n("File"), importMenu ); |
526 | menuBar1->insertItem( i18n("View"), viewMenu ); | 526 | menuBar1->insertItem( i18n("View"), viewMenu ); |
527 | menuBar1->insertItem( i18n("Actions"), actionMenu ); | 527 | menuBar1->insertItem( i18n("Actions"), actionMenu ); |
528 | #ifdef DESKTOP_VERSION | 528 | #ifdef DESKTOP_VERSION |
529 | menuBar1->insertItem( i18n("Synchronize"), syncMenu ); | 529 | menuBar1->insertItem( i18n("Synchronize"), syncMenu ); |
530 | menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 530 | menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
531 | #else | 531 | #else |
532 | menuBar1->insertItem( i18n("Sync"), syncMenu ); | 532 | menuBar1->insertItem( i18n("Sync"), syncMenu ); |
533 | menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); | 533 | menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); |
534 | #endif | 534 | #endif |
535 | //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 535 | //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
536 | menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); | 536 | menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); |
537 | menuBar1->insertItem( i18n("Help"), helpMenu ); | 537 | menuBar1->insertItem( i18n("Help"), helpMenu ); |
538 | } else { | 538 | } else { |
539 | QPEMenuBar *menuBar1; | 539 | QPEMenuBar *menuBar1; |
540 | menuBar1 = new QPEMenuBar( iconToolBar ); | 540 | menuBar1 = new QPEMenuBar( iconToolBar ); |
541 | QPopupMenu *menuBar = new QPopupMenu( this ); | 541 | QPopupMenu *menuBar = new QPopupMenu( this ); |
542 | menuBar1->insertItem( i18n("ME"), menuBar); | 542 | menuBar1->insertItem( i18n("ME"), menuBar); |
543 | menuBar->insertItem( i18n("File"), importMenu ); | 543 | menuBar->insertItem( i18n("File"), importMenu ); |
544 | menuBar->insertItem( i18n("View"), viewMenu ); | 544 | menuBar->insertItem( i18n("View"), viewMenu ); |
545 | menuBar->insertItem( i18n("Actions"), actionMenu ); | 545 | menuBar->insertItem( i18n("Actions"), actionMenu ); |
546 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); | 546 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); |
547 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 547 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
548 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 548 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
549 | menuBar->insertItem( i18n("Filter"),selectFilterMenu ); | 549 | menuBar->insertItem( i18n("Filter"),selectFilterMenu ); |
550 | menuBar->insertItem( i18n("Help"), helpMenu ); | 550 | menuBar->insertItem( i18n("Help"), helpMenu ); |
551 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); | 551 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); |
552 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); | 552 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); |
553 | } | 553 | } |
554 | connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); | 554 | connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); |
555 | connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); | 555 | connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); |
556 | QIconSet icon; | 556 | QIconSet icon; |
557 | int pixWid = 22, pixHei = 22; | 557 | int pixWid = 22, pixHei = 22; |
558 | QString pathString = ""; | 558 | QString pathString = ""; |
559 | if ( !p->mToolBarMiniIcons ) { | 559 | if ( !p->mToolBarMiniIcons ) { |
560 | if ( QApplication::desktop()->width() < 480 ) { | 560 | if ( QApplication::desktop()->width() < 480 ) { |
561 | pathString += "icons16/"; | 561 | pathString += "icons16/"; |
562 | pixWid = 18; pixHei = 16; | 562 | pixWid = 18; pixHei = 16; |
563 | } | 563 | } |
564 | } else { | 564 | } else { |
565 | pathString += "iconsmini/"; | 565 | pathString += "iconsmini/"; |
566 | pixWid = 18; pixHei = 16; | 566 | pixWid = 18; pixHei = 16; |
567 | } | 567 | } |
568 | mWeekBgColor = iconToolBar->backgroundColor(); | 568 | mWeekBgColor = iconToolBar->backgroundColor(); |
569 | mWeekPixmap.resize( pixWid , pixHei ); | 569 | mWeekPixmap.resize( pixWid , pixHei ); |
570 | mWeekPixmap.fill( mWeekBgColor ); | 570 | mWeekPixmap.fill( mWeekBgColor ); |
571 | icon = mWeekPixmap; | 571 | icon = mWeekPixmap; |
572 | mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this ); | 572 | mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this ); |
573 | mWeekAction->addTo( iconToolBar ); | 573 | mWeekAction->addTo( iconToolBar ); |
574 | mWeekFont = font(); | 574 | mWeekFont = font(); |
575 | 575 | ||
576 | int fontPoint = mWeekFont.pointSize(); | 576 | int fontPoint = mWeekFont.pointSize(); |
577 | QFontMetrics f( mWeekFont ); | 577 | QFontMetrics f( mWeekFont ); |
578 | int fontWid = f.width( "30" ); | 578 | int fontWid = f.width( "30" ); |
579 | while ( fontWid > pixWid ) { | 579 | while ( fontWid > pixWid ) { |
580 | --fontPoint; | 580 | --fontPoint; |
581 | mWeekFont.setPointSize( fontPoint ); | 581 | mWeekFont.setPointSize( fontPoint ); |
582 | QFontMetrics f( mWeekFont ); | 582 | QFontMetrics f( mWeekFont ); |
583 | fontWid = f.width( "30" ); | 583 | fontWid = f.width( "30" ); |
584 | qDebug("dec-- "); | 584 | qDebug("dec-- "); |
585 | } | 585 | } |
586 | 586 | ||
587 | connect( mWeekAction, SIGNAL( activated() ), | 587 | connect( mWeekAction, SIGNAL( activated() ), |
588 | this, SLOT( weekAction() ) ); | 588 | this, SLOT( weekAction() ) ); |
589 | 589 | ||
590 | connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); | 590 | connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); |
591 | 591 | ||
592 | //#endif | 592 | //#endif |
593 | // ****************** | 593 | // ****************** |
594 | QAction *action; | 594 | QAction *action; |
595 | // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); | 595 | // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); |
596 | configureToolBarMenu->setCheckable( true ); | 596 | configureToolBarMenu->setCheckable( true ); |
597 | 597 | ||
598 | 598 | ||
599 | configureAgendaMenu->setCheckable( true ); | 599 | configureAgendaMenu->setCheckable( true ); |
600 | int iii ; | 600 | int iii ; |
601 | for ( iii = 1;iii<= 10 ;++iii ){ | 601 | for ( iii = 1;iii<= 10 ;++iii ){ |
602 | configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); | 602 | configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); |
603 | } | 603 | } |
604 | //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); | 604 | //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); |
605 | 605 | ||
606 | connect( configureAgendaMenu, SIGNAL( aboutToShow()), | 606 | connect( configureAgendaMenu, SIGNAL( aboutToShow()), |
607 | this, SLOT( showConfigureAgenda( ) ) ); | 607 | this, SLOT( showConfigureAgenda( ) ) ); |
608 | 608 | ||
609 | icon = loadPixmap( pathString + "configure" ); | 609 | icon = loadPixmap( pathString + "configure" ); |
610 | action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); | 610 | action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); |
611 | action->addTo( actionMenu ); | 611 | action->addTo( actionMenu ); |
612 | connect( action, SIGNAL( activated() ), | 612 | connect( action, SIGNAL( activated() ), |
613 | mView, SLOT( edit_options() ) ); | 613 | mView, SLOT( edit_options() ) ); |
614 | actionMenu->insertSeparator(); | 614 | actionMenu->insertSeparator(); |
615 | 615 | ||
616 | action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); | 616 | action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); |
617 | action->addTo( actionMenu ); | 617 | action->addTo( actionMenu ); |
618 | connect( action, SIGNAL( activated() ), | 618 | connect( action, SIGNAL( activated() ), |
619 | mView, SLOT( undo_delete() ) ); | 619 | mView, SLOT( undo_delete() ) ); |
620 | actionMenu->insertSeparator(); | 620 | actionMenu->insertSeparator(); |
621 | 621 | ||
622 | icon = loadPixmap( pathString + "newevent" ); | 622 | icon = loadPixmap( pathString + "newevent" ); |
623 | configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); | 623 | configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); |
624 | configureToolBarMenu->insertSeparator(); | 624 | configureToolBarMenu->insertSeparator(); |
625 | configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); | 625 | configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); |
626 | QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); | 626 | QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); |
627 | ne_action->addTo( actionMenu ); | 627 | ne_action->addTo( actionMenu ); |
628 | connect( ne_action, SIGNAL( activated() ), | 628 | connect( ne_action, SIGNAL( activated() ), |
629 | mView, SLOT( newEvent() ) ); | 629 | mView, SLOT( newEvent() ) ); |
630 | icon = loadPixmap( pathString + "newtodo" ); | 630 | icon = loadPixmap( pathString + "newtodo" ); |
631 | configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); | 631 | configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); |
632 | QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); | 632 | QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); |
633 | nt_action->addTo( actionMenu ); | 633 | nt_action->addTo( actionMenu ); |
634 | connect( nt_action, SIGNAL( activated() ), | 634 | connect( nt_action, SIGNAL( activated() ), |
635 | mView, SLOT( newTodo() ) ); | 635 | mView, SLOT( newTodo() ) ); |
636 | 636 | ||
637 | icon = loadPixmap( pathString + "today" ); | 637 | icon = loadPixmap( pathString + "today" ); |
638 | QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); | 638 | QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); |
639 | today_action->addTo( viewMenu ); | 639 | today_action->addTo( viewMenu ); |
640 | connect( today_action, SIGNAL( activated() ), | 640 | connect( today_action, SIGNAL( activated() ), |
641 | mView, SLOT( goToday() ) ); | 641 | mView, SLOT( goToday() ) ); |
642 | viewMenu->insertSeparator(); | 642 | viewMenu->insertSeparator(); |
643 | 643 | ||
644 | icon = loadPixmap( pathString + "navi" ); | 644 | icon = loadPixmap( pathString + "navi" ); |
645 | action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); | 645 | action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); |
646 | action->addTo( viewMenu ); | 646 | action->addTo( viewMenu ); |
647 | connect( action, SIGNAL( activated() ), | 647 | connect( action, SIGNAL( activated() ), |
648 | mView, SLOT( toggleDateNavigatorWidget() ) ); | 648 | mView, SLOT( toggleDateNavigatorWidget() ) ); |
649 | mToggleNav = action ; | 649 | mToggleNav = action ; |
650 | icon = loadPixmap( pathString + "filter" ); | 650 | icon = loadPixmap( pathString + "filter" ); |
651 | action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); | 651 | action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); |
652 | action->addTo( viewMenu ); | 652 | action->addTo( viewMenu ); |
653 | connect( action, SIGNAL( activated() ), | 653 | connect( action, SIGNAL( activated() ), |
654 | mView, SLOT( toggleFilter() ) ); | 654 | mView, SLOT( toggleFilter() ) ); |
655 | mToggleFilter = action; | 655 | mToggleFilter = action; |
656 | icon = loadPixmap( pathString + "allday" ); | 656 | icon = loadPixmap( pathString + "allday" ); |
657 | action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); | 657 | action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); |
658 | action->addTo( viewMenu ); | 658 | action->addTo( viewMenu ); |
659 | connect( action, SIGNAL( activated() ), | 659 | connect( action, SIGNAL( activated() ), |
660 | mView, SLOT( toggleAllDaySize() ) ); | 660 | mView, SLOT( toggleAllDaySize() ) ); |
661 | mToggleAllday = action; | 661 | mToggleAllday = action; |
662 | 662 | ||
663 | 663 | ||
664 | connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), | 664 | connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), |
665 | mToggleNav, SLOT( setEnabled ( bool ) ) ); | 665 | mToggleNav, SLOT( setEnabled ( bool ) ) ); |
666 | connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), | 666 | connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), |
667 | mToggleFilter, SLOT( setEnabled ( bool ) ) ); | 667 | mToggleFilter, SLOT( setEnabled ( bool ) ) ); |
668 | connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), | 668 | connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), |
669 | mToggleAllday, SLOT( setEnabled ( bool ) ) ); | 669 | mToggleAllday, SLOT( setEnabled ( bool ) ) ); |
670 | 670 | ||
671 | viewMenu->insertSeparator(); | 671 | viewMenu->insertSeparator(); |
672 | icon = loadPixmap( pathString + "picker" ); | 672 | icon = loadPixmap( pathString + "picker" ); |
673 | action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); | 673 | action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); |
674 | action->addTo( viewMenu ); | 674 | action->addTo( viewMenu ); |
675 | connect( action, SIGNAL( activated() ), | 675 | connect( action, SIGNAL( activated() ), |
676 | mView, SLOT( showDatePicker() ) ); | 676 | mView, SLOT( showDatePicker() ) ); |
677 | action->addTo( iconToolBar ); | 677 | action->addTo( iconToolBar ); |
678 | viewMenu->insertSeparator(); | 678 | viewMenu->insertSeparator(); |
679 | icon = loadPixmap( pathString + "list" ); | 679 | icon = loadPixmap( pathString + "list" ); |
680 | configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); | 680 | configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); |
681 | QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); | 681 | QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); |
682 | showlist_action->addTo( viewMenu ); | 682 | showlist_action->addTo( viewMenu ); |
683 | connect( showlist_action, SIGNAL( activated() ), | 683 | connect( showlist_action, SIGNAL( activated() ), |
684 | mView->viewManager(), SLOT( showListView() ) ); | 684 | mView->viewManager(), SLOT( showListView() ) ); |
685 | 685 | ||
686 | 686 | ||
687 | icon = loadPixmap( pathString + "day" ); | 687 | icon = loadPixmap( pathString + "day" ); |
688 | configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); | 688 | configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); |
689 | QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); | 689 | QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); |
690 | day1_action->addTo( viewMenu ); | 690 | day1_action->addTo( viewMenu ); |
691 | // action->addTo( toolBar ); | 691 | // action->addTo( toolBar ); |
692 | connect( day1_action, SIGNAL( activated() ), | 692 | connect( day1_action, SIGNAL( activated() ), |
693 | mView->viewManager(), SLOT( showDayView() ) ); | 693 | mView->viewManager(), SLOT( showDayView() ) ); |
694 | 694 | ||
695 | icon = loadPixmap( pathString + "workweek" ); | 695 | icon = loadPixmap( pathString + "workweek" ); |
696 | configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); | 696 | configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); |
697 | QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); | 697 | QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); |
698 | day5_action->addTo( viewMenu ); | 698 | day5_action->addTo( viewMenu ); |
699 | connect( day5_action, SIGNAL( activated() ), | 699 | connect( day5_action, SIGNAL( activated() ), |
700 | mView->viewManager(), SLOT( showWorkWeekView() ) ); | 700 | mView->viewManager(), SLOT( showWorkWeekView() ) ); |
701 | 701 | ||
702 | icon = loadPixmap( pathString + "week" ); | 702 | icon = loadPixmap( pathString + "week" ); |
703 | configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); | 703 | configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); |
704 | QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); | 704 | QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); |
705 | day7_action->addTo( viewMenu ); | 705 | day7_action->addTo( viewMenu ); |
706 | connect( day7_action, SIGNAL( activated() ), | 706 | connect( day7_action, SIGNAL( activated() ), |
707 | mView->viewManager(), SLOT( showWeekView() ) ); | 707 | mView->viewManager(), SLOT( showWeekView() ) ); |
708 | 708 | ||
709 | icon = loadPixmap( pathString + "month" ); | 709 | icon = loadPixmap( pathString + "month" ); |
710 | configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); | 710 | configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); |
711 | QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); | 711 | QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); |
712 | month_action->addTo( viewMenu ); | 712 | month_action->addTo( viewMenu ); |
713 | connect( month_action, SIGNAL( activated() ), | 713 | connect( month_action, SIGNAL( activated() ), |
714 | mView->viewManager(), SLOT( showMonthView() ) ); | 714 | mView->viewManager(), SLOT( showMonthView() ) ); |
715 | 715 | ||
716 | icon = loadPixmap( pathString + "workweek2" ); | ||
717 | configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 ); | ||
718 | QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this ); | ||
719 | day6_action->addTo( viewMenu ); | ||
720 | connect( day6_action, SIGNAL( activated() ), | ||
721 | mView->viewManager(), SLOT( showMonthViewWeek() ) ); | ||
722 | |||
716 | icon = loadPixmap( pathString + "todo" ); | 723 | icon = loadPixmap( pathString + "todo" ); |
717 | configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); | 724 | configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); |
718 | QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); | 725 | QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); |
719 | todoview_action->addTo( viewMenu ); | 726 | todoview_action->addTo( viewMenu ); |
720 | connect( todoview_action, SIGNAL( activated() ), | 727 | connect( todoview_action, SIGNAL( activated() ), |
721 | mView->viewManager(), SLOT( showTodoView() ) ); | 728 | mView->viewManager(), SLOT( showTodoView() ) ); |
722 | 729 | ||
723 | icon = loadPixmap( pathString + "journal" ); | 730 | icon = loadPixmap( pathString + "journal" ); |
724 | configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); | 731 | configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); |
725 | QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); | 732 | QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); |
726 | viewjournal_action->addTo( viewMenu ); | 733 | viewjournal_action->addTo( viewMenu ); |
727 | connect( viewjournal_action, SIGNAL( activated() ), | 734 | connect( viewjournal_action, SIGNAL( activated() ), |
728 | mView->viewManager(), SLOT( showJournalView() ) ); | 735 | mView->viewManager(), SLOT( showJournalView() ) ); |
729 | 736 | ||
730 | icon = loadPixmap( pathString + "xdays" ); | 737 | icon = loadPixmap( pathString + "xdays" ); |
731 | configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 ); | 738 | configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 ); |
732 | QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); | 739 | QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); |
733 | xdays_action->addTo( viewMenu ); | 740 | xdays_action->addTo( viewMenu ); |
734 | connect( xdays_action, SIGNAL( activated() ), | 741 | connect( xdays_action, SIGNAL( activated() ), |
735 | mView->viewManager(), SLOT( showNextXView() ) ); | 742 | mView->viewManager(), SLOT( showNextXView() ) ); |
736 | 743 | ||
737 | icon = loadPixmap( pathString + "whatsnext" ); | 744 | icon = loadPixmap( pathString + "whatsnext" ); |
738 | configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 ); | 745 | configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 ); |
739 | QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); | 746 | QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); |
740 | whatsnext_action->addTo( viewMenu ); | 747 | whatsnext_action->addTo( viewMenu ); |
741 | connect( whatsnext_action, SIGNAL( activated() ), | 748 | connect( whatsnext_action, SIGNAL( activated() ), |
742 | mView->viewManager(), SLOT( showWhatsNextView() ) ); | 749 | mView->viewManager(), SLOT( showWhatsNextView() ) ); |
743 | 750 | ||
744 | #if 0 | 751 | #if 0 |
745 | action = new QAction( "view_timespan", "Time Span", 0, this ); | 752 | action = new QAction( "view_timespan", "Time Span", 0, this ); |
746 | action->addTo( viewMenu ); | 753 | action->addTo( viewMenu ); |
747 | connect( action, SIGNAL( activated() ), | 754 | connect( action, SIGNAL( activated() ), |
748 | mView->viewManager(), SLOT( showTimeSpanView() ) ); | 755 | mView->viewManager(), SLOT( showTimeSpanView() ) ); |
749 | #endif | 756 | #endif |
750 | 757 | ||
751 | mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, | 758 | mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, |
752 | this ); | 759 | this ); |
753 | mNewSubTodoAction->addTo( actionMenu ); | 760 | mNewSubTodoAction->addTo( actionMenu ); |
754 | connect( mNewSubTodoAction, SIGNAL( activated() ), | 761 | connect( mNewSubTodoAction, SIGNAL( activated() ), |
755 | mView, SLOT( newSubTodo() ) ); | 762 | mView, SLOT( newSubTodo() ) ); |
756 | 763 | ||
757 | actionMenu->insertSeparator(); | 764 | actionMenu->insertSeparator(); |
758 | 765 | ||
759 | mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); | 766 | mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); |
760 | mShowAction->addTo( actionMenu ); | 767 | mShowAction->addTo( actionMenu ); |
761 | connect( mShowAction, SIGNAL( activated() ), | 768 | connect( mShowAction, SIGNAL( activated() ), |
762 | mView, SLOT( showIncidence() ) ); | 769 | mView, SLOT( showIncidence() ) ); |
763 | 770 | ||
764 | mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); | 771 | mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); |
765 | mEditAction->addTo( actionMenu ); | 772 | mEditAction->addTo( actionMenu ); |
766 | connect( mEditAction, SIGNAL( activated() ), | 773 | connect( mEditAction, SIGNAL( activated() ), |
767 | mView, SLOT( editIncidence() ) ); | 774 | mView, SLOT( editIncidence() ) ); |
768 | 775 | ||
769 | mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); | 776 | mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); |
770 | mDeleteAction->addTo( actionMenu ); | 777 | mDeleteAction->addTo( actionMenu ); |
771 | connect( mDeleteAction, SIGNAL( activated() ), | 778 | connect( mDeleteAction, SIGNAL( activated() ), |
772 | mView, SLOT( deleteIncidence() ) ); | 779 | mView, SLOT( deleteIncidence() ) ); |
773 | 780 | ||
774 | 781 | ||
775 | mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); | 782 | mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); |
776 | mCloneAction->addTo( actionMenu ); | 783 | mCloneAction->addTo( actionMenu ); |
777 | connect( mCloneAction, SIGNAL( activated() ), | 784 | connect( mCloneAction, SIGNAL( activated() ), |
778 | mView, SLOT( cloneIncidence() ) ); | 785 | mView, SLOT( cloneIncidence() ) ); |
779 | mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); | 786 | mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); |
780 | mMoveAction->addTo( actionMenu ); | 787 | mMoveAction->addTo( actionMenu ); |
781 | connect( mMoveAction, SIGNAL( activated() ), | 788 | connect( mMoveAction, SIGNAL( activated() ), |
782 | mView, SLOT( moveIncidence() ) ); | 789 | mView, SLOT( moveIncidence() ) ); |
783 | mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); | 790 | mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); |
784 | mBeamAction->addTo( actionMenu ); | 791 | mBeamAction->addTo( actionMenu ); |
785 | connect( mBeamAction, SIGNAL( activated() ), | 792 | connect( mBeamAction, SIGNAL( activated() ), |
786 | mView, SLOT( beamIncidence() ) ); | 793 | mView, SLOT( beamIncidence() ) ); |
787 | mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); | 794 | mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); |
788 | mCancelAction->addTo( actionMenu ); | 795 | mCancelAction->addTo( actionMenu ); |
789 | connect( mCancelAction, SIGNAL( activated() ), | 796 | connect( mCancelAction, SIGNAL( activated() ), |
790 | mView, SLOT( toggleCancelIncidence() ) ); | 797 | mView, SLOT( toggleCancelIncidence() ) ); |
791 | 798 | ||
792 | actionMenu->insertSeparator(); | 799 | actionMenu->insertSeparator(); |
793 | 800 | ||
794 | action = new QAction( "purge_completed", i18n("Purge Completed"), 0, | 801 | action = new QAction( "purge_completed", i18n("Purge Completed"), 0, |
795 | this ); | 802 | this ); |
796 | action->addTo( actionMenu ); | 803 | action->addTo( actionMenu ); |
797 | connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); | 804 | connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); |
798 | 805 | ||
799 | icon = loadPixmap( pathString + "search" ); | 806 | icon = loadPixmap( pathString + "search" ); |
800 | QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); | 807 | QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); |
801 | configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4); | 808 | configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4); |
802 | search_action->addTo( actionMenu ); | 809 | search_action->addTo( actionMenu ); |
803 | connect( search_action, SIGNAL( activated() ), | 810 | connect( search_action, SIGNAL( activated() ), |
804 | mView->dialogManager(), SLOT( showSearchDialog() ) ); | 811 | mView->dialogManager(), SLOT( showSearchDialog() ) ); |
805 | 812 | ||
806 | 813 | ||
807 | 814 | ||
808 | if ( KOPrefs::instance()->mShowFullMenu ) { | 815 | if ( KOPrefs::instance()->mShowFullMenu ) { |
809 | actionMenu->insertSeparator(); | 816 | actionMenu->insertSeparator(); |
810 | actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); | 817 | actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); |
811 | 818 | ||
812 | } | 819 | } |
813 | // actionMenu->insertSeparator(); | 820 | // actionMenu->insertSeparator(); |
814 | action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, | 821 | action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, |
815 | this ); | 822 | this ); |
816 | action->addTo( importMenu ); | 823 | action->addTo( importMenu ); |
817 | connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); | 824 | connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); |
818 | action = new QAction( "import_quick", i18n("Import last file"), 0, | 825 | action = new QAction( "import_quick", i18n("Import last file"), 0, |
819 | this ); | 826 | this ); |
820 | action->addTo( importMenu ); | 827 | action->addTo( importMenu ); |
821 | connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); | 828 | connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); |
822 | importMenu->insertSeparator(); | 829 | importMenu->insertSeparator(); |
823 | action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, | 830 | action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, |
824 | this ); | 831 | this ); |
825 | action->addTo( importMenu ); | 832 | action->addTo( importMenu ); |
826 | connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); | 833 | connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); |
827 | #ifndef DESKTOP_VERSION | 834 | #ifndef DESKTOP_VERSION |
828 | importMenu->insertSeparator(); | 835 | importMenu->insertSeparator(); |
829 | action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, | 836 | action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, |
830 | this ); | 837 | this ); |
831 | action->addTo( importMenu ); | 838 | action->addTo( importMenu ); |
832 | connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); | 839 | connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); |
833 | #else | 840 | #else |
834 | #ifdef _OL_IMPORT_ | 841 | #ifdef _OL_IMPORT_ |
835 | importMenu->insertSeparator(); | 842 | importMenu->insertSeparator(); |
836 | action = new QAction( "import_ol", i18n("Import from OL"), 0, | 843 | action = new QAction( "import_ol", i18n("Import from OL"), 0, |
837 | this ); | 844 | this ); |
838 | action->addTo( importMenu ); | 845 | action->addTo( importMenu ); |
839 | connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); | 846 | connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); |
840 | #endif | 847 | #endif |
841 | #endif | 848 | #endif |
842 | 849 | ||
843 | importMenu->insertSeparator(); | 850 | importMenu->insertSeparator(); |
844 | action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, | 851 | action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, |
845 | this ); | 852 | this ); |
846 | action->addTo( importMenu ); | 853 | action->addTo( importMenu ); |
847 | connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); | 854 | connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); |
848 | 855 | ||
849 | action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, | 856 | action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, |
850 | this ); | 857 | this ); |
851 | action->addTo( importMenu ); | 858 | action->addTo( importMenu ); |
852 | connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); | 859 | connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); |
853 | 860 | ||
854 | importMenu->insertSeparator(); | 861 | importMenu->insertSeparator(); |
855 | action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, | 862 | action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, |
856 | this ); | 863 | this ); |
857 | action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); | 864 | action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); |
858 | 865 | ||
859 | 866 | ||
860 | //LR | 867 | //LR |
861 | QPopupMenu *ex2phone = new QPopupMenu( this ); | 868 | QPopupMenu *ex2phone = new QPopupMenu( this ); |
862 | ex2phone->insertItem(i18n("Complete calendar..."), 1 ); | 869 | ex2phone->insertItem(i18n("Complete calendar..."), 1 ); |
863 | ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); | 870 | ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); |
864 | connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); | 871 | connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); |
865 | importMenu->insertItem( i18n("Export to phone"), ex2phone ); | 872 | importMenu->insertItem( i18n("Export to phone"), ex2phone ); |
866 | 873 | ||
867 | importMenu->insertSeparator(); | 874 | importMenu->insertSeparator(); |
868 | action = new QAction( "manage cat", i18n("Manage new categories..."), 0, | 875 | action = new QAction( "manage cat", i18n("Manage new categories..."), 0, |
869 | this ); | 876 | this ); |
870 | action->addTo( importMenu ); | 877 | action->addTo( importMenu ); |
871 | connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); | 878 | connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); |
872 | #ifndef DESKTOP_VERSION | 879 | #ifndef DESKTOP_VERSION |
873 | importMenu->insertSeparator(); | 880 | importMenu->insertSeparator(); |
874 | brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, | 881 | brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, |
875 | this ); | 882 | this ); |
876 | brAction->addTo( importMenu ); | 883 | brAction->addTo( importMenu ); |
877 | brAction->setToggleAction (true ) ; | 884 | brAction->setToggleAction (true ) ; |
878 | connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); | 885 | connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); |
879 | 886 | ||
880 | action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, | 887 | action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, |
881 | this ); | 888 | this ); |
882 | action->addTo( importMenu ); | 889 | action->addTo( importMenu ); |
883 | connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); | 890 | connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); |
884 | 891 | ||
885 | action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, | 892 | action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, |
886 | this ); | 893 | this ); |
887 | action->addTo( importMenu ); | 894 | action->addTo( importMenu ); |
888 | connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); | 895 | connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); |
889 | #else | 896 | #else |
890 | importMenu->insertSeparator(); | 897 | importMenu->insertSeparator(); |
891 | icon = loadPixmap( pathString + "print" ); | 898 | icon = loadPixmap( pathString + "print" ); |
892 | action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); | 899 | action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); |
893 | action->addTo( importMenu ); | 900 | action->addTo( importMenu ); |
894 | connect( action, SIGNAL( activated() ), | 901 | connect( action, SIGNAL( activated() ), |
895 | this, SLOT( printCal() ) ); | 902 | this, SLOT( printCal() ) ); |
896 | 903 | ||
897 | icon = loadPixmap( pathString + "print" ); | 904 | icon = loadPixmap( pathString + "print" ); |
898 | action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); | 905 | action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); |
899 | action->addTo( importMenu ); | 906 | action->addTo( importMenu ); |
900 | connect( action, SIGNAL( activated() ), | 907 | connect( action, SIGNAL( activated() ), |
901 | this, SLOT( printSel() ) ); | 908 | this, SLOT( printSel() ) ); |
902 | action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this ); | 909 | action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this ); |
903 | action->addTo( importMenu ); | 910 | action->addTo( importMenu ); |
904 | connect( action, SIGNAL( activated() ), | 911 | connect( action, SIGNAL( activated() ), |
905 | mView->viewManager(), SIGNAL( printWNV() ) ); | 912 | mView->viewManager(), SIGNAL( printWNV() ) ); |
906 | #endif | 913 | #endif |
907 | importMenu->insertSeparator(); | 914 | importMenu->insertSeparator(); |
908 | action = new QAction( "beam all", i18n("Save"), 0, | 915 | action = new QAction( "beam all", i18n("Save"), 0, |
909 | this ); | 916 | this ); |
910 | action->addTo( importMenu ); | 917 | action->addTo( importMenu ); |
911 | connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); | 918 | connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); |
912 | action = new QAction( "beam all", i18n("Exit (+save)"), 0, | 919 | action = new QAction( "beam all", i18n("Exit (+save)"), 0, |
913 | this ); | 920 | this ); |
914 | action->addTo( importMenu ); | 921 | action->addTo( importMenu ); |
915 | connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); | 922 | connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); |
916 | 923 | ||
917 | //menuBar->insertItem( "Configure",configureMenu ); | 924 | //menuBar->insertItem( "Configure",configureMenu ); |
918 | //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); | 925 | //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); |
919 | icon = loadPixmap( "korganizer/korganizer" ); | 926 | icon = loadPixmap( "korganizer/korganizer" ); |
920 | 927 | ||
921 | action = new QAction( "Whats New", i18n("What's new?"), 0,this ); | 928 | action = new QAction( "Whats New", i18n("What's new?"), 0,this ); |
922 | action->addTo( helpMenu ); | 929 | action->addTo( helpMenu ); |
923 | connect( action, SIGNAL( activated() ), | 930 | connect( action, SIGNAL( activated() ), |
924 | SLOT( whatsNew() ) ); | 931 | SLOT( whatsNew() ) ); |
925 | action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); | 932 | action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); |
926 | action->addTo( helpMenu ); | 933 | action->addTo( helpMenu ); |
927 | connect( action, SIGNAL( activated() ), | 934 | connect( action, SIGNAL( activated() ), |
928 | SLOT( features() ) ); | 935 | SLOT( features() ) ); |
929 | action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); | 936 | action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); |
930 | action->addTo( helpMenu ); | 937 | action->addTo( helpMenu ); |
931 | connect( action, SIGNAL( activated() ), | 938 | connect( action, SIGNAL( activated() ), |
932 | SLOT( keyBindings() ) ); | 939 | SLOT( keyBindings() ) ); |
933 | action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); | 940 | action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); |
934 | action->addTo( helpMenu ); | 941 | action->addTo( helpMenu ); |
935 | connect( action, SIGNAL( activated() ), | 942 | connect( action, SIGNAL( activated() ), |
936 | SLOT( synchowto() ) ); | 943 | SLOT( synchowto() ) ); |
937 | action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this ); | 944 | action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this ); |
938 | action->addTo( helpMenu ); | 945 | action->addTo( helpMenu ); |
939 | connect( action, SIGNAL( activated() ), | 946 | connect( action, SIGNAL( activated() ), |
940 | SLOT( kdesynchowto() ) ); | 947 | SLOT( kdesynchowto() ) ); |
941 | action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this ); | 948 | action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this ); |
942 | action->addTo( helpMenu ); | 949 | action->addTo( helpMenu ); |
943 | connect( action, SIGNAL( activated() ), | 950 | connect( action, SIGNAL( activated() ), |
944 | SLOT( multisynchowto() ) ); | 951 | SLOT( multisynchowto() ) ); |
945 | action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); | 952 | action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); |
946 | action->addTo( helpMenu ); | 953 | action->addTo( helpMenu ); |
947 | connect( action, SIGNAL( activated() ), | 954 | connect( action, SIGNAL( activated() ), |
948 | SLOT( aboutAutoSaving() ) ); | 955 | SLOT( aboutAutoSaving() ) ); |
949 | action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); | 956 | action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); |
950 | action->addTo( helpMenu ); | 957 | action->addTo( helpMenu ); |
951 | connect( action, SIGNAL( activated() ), | 958 | connect( action, SIGNAL( activated() ), |
952 | SLOT( aboutKnownBugs() ) ); | 959 | SLOT( aboutKnownBugs() ) ); |
953 | action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); | 960 | action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); |
954 | action->addTo( helpMenu ); | 961 | action->addTo( helpMenu ); |
955 | connect( action, SIGNAL( activated() ), | 962 | connect( action, SIGNAL( activated() ), |
956 | SLOT( usertrans() ) ); | 963 | SLOT( usertrans() ) ); |
957 | action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); | 964 | action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); |
958 | action->addTo( helpMenu ); | 965 | action->addTo( helpMenu ); |
959 | connect( action, SIGNAL( activated() ), | 966 | connect( action, SIGNAL( activated() ), |
960 | SLOT( faq() ) ); | 967 | SLOT( faq() ) ); |
961 | action = new QAction( "licence", i18n("Licence..."), 0, this ); | 968 | action = new QAction( "licence", i18n("Licence..."), 0, this ); |
962 | action->addTo( helpMenu ); | 969 | action->addTo( helpMenu ); |
963 | connect( action, SIGNAL( activated() ), | 970 | connect( action, SIGNAL( activated() ), |
964 | SLOT( licence() ) ); | 971 | SLOT( licence() ) ); |
965 | action = new QAction( "about", i18n("About..."), 0, this ); | 972 | action = new QAction( "about", i18n("About..."), 0, this ); |
966 | action->addTo( helpMenu ); | 973 | action->addTo( helpMenu ); |
967 | connect( action, SIGNAL( activated() ), | 974 | connect( action, SIGNAL( activated() ), |
968 | SLOT( about() ) ); | 975 | SLOT( about() ) ); |
969 | //menuBar->insertSeparator(); | 976 | //menuBar->insertSeparator(); |
970 | 977 | ||
971 | // ****************************************************** | 978 | // ****************************************************** |
972 | // menubar icons | 979 | // menubar icons |
973 | 980 | ||
974 | 981 | ||
975 | iconToolBar->setHorizontalStretchable (true ); | 982 | iconToolBar->setHorizontalStretchable (true ); |
976 | //menuBar->insertItem( iconToolBar ); | 983 | //menuBar->insertItem( iconToolBar ); |
977 | //xdays_action | 984 | //xdays_action |
978 | if (p-> mShowIconNewEvent) | 985 | if (p-> mShowIconNewEvent) |
979 | ne_action->addTo( iconToolBar ); | 986 | ne_action->addTo( iconToolBar ); |
980 | if (p->mShowIconNewTodo ) | 987 | if (p->mShowIconNewTodo ) |
981 | nt_action->addTo( iconToolBar ); | 988 | nt_action->addTo( iconToolBar ); |
982 | if (p-> mShowIconSearch) | 989 | if (p-> mShowIconSearch) |
983 | search_action->addTo( iconToolBar ); | 990 | search_action->addTo( iconToolBar ); |
984 | if (p-> mShowIconNext) | 991 | if (p-> mShowIconNext) |
985 | whatsnext_action->addTo( iconToolBar ); | 992 | whatsnext_action->addTo( iconToolBar ); |
986 | if (p-> mShowIconNextDays) | 993 | if (p-> mShowIconNextDays) |
987 | xdays_action->addTo( iconToolBar ); | 994 | xdays_action->addTo( iconToolBar ); |
988 | if (p-> mShowIconList) | 995 | if (p-> mShowIconList) |
989 | showlist_action->addTo( iconToolBar ); | 996 | showlist_action->addTo( iconToolBar ); |
990 | if (p-> mShowIconDay1) | 997 | if (p-> mShowIconDay1) |
991 | day1_action->addTo( iconToolBar ); | 998 | day1_action->addTo( iconToolBar ); |
992 | if (p-> mShowIconDay5) | 999 | if (p-> mShowIconDay5) |
993 | day5_action->addTo( iconToolBar ); | 1000 | day5_action->addTo( iconToolBar ); |
994 | if (p-> mShowIconDay7) | 1001 | if (p-> mShowIconDay7) |
995 | day7_action->addTo( iconToolBar ); | 1002 | day7_action->addTo( iconToolBar ); |
996 | if (p-> mShowIconMonth) | 1003 | if (p-> mShowIconMonth) |
997 | month_action->addTo( iconToolBar ); | 1004 | month_action->addTo( iconToolBar ); |
1005 | if (p-> mShowIconDay6) | ||
1006 | day6_action->addTo( iconToolBar ); | ||
998 | if (p-> mShowIconTodoview) | 1007 | if (p-> mShowIconTodoview) |
999 | todoview_action->addTo( iconToolBar ); | 1008 | todoview_action->addTo( iconToolBar ); |
1000 | if (p-> mShowIconJournal) | 1009 | if (p-> mShowIconJournal) |
1001 | viewjournal_action->addTo( iconToolBar ); | 1010 | viewjournal_action->addTo( iconToolBar ); |
1002 | icon = loadPixmap( pathString + "2leftarrowB" ); | 1011 | icon = loadPixmap( pathString + "2leftarrowB" ); |
1003 | configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14); | 1012 | configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14); |
1004 | if (p-> mShowIconBackFast) { | 1013 | if (p-> mShowIconBackFast) { |
1005 | action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); | 1014 | action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); |
1006 | connect( action, SIGNAL( activated() ), | 1015 | connect( action, SIGNAL( activated() ), |
1007 | mView, SLOT( goPreviousMonth() ) ); | 1016 | mView, SLOT( goPreviousMonth() ) ); |
1008 | action->addTo( iconToolBar ); | 1017 | action->addTo( iconToolBar ); |
1009 | } | 1018 | } |
1010 | icon = loadPixmap( pathString + "1leftarrowB" ); | 1019 | icon = loadPixmap( pathString + "1leftarrowB" ); |
1011 | configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15); | 1020 | configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15); |
1012 | if (p-> mShowIconBack) { | 1021 | if (p-> mShowIconBack) { |
1013 | action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); | 1022 | action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); |
1014 | connect( action, SIGNAL( activated() ), | 1023 | connect( action, SIGNAL( activated() ), |
1015 | mView, SLOT( goPrevious() ) ); | 1024 | mView, SLOT( goPrevious() ) ); |
1016 | action->addTo( iconToolBar ); | 1025 | action->addTo( iconToolBar ); |
1017 | } | 1026 | } |
1018 | icon = loadPixmap( pathString + "today" ); | 1027 | icon = loadPixmap( pathString + "today" ); |
1019 | configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); | 1028 | configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); |
1020 | if (p-> mShowIconToday) | 1029 | if (p-> mShowIconToday) |
1021 | today_action->addTo( iconToolBar ); | 1030 | today_action->addTo( iconToolBar ); |
1022 | icon = loadPixmap( pathString + "1rightarrowB" ); | 1031 | icon = loadPixmap( pathString + "1rightarrowB" ); |
1023 | configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); | 1032 | configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); |
1024 | if (p-> mShowIconForward) { | 1033 | if (p-> mShowIconForward) { |
1025 | action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); | 1034 | action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); |
1026 | connect( action, SIGNAL( activated() ), | 1035 | connect( action, SIGNAL( activated() ), |
1027 | mView, SLOT( goNext() ) ); | 1036 | mView, SLOT( goNext() ) ); |
1028 | action->addTo( iconToolBar ); | 1037 | action->addTo( iconToolBar ); |
1029 | } | 1038 | } |
1030 | icon = loadPixmap( pathString + "2rightarrowB" ); | 1039 | icon = loadPixmap( pathString + "2rightarrowB" ); |
1031 | configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); | 1040 | configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); |
1032 | if (p-> mShowIconForwardFast) { | 1041 | if (p-> mShowIconForwardFast) { |
1033 | action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); | 1042 | action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); |
1034 | connect( action, SIGNAL( activated() ), | 1043 | connect( action, SIGNAL( activated() ), |
1035 | mView, SLOT( goNextMonth() ) ); | 1044 | mView, SLOT( goNextMonth() ) ); |
1036 | action->addTo( iconToolBar ); | 1045 | action->addTo( iconToolBar ); |
1037 | } | 1046 | } |
1038 | 1047 | ||
1039 | 1048 | ||
1040 | configureToolBarMenu->insertItem(i18n("What's This?"), 300); | 1049 | configureToolBarMenu->insertItem(i18n("What's This?"), 300); |
1041 | 1050 | ||
1042 | if (p-> mShowIconNewEvent) | 1051 | if (p-> mShowIconNewEvent) |
1043 | configureToolBarMenu->setItemChecked( 10, true ); | 1052 | configureToolBarMenu->setItemChecked( 10, true ); |
1044 | if (p->mShowIconNewTodo ) | 1053 | if (p->mShowIconNewTodo ) |
1045 | configureToolBarMenu->setItemChecked( 20, true ); | 1054 | configureToolBarMenu->setItemChecked( 20, true ); |
1046 | if (p-> mShowIconSearch) | 1055 | if (p-> mShowIconSearch) |
1047 | configureToolBarMenu->setItemChecked( 120, true ); | 1056 | configureToolBarMenu->setItemChecked( 120, true ); |
1048 | if (p-> mShowIconList) | 1057 | if (p-> mShowIconList) |
1049 | configureToolBarMenu->setItemChecked( 30, true ); | 1058 | configureToolBarMenu->setItemChecked( 30, true ); |
1050 | if (p-> mShowIconDay1) | 1059 | if (p-> mShowIconDay1) |
1051 | configureToolBarMenu->setItemChecked( 40, true ); | 1060 | configureToolBarMenu->setItemChecked( 40, true ); |
1052 | if (p-> mShowIconDay5) | 1061 | if (p-> mShowIconDay5) |
1053 | configureToolBarMenu->setItemChecked( 50, true ); | 1062 | configureToolBarMenu->setItemChecked( 50, true ); |
1063 | if (p-> mShowIconDay6) | ||
1064 | configureToolBarMenu->setItemChecked( 75, true ); | ||
1054 | if (p-> mShowIconDay7) | 1065 | if (p-> mShowIconDay7) |
1055 | configureToolBarMenu->setItemChecked( 60, true ); | 1066 | configureToolBarMenu->setItemChecked( 60, true ); |
1056 | if (p-> mShowIconMonth) | 1067 | if (p-> mShowIconMonth) |
1057 | configureToolBarMenu->setItemChecked( 70, true ); | 1068 | configureToolBarMenu->setItemChecked( 70, true ); |
1058 | if (p-> mShowIconTodoview) | 1069 | if (p-> mShowIconTodoview) |
1059 | configureToolBarMenu->setItemChecked( 80, true ); | 1070 | configureToolBarMenu->setItemChecked( 80, true ); |
1060 | if (p-> mShowIconBackFast) | 1071 | if (p-> mShowIconBackFast) |
1061 | configureToolBarMenu->setItemChecked( 200, true ); | 1072 | configureToolBarMenu->setItemChecked( 200, true ); |
1062 | if (p-> mShowIconBack) | 1073 | if (p-> mShowIconBack) |
1063 | configureToolBarMenu->setItemChecked( 210, true ); | 1074 | configureToolBarMenu->setItemChecked( 210, true ); |
1064 | if (p-> mShowIconToday) | 1075 | if (p-> mShowIconToday) |
1065 | configureToolBarMenu->setItemChecked( 130, true ); | 1076 | configureToolBarMenu->setItemChecked( 130, true ); |
1066 | if (p-> mShowIconForward) | 1077 | if (p-> mShowIconForward) |
1067 | configureToolBarMenu->setItemChecked( 220, true ); | 1078 | configureToolBarMenu->setItemChecked( 220, true ); |
1068 | if (p-> mShowIconForwardFast) | 1079 | if (p-> mShowIconForwardFast) |
1069 | configureToolBarMenu->setItemChecked( 230, true ); | 1080 | configureToolBarMenu->setItemChecked( 230, true ); |
1070 | if (p-> mShowIconNextDays) | 1081 | if (p-> mShowIconNextDays) |
1071 | configureToolBarMenu->setItemChecked( 100, true ); | 1082 | configureToolBarMenu->setItemChecked( 100, true ); |
1072 | if (p-> mShowIconNext) | 1083 | if (p-> mShowIconNext) |
1073 | configureToolBarMenu->setItemChecked( 110, true ); | 1084 | configureToolBarMenu->setItemChecked( 110, true ); |
1074 | if (p-> mShowIconJournal) | 1085 | if (p-> mShowIconJournal) |
1075 | configureToolBarMenu->setItemChecked( 90, true ); | 1086 | configureToolBarMenu->setItemChecked( 90, true ); |
1076 | if (p-> mShowIconWhatsThis) | 1087 | if (p-> mShowIconWhatsThis) |
1077 | configureToolBarMenu->setItemChecked( 300, true ); | 1088 | configureToolBarMenu->setItemChecked( 300, true ); |
1078 | 1089 | ||
1079 | QLabel* dummy = new QLabel( iconToolBar ); | 1090 | QLabel* dummy = new QLabel( iconToolBar ); |
1080 | dummy->setBackgroundColor( iconToolBar->backgroundColor() ); | 1091 | dummy->setBackgroundColor( iconToolBar->backgroundColor() ); |
1081 | if (!p-> mShowIconStretch) | 1092 | if (!p-> mShowIconStretch) |
1082 | iconToolBar->setStretchableWidget ( dummy ) ; | 1093 | iconToolBar->setStretchableWidget ( dummy ) ; |
1083 | else | 1094 | else |
1084 | configureToolBarMenu->setItemChecked( 5, true ); | 1095 | configureToolBarMenu->setItemChecked( 5, true ); |
1085 | if (p-> mShowIconWhatsThis) | 1096 | if (p-> mShowIconWhatsThis) |
1086 | QWhatsThis::whatsThisButton ( iconToolBar ); | 1097 | QWhatsThis::whatsThisButton ( iconToolBar ); |
1087 | connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); | 1098 | connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); |
1088 | configureAgenda( p->mHourSize ); | 1099 | configureAgenda( p->mHourSize ); |
1089 | connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); | 1100 | connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); |
1090 | } | 1101 | } |
1091 | 1102 | ||
1092 | void MainWindow::exportToPhone( int mode ) | 1103 | void MainWindow::exportToPhone( int mode ) |
1093 | { | 1104 | { |
1094 | 1105 | ||
1095 | //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); | 1106 | //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); |
1096 | //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); | 1107 | //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); |
1097 | KOex2phonePrefs ex2phone; | 1108 | KOex2phonePrefs ex2phone; |
1098 | 1109 | ||
1099 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); | 1110 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); |
1100 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); | 1111 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); |
1101 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 1112 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
1102 | if ( mode == 1 ) | 1113 | if ( mode == 1 ) |
1103 | ex2phone.setCaption(i18n("Export complete calendar")); | 1114 | ex2phone.setCaption(i18n("Export complete calendar")); |
1104 | if ( mode == 2 ) | 1115 | if ( mode == 2 ) |
1105 | ex2phone.setCaption(i18n("Export filtered calendar")); | 1116 | ex2phone.setCaption(i18n("Export filtered calendar")); |
1106 | 1117 | ||
1107 | if ( !ex2phone.exec() ) { | 1118 | if ( !ex2phone.exec() ) { |
1108 | return; | 1119 | return; |
1109 | } | 1120 | } |
1110 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); | 1121 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); |
1111 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); | 1122 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); |
1112 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); | 1123 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); |
1113 | 1124 | ||
1114 | int inFuture = 0; | 1125 | int inFuture = 0; |
1115 | if ( ex2phone.mWriteBackFuture->isChecked() ) | 1126 | if ( ex2phone.mWriteBackFuture->isChecked() ) |
1116 | inFuture = ex2phone.mWriteBackFutureWeeks->value(); | 1127 | inFuture = ex2phone.mWriteBackFutureWeeks->value(); |
1117 | QPtrList<Incidence> delSel; | 1128 | QPtrList<Incidence> delSel; |
1118 | if ( mode == 1 ) | 1129 | if ( mode == 1 ) |
1119 | delSel = mCalendar->rawIncidences(); | 1130 | delSel = mCalendar->rawIncidences(); |
1120 | if ( mode == 2 ) | 1131 | if ( mode == 2 ) |
1121 | delSel = mCalendar->incidences(); | 1132 | delSel = mCalendar->incidences(); |
1122 | CalendarLocal* cal = new CalendarLocal(); | 1133 | CalendarLocal* cal = new CalendarLocal(); |
1123 | cal->setLocalTime(); | 1134 | cal->setLocalTime(); |
1124 | Incidence *incidence = delSel.first(); | 1135 | Incidence *incidence = delSel.first(); |
1125 | QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); | 1136 | QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); |
1126 | QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); | 1137 | QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); |
1127 | while ( incidence ) { | 1138 | while ( incidence ) { |
1128 | if ( incidence->type() != "Journal" ) { | 1139 | if ( incidence->type() != "Journal" ) { |
1129 | bool add = true; | 1140 | bool add = true; |
1130 | if ( inFuture ) { | 1141 | if ( inFuture ) { |
1131 | QDateTime dt; | 1142 | QDateTime dt; |
1132 | if ( incidence->type() == "Todo" ) { | 1143 | if ( incidence->type() == "Todo" ) { |
1133 | Todo * t = (Todo*)incidence; | 1144 | Todo * t = (Todo*)incidence; |
1134 | if ( t->hasDueDate() ) | 1145 | if ( t->hasDueDate() ) |
1135 | dt = t->dtDue(); | 1146 | dt = t->dtDue(); |
1136 | else | 1147 | else |
1137 | dt = cur.addSecs( 62 ); | 1148 | dt = cur.addSecs( 62 ); |
1138 | } | 1149 | } |
1139 | else { | 1150 | else { |
1140 | bool ok; | 1151 | bool ok; |
1141 | dt = incidence->getNextOccurence( cur, &ok ); | 1152 | dt = incidence->getNextOccurence( cur, &ok ); |
1142 | if ( !ok ) | 1153 | if ( !ok ) |
1143 | dt = cur.addSecs( -62 ); | 1154 | dt = cur.addSecs( -62 ); |
1144 | } | 1155 | } |
1145 | if ( dt < cur || dt > end ) { | 1156 | if ( dt < cur || dt > end ) { |
1146 | add = false; | 1157 | add = false; |
1147 | } | 1158 | } |
1148 | } | 1159 | } |
1149 | if ( add ) { | 1160 | if ( add ) { |
1150 | Incidence *in = incidence->clone(); | 1161 | Incidence *in = incidence->clone(); |
1151 | cal->addIncidence( in ); | 1162 | cal->addIncidence( in ); |
1152 | } | 1163 | } |
1153 | } | 1164 | } |
1154 | incidence = delSel.next(); | 1165 | incidence = delSel.next(); |
1155 | } | 1166 | } |
1156 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, | 1167 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, |
1157 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, | 1168 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, |
1158 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 1169 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
1159 | 1170 | ||
1160 | setCaption( i18n("Writing to phone...")); | 1171 | setCaption( i18n("Writing to phone...")); |
1161 | if ( PhoneFormat::writeToPhone( cal ) ) | 1172 | if ( PhoneFormat::writeToPhone( cal ) ) |
1162 | setCaption( i18n("Export to phone successful!")); | 1173 | setCaption( i18n("Export to phone successful!")); |
1163 | else | 1174 | else |
1164 | setCaption( i18n("Error exporting to phone!")); | 1175 | setCaption( i18n("Error exporting to phone!")); |
1165 | delete cal; | 1176 | delete cal; |
1166 | } | 1177 | } |
1167 | 1178 | ||
1168 | 1179 | ||
1169 | void MainWindow::setDefaultPreferences() | 1180 | void MainWindow::setDefaultPreferences() |
1170 | { | 1181 | { |
1171 | KOPrefs *p = KOPrefs::instance(); | 1182 | KOPrefs *p = KOPrefs::instance(); |
1172 | 1183 | ||
1173 | p->mCompactDialogs = true; | 1184 | p->mCompactDialogs = true; |
1174 | p->mConfirm = true; | 1185 | p->mConfirm = true; |
1175 | // p->mEnableQuickTodo = false; | 1186 | // p->mEnableQuickTodo = false; |
1176 | 1187 | ||
1177 | } | 1188 | } |
1178 | 1189 | ||
1179 | QString MainWindow::resourcePath() | 1190 | QString MainWindow::resourcePath() |
1180 | { | 1191 | { |
1181 | return KGlobal::iconLoader()->iconPath(); | 1192 | return KGlobal::iconLoader()->iconPath(); |
1182 | } | 1193 | } |
1183 | 1194 | ||
1184 | void MainWindow::displayText( QString text ,QString cap ) | 1195 | void MainWindow::displayText( QString text ,QString cap ) |
1185 | { | 1196 | { |
1186 | QDialog dia( this, "name", true ); ; | 1197 | QDialog dia( this, "name", true ); ; |
1187 | dia.setCaption( cap ); | 1198 | dia.setCaption( cap ); |
1188 | QVBoxLayout* lay = new QVBoxLayout( &dia ); | 1199 | QVBoxLayout* lay = new QVBoxLayout( &dia ); |
1189 | lay->setSpacing( 3 ); | 1200 | lay->setSpacing( 3 ); |
1190 | lay->setMargin( 3 ); | 1201 | lay->setMargin( 3 ); |
1191 | QTextBrowser tb ( &dia ); | 1202 | QTextBrowser tb ( &dia ); |
1192 | lay->addWidget( &tb ); | 1203 | lay->addWidget( &tb ); |
1193 | tb.setText( text ); | 1204 | tb.setText( text ); |
1194 | #ifdef DESKTOP_VERSION | 1205 | #ifdef DESKTOP_VERSION |
1195 | dia.resize( 640, 480); | 1206 | dia.resize( 640, 480); |
1196 | #else | 1207 | #else |
1197 | dia.showMaximized(); | 1208 | dia.showMaximized(); |
1198 | #endif | 1209 | #endif |
1199 | dia.exec(); | 1210 | dia.exec(); |
1200 | } | 1211 | } |
1201 | 1212 | ||
1202 | void MainWindow::features() | 1213 | void MainWindow::features() |
1203 | { | 1214 | { |
1204 | 1215 | ||
1205 | KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" ); | 1216 | KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" ); |
1206 | } | 1217 | } |
1207 | 1218 | ||
1208 | void MainWindow::usertrans() | 1219 | void MainWindow::usertrans() |
1209 | { | 1220 | { |
1210 | 1221 | ||
1211 | KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" ); | 1222 | KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" ); |
1212 | } | 1223 | } |
1213 | 1224 | ||
1214 | void MainWindow::kdesynchowto() | 1225 | void MainWindow::kdesynchowto() |
1215 | { | 1226 | { |
1216 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); | 1227 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); |
1217 | } | 1228 | } |
1218 | void MainWindow::multisynchowto() | 1229 | void MainWindow::multisynchowto() |
1219 | { | 1230 | { |
1220 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); | 1231 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); |
1221 | } | 1232 | } |
1222 | void MainWindow::synchowto() | 1233 | void MainWindow::synchowto() |
1223 | { | 1234 | { |
1224 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); | 1235 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); |
1225 | } | 1236 | } |
1226 | void MainWindow::faq() | 1237 | void MainWindow::faq() |
1227 | { | 1238 | { |
1228 | KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" ); | 1239 | KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" ); |
1229 | 1240 | ||
1230 | } | 1241 | } |
1231 | void MainWindow::whatsNew() | 1242 | void MainWindow::whatsNew() |
1232 | { | 1243 | { |
1233 | KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); | 1244 | KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); |
1234 | 1245 | ||
1235 | } | 1246 | } |
1236 | void MainWindow::licence() | 1247 | void MainWindow::licence() |
1237 | { | 1248 | { |
1238 | KApplication::showLicence(); | 1249 | KApplication::showLicence(); |
1239 | 1250 | ||
1240 | } | 1251 | } |
1241 | void MainWindow::about() | 1252 | void MainWindow::about() |
1242 | { | 1253 | { |
1243 | QString version; | 1254 | QString version; |
1244 | #include <../version> | 1255 | #include <../version> |
1245 | QMessageBox::about( this, i18n("About KOrganizer/Pi"), | 1256 | QMessageBox::about( this, i18n("About KOrganizer/Pi"), |
1246 | i18n("KOrganizer/Platform-independent\n") + | 1257 | i18n("KOrganizer/Platform-independent\n") + |
1247 | "(KO/Pi) " + version + " - " + | 1258 | "(KO/Pi) " + version + " - " + |
1248 | 1259 | ||
1249 | #ifdef DESKTOP_VERSION | 1260 | #ifdef DESKTOP_VERSION |
1250 | i18n("Desktop Edition\n") + | 1261 | i18n("Desktop Edition\n") + |
1251 | #else | 1262 | #else |
1252 | i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") + | 1263 | i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") + |
1253 | #endif | 1264 | #endif |
1254 | i18n("(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi is based on KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) and the KDE team.\nKOrganizer/Pi is licensed under the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.pi-sync.net --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!") ); | 1265 | i18n("(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi is based on KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) and the KDE team.\nKOrganizer/Pi is licensed under the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.pi-sync.net --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!") ); |
1255 | } | 1266 | } |
1256 | void MainWindow::keyBindings() | 1267 | void MainWindow::keyBindings() |
1257 | { | 1268 | { |
1258 | QString cap = i18n("KO/Pi Keys + Colors"); | 1269 | QString cap = i18n("KO/Pi Keys + Colors"); |
1259 | QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + | 1270 | QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + |
1260 | i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ | 1271 | i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ |
1261 | i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + | 1272 | i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + |
1262 | i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ | 1273 | i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ |
1263 | i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ | 1274 | i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ |
1264 | i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ | 1275 | i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ |
1265 | i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ | 1276 | i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ |
1266 | i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+ | 1277 | i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+ |
1267 | i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ | 1278 | i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ |
1268 | i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ | 1279 | i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ |
1269 | i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ | 1280 | i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ |
1270 | i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ | 1281 | i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ |
1271 | i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ | 1282 | i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ |
1272 | i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+ | 1283 | i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+ |
1273 | i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ | 1284 | i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ |
1274 | i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ | 1285 | i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ |
1275 | i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ | 1286 | i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ |
1276 | i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ | 1287 | i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ |
1277 | i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ | 1288 | i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ |
1278 | i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ | 1289 | i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ |
1279 | i18n("<p><h3>In agenda view:</h3></p>\n") + | 1290 | i18n("<p><h3>In agenda view:</h3></p>\n") + |
1280 | i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ | 1291 | i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ |
1281 | i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ | 1292 | i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ |
1282 | i18n("<p><h3>In todo view:</h3></p>\n") + | 1293 | i18n("<p><h3>In todo view:</h3></p>\n") + |
1283 | i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ | 1294 | i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ |
1284 | i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ | 1295 | i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ |
1285 | i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ | 1296 | i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ |
1286 | i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ | 1297 | i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ |
1287 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ | 1298 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ |
1288 | i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ | 1299 | i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ |
1289 | i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ | 1300 | i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ |
1290 | i18n("<p><h3>In list view:</h3></p>\n") + | 1301 | i18n("<p><h3>In list view:</h3></p>\n") + |
1291 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ | 1302 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ |
1292 | i18n("<p><b>return</b>: Select item+one step down</p>\n")+ | 1303 | i18n("<p><b>return</b>: Select item+one step down</p>\n")+ |
1293 | i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ | 1304 | i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ |
1294 | i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ | 1305 | i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ |
1295 | i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ | 1306 | i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ |
1296 | i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ | 1307 | i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ |
1297 | i18n("<p><h3>In event/todo viewer:</h3></p>\n") + | 1308 | i18n("<p><h3>In event/todo viewer:</h3></p>\n") + |
1298 | i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ | 1309 | i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ |
1299 | i18n("<p><b>A</b>: Show agenda view.</p>\n")+ | 1310 | i18n("<p><b>A</b>: Show agenda view.</p>\n")+ |
1300 | i18n("<p><b>E</b>: Edit item</p>\n") + | 1311 | i18n("<p><b>E</b>: Edit item</p>\n") + |
1301 | i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + | 1312 | i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + |
1302 | i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + | 1313 | i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + |
1303 | i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ | 1314 | i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ |
1304 | i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ | 1315 | i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ |
1305 | i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ | 1316 | i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ |
1306 | i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ | 1317 | i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ |
1307 | i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ | 1318 | i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ |
1308 | i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + | 1319 | i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + |
1309 | i18n("<p><b>White</b>: Item readonly</p>\n"); | 1320 | i18n("<p><b>White</b>: Item readonly</p>\n"); |
1310 | displayText( text, cap); | 1321 | displayText( text, cap); |
1311 | } | 1322 | } |
1312 | void MainWindow::aboutAutoSaving() | 1323 | void MainWindow::aboutAutoSaving() |
1313 | { | 1324 | { |
1314 | QString text = i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configurable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"); | 1325 | QString text = i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configurable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"); |
1315 | 1326 | ||
1316 | KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); | 1327 | KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); |
1317 | 1328 | ||
1318 | } | 1329 | } |
1319 | void MainWindow::aboutKnownBugs() | 1330 | void MainWindow::aboutKnownBugs() |
1320 | { | 1331 | { |
1321 | QMessageBox* msg; | 1332 | QMessageBox* msg; |
1322 | msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), | 1333 | msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), |
1323 | i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ | 1334 | i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ |
1324 | i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ | 1335 | i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ |
1325 | i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") + | 1336 | i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") + |
1326 | i18n("\nor report them in the bugtracker on\n") + | 1337 | i18n("\nor report them in the bugtracker on\n") + |
1327 | i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), | 1338 | i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), |
1328 | QMessageBox::NoIcon, | 1339 | QMessageBox::NoIcon, |
1329 | QMessageBox::Ok, | 1340 | QMessageBox::Ok, |
1330 | QMessageBox::NoButton, | 1341 | QMessageBox::NoButton, |
1331 | QMessageBox::NoButton); | 1342 | QMessageBox::NoButton); |
1332 | msg->exec(); | 1343 | msg->exec(); |
1333 | delete msg; | 1344 | delete msg; |
1334 | 1345 | ||
1335 | } | 1346 | } |
1336 | 1347 | ||
1337 | QString MainWindow::defaultFileName() | 1348 | QString MainWindow::defaultFileName() |
1338 | { | 1349 | { |
1339 | return locateLocal( "data", "korganizer/mycalendar.ics" ); | 1350 | return locateLocal( "data", "korganizer/mycalendar.ics" ); |
1340 | } | 1351 | } |
1341 | QString MainWindow::syncFileName() | 1352 | QString MainWindow::syncFileName() |
1342 | { | 1353 | { |
1343 | #ifdef DESKTOP_VERSION | 1354 | #ifdef DESKTOP_VERSION |
1344 | return locateLocal( "tmp", "synccalendar.ics" ); | 1355 | return locateLocal( "tmp", "synccalendar.ics" ); |
1345 | #else | 1356 | #else |
1346 | return QString( "/tmp/synccalendar.ics" ); | 1357 | return QString( "/tmp/synccalendar.ics" ); |
1347 | #endif | 1358 | #endif |
1348 | } | 1359 | } |
1349 | void MainWindow::updateWeek(QDate seda) | 1360 | void MainWindow::updateWeek(QDate seda) |
1350 | { | 1361 | { |
1351 | int weekNum = 0; | 1362 | int weekNum = 0; |
1352 | QDate d = QDate ( seda.year(), 1,1); | 1363 | QDate d = QDate ( seda.year(), 1,1); |
1353 | seda = seda.addDays( 1-seda.dayOfWeek() );//we are on monday | 1364 | seda = seda.addDays( 1-seda.dayOfWeek() );//we are on monday |
1354 | if ( seda.addDays(6).year() != seda.year() ) { | 1365 | if ( seda.addDays(6).year() != seda.year() ) { |
1355 | if ( seda.year() != d.year() ) { | 1366 | if ( seda.year() != d.year() ) { |
1356 | if ( d.dayOfWeek() > 4 ) | 1367 | if ( d.dayOfWeek() > 4 ) |
1357 | d = QDate ( seda.year(), 1,1); | 1368 | d = QDate ( seda.year(), 1,1); |
1358 | else | 1369 | else |
1359 | weekNum = 1; | 1370 | weekNum = 1; |
1360 | } else { | 1371 | } else { |
1361 | QDate dd( seda.year()+1, 1,1); | 1372 | QDate dd( seda.year()+1, 1,1); |
1362 | if ( dd.dayOfWeek() <= 4 ) | 1373 | if ( dd.dayOfWeek() <= 4 ) |
1363 | weekNum = 1; | 1374 | weekNum = 1; |
1364 | } | 1375 | } |
1365 | } | 1376 | } |
1366 | if ( weekNum == 0 ){ | 1377 | if ( weekNum == 0 ){ |
1367 | int dow = d.dayOfWeek(); | 1378 | int dow = d.dayOfWeek(); |
1368 | if ( dow <= 4 ) | 1379 | if ( dow <= 4 ) |
1369 | d = d.addDays( 1-dow ); | 1380 | d = d.addDays( 1-dow ); |
1370 | else // 5,6,7 | 1381 | else // 5,6,7 |
1371 | d = d.addDays( 8-dow ); | 1382 | d = d.addDays( 8-dow ); |
1372 | // we have the first week of the year.we are on monday | 1383 | // we have the first week of the year.we are on monday |
1373 | weekNum = d.daysTo( seda ) / 7 +1; | 1384 | weekNum = d.daysTo( seda ) / 7 +1; |
1374 | } | 1385 | } |
1375 | 1386 | ||
1376 | mWeekPixmap.fill( mWeekBgColor ); | 1387 | mWeekPixmap.fill( mWeekBgColor ); |
1377 | QPainter p ( &mWeekPixmap ); | 1388 | QPainter p ( &mWeekPixmap ); |
1378 | p.setFont( mWeekFont ); | 1389 | p.setFont( mWeekFont ); |
1379 | p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); | 1390 | p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); |
1380 | p.end(); | 1391 | p.end(); |
1381 | QIconSet icon3 ( mWeekPixmap ); | 1392 | QIconSet icon3 ( mWeekPixmap ); |
1382 | mWeekAction->setIconSet ( icon3 ); | 1393 | mWeekAction->setIconSet ( icon3 ); |
1383 | 1394 | ||
1384 | } | 1395 | } |
1385 | void MainWindow::updateWeekNum(const DateList &selectedDates) | 1396 | void MainWindow::updateWeekNum(const DateList &selectedDates) |
1386 | { | 1397 | { |
1387 | updateWeek( selectedDates.first() ); | 1398 | updateWeek( selectedDates.first() ); |
1388 | } | 1399 | } |
1389 | void MainWindow::processIncidenceSelection( Incidence *incidence ) | 1400 | void MainWindow::processIncidenceSelection( Incidence *incidence ) |
1390 | { | 1401 | { |
1391 | 1402 | ||
1392 | if ( !incidence ) { | 1403 | if ( !incidence ) { |
1393 | enableIncidenceActions( false ); | 1404 | enableIncidenceActions( false ); |
1394 | 1405 | ||
1395 | mNewSubTodoAction->setEnabled( false ); | 1406 | mNewSubTodoAction->setEnabled( false ); |
1396 | setCaptionToDates(); | 1407 | setCaptionToDates(); |
1397 | return; | 1408 | return; |
1398 | 1409 | ||
1399 | } | 1410 | } |
1400 | 1411 | ||
1401 | //KGlobal::locale()->formatDateTime(nextA, true); | 1412 | //KGlobal::locale()->formatDateTime(nextA, true); |
1402 | QString startString = ""; | 1413 | QString startString = ""; |
1403 | if ( incidence->type() != "Todo" ) { | 1414 | if ( incidence->type() != "Todo" ) { |
1404 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { | 1415 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { |
1405 | if ( incidence->doesFloat() ) { | 1416 | if ( incidence->doesFloat() ) { |
1406 | startString += ": "+incidence->dtStartDateStr( true ); | 1417 | startString += ": "+incidence->dtStartDateStr( true ); |
1407 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); | 1418 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); |
1408 | 1419 | ||
1409 | } else { | 1420 | } else { |
1410 | startString = ": "+incidence->dtStartStr(true); | 1421 | startString = ": "+incidence->dtStartStr(true); |
1411 | startString += " --- "+((Event*)incidence)->dtEndStr(true); | 1422 | startString += " --- "+((Event*)incidence)->dtEndStr(true); |
1412 | 1423 | ||
1413 | } | 1424 | } |
1414 | 1425 | ||
1415 | } else { | 1426 | } else { |
1416 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) | 1427 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) |
1417 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ | 1428 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ |
1418 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); | 1429 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); |
1419 | if ( incidence->categories().contains( i18n("Birthday") ) || incidence->categories().contains( i18n("Anniversary") ) ) { | 1430 | if ( incidence->categories().contains( i18n("Birthday") ) || incidence->categories().contains( i18n("Anniversary") ) ) { |
1420 | bool ok; | 1431 | bool ok; |
1421 | QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); | 1432 | QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); |
1422 | if ( ok ) { | 1433 | if ( ok ) { |
1423 | int years = noc.date().year() - incidence->dtStart().date().year(); | 1434 | int years = noc.date().year() - incidence->dtStart().date().year(); |
1424 | startString += i18n(" (%1 y.)"). arg( years ); | 1435 | startString += i18n(" (%1 y.)"). arg( years ); |
1425 | } | 1436 | } |
1426 | } | 1437 | } |
1427 | else | 1438 | else |
1428 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); | 1439 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); |
1429 | } | 1440 | } |
1430 | 1441 | ||
1431 | } | 1442 | } |
1432 | else | 1443 | else |
1433 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); | 1444 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); |
1434 | if ( !incidence->location().isEmpty() ) | 1445 | if ( !incidence->location().isEmpty() ) |
1435 | startString += " (" +incidence->location()+")"; | 1446 | startString += " (" +incidence->location()+")"; |
1436 | setCaption( incidence->summary()+startString); | 1447 | setCaption( incidence->summary()+startString); |
1437 | 1448 | ||
1438 | enableIncidenceActions( true ); | 1449 | enableIncidenceActions( true ); |
1439 | 1450 | ||
1440 | if ( incidence->type() == "Event" ) { | 1451 | if ( incidence->type() == "Event" ) { |
1441 | mShowAction->setText( i18n("Show Event...") ); | 1452 | mShowAction->setText( i18n("Show Event...") ); |
1442 | mEditAction->setText( i18n("Edit Event...") ); | 1453 | mEditAction->setText( i18n("Edit Event...") ); |
1443 | mDeleteAction->setText( i18n("Delete Event...") ); | 1454 | mDeleteAction->setText( i18n("Delete Event...") ); |
1444 | 1455 | ||
1445 | mNewSubTodoAction->setEnabled( false ); | 1456 | mNewSubTodoAction->setEnabled( false ); |
1446 | } else if ( incidence->type() == "Todo" ) { | 1457 | } else if ( incidence->type() == "Todo" ) { |
1447 | mShowAction->setText( i18n("Show Todo...") ); | 1458 | mShowAction->setText( i18n("Show Todo...") ); |
1448 | mEditAction->setText( i18n("Edit Todo...") ); | 1459 | mEditAction->setText( i18n("Edit Todo...") ); |
1449 | mDeleteAction->setText( i18n("Delete Todo...") ); | 1460 | mDeleteAction->setText( i18n("Delete Todo...") ); |
1450 | 1461 | ||
1451 | mNewSubTodoAction->setEnabled( true ); | 1462 | mNewSubTodoAction->setEnabled( true ); |
1452 | } else { | 1463 | } else { |
1453 | mShowAction->setText( i18n("Show...") ); | 1464 | mShowAction->setText( i18n("Show...") ); |
1454 | mShowAction->setText( i18n("Edit...") ); | 1465 | mShowAction->setText( i18n("Edit...") ); |
1455 | mShowAction->setText( i18n("Delete...") ); | 1466 | mShowAction->setText( i18n("Delete...") ); |
1456 | 1467 | ||
1457 | mNewSubTodoAction->setEnabled( false ); | 1468 | mNewSubTodoAction->setEnabled( false ); |
1458 | } | 1469 | } |
1459 | } | 1470 | } |
1460 | 1471 | ||
1461 | void MainWindow::enableIncidenceActions( bool enabled ) | 1472 | void MainWindow::enableIncidenceActions( bool enabled ) |
1462 | { | 1473 | { |
1463 | mShowAction->setEnabled( enabled ); | 1474 | mShowAction->setEnabled( enabled ); |
1464 | mEditAction->setEnabled( enabled ); | 1475 | mEditAction->setEnabled( enabled ); |
1465 | mDeleteAction->setEnabled( enabled ); | 1476 | mDeleteAction->setEnabled( enabled ); |
1466 | 1477 | ||
1467 | mCloneAction->setEnabled( enabled ); | 1478 | mCloneAction->setEnabled( enabled ); |
1468 | mMoveAction->setEnabled( enabled ); | 1479 | mMoveAction->setEnabled( enabled ); |
1469 | mBeamAction->setEnabled( enabled ); | 1480 | mBeamAction->setEnabled( enabled ); |
1470 | mCancelAction->setEnabled( enabled ); | 1481 | mCancelAction->setEnabled( enabled ); |
1471 | } | 1482 | } |
1472 | 1483 | ||
1473 | void MainWindow::importOL() | 1484 | void MainWindow::importOL() |
1474 | { | 1485 | { |
1475 | #ifdef _OL_IMPORT_ | 1486 | #ifdef _OL_IMPORT_ |
1476 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); | 1487 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); |
1477 | id->exec(); | 1488 | id->exec(); |
1478 | delete id; | 1489 | delete id; |
1479 | mView->updateView(); | 1490 | mView->updateView(); |
1480 | #endif | 1491 | #endif |
1481 | } | 1492 | } |
1482 | void MainWindow::importBday() | 1493 | void MainWindow::importBday() |
1483 | { | 1494 | { |
1484 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1495 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1485 | i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), | 1496 | i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), |
1486 | i18n("Import!"), i18n("Cancel"), 0, | 1497 | i18n("Import!"), i18n("Cancel"), 0, |
1487 | 0, 1 ); | 1498 | 0, 1 ); |
1488 | if ( result == 0 ) { | 1499 | if ( result == 0 ) { |
1489 | mView->importBday(); | 1500 | mView->importBday(); |
1490 | 1501 | ||
1491 | } | 1502 | } |
1492 | 1503 | ||
1493 | 1504 | ||
1494 | } | 1505 | } |
1495 | void MainWindow::importQtopia() | 1506 | void MainWindow::importQtopia() |
1496 | { | 1507 | { |
1497 | #ifndef DESKTOP_VERSION | 1508 | #ifndef DESKTOP_VERSION |
1498 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1509 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1499 | i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"), | 1510 | i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"), |
1500 | i18n("Import!"), i18n("Cancel"), 0, | 1511 | i18n("Import!"), i18n("Cancel"), 0, |
1501 | 0, 1 ); | 1512 | 0, 1 ); |
1502 | if ( result == 0 ) { | 1513 | if ( result == 0 ) { |
1503 | QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); | 1514 | QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); |
1504 | QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); | 1515 | QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); |
1505 | QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; | 1516 | QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; |
1506 | mView->importQtopia( categories, datebook, todolist ); | 1517 | mView->importQtopia( categories, datebook, todolist ); |
1507 | } | 1518 | } |
1508 | #else | 1519 | #else |
1509 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1520 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1510 | i18n("Not supported \non desktop!\n"), | 1521 | i18n("Not supported \non desktop!\n"), |
1511 | i18n("Ok"), i18n("Cancel"), 0, | 1522 | i18n("Ok"), i18n("Cancel"), 0, |
1512 | 0, 1 ); | 1523 | 0, 1 ); |
1513 | 1524 | ||
1514 | #endif | 1525 | #endif |
1515 | } | 1526 | } |
1516 | 1527 | ||
1517 | void MainWindow::saveOnClose() | 1528 | void MainWindow::saveOnClose() |
1518 | { | 1529 | { |
1519 | KOPrefs *p = KOPrefs::instance(); | 1530 | KOPrefs *p = KOPrefs::instance(); |
1520 | p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); | 1531 | p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); |
1521 | p->mToolBarUp = iconToolBar->x() > width()/2 || | 1532 | p->mToolBarUp = iconToolBar->x() > width()/2 || |
1522 | iconToolBar->y() > height()/2; | 1533 | iconToolBar->y() > height()/2; |
1523 | mView->writeSettings(); | 1534 | mView->writeSettings(); |
1524 | if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) | 1535 | if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) |
1525 | save(); | 1536 | save(); |
1526 | } | 1537 | } |
1527 | void MainWindow::slotModifiedChanged( bool changed ) | 1538 | void MainWindow::slotModifiedChanged( bool changed ) |
1528 | { | 1539 | { |
1529 | if ( mBlockAtStartup ) | 1540 | if ( mBlockAtStartup ) |
1530 | return; | 1541 | return; |
1531 | 1542 | ||
1532 | int msec; | 1543 | int msec; |
1533 | // we store the changes after 1 minute, | 1544 | // we store the changes after 1 minute, |
1534 | // and for safety reasons after 10 minutes again | 1545 | // and for safety reasons after 10 minutes again |
1535 | if ( !mSyncManager->blockSave() ) | 1546 | if ( !mSyncManager->blockSave() ) |
1536 | msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; | 1547 | msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; |
1537 | else | 1548 | else |
1538 | msec = 1000 * 600; | 1549 | msec = 1000 * 600; |
1539 | mSaveTimer.start( msec, true ); // 1 minute | 1550 | mSaveTimer.start( msec, true ); // 1 minute |
1540 | qDebug("KO: Saving File in %d secs!", msec/1000); | 1551 | qDebug("KO: Saving File in %d secs!", msec/1000); |
1541 | mCalendarModifiedFlag = true; | 1552 | mCalendarModifiedFlag = true; |
1542 | } | 1553 | } |
1543 | void MainWindow::saveStopTimer() | 1554 | void MainWindow::saveStopTimer() |
1544 | { | 1555 | { |
1545 | mSaveTimer.stop(); | 1556 | mSaveTimer.stop(); |
1546 | if (mSaveTimer.isActive() ) | 1557 | if (mSaveTimer.isActive() ) |
1547 | qDebug("ti active "); | 1558 | qDebug("ti active "); |
1548 | else | 1559 | else |
1549 | qDebug("KO: Save timer stopped"); | 1560 | qDebug("KO: Save timer stopped"); |
1550 | } | 1561 | } |
1551 | void MainWindow::save() | 1562 | void MainWindow::save() |
1552 | { | 1563 | { |
1553 | if ( !mCalendarModifiedFlag ) { | 1564 | if ( !mCalendarModifiedFlag ) { |
1554 | qDebug("KO: Calendar not modified. Nothing saved."); | 1565 | qDebug("KO: Calendar not modified. Nothing saved."); |
1555 | return; | 1566 | return; |
1556 | } | 1567 | } |
1557 | if ( mSyncManager->blockSave() ) | 1568 | if ( mSyncManager->blockSave() ) |
1558 | return; | 1569 | return; |
1559 | mSyncManager->setBlockSave(true); | 1570 | mSyncManager->setBlockSave(true); |
1560 | if ( mView->checkFileVersion( defaultFileName()) ) { | 1571 | if ( mView->checkFileVersion( defaultFileName()) ) { |
1561 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 1572 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
1562 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); | 1573 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); |
1563 | qDebug("KO: Start saving data to file!"); | 1574 | qDebug("KO: Start saving data to file!"); |
1564 | mView->saveCalendar( defaultFileName() ); | 1575 | mView->saveCalendar( defaultFileName() ); |
1565 | mCalendarModifiedFlag = false; | 1576 | mCalendarModifiedFlag = false; |
1566 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 1577 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
1567 | qDebug("KO: Needed %d ms for saving.",msNeeded ); | 1578 | qDebug("KO: Needed %d ms for saving.",msNeeded ); |
1568 | QString savemes; | 1579 | QString savemes; |
1569 | savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); | 1580 | savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); |
1570 | setCaption(savemes); | 1581 | setCaption(savemes); |
1571 | } else | 1582 | } else |
1572 | setCaption(i18n("Saving cancelled!")); | 1583 | setCaption(i18n("Saving cancelled!")); |
1573 | mSyncManager->setBlockSave( false ); | 1584 | mSyncManager->setBlockSave( false ); |
1574 | } | 1585 | } |
1575 | 1586 | ||
1576 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) | 1587 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) |
1577 | { | 1588 | { |
1578 | if ( !e->isAutoRepeat() ) { | 1589 | if ( !e->isAutoRepeat() ) { |
1579 | mFlagKeyPressed = false; | 1590 | mFlagKeyPressed = false; |
1580 | } | 1591 | } |
1581 | } | 1592 | } |
1582 | void MainWindow::keyPressEvent ( QKeyEvent * e ) | 1593 | void MainWindow::keyPressEvent ( QKeyEvent * e ) |
1583 | { | 1594 | { |
1584 | qApp->processEvents(); | 1595 | qApp->processEvents(); |
1585 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { | 1596 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { |
1586 | e->ignore(); | 1597 | e->ignore(); |
1587 | // qDebug(" ignore %d",e->isAutoRepeat() ); | 1598 | // qDebug(" ignore %d",e->isAutoRepeat() ); |
1588 | return; | 1599 | return; |
1589 | } | 1600 | } |
1590 | if (! e->isAutoRepeat() ) | 1601 | if (! e->isAutoRepeat() ) |
1591 | mFlagKeyPressed = true; | 1602 | mFlagKeyPressed = true; |
1592 | KOPrefs *p = KOPrefs::instance(); | 1603 | KOPrefs *p = KOPrefs::instance(); |
1593 | bool showSelectedDates = false; | 1604 | bool showSelectedDates = false; |
1594 | int size; | 1605 | int size; |
1595 | int pro = 0; | 1606 | int pro = 0; |
1596 | //qDebug("MainWindow::keyPressEvent "); | 1607 | //qDebug("MainWindow::keyPressEvent "); |
1597 | switch ( e->key() ) { | 1608 | switch ( e->key() ) { |
1598 | case Qt::Key_Right: | 1609 | case Qt::Key_Right: |
1599 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) | 1610 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) |
1600 | mView->goNextMonth(); | 1611 | mView->goNextMonth(); |
1601 | else | 1612 | else |
1602 | mView->goNext(); | 1613 | mView->goNext(); |
1603 | showSelectedDates = true; | 1614 | showSelectedDates = true; |
1604 | break; | 1615 | break; |
1605 | case Qt::Key_Left: | 1616 | case Qt::Key_Left: |
1606 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1617 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1607 | mView->goPreviousMonth(); | 1618 | mView->goPreviousMonth(); |
1608 | else | 1619 | else |
1609 | mView->goPrevious(); | 1620 | mView->goPrevious(); |
1610 | showSelectedDates = true; | 1621 | showSelectedDates = true; |
1611 | break; | 1622 | break; |
1612 | case Qt::Key_Down: | 1623 | case Qt::Key_Down: |
1613 | mView->viewManager()->agendaView()->scrollOneHourDown(); | 1624 | mView->viewManager()->agendaView()->scrollOneHourDown(); |
1614 | break; | 1625 | break; |
1615 | case Qt::Key_Up: | 1626 | case Qt::Key_Up: |
1616 | mView->viewManager()->agendaView()->scrollOneHourUp(); | 1627 | mView->viewManager()->agendaView()->scrollOneHourUp(); |
1617 | break; | 1628 | break; |
1618 | case Qt::Key_I: | 1629 | case Qt::Key_I: |
1619 | mView->showIncidence(); | 1630 | mView->showIncidence(); |
1620 | break; | 1631 | break; |
1621 | case Qt::Key_Delete: | 1632 | case Qt::Key_Delete: |
1622 | case Qt::Key_Backspace: | 1633 | case Qt::Key_Backspace: |
1623 | mView->deleteIncidence(); | 1634 | mView->deleteIncidence(); |
1624 | break; | 1635 | break; |
1625 | case Qt::Key_D: | 1636 | case Qt::Key_D: |
1626 | mView->viewManager()->showDayView(); | 1637 | mView->viewManager()->showDayView(); |
1627 | showSelectedDates = true; | 1638 | showSelectedDates = true; |
1628 | break; | 1639 | break; |
1629 | case Qt::Key_O: | 1640 | case Qt::Key_O: |
1630 | mView->toggleFilerEnabled( ); | 1641 | mView->toggleFilerEnabled( ); |
1631 | break; | 1642 | break; |
1632 | case Qt::Key_0: | 1643 | case Qt::Key_0: |
1633 | case Qt::Key_1: | 1644 | case Qt::Key_1: |
1634 | case Qt::Key_2: | 1645 | case Qt::Key_2: |
1635 | case Qt::Key_3: | 1646 | case Qt::Key_3: |
1636 | case Qt::Key_4: | 1647 | case Qt::Key_4: |
1637 | case Qt::Key_5: | 1648 | case Qt::Key_5: |
1638 | case Qt::Key_6: | 1649 | case Qt::Key_6: |
1639 | case Qt::Key_7: | 1650 | case Qt::Key_7: |
1640 | case Qt::Key_8: | 1651 | case Qt::Key_8: |
1641 | case Qt::Key_9: | 1652 | case Qt::Key_9: |
1642 | pro = e->key()-48; | 1653 | pro = e->key()-48; |
1643 | if ( pro == 0 ) | 1654 | if ( pro == 0 ) |
1644 | pro = 10; | 1655 | pro = 10; |
1645 | if ( e->state() == Qt::ControlButton) | 1656 | if ( e->state() == Qt::ControlButton) |
1646 | pro += 10; | 1657 | pro += 10; |
1647 | break; | 1658 | break; |
1648 | case Qt::Key_M: | 1659 | case Qt::Key_M: |
1649 | mView->viewManager()->showMonthView(); | 1660 | mView->viewManager()->showMonthView(); |
1650 | showSelectedDates = true; | 1661 | showSelectedDates = true; |
1651 | break; | 1662 | break; |
1652 | case Qt::Key_Insert: | 1663 | case Qt::Key_Insert: |
1653 | mView->newEvent(); | 1664 | mView->newEvent(); |
1654 | break; | 1665 | break; |
1655 | case Qt::Key_S : | 1666 | case Qt::Key_S : |
1656 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) | 1667 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) |
1657 | mView->newSubTodo(); | 1668 | mView->newSubTodo(); |
1658 | else | 1669 | else |
1659 | mView->dialogManager()->showSearchDialog(); | 1670 | mView->dialogManager()->showSearchDialog(); |
1660 | break; | 1671 | break; |
1661 | case Qt::Key_Y : | 1672 | case Qt::Key_Y : |
1662 | case Qt::Key_Z : | 1673 | case Qt::Key_Z : |
1663 | mView->viewManager()->showWorkWeekView(); | 1674 | mView->viewManager()->showWorkWeekView(); |
1664 | showSelectedDates = true; | 1675 | showSelectedDates = true; |
1665 | break; | 1676 | break; |
1666 | case Qt::Key_U : | 1677 | case Qt::Key_U : |
1667 | mView->viewManager()->showWeekView(); | 1678 | mView->viewManager()->showWeekView(); |
1668 | showSelectedDates = true; | 1679 | showSelectedDates = true; |
1669 | break; | 1680 | break; |
1670 | case Qt::Key_H : | 1681 | case Qt::Key_H : |
1671 | keyBindings(); | 1682 | keyBindings(); |
1672 | break; | 1683 | break; |
1673 | case Qt::Key_W: | 1684 | case Qt::Key_W: |
1674 | mView->viewManager()->showWhatsNextView(); | 1685 | mView->viewManager()->showWhatsNextView(); |
1675 | break; | 1686 | break; |
1676 | case Qt::Key_L: | 1687 | case Qt::Key_L: |
1677 | mView->viewManager()->showListView(); | 1688 | mView->viewManager()->showListView(); |
1678 | break; | 1689 | break; |
1679 | case Qt::Key_N: | 1690 | case Qt::Key_N: |
1680 | mView->viewManager()->showNextXView(); | 1691 | mView->viewManager()->showNextXView(); |
1681 | showSelectedDates = true; | 1692 | showSelectedDates = true; |
1682 | break; | 1693 | break; |
1683 | case Qt::Key_V: | 1694 | case Qt::Key_V: |
1684 | mView->viewManager()->showTodoView(); | 1695 | mView->viewManager()->showTodoView(); |
1685 | break; | 1696 | break; |
1686 | case Qt::Key_C: | 1697 | case Qt::Key_C: |
1687 | mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); | 1698 | mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); |
1688 | break; | 1699 | break; |
1689 | case Qt::Key_P: | 1700 | case Qt::Key_P: |
1690 | mView->showDatePicker( ); | 1701 | mView->showDatePicker( ); |
1691 | break; | 1702 | break; |
1692 | case Qt::Key_F: | 1703 | case Qt::Key_F: |
1693 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1704 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1694 | mView->editFilters(); | 1705 | mView->editFilters(); |
1695 | else | 1706 | else |
1696 | mView->toggleFilter(); | 1707 | mView->toggleFilter(); |
1697 | break; | 1708 | break; |
1698 | case Qt::Key_X: | 1709 | case Qt::Key_X: |
1699 | mView->toggleDateNavigatorWidget(); | 1710 | mView->toggleDateNavigatorWidget(); |
1700 | break; | 1711 | break; |
1701 | case Qt::Key_Space: | 1712 | case Qt::Key_Space: |
1702 | mView->toggleExpand(); | 1713 | mView->toggleExpand(); |
1703 | break; | 1714 | break; |
1704 | case Qt::Key_A: | 1715 | case Qt::Key_A: |
1705 | mView->toggleAllDaySize(); | 1716 | mView->toggleAllDaySize(); |
1706 | break; | 1717 | break; |
1707 | case Qt::Key_T: | 1718 | case Qt::Key_T: |
1708 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1719 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1709 | mView->newTodo(); | 1720 | mView->newTodo(); |
1710 | else { | 1721 | else { |
1711 | mView->goToday(); | 1722 | mView->goToday(); |
1712 | showSelectedDates = true; | 1723 | showSelectedDates = true; |
1713 | } | 1724 | } |
1714 | break; | 1725 | break; |
1715 | case Qt::Key_J: | 1726 | case Qt::Key_J: |
1716 | mView->viewManager()->showJournalView(); | 1727 | mView->viewManager()->showJournalView(); |
1717 | break; | 1728 | break; |
1718 | case Qt::Key_B: | 1729 | case Qt::Key_B: |
1719 | mView->editIncidenceDescription();; | 1730 | mView->editIncidenceDescription();; |
1720 | break; | 1731 | break; |
1721 | // case Qt::Key_Return: | 1732 | // case Qt::Key_Return: |
1722 | case Qt::Key_E: | 1733 | case Qt::Key_E: |
1723 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1734 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1724 | mView->newEvent(); | 1735 | mView->newEvent(); |
1725 | else | 1736 | else |
1726 | mView->editIncidence(); | 1737 | mView->editIncidence(); |
1727 | break; | 1738 | break; |
1728 | case Qt::Key_Plus: | 1739 | case Qt::Key_Plus: |
1729 | size = p->mHourSize +2; | 1740 | size = p->mHourSize +2; |
1730 | if ( size <= 22 ) | 1741 | if ( size <= 22 ) |
1731 | configureAgenda( size ); | 1742 | configureAgenda( size ); |
1732 | break; | 1743 | break; |
1733 | case Qt::Key_Minus: | 1744 | case Qt::Key_Minus: |
1734 | size = p->mHourSize - 2; | 1745 | size = p->mHourSize - 2; |
1735 | if ( size >= 4 ) | 1746 | if ( size >= 4 ) |
1736 | configureAgenda( size ); | 1747 | configureAgenda( size ); |
1737 | break; | 1748 | break; |
1738 | 1749 | ||
1739 | 1750 | ||
1740 | default: | 1751 | default: |
1741 | e->ignore(); | 1752 | e->ignore(); |
1742 | } | 1753 | } |
1743 | if ( pro > 0 ) { | 1754 | if ( pro > 0 ) { |
1744 | mView->selectFilter( pro-1 ); | 1755 | mView->selectFilter( pro-1 ); |
1745 | } | 1756 | } |
1746 | if ( showSelectedDates ) { | 1757 | if ( showSelectedDates ) { |
1747 | ;// setCaptionToDates(); | 1758 | ;// setCaptionToDates(); |
1748 | } | 1759 | } |
1749 | 1760 | ||
1750 | } | 1761 | } |
1751 | 1762 | ||
1752 | void MainWindow::fillFilterMenu() | 1763 | void MainWindow::fillFilterMenu() |
1753 | { | 1764 | { |
1754 | selectFilterMenu->clear(); | 1765 | selectFilterMenu->clear(); |
1755 | bool disable = false; | 1766 | bool disable = false; |
1756 | selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); | 1767 | selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); |
1757 | selectFilterMenu->insertSeparator(); | 1768 | selectFilterMenu->insertSeparator(); |
1758 | if ( mView->filterView()->filtersEnabled() ) { | 1769 | if ( mView->filterView()->filtersEnabled() ) { |
1759 | selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 1 ); | 1770 | selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 1 ); |
1760 | } | 1771 | } |
1761 | else { | 1772 | else { |
1762 | selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 1 ); | 1773 | selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 1 ); |
1763 | disable = true; | 1774 | disable = true; |
1764 | } | 1775 | } |
1765 | selectFilterMenu->insertSeparator(); | 1776 | selectFilterMenu->insertSeparator(); |
1766 | QPtrList<CalFilter> fili = mView->filters(); | 1777 | QPtrList<CalFilter> fili = mView->filters(); |
1767 | CalFilter *curfilter = mView->filterView()->selectedFilter(); | 1778 | CalFilter *curfilter = mView->filterView()->selectedFilter(); |
1768 | CalFilter *filter = fili.first(); | 1779 | CalFilter *filter = fili.first(); |
1769 | int iii = 2; | 1780 | int iii = 2; |
1770 | while(filter) { | 1781 | while(filter) { |
1771 | selectFilterMenu->insertItem( filter->name(), iii ); | 1782 | selectFilterMenu->insertItem( filter->name(), iii ); |
1772 | if ( filter == curfilter) | 1783 | if ( filter == curfilter) |
1773 | selectFilterMenu->setItemChecked( iii, true ); | 1784 | selectFilterMenu->setItemChecked( iii, true ); |
1774 | if ( disable ) | 1785 | if ( disable ) |
1775 | selectFilterMenu->setItemEnabled( iii, false ); | 1786 | selectFilterMenu->setItemEnabled( iii, false ); |
1776 | filter = fili.next(); | 1787 | filter = fili.next(); |
1777 | ++iii; | 1788 | ++iii; |
1778 | } | 1789 | } |
1779 | } | 1790 | } |
1780 | void MainWindow::selectFilter( int fil ) | 1791 | void MainWindow::selectFilter( int fil ) |
1781 | { | 1792 | { |
1782 | if ( fil == 0 ) { | 1793 | if ( fil == 0 ) { |
1783 | mView->editFilters( ); | 1794 | mView->editFilters( ); |
1784 | } else if ( fil == 1 ){ | 1795 | } else if ( fil == 1 ){ |
1785 | mView->toggleFilerEnabled( ); | 1796 | mView->toggleFilerEnabled( ); |
1786 | } else { | 1797 | } else { |
1787 | mView->selectFilter( fil-2 ); | 1798 | mView->selectFilter( fil-2 ); |
1788 | } | 1799 | } |
1789 | } | 1800 | } |
1790 | void MainWindow::configureToolBar( int item ) | 1801 | void MainWindow::configureToolBar( int item ) |
1791 | { | 1802 | { |
1792 | 1803 | ||
1793 | configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); | 1804 | configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); |
1794 | KOPrefs *p = KOPrefs::instance(); | 1805 | KOPrefs *p = KOPrefs::instance(); |
1795 | p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); | 1806 | p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); |
1796 | p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); | 1807 | p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); |
1797 | p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); | 1808 | p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); |
1798 | p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); | 1809 | p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); |
1799 | p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); | 1810 | p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); |
1800 | p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); | 1811 | p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); |
1801 | p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); | 1812 | p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); |
1813 | p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 ); | ||
1802 | p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); | 1814 | p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); |
1803 | p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); | 1815 | p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); |
1804 | p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); | 1816 | p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); |
1805 | p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); | 1817 | p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); |
1806 | p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); | 1818 | p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); |
1807 | p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); | 1819 | p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); |
1808 | p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); | 1820 | p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); |
1809 | p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); | 1821 | p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); |
1810 | p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); | 1822 | p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); |
1811 | p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); | 1823 | p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); |
1812 | p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); | 1824 | p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); |
1813 | p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); | 1825 | p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); |
1814 | // initActions(); | 1826 | // initActions(); |
1815 | } | 1827 | } |
1816 | 1828 | ||
1817 | void MainWindow::setCaptionToDates() | 1829 | void MainWindow::setCaptionToDates() |
1818 | { | 1830 | { |
1819 | QString selDates; | 1831 | QString selDates; |
1820 | selDates = KGlobal::locale()->formatDate(mView->startDate(), true); | 1832 | selDates = KGlobal::locale()->formatDate(mView->startDate(), true); |
1821 | if (mView->startDate() < mView->endDate() ) | 1833 | if (mView->startDate() < mView->endDate() ) |
1822 | selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); | 1834 | selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); |
1823 | else { | 1835 | else { |
1824 | QString addString; | 1836 | QString addString; |
1825 | if ( mView->startDate() == QDateTime::currentDateTime().date() ) | 1837 | if ( mView->startDate() == QDateTime::currentDateTime().date() ) |
1826 | addString = i18n("Today"); | 1838 | addString = i18n("Today"); |
1827 | else if ( mView->startDate() == QDateTime::currentDateTime().date().addDays(1) ) | 1839 | else if ( mView->startDate() == QDateTime::currentDateTime().date().addDays(1) ) |
1828 | addString = i18n("Tomorrow"); | 1840 | addString = i18n("Tomorrow"); |
1829 | if ( !addString.isEmpty() ) | 1841 | if ( !addString.isEmpty() ) |
1830 | selDates = addString+", "+selDates ; | 1842 | selDates = addString+", "+selDates ; |
1831 | } | 1843 | } |
1832 | setCaption( i18n("Dates: ") + selDates ); | 1844 | setCaption( i18n("Dates: ") + selDates ); |
1833 | 1845 | ||
1834 | } | 1846 | } |
1835 | void MainWindow::showConfigureAgenda( ) | 1847 | void MainWindow::showConfigureAgenda( ) |
1836 | { | 1848 | { |
1837 | int iii; | 1849 | int iii; |
1838 | for ( iii = 1;iii<= 10 ;++iii ){ | 1850 | for ( iii = 1;iii<= 10 ;++iii ){ |
1839 | configureAgendaMenu->setItemChecked( (iii+1)*2, false ); | 1851 | configureAgendaMenu->setItemChecked( (iii+1)*2, false ); |
1840 | } | 1852 | } |
1841 | configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true ); | 1853 | configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true ); |
1842 | } | 1854 | } |
1843 | void MainWindow::configureAgenda( int item ) | 1855 | void MainWindow::configureAgenda( int item ) |
1844 | { | 1856 | { |
1845 | if ( KOPrefs::instance()->mHourSize == item ) | 1857 | if ( KOPrefs::instance()->mHourSize == item ) |
1846 | return; | 1858 | return; |
1847 | KOPrefs::instance()->mHourSize=item; | 1859 | KOPrefs::instance()->mHourSize=item; |
1848 | mView->viewManager()->agendaView()->updateConfig(); | 1860 | mView->viewManager()->agendaView()->updateConfig(); |
1849 | } | 1861 | } |
1850 | 1862 | ||
1851 | void MainWindow::saveCalendar() | 1863 | void MainWindow::saveCalendar() |
1852 | { | 1864 | { |
1853 | QString fn = KOPrefs::instance()->mLastSaveFile; | 1865 | QString fn = KOPrefs::instance()->mLastSaveFile; |
1854 | fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); | 1866 | fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); |
1855 | 1867 | ||
1856 | if ( fn == "" ) | 1868 | if ( fn == "" ) |
1857 | return; | 1869 | return; |
1858 | QFileInfo info; | 1870 | QFileInfo info; |
1859 | info.setFile( fn ); | 1871 | info.setFile( fn ); |
1860 | QString mes; | 1872 | QString mes; |
1861 | bool createbup = true; | 1873 | bool createbup = true; |
1862 | if ( info. exists() ) { | 1874 | if ( info. exists() ) { |
1863 | mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; | 1875 | mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; |
1864 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, | 1876 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, |
1865 | i18n("Overwrite!"), i18n("Cancel"), 0, | 1877 | i18n("Overwrite!"), i18n("Cancel"), 0, |
1866 | 0, 1 ); | 1878 | 0, 1 ); |
1867 | if ( result != 0 ) { | 1879 | if ( result != 0 ) { |
1868 | createbup = false; | 1880 | createbup = false; |
1869 | } | 1881 | } |
1870 | } | 1882 | } |
1871 | if ( createbup ) { | 1883 | if ( createbup ) { |
1872 | mView->saveCalendar( fn ); | 1884 | mView->saveCalendar( fn ); |
1873 | mes = i18n("KO/Pi:Saved %1").arg(fn); | 1885 | mes = i18n("KO/Pi:Saved %1").arg(fn); |
1874 | KOPrefs::instance()->mLastSaveFile = fn; | 1886 | KOPrefs::instance()->mLastSaveFile = fn; |
1875 | setCaption(mes); | 1887 | setCaption(mes); |
1876 | } | 1888 | } |
1877 | } | 1889 | } |
1878 | void MainWindow::loadCalendar() | 1890 | void MainWindow::loadCalendar() |
1879 | { | 1891 | { |
1880 | 1892 | ||
1881 | QString fn = KOPrefs::instance()->mLastLoadFile; | 1893 | QString fn = KOPrefs::instance()->mLastLoadFile; |
1882 | fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); | 1894 | fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); |
1883 | 1895 | ||
1884 | if ( fn == "" ) | 1896 | if ( fn == "" ) |
1885 | return; | 1897 | return; |
1886 | QFileInfo info; | 1898 | QFileInfo info; |
1887 | info.setFile( fn ); | 1899 | info.setFile( fn ); |
1888 | QString mess; | 1900 | QString mess; |
1889 | bool loadbup = true; | 1901 | bool loadbup = true; |
1890 | if ( info. exists() ) { | 1902 | if ( info. exists() ) { |
1891 | mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); | 1903 | mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); |
1892 | int result = QMessageBox::warning( this, "KO/Pi: Warning!", | 1904 | int result = QMessageBox::warning( this, "KO/Pi: Warning!", |
1893 | mess, | 1905 | mess, |
1894 | i18n("Load!"), i18n("Cancel"), 0, | 1906 | i18n("Load!"), i18n("Cancel"), 0, |
1895 | 0, 1 ); | 1907 | 0, 1 ); |
1896 | if ( result != 0 ) { | 1908 | if ( result != 0 ) { |
1897 | loadbup = false; | 1909 | loadbup = false; |
1898 | } | 1910 | } |
1899 | } else { | 1911 | } else { |
1900 | QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1912 | QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1901 | i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, | 1913 | i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, |
1902 | 0, 1 ); | 1914 | 0, 1 ); |
1903 | 1915 | ||
1904 | return; | 1916 | return; |
1905 | } | 1917 | } |
1906 | if ( loadbup ) { | 1918 | if ( loadbup ) { |
1907 | mView->openCalendar( fn ); | 1919 | mView->openCalendar( fn ); |
1908 | KOPrefs::instance()->mLastLoadFile = fn; | 1920 | KOPrefs::instance()->mLastLoadFile = fn; |
1909 | mess = i18n("KO/Pi:Loaded %1").arg(fn) ; | 1921 | mess = i18n("KO/Pi:Loaded %1").arg(fn) ; |
1910 | setCaption(mess); | 1922 | setCaption(mess); |
1911 | } | 1923 | } |
1912 | 1924 | ||
1913 | } | 1925 | } |
1914 | void MainWindow::quickImportIcal() | 1926 | void MainWindow::quickImportIcal() |
1915 | { | 1927 | { |
1916 | importFile( KOPrefs::instance()->mLastImportFile, false ); | 1928 | importFile( KOPrefs::instance()->mLastImportFile, false ); |
1917 | } | 1929 | } |
1918 | void MainWindow::importFile( QString fn, bool quick ) | 1930 | void MainWindow::importFile( QString fn, bool quick ) |
1919 | { | 1931 | { |
1920 | QFileInfo info; | 1932 | QFileInfo info; |
1921 | info.setFile( fn ); | 1933 | info.setFile( fn ); |
1922 | QString mess; | 1934 | QString mess; |
1923 | bool loadbup = true; | 1935 | bool loadbup = true; |
1924 | if ( !info. exists() ) { | 1936 | if ( !info. exists() ) { |
1925 | mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); | 1937 | mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); |
1926 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1938 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1927 | mess ); | 1939 | mess ); |
1928 | return; | 1940 | return; |
1929 | } | 1941 | } |
1930 | int result = 0; | 1942 | int result = 0; |
1931 | if ( !quick ) { | 1943 | if ( !quick ) { |
1932 | mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); | 1944 | mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); |
1933 | result = QMessageBox::warning( this, "KO/Pi: Warning!", | 1945 | result = QMessageBox::warning( this, "KO/Pi: Warning!", |
1934 | mess, | 1946 | mess, |
1935 | "Import", "Cancel", 0, | 1947 | "Import", "Cancel", 0, |
1936 | 0, 1 ); | 1948 | 0, 1 ); |
1937 | } | 1949 | } |
1938 | if ( result == 0 ) { | 1950 | if ( result == 0 ) { |
1939 | if ( mView->openCalendar( fn, true )) { | 1951 | if ( mView->openCalendar( fn, true )) { |
1940 | KOPrefs::instance()->mLastImportFile = fn; | 1952 | KOPrefs::instance()->mLastImportFile = fn; |
1941 | setCaption(i18n("Imported file successfully")); | 1953 | setCaption(i18n("Imported file successfully")); |
1942 | } else { | 1954 | } else { |
1943 | setCaption(i18n("Error importing file")); | 1955 | setCaption(i18n("Error importing file")); |
1944 | } | 1956 | } |
1945 | } | 1957 | } |
1946 | } | 1958 | } |
1947 | 1959 | ||
1948 | void MainWindow::importIcal() | 1960 | void MainWindow::importIcal() |
1949 | { | 1961 | { |
1950 | 1962 | ||
1951 | QString fn =KOPrefs::instance()->mLastImportFile; | 1963 | QString fn =KOPrefs::instance()->mLastImportFile; |
1952 | 1964 | ||
1953 | fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); | 1965 | fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); |
1954 | if ( fn == "" ) | 1966 | if ( fn == "" ) |
1955 | return; | 1967 | return; |
1956 | importFile( fn, true ); | 1968 | importFile( fn, true ); |
1957 | 1969 | ||
1958 | } | 1970 | } |
1959 | 1971 | ||
1960 | void MainWindow::exportVCalendar() | 1972 | void MainWindow::exportVCalendar() |
1961 | { | 1973 | { |
1962 | QString fn = KOPrefs::instance()->mLastVcalFile; | 1974 | QString fn = KOPrefs::instance()->mLastVcalFile; |
1963 | fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); | 1975 | fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); |
1964 | if ( fn == "" ) | 1976 | if ( fn == "" ) |
1965 | return; | 1977 | return; |
1966 | QFileInfo info; | 1978 | QFileInfo info; |
1967 | info.setFile( fn ); | 1979 | info.setFile( fn ); |
1968 | QString mes; | 1980 | QString mes; |
1969 | bool createbup = true; | 1981 | bool createbup = true; |
1970 | if ( info. exists() ) { | 1982 | if ( info. exists() ) { |
1971 | mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); | 1983 | mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); |
1972 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, | 1984 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, |
1973 | i18n("Overwrite!"), i18n("Cancel"), 0, | 1985 | i18n("Overwrite!"), i18n("Cancel"), 0, |
1974 | 0, 1 ); | 1986 | 0, 1 ); |
1975 | if ( result != 0 ) { | 1987 | if ( result != 0 ) { |
1976 | createbup = false; | 1988 | createbup = false; |
1977 | } | 1989 | } |
1978 | } | 1990 | } |
1979 | if ( createbup ) { | 1991 | if ( createbup ) { |
1980 | if ( mView->exportVCalendar( fn ) ) { | 1992 | if ( mView->exportVCalendar( fn ) ) { |
1981 | KOPrefs::instance()->mLastVcalFile = fn; | 1993 | KOPrefs::instance()->mLastVcalFile = fn; |
1982 | if ( fn.length() > 20 ) | 1994 | if ( fn.length() > 20 ) |
1983 | mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; | 1995 | mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; |
1984 | else | 1996 | else |
1985 | mes = i18n("KO/Pi:Exported to %1").arg(fn ); | 1997 | mes = i18n("KO/Pi:Exported to %1").arg(fn ); |
1986 | setCaption(mes); | 1998 | setCaption(mes); |
1987 | } | 1999 | } |
1988 | } | 2000 | } |
1989 | 2001 | ||
1990 | } | 2002 | } |
1991 | QString MainWindow::sentSyncFile() | 2003 | QString MainWindow::sentSyncFile() |
1992 | { | 2004 | { |
1993 | #ifdef DESKTOP_VERSION | 2005 | #ifdef DESKTOP_VERSION |
1994 | return locateLocal( "tmp", "copysynccal.ics" ); | 2006 | return locateLocal( "tmp", "copysynccal.ics" ); |
1995 | #else | 2007 | #else |
1996 | return QString( "/tmp/copysynccal.ics" ); | 2008 | return QString( "/tmp/copysynccal.ics" ); |
1997 | #endif | 2009 | #endif |
1998 | } | 2010 | } |
1999 | 2011 | ||
2000 | void MainWindow::syncFileRequest() | 2012 | void MainWindow::syncFileRequest() |
2001 | { | 2013 | { |
2002 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { | 2014 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { |
2003 | mSyncManager->slotSyncMenu( 999 ); | 2015 | mSyncManager->slotSyncMenu( 999 ); |
2004 | } | 2016 | } |
2005 | 2017 | ||
2006 | setCaption(i18n("Saving Data to temp file ..." )); | 2018 | setCaption(i18n("Saving Data to temp file ..." )); |
2007 | mView->saveCalendar( sentSyncFile() ); | 2019 | mView->saveCalendar( sentSyncFile() ); |
2008 | setCaption(i18n("Data saved to temp file!" )); | 2020 | setCaption(i18n("Data saved to temp file!" )); |
2009 | 2021 | ||
2010 | } | 2022 | } |
2011 | void MainWindow::getFile( bool success ) | 2023 | void MainWindow::getFile( bool success ) |
2012 | { | 2024 | { |
2013 | if ( ! success ) { | 2025 | if ( ! success ) { |
2014 | setCaption( i18n("Error receiving file. Nothing changed!") ); | 2026 | setCaption( i18n("Error receiving file. Nothing changed!") ); |
2015 | return; | 2027 | return; |
2016 | } | 2028 | } |
2017 | mView->openCalendar( sentSyncFile() ); | 2029 | mView->openCalendar( sentSyncFile() ); |
2018 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { | 2030 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { |
2019 | mSyncManager->slotSyncMenu( 999 ); | 2031 | mSyncManager->slotSyncMenu( 999 ); |
2020 | } | 2032 | } |
2021 | setCaption( i18n("Pi-Sync successful!") ); | 2033 | setCaption( i18n("Pi-Sync successful!") ); |
2022 | } | 2034 | } |
2023 | 2035 | ||
2024 | void MainWindow::printSel( ) | 2036 | void MainWindow::printSel( ) |
2025 | { | 2037 | { |
2026 | mView->viewManager()->agendaView()->agenda()->printSelection(); | 2038 | mView->viewManager()->agendaView()->agenda()->printSelection(); |
2027 | } | 2039 | } |
2028 | 2040 | ||
2029 | void MainWindow::printCal() | 2041 | void MainWindow::printCal() |
2030 | { | 2042 | { |
2031 | mView->print();//mCp->showDialog(); | 2043 | mView->print();//mCp->showDialog(); |
2032 | } | 2044 | } |
2033 | 2045 | ||
2034 | 2046 | ||
2035 | #include "libkdepim/kdatepicker.h" | 2047 | #include "libkdepim/kdatepicker.h" |
2036 | #include <kdatetbl.h> | 2048 | #include <kdatetbl.h> |
2037 | void MainWindow::weekAction() | 2049 | void MainWindow::weekAction() |
2038 | { | 2050 | { |
2039 | int month; | 2051 | int month; |
2040 | KPopupFrame* popup = new KPopupFrame(this); | 2052 | KPopupFrame* popup = new KPopupFrame(this); |
2041 | KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup); | 2053 | KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup); |
2042 | // ----- | 2054 | // ----- |
2043 | picker->resize(picker->sizeHint()); | 2055 | picker->resize(picker->sizeHint()); |
2044 | popup->setMainWidget(picker); | 2056 | popup->setMainWidget(picker); |
2045 | picker->setFocus(); | 2057 | picker->setFocus(); |
2046 | connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); | 2058 | connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); |
2047 | int x = 0; | 2059 | int x = 0; |
2048 | int y = iconToolBar->height(); | 2060 | int y = iconToolBar->height(); |
2049 | int dX = 0; | 2061 | int dX = 0; |
2050 | int dY = 0; | 2062 | int dY = 0; |
2051 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { | 2063 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { |
2052 | if ( iconToolBar->y() > height()/2 ) { | 2064 | if ( iconToolBar->y() > height()/2 ) { |
2053 | dY = picker->sizeHint().height()+8; | 2065 | dY = picker->sizeHint().height()+8; |
2054 | y = 0; | 2066 | y = 0; |
2055 | } | 2067 | } |
2056 | } else { | 2068 | } else { |
2057 | if ( iconToolBar->x() > width()/2 ) { // right side | 2069 | if ( iconToolBar->x() > width()/2 ) { // right side |
2058 | x=0; | 2070 | x=0; |
2059 | dX= picker->sizeHint().width()+8; | 2071 | dX= picker->sizeHint().width()+8; |
2060 | y = 0; | 2072 | y = 0; |
2061 | } else { | 2073 | } else { |
2062 | x= iconToolBar->width(); | 2074 | x= iconToolBar->width(); |
2063 | y = 0; | 2075 | y = 0; |
2064 | } | 2076 | } |
2065 | } | 2077 | } |
2066 | //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); | 2078 | //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); |
2067 | if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY)))) | 2079 | if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY)))) |
2068 | { | 2080 | { |
2069 | month = picker->getResult(); | 2081 | month = picker->getResult(); |
2070 | emit selectWeek ( month ); | 2082 | emit selectWeek ( month ); |
2071 | //qDebug("weekSelected %d ", month); | 2083 | //qDebug("weekSelected %d ", month); |
2072 | } | 2084 | } |
2073 | delete popup; | 2085 | delete popup; |
2074 | } | 2086 | } |
diff --git a/korganizer/navigatorbar.cpp b/korganizer/navigatorbar.cpp index b591232..934e153 100644 --- a/korganizer/navigatorbar.cpp +++ b/korganizer/navigatorbar.cpp | |||
@@ -1,200 +1,222 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | 3 | ||
4 | Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org> | 4 | Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org> |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
7 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
8 | the Free Software Foundation; either version 2 of the License, or | 8 | the Free Software Foundation; either version 2 of the License, or |
9 | (at your option) any later version. | 9 | (at your option) any later version. |
10 | 10 | ||
11 | This program is distributed in the hope that it will be useful, | 11 | This program is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | GNU General Public License for more details. | 14 | GNU General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU General Public License | 16 | You should have received a copy of the GNU General Public License |
17 | along with this program; if not, write to the Free Software | 17 | along with this program; if not, write to the Free Software |
18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
19 | 19 | ||
20 | As a special exception, permission is given to link this program | 20 | As a special exception, permission is given to link this program |
21 | with any edition of Qt, and distribute the resulting executable, | 21 | with any edition of Qt, and distribute the resulting executable, |
22 | without including the source code for Qt in the source distribution. | 22 | without including the source code for Qt in the source distribution. |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include <qstring.h> | 25 | #include <qstring.h> |
26 | #include <qtooltip.h> | 26 | #include <qtooltip.h> |
27 | #include <qpushbutton.h> | 27 | #include <qpushbutton.h> |
28 | #include <qlayout.h> | 28 | #include <qlayout.h> |
29 | #include <qframe.h> | 29 | #include <qframe.h> |
30 | #include <qlabel.h> | 30 | #include <qlabel.h> |
31 | #include <qpopupmenu.h> | 31 | #include <qpopupmenu.h> |
32 | #include <qapplication.h> | 32 | #include <qapplication.h> |
33 | 33 | ||
34 | #include <kdebug.h> | 34 | #include <kdebug.h> |
35 | #include <klocale.h> | 35 | #include <klocale.h> |
36 | #include <kglobal.h> | 36 | #include <kglobal.h> |
37 | #include <kiconloader.h> | 37 | #include <kiconloader.h> |
38 | #include "libkdepim/kdatepicker.h" | 38 | #include "libkdepim/kdatepicker.h" |
39 | #include <knotifyclient.h> | 39 | #include <knotifyclient.h> |
40 | #include "kdatetbl.h" | 40 | #include "kdatetbl.h" |
41 | 41 | ||
42 | #include "koglobals.h" | 42 | #include "koglobals.h" |
43 | #include <kglobalsettings.h> | 43 | #include <kglobalsettings.h> |
44 | #include "koprefs.h" | 44 | #include "koprefs.h" |
45 | #ifndef KORG_NOPLUGINS | 45 | #ifndef KORG_NOPLUGINS |
46 | #include "kocore.h" | 46 | #include "kocore.h" |
47 | #endif | 47 | #endif |
48 | 48 | ||
49 | #include <kcalendarsystem.h> | 49 | #include <kcalendarsystem.h> |
50 | 50 | ||
51 | #include "navigatorbar.h" | 51 | #include "navigatorbar.h" |
52 | 52 | ||
53 | NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *name ) | 53 | NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *name ) |
54 | : QWidget( parent, name ) | 54 | : QWidget( parent, name ) |
55 | { | 55 | { |
56 | QBoxLayout *topLayout = new QHBoxLayout( this ); | 56 | QBoxLayout *topLayout = new QHBoxLayout( this ); |
57 | 57 | ||
58 | // Set up the control buttons and date label | 58 | // Set up the control buttons and date label |
59 | mCtrlFrame = new QFrame( this ); | 59 | mCtrlFrame = new QFrame( this ); |
60 | mCtrlFrame->setFrameStyle(QFrame::Panel|QFrame::Raised); | 60 | mCtrlFrame->setFrameStyle(QFrame::Panel|QFrame::Raised); |
61 | mCtrlFrame->setLineWidth(1); | 61 | mCtrlFrame->setLineWidth(1); |
62 | 62 | ||
63 | topLayout->addWidget( mCtrlFrame ); | 63 | topLayout->addWidget( mCtrlFrame ); |
64 | 64 | ||
65 | QFont tfont = font(); | 65 | QFont tfont = font(); |
66 | if ( QApplication::desktop()->width() >= 480 ) | 66 | if ( QApplication::desktop()->width() >= 480 ) |
67 | tfont.setPointSize(tfont.pointSize()+2); | 67 | tfont.setPointSize(tfont.pointSize()+2); |
68 | tfont.setBold(true); | 68 | tfont.setBold(true); |
69 | 69 | ||
70 | bool isRTL = KOGlobals::self()->reverseLayout(); | 70 | bool isRTL = KOGlobals::self()->reverseLayout(); |
71 | #ifndef DESKTOP_VERSION | 71 | #ifndef DESKTOP_VERSION |
72 | bool isDesktop = false; | 72 | bool isDesktop = false; |
73 | #else | 73 | #else |
74 | bool isDesktop = true; | 74 | bool isDesktop = true; |
75 | #endif | 75 | #endif |
76 | if ( QString ( name ) == QString("useBigPixmaps") && QApplication::desktop()->width() > 320 ) | 76 | if ( QString ( name ) == QString("useBigPixmaps") && QApplication::desktop()->width() > 320 ) |
77 | isDesktop = true; | 77 | isDesktop = true; |
78 | // Create backward navigation buttons | 78 | // Create backward navigation buttons |
79 | mPrevYear = new QPushButton( mCtrlFrame ); | 79 | mPrevYear = new QPushButton( mCtrlFrame ); |
80 | mPrevYear->setPixmap( SmallIcon( isDesktop ? "2leftarrowB" : "2leftarrow" ) ); | 80 | mPrevYear->setPixmap( SmallIcon( isDesktop ? "2leftarrowB" : "2leftarrow" ) ); |
81 | QToolTip::add( mPrevYear, i18n("Previous Year") ); | 81 | QToolTip::add( mPrevYear, i18n("Previous Year") ); |
82 | 82 | ||
83 | mPrevMonth = new QPushButton( mCtrlFrame ); | 83 | mPrevMonth = new QPushButton( mCtrlFrame ); |
84 | mPrevMonth->setPixmap( SmallIcon( isDesktop ? "1leftarrowB" : "1leftarrow") ); | 84 | mPrevMonth->setPixmap( SmallIcon( isDesktop ? "1leftarrowB" : "1leftarrow") ); |
85 | QToolTip::add( mPrevMonth, i18n("Previous Month") ); | 85 | QToolTip::add( mPrevMonth, i18n("Previous Month") ); |
86 | 86 | ||
87 | // Create forward navigation buttons | 87 | // Create forward navigation buttons |
88 | mNextMonth = new QPushButton( mCtrlFrame ); | 88 | mNextMonth = new QPushButton( mCtrlFrame ); |
89 | mNextMonth->setPixmap( SmallIcon( isDesktop ? "1rightarrowB" : "1rightarrow") ); | 89 | mNextMonth->setPixmap( SmallIcon( isDesktop ? "1rightarrowB" : "1rightarrow") ); |
90 | QToolTip::add( mNextMonth, i18n("Next Month") ); | 90 | QToolTip::add( mNextMonth, i18n("Next Month") ); |
91 | 91 | ||
92 | mPrevWeek = new QPushButton( mCtrlFrame ); | ||
93 | mPrevWeek->setPixmap( SmallIcon( isDesktop ? "1leftarrowB" : "1leftarrow") ); | ||
94 | QToolTip::add( mPrevWeek, i18n("Previous Week") ); | ||
95 | |||
96 | // Create forward navigation buttons | ||
97 | mNextWeek = new QPushButton( mCtrlFrame ); | ||
98 | mNextWeek->setPixmap( SmallIcon( isDesktop ? "1rightarrowB" : "1rightarrow") ); | ||
99 | QToolTip::add( mNextWeek, i18n("Next Week") ); | ||
100 | |||
92 | mNextYear = new QPushButton( mCtrlFrame ); | 101 | mNextYear = new QPushButton( mCtrlFrame ); |
93 | mNextYear->setPixmap( SmallIcon( isDesktop ? "2rightarrowB": "2rightarrow") ); | 102 | mNextYear->setPixmap( SmallIcon( isDesktop ? "2rightarrowB": "2rightarrow") ); |
94 | QToolTip::add( mNextYear, i18n("Next Year") ); | 103 | QToolTip::add( mNextYear, i18n("Next Year") ); |
95 | mSelectMonth = new QPushButton( mCtrlFrame ); | 104 | mSelectMonth = new QPushButton( mCtrlFrame ); |
96 | // Create month name label | 105 | // Create month name label |
97 | //selectMonth->setFont( tfont ); | 106 | //selectMonth->setFont( tfont ); |
98 | // selectMonth->setAlignment( AlignCenter ); | 107 | // selectMonth->setAlignment( AlignCenter ); |
99 | //mDateLabel = new QLabel( selectMonth ); | 108 | //mDateLabel = new QLabel( selectMonth ); |
100 | //mDateLabel->setFont( tfont ); | 109 | //mDateLabel->setFont( tfont ); |
101 | //mDateLabel->setAlignment( AlignCenter ); | 110 | //mDateLabel->setAlignment( AlignCenter ); |
102 | if ( QString ( name ) == QString("useBigPixmaps") ) { | 111 | if ( QString ( name ) == QString("useBigPixmaps") ) { |
103 | mNextMonth->setFlat( true); | 112 | mNextMonth->setFlat( true); |
113 | mNextWeek->setFlat( true); | ||
104 | mNextYear->setFlat( true); | 114 | mNextYear->setFlat( true); |
105 | mSelectMonth->setFlat( true); | 115 | mSelectMonth->setFlat( true); |
106 | mPrevYear->setFlat( true); | 116 | mPrevYear->setFlat( true); |
107 | mPrevMonth->setFlat( true); | 117 | mPrevMonth->setFlat( true); |
118 | mPrevWeek->setFlat( true); | ||
119 | } else { | ||
120 | mPrevWeek->hide(); | ||
121 | mNextWeek->hide(); | ||
108 | } | 122 | } |
109 | mSelectMonth->setFont( tfont ); | 123 | mSelectMonth->setFont( tfont ); |
110 | // Set minimum width to width of widest month name label | 124 | // Set minimum width to width of widest month name label |
111 | int i; | 125 | int i; |
112 | int maxwidth = 0; | 126 | int maxwidth = 0; |
113 | QFontMetrics fm ( mSelectMonth->font() ); | 127 | QFontMetrics fm ( mSelectMonth->font() ); |
114 | int width = fm.width("September '00" ); | 128 | int width = fm.width("September '00" ); |
115 | // for( i = 1; i <= KOGlobals::self()->calendarSystem()->monthsInYear(date); | 129 | // for( i = 1; i <= KOGlobals::self()->calendarSystem()->monthsInYear(date); |
116 | // ++i ) { | 130 | // ++i ) { |
117 | // //int width = fm.width( KOGlobals::self()->calendarSystem()->monthName(i, | 131 | // //int width = fm.width( KOGlobals::self()->calendarSystem()->monthName(i, |
118 | // // KOGlobals::self()->calendarSystem()->year(date) ) + " 2000" ); | 132 | // // KOGlobals::self()->calendarSystem()->year(date) ) + " 2000" ); |
119 | // int width = fm.width("September 2000" ); | 133 | // int width = fm.width("September 2000" ); |
120 | // if ( width > maxwidth ) maxwidth = width; | 134 | // if ( width > maxwidth ) maxwidth = width; |
121 | // } | 135 | // } |
122 | maxwidth = width+2; | 136 | maxwidth = width+2; |
123 | int size = fm.height()+2; | 137 | int size = fm.height()+2; |
124 | if ( QApplication::desktop()->width() >= 480 ) { | 138 | if ( QApplication::desktop()->width() >= 480 ) { |
125 | size += 6; | 139 | size += 6; |
126 | maxwidth+= 6; | 140 | maxwidth+= 6; |
127 | } | 141 | } |
128 | 142 | ||
129 | mSelectMonth->setFixedWidth( maxwidth ); | 143 | mSelectMonth->setFixedWidth( maxwidth ); |
130 | mSelectMonth->setFixedHeight( size ); | 144 | mSelectMonth->setFixedHeight( size ); |
131 | mPrevYear->setFixedHeight( size ); | 145 | mPrevYear->setFixedHeight( size ); |
132 | mPrevMonth->setFixedHeight( size ); | 146 | mPrevMonth->setFixedHeight( size ); |
133 | mNextMonth->setFixedHeight( size ); | 147 | mPrevWeek->setFixedHeight( size ); |
148 | mNextMonth->setFixedHeight( size ); | ||
149 | mNextWeek->setFixedHeight( size ); | ||
134 | mNextYear->setFixedHeight ( size ); | 150 | mNextYear->setFixedHeight ( size ); |
135 | // set up control frame layout | 151 | // set up control frame layout |
136 | QBoxLayout *ctrlLayout = new QHBoxLayout( mCtrlFrame, 1 ); | 152 | QBoxLayout *ctrlLayout = new QHBoxLayout( mCtrlFrame, 1 ); |
137 | ctrlLayout->addWidget( mPrevYear, 3 ); | 153 | ctrlLayout->addWidget( mPrevYear, 3 ); |
138 | ctrlLayout->addWidget( mPrevMonth, 3 ); | 154 | ctrlLayout->addWidget( mPrevMonth, 3 ); |
155 | ctrlLayout->addWidget( mPrevWeek, 3 ); | ||
139 | //ctrlLayout->addStretch( 1 ); | 156 | //ctrlLayout->addStretch( 1 ); |
140 | // ctrlLayout->addSpacing( 1 ); | 157 | // ctrlLayout->addSpacing( 1 ); |
141 | // ctrlLayout->addWidget( mDateLabel ); | 158 | // ctrlLayout->addWidget( mDateLabel ); |
142 | ctrlLayout->addWidget( mSelectMonth ); | 159 | ctrlLayout->addWidget( mSelectMonth ); |
143 | // ctrlLayout->addSpacing( 1 ); | 160 | // ctrlLayout->addSpacing( 1 ); |
144 | // ctrlLayout->addStretch( 1 ); | 161 | // ctrlLayout->addStretch( 1 ); |
162 | ctrlLayout->addWidget( mNextWeek, 3 ); | ||
145 | ctrlLayout->addWidget( mNextMonth, 3 ); | 163 | ctrlLayout->addWidget( mNextMonth, 3 ); |
146 | ctrlLayout->addWidget( mNextYear, 3 ); | 164 | ctrlLayout->addWidget( mNextYear, 3 ); |
147 | 165 | ||
148 | connect( mPrevYear, SIGNAL( clicked() ), SIGNAL( goPrevYear() ) ); | 166 | connect( mPrevYear, SIGNAL( clicked() ), SIGNAL( goPrevYear() ) ); |
149 | connect( mPrevMonth, SIGNAL( clicked() ), SIGNAL( goPrevMonth() ) ); | 167 | connect( mPrevMonth, SIGNAL( clicked() ), SIGNAL( goPrevMonth() ) ); |
150 | connect( mNextMonth, SIGNAL( clicked() ), SIGNAL( goNextMonth() ) ); | 168 | connect( mNextMonth, SIGNAL( clicked() ), SIGNAL( goNextMonth() ) ); |
169 | connect( mPrevWeek, SIGNAL( clicked() ), SIGNAL( goPrevWeek() ) ); | ||
170 | connect( mNextWeek, SIGNAL( clicked() ), SIGNAL( goNextWeek() ) ); | ||
151 | connect( mNextYear, SIGNAL( clicked() ), SIGNAL( goNextYear() ) ); | 171 | connect( mNextYear, SIGNAL( clicked() ), SIGNAL( goNextYear() ) ); |
152 | connect( mSelectMonth, SIGNAL( clicked() ),SLOT( selectMonth() ) ); | 172 | connect( mSelectMonth, SIGNAL( clicked() ),SLOT( selectMonth() ) ); |
153 | mPrevYear->setFocusPolicy(NoFocus); | 173 | mPrevYear->setFocusPolicy(NoFocus); |
154 | mPrevMonth->setFocusPolicy(NoFocus); | 174 | mPrevMonth->setFocusPolicy(NoFocus); |
155 | mNextMonth->setFocusPolicy(NoFocus); | 175 | mNextMonth->setFocusPolicy(NoFocus); |
176 | mPrevWeek->setFocusPolicy(NoFocus); | ||
177 | mNextWeek->setFocusPolicy(NoFocus); | ||
156 | mNextYear->setFocusPolicy(NoFocus); | 178 | mNextYear->setFocusPolicy(NoFocus); |
157 | mSelectMonth->setFocusPolicy(NoFocus); | 179 | mSelectMonth->setFocusPolicy(NoFocus); |
158 | setSizePolicy( QSizePolicy ( QSizePolicy::Expanding ,QSizePolicy::Fixed ) ); | 180 | setSizePolicy( QSizePolicy ( QSizePolicy::Expanding ,QSizePolicy::Fixed ) ); |
159 | 181 | ||
160 | } | 182 | } |
161 | 183 | ||
162 | NavigatorBar::~NavigatorBar() | 184 | NavigatorBar::~NavigatorBar() |
163 | { | 185 | { |
164 | } | 186 | } |
165 | 187 | ||
166 | void NavigatorBar::selectMonth() | 188 | void NavigatorBar::selectMonth() |
167 | { | 189 | { |
168 | 190 | ||
169 | int month; | 191 | int month; |
170 | KPopupFrame* popup = new KPopupFrame(this); | 192 | KPopupFrame* popup = new KPopupFrame(this); |
171 | KDateInternalMonthPicker* picker = new KDateInternalMonthPicker(popup); | 193 | KDateInternalMonthPicker* picker = new KDateInternalMonthPicker(popup); |
172 | // ----- | 194 | // ----- |
173 | picker->resize(picker->sizeHint()); | 195 | picker->resize(picker->sizeHint()); |
174 | popup->setMainWidget(picker); | 196 | popup->setMainWidget(picker); |
175 | picker->setFocus(); | 197 | picker->setFocus(); |
176 | connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); | 198 | connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); |
177 | if(popup->exec(mSelectMonth->mapToGlobal(QPoint(0, mSelectMonth->height())))) | 199 | if(popup->exec(mSelectMonth->mapToGlobal(QPoint(0, mSelectMonth->height())))) |
178 | { | 200 | { |
179 | month = picker->getResult(); | 201 | month = picker->getResult(); |
180 | emit monthSelected ( month ); | 202 | emit monthSelected ( month ); |
181 | } else { | 203 | } else { |
182 | KNotifyClient::beep(); | 204 | KNotifyClient::beep(); |
183 | } | 205 | } |
184 | delete popup; | 206 | delete popup; |
185 | } | 207 | } |
186 | void NavigatorBar::selectDates( const KCal::DateList &dateList ) | 208 | void NavigatorBar::selectDates( const KCal::DateList &dateList ) |
187 | { | 209 | { |
188 | if (dateList.count() > 0) { | 210 | if (dateList.count() > 0) { |
189 | QDate date = dateList.first(); | 211 | QDate date = dateList.first(); |
190 | 212 | ||
191 | const KCalendarSystem *calSys = KOGlobals::self()->calendarSystem(); | 213 | const KCalendarSystem *calSys = KOGlobals::self()->calendarSystem(); |
192 | 214 | ||
193 | // compute the label at the top of the navigator | 215 | // compute the label at the top of the navigator |
194 | QString dtstr = i18n(calSys->monthName( date )) + " '" + | 216 | QString dtstr = i18n(calSys->monthName( date )) + " '" + |
195 | QString::number( calSys->year( date ) ).right(2); | 217 | QString::number( calSys->year( date ) ).right(2); |
196 | 218 | ||
197 | mSelectMonth->setText( dtstr ); | 219 | mSelectMonth->setText( dtstr ); |
198 | } | 220 | } |
199 | } | 221 | } |
200 | 222 | ||
diff --git a/korganizer/navigatorbar.h b/korganizer/navigatorbar.h index 93240a6..803c817 100644 --- a/korganizer/navigatorbar.h +++ b/korganizer/navigatorbar.h | |||
@@ -1,65 +1,69 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | 3 | ||
4 | Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org> | 4 | Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org> |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
7 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
8 | the Free Software Foundation; either version 2 of the License, or | 8 | the Free Software Foundation; either version 2 of the License, or |
9 | (at your option) any later version. | 9 | (at your option) any later version. |
10 | 10 | ||
11 | This program is distributed in the hope that it will be useful, | 11 | This program is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | GNU General Public License for more details. | 14 | GNU General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU General Public License | 16 | You should have received a copy of the GNU General Public License |
17 | along with this program; if not, write to the Free Software | 17 | along with this program; if not, write to the Free Software |
18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
19 | 19 | ||
20 | As a special exception, permission is given to link this program | 20 | As a special exception, permission is given to link this program |
21 | with any edition of Qt, and distribute the resulting executable, | 21 | with any edition of Qt, and distribute the resulting executable, |
22 | without including the source code for Qt in the source distribution. | 22 | without including the source code for Qt in the source distribution. |
23 | */ | 23 | */ |
24 | #ifndef NAVIGATORBAR_H | 24 | #ifndef NAVIGATORBAR_H |
25 | #define NAVIGATORBAR_H | 25 | #define NAVIGATORBAR_H |
26 | 26 | ||
27 | #include <libkcal/incidencebase.h> | 27 | #include <libkcal/incidencebase.h> |
28 | 28 | ||
29 | #include <qwidget.h> | 29 | #include <qwidget.h> |
30 | 30 | ||
31 | class QPushButton; | 31 | class QPushButton; |
32 | class QFrame; | 32 | class QFrame; |
33 | class QLabel; | 33 | class QLabel; |
34 | 34 | ||
35 | class NavigatorBar: public QWidget | 35 | class NavigatorBar: public QWidget |
36 | { | 36 | { |
37 | Q_OBJECT | 37 | Q_OBJECT |
38 | public: | 38 | public: |
39 | NavigatorBar( const QDate & date, QWidget *parent = 0, const char *name = 0 ); | 39 | NavigatorBar( const QDate & date, QWidget *parent = 0, const char *name = 0 ); |
40 | ~NavigatorBar(); | 40 | ~NavigatorBar(); |
41 | 41 | ||
42 | public slots: | 42 | public slots: |
43 | void selectDates( const KCal::DateList & ); | 43 | void selectDates( const KCal::DateList & ); |
44 | void selectMonth(); | 44 | void selectMonth(); |
45 | 45 | ||
46 | signals: | 46 | signals: |
47 | void goNextMonth(); | 47 | void goNextMonth(); |
48 | void goPrevMonth(); | 48 | void goPrevMonth(); |
49 | void goNextWeek(); | ||
50 | void goPrevWeek(); | ||
49 | void goNextYear(); | 51 | void goNextYear(); |
50 | void goPrevYear(); | 52 | void goPrevYear(); |
51 | void monthSelected( int ); | 53 | void monthSelected( int ); |
52 | 54 | ||
53 | private: | 55 | private: |
54 | QFrame *mCtrlFrame; | 56 | QFrame *mCtrlFrame; |
55 | 57 | ||
56 | QPushButton *mPrevYear; | 58 | QPushButton *mPrevYear; |
57 | QPushButton *mPrevMonth; | 59 | QPushButton *mPrevMonth; |
58 | QPushButton *mNextMonth; | 60 | QPushButton *mNextMonth; |
61 | QPushButton *mPrevWeek; | ||
62 | QPushButton *mNextWeek; | ||
59 | QPushButton *mNextYear; | 63 | QPushButton *mNextYear; |
60 | QPushButton *mSelectMonth; | 64 | QPushButton *mSelectMonth; |
61 | 65 | ||
62 | //QLabel *mDateLabel; | 66 | //QLabel *mDateLabel; |
63 | }; | 67 | }; |
64 | 68 | ||
65 | #endif | 69 | #endif |