-rw-r--r-- | korganizer/koagendaview.cpp | 10 | ||||
-rw-r--r-- | korganizer/kowhatsnextview.cpp | 19 | ||||
-rw-r--r-- | libkdepim/categoryeditdialog.cpp | 2 | ||||
-rw-r--r-- | libkdepim/categoryselectdialog.cpp | 8 |
4 files changed, 28 insertions, 11 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index 3aae076..749204b 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp | |||
@@ -185,386 +185,392 @@ void TimeLabels::updateConfig() | |||
185 | setFixedWidth(minimumWidth()); | 185 | setFixedWidth(minimumWidth()); |
186 | 186 | ||
187 | // update HourSize | 187 | // update HourSize |
188 | mCellHeight = KOPrefs::instance()->mHourSize*4; | 188 | mCellHeight = KOPrefs::instance()->mHourSize*4; |
189 | resizeContents(50,mRows * mCellHeight); | 189 | resizeContents(50,mRows * mCellHeight); |
190 | } | 190 | } |
191 | 191 | ||
192 | /** update time label positions */ | 192 | /** update time label positions */ |
193 | void TimeLabels::positionChanged() | 193 | void TimeLabels::positionChanged() |
194 | { | 194 | { |
195 | int adjustment = mAgenda->contentsY(); | 195 | int adjustment = mAgenda->contentsY(); |
196 | setContentsPos(0, adjustment); | 196 | setContentsPos(0, adjustment); |
197 | } | 197 | } |
198 | 198 | ||
199 | /** */ | 199 | /** */ |
200 | void TimeLabels::setAgenda(KOAgenda* agenda) | 200 | void TimeLabels::setAgenda(KOAgenda* agenda) |
201 | { | 201 | { |
202 | mAgenda = agenda; | 202 | mAgenda = agenda; |
203 | } | 203 | } |
204 | 204 | ||
205 | 205 | ||
206 | /** This is called in response to repaint() */ | 206 | /** This is called in response to repaint() */ |
207 | void TimeLabels::paintEvent(QPaintEvent*) | 207 | void TimeLabels::paintEvent(QPaintEvent*) |
208 | { | 208 | { |
209 | 209 | ||
210 | // kdDebug() << "paintevent..." << endl; | 210 | // kdDebug() << "paintevent..." << endl; |
211 | // this is another hack! | 211 | // this is another hack! |
212 | // QPainter painter(this); | 212 | // QPainter painter(this); |
213 | //QString c | 213 | //QString c |
214 | repaintContents(contentsX(), contentsY(), visibleWidth(), visibleHeight()); | 214 | repaintContents(contentsX(), contentsY(), visibleWidth(), visibleHeight()); |
215 | } | 215 | } |
216 | 216 | ||
217 | //////////////////////////////////////////////////////////////////////////// | 217 | //////////////////////////////////////////////////////////////////////////// |
218 | 218 | ||
219 | EventIndicator::EventIndicator(Location loc,QWidget *parent,const char *name) | 219 | EventIndicator::EventIndicator(Location loc,QWidget *parent,const char *name) |
220 | : QFrame(parent,name) | 220 | : QFrame(parent,name) |
221 | { | 221 | { |
222 | mColumns = 1; | 222 | mColumns = 1; |
223 | mTopBox = 0; | 223 | mTopBox = 0; |
224 | mLocation = loc; | 224 | mLocation = loc; |
225 | mTopLayout = 0; | 225 | mTopLayout = 0; |
226 | mPaintWidget = 0; | 226 | mPaintWidget = 0; |
227 | mXOffset = 0; | 227 | mXOffset = 0; |
228 | if (mLocation == Top) mPixmap = SmallIcon("1uparrow"); | 228 | if (mLocation == Top) mPixmap = SmallIcon("1uparrow"); |
229 | else mPixmap = SmallIcon("1downarrow"); | 229 | else mPixmap = SmallIcon("1downarrow"); |
230 | mEnabled.resize(mColumns); | 230 | mEnabled.resize(mColumns); |
231 | if (mLocation == Top) | 231 | if (mLocation == Top) |
232 | setMaximumHeight(0); | 232 | setMaximumHeight(0); |
233 | else | 233 | else |
234 | setMinimumHeight(mPixmap.height()); | 234 | setMinimumHeight(mPixmap.height()); |
235 | } | 235 | } |
236 | 236 | ||
237 | EventIndicator::~EventIndicator() | 237 | EventIndicator::~EventIndicator() |
238 | { | 238 | { |
239 | } | 239 | } |
240 | 240 | ||
241 | void EventIndicator::drawContents(QPainter *p) | 241 | void EventIndicator::drawContents(QPainter *p) |
242 | { | 242 | { |
243 | 243 | ||
244 | // kdDebug() << "======== top: " << contentsRect().top() << " bottom " << // contentsRect().bottom() << " left " << contentsRect().left() << " right " << contentsRect().right() << endl; | 244 | // kdDebug() << "======== top: " << contentsRect().top() << " bottom " << // contentsRect().bottom() << " left " << contentsRect().left() << " right " << contentsRect().right() << endl; |
245 | KDGanttSplitterHandle* han = 0; | 245 | KDGanttSplitterHandle* han = 0; |
246 | if ( mPaintWidget ) | 246 | if ( mPaintWidget ) |
247 | han = mPaintWidget->firstHandle(); | 247 | han = mPaintWidget->firstHandle(); |
248 | if ( ! han ) { | 248 | if ( ! han ) { |
249 | int i; | 249 | int i; |
250 | for(i=0;i<mColumns;++i) { | 250 | for(i=0;i<mColumns;++i) { |
251 | if (mEnabled[i]) { | 251 | if (mEnabled[i]) { |
252 | int cellWidth = contentsRect().right()/mColumns; | 252 | int cellWidth = contentsRect().right()/mColumns; |
253 | int xOffset = KOGlobals::self()->reverseLayout() ? | 253 | int xOffset = KOGlobals::self()->reverseLayout() ? |
254 | (mColumns - 1 - i)*cellWidth + cellWidth/2 -mPixmap.width()/2 : | 254 | (mColumns - 1 - i)*cellWidth + cellWidth/2 -mPixmap.width()/2 : |
255 | i*cellWidth + cellWidth/2 -mPixmap.width()/2; | 255 | i*cellWidth + cellWidth/2 -mPixmap.width()/2; |
256 | p->drawPixmap(QPoint(xOffset,0),mPixmap); | 256 | p->drawPixmap(QPoint(xOffset,0),mPixmap); |
257 | } | 257 | } |
258 | } | 258 | } |
259 | } else { | 259 | } else { |
260 | han->repaint(); | 260 | han->repaint(); |
261 | //mPaintWidget->setBackgroundColor( red ); | 261 | //mPaintWidget->setBackgroundColor( red ); |
262 | 262 | ||
263 | QPainter pa( han ); | 263 | QPainter pa( han ); |
264 | int i; | 264 | int i; |
265 | bool setColor = false; | 265 | bool setColor = false; |
266 | for(i=0;i<mColumns;++i) { | 266 | for(i=0;i<mColumns;++i) { |
267 | if (mEnabled[i]) { | 267 | if (mEnabled[i]) { |
268 | setColor = true; | 268 | setColor = true; |
269 | 269 | ||
270 | int cellWidth = contentsRect().right()/mColumns; | 270 | int cellWidth = contentsRect().right()/mColumns; |
271 | int xOffset = KOGlobals::self()->reverseLayout() ? | 271 | int xOffset = KOGlobals::self()->reverseLayout() ? |
272 | (mColumns - 1 - i)*cellWidth + cellWidth/2 -mPixmap.width()/2 : | 272 | (mColumns - 1 - i)*cellWidth + cellWidth/2 -mPixmap.width()/2 : |
273 | i*cellWidth + cellWidth/2 -mPixmap.width()/2; | 273 | i*cellWidth + cellWidth/2 -mPixmap.width()/2; |
274 | pa.drawPixmap(QPoint(mXOffset + xOffset,0),mPixmap); | 274 | pa.drawPixmap(QPoint(mXOffset + xOffset,0),mPixmap); |
275 | //qDebug("222draw pix %d ",xOffset ); | 275 | //qDebug("222draw pix %d ",xOffset ); |
276 | 276 | ||
277 | } | 277 | } |
278 | 278 | ||
279 | } | 279 | } |
280 | pa.end(); | 280 | pa.end(); |
281 | 281 | ||
282 | } | 282 | } |
283 | } | 283 | } |
284 | 284 | ||
285 | void EventIndicator::setXOffset( int x ) | 285 | void EventIndicator::setXOffset( int x ) |
286 | { | 286 | { |
287 | mXOffset = x; | 287 | mXOffset = x; |
288 | } | 288 | } |
289 | void EventIndicator::setPaintWidget( KDGanttMinimizeSplitter * w ) | 289 | void EventIndicator::setPaintWidget( KDGanttMinimizeSplitter * w ) |
290 | { | 290 | { |
291 | mPaintWidget = w; | 291 | mPaintWidget = w; |
292 | } | 292 | } |
293 | void EventIndicator::changeColumns(int columns) | 293 | void EventIndicator::changeColumns(int columns) |
294 | { | 294 | { |
295 | mColumns = columns; | 295 | mColumns = columns; |
296 | mEnabled.resize(mColumns); | 296 | mEnabled.resize(mColumns); |
297 | 297 | ||
298 | update(); | 298 | update(); |
299 | } | 299 | } |
300 | 300 | ||
301 | void EventIndicator::enableColumn(int column, bool enable) | 301 | void EventIndicator::enableColumn(int column, bool enable) |
302 | { | 302 | { |
303 | mEnabled[column] = enable; | 303 | mEnabled[column] = enable; |
304 | } | 304 | } |
305 | 305 | ||
306 | 306 | ||
307 | //////////////////////////////////////////////////////////////////////////// | 307 | //////////////////////////////////////////////////////////////////////////// |
308 | //////////////////////////////////////////////////////////////////////////// | 308 | //////////////////////////////////////////////////////////////////////////// |
309 | //////////////////////////////////////////////////////////////////////////// | 309 | //////////////////////////////////////////////////////////////////////////// |
310 | 310 | ||
311 | KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : | 311 | KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : |
312 | KOEventView (cal,parent,name) | 312 | KOEventView (cal,parent,name) |
313 | { | 313 | { |
314 | mBlockUpdating = true; | 314 | mBlockUpdating = true; |
315 | mStartHour = 8; | 315 | mStartHour = 8; |
316 | mSelectedDates.append(QDate::currentDate()); | 316 | mSelectedDates.append(QDate::currentDate()); |
317 | 317 | ||
318 | mLayoutDayLabels = 0; | 318 | mLayoutDayLabels = 0; |
319 | mDayLabelsFrame = 0; | 319 | mDayLabelsFrame = 0; |
320 | mDayLabels = 0; | 320 | mDayLabels = 0; |
321 | bool isRTL = KOGlobals::self()->reverseLayout(); | 321 | bool isRTL = KOGlobals::self()->reverseLayout(); |
322 | 322 | ||
323 | if ( KOPrefs::instance()->mVerticalScreen ) { | 323 | if ( KOPrefs::instance()->mVerticalScreen ) { |
324 | mExpandedPixmap = SmallIcon( "1downarrow" ); | 324 | mExpandedPixmap = SmallIcon( "1downarrow" ); |
325 | mNotExpandedPixmap = SmallIcon( "1uparrow" ); | 325 | mNotExpandedPixmap = SmallIcon( "1uparrow" ); |
326 | } else { | 326 | } else { |
327 | mExpandedPixmap = SmallIcon( isRTL ? "1leftarrow" : "1rightarrow" ); | 327 | mExpandedPixmap = SmallIcon( isRTL ? "1leftarrow" : "1rightarrow" ); |
328 | mNotExpandedPixmap = SmallIcon( isRTL ? "1rightarrow" : "1leftarrow" ); | 328 | mNotExpandedPixmap = SmallIcon( isRTL ? "1rightarrow" : "1leftarrow" ); |
329 | } | 329 | } |
330 | 330 | ||
331 | QBoxLayout *topLayout = new QVBoxLayout(this); | 331 | QBoxLayout *topLayout = new QVBoxLayout(this); |
332 | 332 | ||
333 | // Create day name labels for agenda columns | 333 | // Create day name labels for agenda columns |
334 | mDayLabelsFrame = new QHBox(this); | 334 | mDayLabelsFrame = new QHBox(this); |
335 | topLayout->addWidget(mDayLabelsFrame); | 335 | topLayout->addWidget(mDayLabelsFrame); |
336 | mDayLabels = new QFrame (mDayLabelsFrame); | 336 | mDayLabels = new QFrame (mDayLabelsFrame); |
337 | mLayoutDayLabels = new QHBoxLayout(mDayLabels); | 337 | mLayoutDayLabels = new QHBoxLayout(mDayLabels); |
338 | // Create agenda splitter | 338 | // Create agenda splitter |
339 | #ifndef KORG_NOSPLITTER | 339 | #ifndef KORG_NOSPLITTER |
340 | mSplitterAgenda = new QSplitter(Vertical,this); | 340 | mSplitterAgenda = new QSplitter(Vertical,this); |
341 | topLayout->addWidget(mSplitterAgenda); | 341 | topLayout->addWidget(mSplitterAgenda); |
342 | mSplitterAgenda->setOpaqueResize(); | 342 | mSplitterAgenda->setOpaqueResize(); |
343 | 343 | ||
344 | mAllDayFrame = new QHBox(mSplitterAgenda); | 344 | mAllDayFrame = new QHBox(mSplitterAgenda); |
345 | 345 | ||
346 | QWidget *agendaFrame = new QWidget(mSplitterAgenda); | 346 | QWidget *agendaFrame = new QWidget(mSplitterAgenda); |
347 | #else | 347 | #else |
348 | #if 0 | 348 | #if 0 |
349 | QWidget *mainBox = new QWidget( this ); | 349 | QWidget *mainBox = new QWidget( this ); |
350 | topLayout->addWidget( mainBox ); | 350 | topLayout->addWidget( mainBox ); |
351 | QBoxLayout *mainLayout = new QVBoxLayout(mainBox); | 351 | QBoxLayout *mainLayout = new QVBoxLayout(mainBox); |
352 | mAllDayFrame = new QHBox(mainBox); | 352 | mAllDayFrame = new QHBox(mainBox); |
353 | mainLayout->addWidget(mAllDayFrame); | 353 | mainLayout->addWidget(mAllDayFrame); |
354 | mainLayout->setStretchFactor( mAllDayFrame, 0 ); | 354 | mainLayout->setStretchFactor( mAllDayFrame, 0 ); |
355 | mAllDayFrame->setFocusPolicy(NoFocus); | 355 | mAllDayFrame->setFocusPolicy(NoFocus); |
356 | QWidget *agendaFrame = new QWidget(mainBox); | 356 | QWidget *agendaFrame = new QWidget(mainBox); |
357 | mainLayout->addWidget(agendaFrame); | 357 | mainLayout->addWidget(agendaFrame); |
358 | mainLayout->setStretchFactor( agendaFrame, 10 ); | 358 | mainLayout->setStretchFactor( agendaFrame, 10 ); |
359 | 359 | ||
360 | agendaFrame->setFocusPolicy(NoFocus); | 360 | agendaFrame->setFocusPolicy(NoFocus); |
361 | #endif | 361 | #endif |
362 | mSplitterAgenda = new KDGanttMinimizeSplitter( Qt::Vertical, this); | 362 | mSplitterAgenda = new KDGanttMinimizeSplitter( Qt::Vertical, this); |
363 | mSplitterAgenda->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); | 363 | mSplitterAgenda->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); |
364 | topLayout->addWidget( mSplitterAgenda ); | 364 | topLayout->addWidget( mSplitterAgenda ); |
365 | mAllDayFrame = new QHBox(mSplitterAgenda); | 365 | mAllDayFrame = new QHBox(mSplitterAgenda); |
366 | mAllDayFrame->setFocusPolicy(NoFocus); | 366 | mAllDayFrame->setFocusPolicy(NoFocus); |
367 | QWidget *agendaFrame = new QWidget(mSplitterAgenda); | 367 | QWidget *agendaFrame = new QWidget(mSplitterAgenda); |
368 | agendaFrame->setFocusPolicy(NoFocus); | 368 | agendaFrame->setFocusPolicy(NoFocus); |
369 | 369 | ||
370 | #endif | 370 | #endif |
371 | 371 | ||
372 | // Create all-day agenda widget | 372 | // Create all-day agenda widget |
373 | mDummyAllDayLeft = new QVBox( mAllDayFrame ); | 373 | mDummyAllDayLeft = new QVBox( mAllDayFrame ); |
374 | 374 | ||
375 | mExpandButton = new QPushButton(mDummyAllDayLeft); | 375 | mExpandButton = new QPushButton(mDummyAllDayLeft); |
376 | mExpandButton->setPixmap( mNotExpandedPixmap ); | 376 | mExpandButton->setPixmap( mNotExpandedPixmap ); |
377 | mExpandButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, | 377 | int widebut = mExpandButton->sizeHint().width(); |
378 | QSizePolicy::Fixed ) ); | 378 | if ( QApplication::desktop()->width() < 480 ) |
379 | widebut = widebut*2; | ||
380 | else | ||
381 | widebut = (widebut*3) / 2; | ||
382 | //mExpandButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, | ||
383 | // QSizePolicy::Fixed ) ); | ||
384 | mExpandButton->setFixedSize( widebut, widebut); | ||
379 | connect( mExpandButton, SIGNAL( clicked() ), SIGNAL( toggleExpand() ) ); | 385 | connect( mExpandButton, SIGNAL( clicked() ), SIGNAL( toggleExpand() ) ); |
380 | mExpandButton->setFocusPolicy(NoFocus); | 386 | mExpandButton->setFocusPolicy(NoFocus); |
381 | mAllDayAgenda = new KOAgenda(1,mAllDayFrame); | 387 | mAllDayAgenda = new KOAgenda(1,mAllDayFrame); |
382 | mAllDayAgenda->setFocusPolicy(NoFocus); | 388 | mAllDayAgenda->setFocusPolicy(NoFocus); |
383 | QWidget *dummyAllDayRight = new QWidget(mAllDayFrame); | 389 | QWidget *dummyAllDayRight = new QWidget(mAllDayFrame); |
384 | 390 | ||
385 | // Create event context menu for all day agenda | 391 | // Create event context menu for all day agenda |
386 | mAllDayAgendaPopup = eventPopup(); | 392 | mAllDayAgendaPopup = eventPopup(); |
387 | connect(mAllDayAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), | 393 | connect(mAllDayAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), |
388 | mAllDayAgendaPopup,SLOT(showIncidencePopup(Incidence *))); | 394 | mAllDayAgendaPopup,SLOT(showIncidencePopup(Incidence *))); |
389 | 395 | ||
390 | // Create agenda frame | 396 | // Create agenda frame |
391 | QGridLayout *agendaLayout = new QGridLayout(agendaFrame,3,3); | 397 | QGridLayout *agendaLayout = new QGridLayout(agendaFrame,3,3); |
392 | // QHBox *agendaFrame = new QHBox(splitterAgenda); | 398 | // QHBox *agendaFrame = new QHBox(splitterAgenda); |
393 | 399 | ||
394 | // create event indicator bars | 400 | // create event indicator bars |
395 | mEventIndicatorTop = new EventIndicator(EventIndicator::Top,agendaFrame); | 401 | mEventIndicatorTop = new EventIndicator(EventIndicator::Top,agendaFrame); |
396 | agendaLayout->addWidget(mEventIndicatorTop,0,1); | 402 | agendaLayout->addWidget(mEventIndicatorTop,0,1); |
397 | mEventIndicatorTop->setPaintWidget( mSplitterAgenda ); | 403 | mEventIndicatorTop->setPaintWidget( mSplitterAgenda ); |
398 | mEventIndicatorBottom = new EventIndicator(EventIndicator::Bottom, | 404 | mEventIndicatorBottom = new EventIndicator(EventIndicator::Bottom, |
399 | agendaFrame); | 405 | agendaFrame); |
400 | agendaLayout->addWidget(mEventIndicatorBottom,2,1); | 406 | agendaLayout->addWidget(mEventIndicatorBottom,2,1); |
401 | QWidget *dummyAgendaRight = new QWidget(agendaFrame); | 407 | QWidget *dummyAgendaRight = new QWidget(agendaFrame); |
402 | agendaLayout->addWidget(dummyAgendaRight,0,2); | 408 | agendaLayout->addWidget(dummyAgendaRight,0,2); |
403 | 409 | ||
404 | // Create time labels | 410 | // Create time labels |
405 | mTimeLabels = new TimeLabels(24,agendaFrame); | 411 | mTimeLabels = new TimeLabels(24,agendaFrame); |
406 | agendaLayout->addWidget(mTimeLabels,1,0); | 412 | agendaLayout->addWidget(mTimeLabels,1,0); |
407 | 413 | ||
408 | // Create agenda | 414 | // Create agenda |
409 | mAgenda = new KOAgenda(1,96,KOPrefs::instance()->mHourSize,agendaFrame); | 415 | mAgenda = new KOAgenda(1,96,KOPrefs::instance()->mHourSize,agendaFrame); |
410 | agendaLayout->addMultiCellWidget(mAgenda,1,1,1,2); | 416 | agendaLayout->addMultiCellWidget(mAgenda,1,1,1,2); |
411 | agendaLayout->setColStretch(1,1); | 417 | agendaLayout->setColStretch(1,1); |
412 | mAgenda->setFocusPolicy(NoFocus); | 418 | mAgenda->setFocusPolicy(NoFocus); |
413 | // Create event context menu for agenda | 419 | // Create event context menu for agenda |
414 | mAgendaPopup = eventPopup(); | 420 | mAgendaPopup = eventPopup(); |
415 | 421 | ||
416 | mAgendaPopup->addAdditionalItem(QIconSet(SmallIcon("bell")), | 422 | mAgendaPopup->addAdditionalItem(QIconSet(SmallIcon("bell")), |
417 | i18n("Toggle Alarm"),mAgenda, | 423 | i18n("Toggle Alarm"),mAgenda, |
418 | SLOT(popupAlarm()),true); | 424 | SLOT(popupAlarm()),true); |
419 | 425 | ||
420 | 426 | ||
421 | connect(mAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), | 427 | connect(mAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), |
422 | mAgendaPopup,SLOT(showIncidencePopup(Incidence *))); | 428 | mAgendaPopup,SLOT(showIncidencePopup(Incidence *))); |
423 | 429 | ||
424 | // make connections between dependent widgets | 430 | // make connections between dependent widgets |
425 | mTimeLabels->setAgenda(mAgenda); | 431 | mTimeLabels->setAgenda(mAgenda); |
426 | 432 | ||
427 | // Update widgets to reflect user preferences | 433 | // Update widgets to reflect user preferences |
428 | // updateConfig(); | 434 | // updateConfig(); |
429 | 435 | ||
430 | // createDayLabels(); | 436 | // createDayLabels(); |
431 | 437 | ||
432 | // these blank widgets make the All Day Event box line up with the agenda | 438 | // these blank widgets make the All Day Event box line up with the agenda |
433 | dummyAllDayRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); | 439 | dummyAllDayRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); |
434 | dummyAgendaRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); | 440 | dummyAgendaRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); |
435 | mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); | 441 | mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); |
436 | 442 | ||
437 | // Scrolling | 443 | // Scrolling |
438 | connect(mAgenda->verticalScrollBar(),SIGNAL(valueChanged(int)), | 444 | connect(mAgenda->verticalScrollBar(),SIGNAL(valueChanged(int)), |
439 | mTimeLabels, SLOT(positionChanged())); | 445 | mTimeLabels, SLOT(positionChanged())); |
440 | connect(mTimeLabels->verticalScrollBar(),SIGNAL(valueChanged(int)), | 446 | connect(mTimeLabels->verticalScrollBar(),SIGNAL(valueChanged(int)), |
441 | SLOT(setContentsPos(int))); | 447 | SLOT(setContentsPos(int))); |
442 | 448 | ||
443 | // Create/Show/Edit/Delete Event | 449 | // Create/Show/Edit/Delete Event |
444 | connect(mAgenda,SIGNAL(newEventSignal(int,int)), | 450 | connect(mAgenda,SIGNAL(newEventSignal(int,int)), |
445 | SLOT(newEvent(int,int))); | 451 | SLOT(newEvent(int,int))); |
446 | connect(mAgenda,SIGNAL(newEventSignal(int,int,int,int)), | 452 | connect(mAgenda,SIGNAL(newEventSignal(int,int,int,int)), |
447 | SLOT(newEvent(int,int,int,int))); | 453 | SLOT(newEvent(int,int,int,int))); |
448 | connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int)), | 454 | connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int)), |
449 | SLOT(newEventAllDay(int,int))); | 455 | SLOT(newEventAllDay(int,int))); |
450 | connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int,int,int)), | 456 | connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int,int,int)), |
451 | SLOT(newEventAllDay(int,int))); | 457 | SLOT(newEventAllDay(int,int))); |
452 | connect(mAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), | 458 | connect(mAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), |
453 | SLOT(newTimeSpanSelected(int,int,int,int))); | 459 | SLOT(newTimeSpanSelected(int,int,int,int))); |
454 | connect(mAllDayAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), | 460 | connect(mAllDayAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), |
455 | SLOT(newTimeSpanSelectedAllDay(int,int,int,int))); | 461 | SLOT(newTimeSpanSelectedAllDay(int,int,int,int))); |
456 | connect(mAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); | 462 | connect(mAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); |
457 | connect(mAllDayAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); | 463 | connect(mAllDayAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); |
458 | 464 | ||
459 | connect(mAgenda,SIGNAL(editIncidenceSignal(Incidence *)), | 465 | connect(mAgenda,SIGNAL(editIncidenceSignal(Incidence *)), |
460 | SIGNAL(editIncidenceSignal(Incidence *))); | 466 | SIGNAL(editIncidenceSignal(Incidence *))); |
461 | connect(mAllDayAgenda,SIGNAL(editIncidenceSignal(Incidence *)), | 467 | connect(mAllDayAgenda,SIGNAL(editIncidenceSignal(Incidence *)), |
462 | SIGNAL(editIncidenceSignal(Incidence *))); | 468 | SIGNAL(editIncidenceSignal(Incidence *))); |
463 | connect(mAgenda,SIGNAL(showIncidenceSignal(Incidence *)), | 469 | connect(mAgenda,SIGNAL(showIncidenceSignal(Incidence *)), |
464 | SIGNAL(showIncidenceSignal(Incidence *))); | 470 | SIGNAL(showIncidenceSignal(Incidence *))); |
465 | connect(mAllDayAgenda,SIGNAL(showIncidenceSignal(Incidence *)), | 471 | connect(mAllDayAgenda,SIGNAL(showIncidenceSignal(Incidence *)), |
466 | SIGNAL(showIncidenceSignal(Incidence *))); | 472 | SIGNAL(showIncidenceSignal(Incidence *))); |
467 | connect(mAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), | 473 | connect(mAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), |
468 | SIGNAL(deleteIncidenceSignal(Incidence *))); | 474 | SIGNAL(deleteIncidenceSignal(Incidence *))); |
469 | connect(mAllDayAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), | 475 | connect(mAllDayAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), |
470 | SIGNAL(deleteIncidenceSignal(Incidence *))); | 476 | SIGNAL(deleteIncidenceSignal(Incidence *))); |
471 | 477 | ||
472 | connect(mAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), | 478 | connect(mAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), |
473 | SLOT(updateEventDates(KOAgendaItem *, int ))); | 479 | SLOT(updateEventDates(KOAgendaItem *, int ))); |
474 | connect(mAllDayAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), | 480 | connect(mAllDayAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), |
475 | SLOT(updateEventDates(KOAgendaItem *, int))); | 481 | SLOT(updateEventDates(KOAgendaItem *, int))); |
476 | 482 | ||
477 | // event indicator update | 483 | // event indicator update |
478 | connect(mAgenda,SIGNAL(lowerYChanged(int)), | 484 | connect(mAgenda,SIGNAL(lowerYChanged(int)), |
479 | SLOT(updateEventIndicatorTop(int))); | 485 | SLOT(updateEventIndicatorTop(int))); |
480 | connect(mAgenda,SIGNAL(upperYChanged(int)), | 486 | connect(mAgenda,SIGNAL(upperYChanged(int)), |
481 | SLOT(updateEventIndicatorBottom(int))); | 487 | SLOT(updateEventIndicatorBottom(int))); |
482 | // drag signals | 488 | // drag signals |
483 | /* | 489 | /* |
484 | connect(mAgenda,SIGNAL(startDragSignal(Event *)), | 490 | connect(mAgenda,SIGNAL(startDragSignal(Event *)), |
485 | SLOT(startDrag(Event *))); | 491 | SLOT(startDrag(Event *))); |
486 | connect(mAllDayAgenda,SIGNAL(startDragSignal(Event *)), | 492 | connect(mAllDayAgenda,SIGNAL(startDragSignal(Event *)), |
487 | SLOT(startDrag(Event *))); | 493 | SLOT(startDrag(Event *))); |
488 | */ | 494 | */ |
489 | // synchronize selections | 495 | // synchronize selections |
490 | connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), | 496 | connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), |
491 | mAllDayAgenda, SLOT( deselectItem() ) ); | 497 | mAllDayAgenda, SLOT( deselectItem() ) ); |
492 | connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), | 498 | connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), |
493 | mAgenda, SLOT( deselectItem() ) ); | 499 | mAgenda, SLOT( deselectItem() ) ); |
494 | connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), | 500 | connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), |
495 | SIGNAL( incidenceSelected( Incidence * ) ) ); | 501 | SIGNAL( incidenceSelected( Incidence * ) ) ); |
496 | connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), | 502 | connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), |
497 | SIGNAL( incidenceSelected( Incidence * ) ) ); | 503 | SIGNAL( incidenceSelected( Incidence * ) ) ); |
498 | connect( mAgenda, SIGNAL( resizedSignal() ), | 504 | connect( mAgenda, SIGNAL( resizedSignal() ), |
499 | SLOT( updateConfig( ) ) ); | 505 | SLOT( updateConfig( ) ) ); |
500 | connect( mAgenda, SIGNAL( addToCalSignal(Incidence *, Incidence *) ), | 506 | connect( mAgenda, SIGNAL( addToCalSignal(Incidence *, Incidence *) ), |
501 | SLOT( addToCalSlot(Incidence *, Incidence * ) ) ); | 507 | SLOT( addToCalSlot(Incidence *, Incidence * ) ) ); |
502 | connect( mAllDayAgenda, SIGNAL( addToCalSignal(Incidence * ,Incidence *) ), | 508 | connect( mAllDayAgenda, SIGNAL( addToCalSignal(Incidence * ,Incidence *) ), |
503 | SLOT( addToCalSlot(Incidence * , Incidence *) ) ); | 509 | SLOT( addToCalSlot(Incidence * , Incidence *) ) ); |
504 | // connect( mAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); | 510 | // connect( mAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); |
505 | //connect( mAllDayAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); | 511 | //connect( mAllDayAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); |
506 | 512 | ||
507 | 513 | ||
508 | } | 514 | } |
509 | 515 | ||
510 | void KOAgendaView::toggleAllDay() | 516 | void KOAgendaView::toggleAllDay() |
511 | { | 517 | { |
512 | if ( mSplitterAgenda->firstHandle() ) | 518 | if ( mSplitterAgenda->firstHandle() ) |
513 | mSplitterAgenda->firstHandle()->toggle(); | 519 | mSplitterAgenda->firstHandle()->toggle(); |
514 | } | 520 | } |
515 | void KOAgendaView::addToCalSlot(Incidence * inc, Incidence * incOld ) | 521 | void KOAgendaView::addToCalSlot(Incidence * inc, Incidence * incOld ) |
516 | { | 522 | { |
517 | calendar()->addIncidence( inc ); | 523 | calendar()->addIncidence( inc ); |
518 | 524 | ||
519 | if ( incOld ) { | 525 | if ( incOld ) { |
520 | if ( incOld->type() == "Todo" ) | 526 | if ( incOld->type() == "Todo" ) |
521 | emit todoMoved((Todo*)incOld, KOGlobals::EVENTEDITED ); | 527 | emit todoMoved((Todo*)incOld, KOGlobals::EVENTEDITED ); |
522 | else | 528 | else |
523 | emit incidenceChanged(incOld, KOGlobals::EVENTEDITED); | 529 | emit incidenceChanged(incOld, KOGlobals::EVENTEDITED); |
524 | } | 530 | } |
525 | 531 | ||
526 | } | 532 | } |
527 | 533 | ||
528 | KOAgendaView::~KOAgendaView() | 534 | KOAgendaView::~KOAgendaView() |
529 | { | 535 | { |
530 | delete mAgendaPopup; | 536 | delete mAgendaPopup; |
531 | delete mAllDayAgendaPopup; | 537 | delete mAllDayAgendaPopup; |
532 | delete KOAgendaItem::paintPix(); | 538 | delete KOAgendaItem::paintPix(); |
533 | delete KOAgendaItem::paintPixSel(); | 539 | delete KOAgendaItem::paintPixSel(); |
534 | } | 540 | } |
535 | void KOAgendaView::resizeEvent( QResizeEvent* e ) | 541 | void KOAgendaView::resizeEvent( QResizeEvent* e ) |
536 | { | 542 | { |
537 | //qDebug("KOAgendaView::resizeEvent( QResizeEvent* e ) %d ", e->size().width()); | 543 | //qDebug("KOAgendaView::resizeEvent( QResizeEvent* e ) %d ", e->size().width()); |
538 | bool uc = false; | 544 | bool uc = false; |
539 | int ow = e->oldSize().width(); | 545 | int ow = e->oldSize().width(); |
540 | int oh = e->oldSize().height(); | 546 | int oh = e->oldSize().height(); |
541 | int w = e->size().width(); | 547 | int w = e->size().width(); |
542 | int h = e->size().height(); | 548 | int h = e->size().height(); |
543 | if ( (ow > oh && w< h ) || (ow < oh && w > h ) ) { | 549 | if ( (ow > oh && w< h ) || (ow < oh && w > h ) ) { |
544 | if ( ! mBlockUpdating && !globalFlagBlockStartup && !globalFlagBlockAgenda ) | 550 | if ( ! mBlockUpdating && !globalFlagBlockStartup && !globalFlagBlockAgenda ) |
545 | uc = true; | 551 | uc = true; |
546 | //qDebug("view changed %d %d %d %d ", ow, oh , w , h); | 552 | //qDebug("view changed %d %d %d %d ", ow, oh , w , h); |
547 | } | 553 | } |
548 | mUpcomingWidth = e->size().width() ; | 554 | mUpcomingWidth = e->size().width() ; |
549 | if ( mBlockUpdating || uc ) { | 555 | if ( mBlockUpdating || uc ) { |
550 | mBlockUpdating = false; | 556 | mBlockUpdating = false; |
551 | //mAgenda->setMinimumSize(800 , 600 ); | 557 | //mAgenda->setMinimumSize(800 , 600 ); |
552 | //qDebug("mAgenda->resize+++++++++++++++ "); | 558 | //qDebug("mAgenda->resize+++++++++++++++ "); |
553 | updateConfig(); | 559 | updateConfig(); |
554 | //qDebug("KOAgendaView::Updating now possible "); | 560 | //qDebug("KOAgendaView::Updating now possible "); |
555 | } else | 561 | } else |
556 | createDayLabels(); | 562 | createDayLabels(); |
557 | //qDebug("resizeEvent end "); | 563 | //qDebug("resizeEvent end "); |
558 | 564 | ||
559 | } | 565 | } |
560 | void KOAgendaView::createDayLabels() | 566 | void KOAgendaView::createDayLabels() |
561 | { | 567 | { |
562 | 568 | ||
563 | if ( mBlockUpdating || globalFlagBlockLabel == 1) { | 569 | if ( mBlockUpdating || globalFlagBlockLabel == 1) { |
564 | // qDebug(" KOAgendaView::createDayLabels() blocked "); | 570 | // qDebug(" KOAgendaView::createDayLabels() blocked "); |
565 | return; | 571 | return; |
566 | 572 | ||
567 | } | 573 | } |
568 | int newHight; | 574 | int newHight; |
569 | 575 | ||
570 | // ### Before deleting and recreating we could check if mSelectedDates changed... | 576 | // ### Before deleting and recreating we could check if mSelectedDates changed... |
diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp index 0fea9be..59b864c 100644 --- a/korganizer/kowhatsnextview.cpp +++ b/korganizer/kowhatsnextview.cpp | |||
@@ -1,534 +1,545 @@ | |||
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 | 19 | ||
20 | #include <qlayout.h> | 20 | #include <qlayout.h> |
21 | #include <qtextbrowser.h> | 21 | #include <qtextbrowser.h> |
22 | #include <qtextcodec.h> | 22 | #include <qtextcodec.h> |
23 | #include <qfileinfo.h> | 23 | #include <qfileinfo.h> |
24 | #include <qlabel.h> | 24 | #include <qlabel.h> |
25 | 25 | ||
26 | #include <qapplication.h> | 26 | #include <qapplication.h> |
27 | 27 | ||
28 | #include <kglobal.h> | 28 | #include <kglobal.h> |
29 | #include <klocale.h> | 29 | #include <klocale.h> |
30 | #include <kdebug.h> | 30 | #include <kdebug.h> |
31 | #include <kiconloader.h> | 31 | #include <kiconloader.h> |
32 | #include <kmessagebox.h> | 32 | #include <kmessagebox.h> |
33 | 33 | ||
34 | #include <libkcal/calendar.h> | 34 | #include <libkcal/calendar.h> |
35 | 35 | ||
36 | #ifndef KORG_NOPRINTER | 36 | #ifndef KORG_NOPRINTER |
37 | #include "calprinter.h" | 37 | #include "calprinter.h" |
38 | #endif | 38 | #endif |
39 | #include "koglobals.h" | 39 | #include "koglobals.h" |
40 | #include "koprefs.h" | 40 | #include "koprefs.h" |
41 | #include "koeventviewerdialog.h" | 41 | #include "koeventviewerdialog.h" |
42 | 42 | #include <qstylesheet.h> | |
43 | #include "kowhatsnextview.h" | 43 | #include "kowhatsnextview.h" |
44 | using namespace KOrg; | 44 | using namespace KOrg; |
45 | 45 | ||
46 | void WhatsNextTextBrowser::setSource(const QString& n) | 46 | void WhatsNextTextBrowser::setSource(const QString& n) |
47 | { | 47 | { |
48 | 48 | ||
49 | if (n.startsWith("event:")) { | 49 | if (n.startsWith("event:")) { |
50 | emit showIncidence(n); | 50 | emit showIncidence(n); |
51 | return; | 51 | return; |
52 | } else if (n.startsWith("todo:")) { | 52 | } else if (n.startsWith("todo:")) { |
53 | emit showIncidence(n); | 53 | emit showIncidence(n); |
54 | return; | 54 | return; |
55 | } else { | 55 | } else { |
56 | QTextBrowser::setSource(n); | 56 | QTextBrowser::setSource(n); |
57 | } | 57 | } |
58 | } | 58 | } |
59 | 59 | ||
60 | KOWhatsNextView::KOWhatsNextView(Calendar *calendar, QWidget *parent, | 60 | KOWhatsNextView::KOWhatsNextView(Calendar *calendar, QWidget *parent, |
61 | const char *name) | 61 | const char *name) |
62 | : KOrg::BaseView(calendar, parent, name) | 62 | : KOrg::BaseView(calendar, parent, name) |
63 | { | 63 | { |
64 | // mDateLabel = | 64 | // mDateLabel = |
65 | // new QLabel(KGlobal::locale()->formatDate(QDate::currentDate()),this); | 65 | // new QLabel(KGlobal::locale()->formatDate(QDate::currentDate()),this); |
66 | // mDateLabel->setMargin(2); | 66 | // mDateLabel->setMargin(2); |
67 | // mDateLabel->setAlignment(AlignCenter); | 67 | // mDateLabel->setAlignment(AlignCenter); |
68 | setFont( KOPrefs::instance()->mWhatsNextFont ); | 68 | setFont( KOPrefs::instance()->mWhatsNextFont ); |
69 | mView = new WhatsNextTextBrowser(this); | 69 | mView = new WhatsNextTextBrowser(this); |
70 | connect(mView,SIGNAL(showIncidence(const QString &)),SLOT(showIncidence(const QString &))); | 70 | connect(mView,SIGNAL(showIncidence(const QString &)),SLOT(showIncidence(const QString &))); |
71 | 71 | QStyleSheet* stsh = mView->styleSheet(); | |
72 | QStyleSheetItem * style ; | ||
73 | |||
74 | style = stsh->item ("h2" ); | ||
75 | if ( style ) { | ||
76 | style->setMargin(QStyleSheetItem::MarginAll,0); | ||
77 | } | ||
78 | style = stsh->item ("table" ); | ||
79 | if ( style ) { | ||
80 | style->setMargin(QStyleSheetItem::MarginAll,0); | ||
81 | } | ||
72 | mEventViewer = 0; | 82 | mEventViewer = 0; |
73 | 83 | ||
74 | QBoxLayout *topLayout = new QVBoxLayout(this); | 84 | QBoxLayout *topLayout = new QVBoxLayout(this); |
75 | // topLayout->addWidget(mDateLabel); | 85 | // topLayout->addWidget(mDateLabel); |
76 | topLayout->addWidget(mView); | 86 | topLayout->addWidget(mView); |
77 | mTimer = new QTimer( this ); | 87 | mTimer = new QTimer( this ); |
78 | connect(mTimer,SIGNAL( timeout() ),this, SLOT(updateView())); | 88 | connect(mTimer,SIGNAL( timeout() ),this, SLOT(updateView())); |
79 | 89 | ||
80 | connect(mView->horizontalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer())); | 90 | connect(mView->horizontalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer())); |
81 | connect(mView->verticalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer())); | 91 | connect(mView->verticalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer())); |
82 | } | 92 | } |
83 | 93 | ||
84 | KOWhatsNextView::~KOWhatsNextView() | 94 | KOWhatsNextView::~KOWhatsNextView() |
85 | { | 95 | { |
86 | } | 96 | } |
87 | 97 | ||
88 | int KOWhatsNextView::maxDatesHint() | 98 | int KOWhatsNextView::maxDatesHint() |
89 | { | 99 | { |
90 | return 0; | 100 | return 0; |
91 | } | 101 | } |
92 | 102 | ||
93 | int KOWhatsNextView::currentDateCount() | 103 | int KOWhatsNextView::currentDateCount() |
94 | { | 104 | { |
95 | return 0; | 105 | return 0; |
96 | } | 106 | } |
97 | 107 | ||
98 | QPtrList<Incidence> KOWhatsNextView::selectedIncidences() | 108 | QPtrList<Incidence> KOWhatsNextView::selectedIncidences() |
99 | { | 109 | { |
100 | QPtrList<Incidence> eventList; | 110 | QPtrList<Incidence> eventList; |
101 | 111 | ||
102 | return eventList; | 112 | return eventList; |
103 | } | 113 | } |
104 | 114 | ||
105 | 115 | ||
106 | void KOWhatsNextView::printPreview(CalPrinter *calPrinter, const QDate &fd, | 116 | void KOWhatsNextView::printPreview(CalPrinter *calPrinter, const QDate &fd, |
107 | const QDate &td) | 117 | const QDate &td) |
108 | { | 118 | { |
109 | #ifndef KORG_NOPRINTER | 119 | #ifndef KORG_NOPRINTER |
110 | calPrinter->preview(CalPrinter::Day, fd, td); | 120 | calPrinter->preview(CalPrinter::Day, fd, td); |
111 | #endif | 121 | #endif |
112 | } | 122 | } |
113 | void KOWhatsNextView::updateConfig() | 123 | void KOWhatsNextView::updateConfig() |
114 | { | 124 | { |
115 | setFont( KOPrefs::instance()->mWhatsNextFont ); | 125 | setFont( KOPrefs::instance()->mWhatsNextFont ); |
116 | updateView(); | 126 | updateView(); |
117 | 127 | ||
118 | } | 128 | } |
119 | void KOWhatsNextView::showEvent ( QShowEvent * e ) | 129 | void KOWhatsNextView::showEvent ( QShowEvent * e ) |
120 | { | 130 | { |
121 | //qDebug("KOWhatsNextView::showEvent "); | 131 | //qDebug("KOWhatsNextView::showEvent "); |
122 | restartTimer(); | 132 | restartTimer(); |
123 | QWidget::showEvent ( e ); | 133 | QWidget::showEvent ( e ); |
124 | } | 134 | } |
125 | void KOWhatsNextView::hideEvent ( QHideEvent * e) | 135 | void KOWhatsNextView::hideEvent ( QHideEvent * e) |
126 | { | 136 | { |
127 | //qDebug(" KOWhatsNextView::hideEvent"); | 137 | //qDebug(" KOWhatsNextView::hideEvent"); |
128 | mTimer->stop(); | 138 | mTimer->stop(); |
129 | QWidget::hideEvent ( e ); | 139 | QWidget::hideEvent ( e ); |
130 | } | 140 | } |
131 | void KOWhatsNextView::restartTimer() | 141 | void KOWhatsNextView::restartTimer() |
132 | { | 142 | { |
133 | //qDebug("KOWhatsNextView::restartTimer() "); | 143 | //qDebug("KOWhatsNextView::restartTimer() "); |
134 | mTimer->start( 300000 ); | 144 | mTimer->start( 300000 ); |
135 | //mTimer->start( 5000 ); | 145 | //mTimer->start( 5000 ); |
136 | } | 146 | } |
137 | void KOWhatsNextView::updateView() | 147 | void KOWhatsNextView::updateView() |
138 | { | 148 | { |
139 | if ( mTimer->isActive() ) | 149 | if ( mTimer->isActive() ) |
140 | restartTimer(); | 150 | restartTimer(); |
141 | //qDebug("KOWhatsNextView::updateView() "); | 151 | //qDebug("KOWhatsNextView::updateView() "); |
142 | // mDateLabel->setText(KGlobal::locale()->formatDate(QDate::currentDate())); | 152 | // mDateLabel->setText(KGlobal::locale()->formatDate(QDate::currentDate())); |
143 | KIconLoader kil("korganizer"); | 153 | KIconLoader kil("korganizer"); |
144 | QString ipath;// = new QString(); | 154 | QString ipath;// = new QString(); |
145 | // kil.loadIcon("korganizer",KIcon::NoGroup,32,KIcon::DefaultState,&ipath); | 155 | // kil.loadIcon("korganizer",KIcon::NoGroup,32,KIcon::DefaultState,&ipath); |
146 | //<big><big><strong>" + date + "</strong></big></big>\n"; | 156 | //<big><big><strong>" + date + "</strong></big></big>\n"; |
147 | mText = "<table width=\"100%\">\n"; | 157 | mText = "<qt><table width=\"100%\">\n"; |
148 | //mText += "<tr bgcolor=\"#3679AD\"><td><h2>"; | 158 | //mText += "<tr bgcolor=\"#3679AD\"><td><h2>"; |
149 | #ifdef DESKTOP_VERSION | 159 | #ifdef DESKTOP_VERSION |
150 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h1>"; | 160 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h1>"; |
151 | #else | 161 | #else |
152 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h2>"; | 162 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h2>"; |
153 | #endif | 163 | #endif |
154 | // mText += "<img src=\""; | 164 | // mText += "<img src=\""; |
155 | // mText += ipath; | 165 | // mText += ipath; |
156 | // mText += "\">"; | 166 | // mText += "\">"; |
157 | mEventDate = QDate::currentDate(); | 167 | mEventDate = QDate::currentDate(); |
158 | #ifdef DESKTOP_VERSION | 168 | #ifdef DESKTOP_VERSION |
159 | mText += "<font color=\"#FFFFFF\"> <em>" + KGlobal::locale()->formatDate( mEventDate , false )+"</em></font></h1>"; | 169 | mText += "<font color=\"#FFFFFF\"> <em>" + KGlobal::locale()->formatDate( mEventDate , false )+"</em></font></h1>"; |
160 | #else | 170 | #else |
161 | mText += "<font color=\"#FFFFFF\"> <em>" + KGlobal::locale()->formatDate( mEventDate , false )+"</em></font></h2>"; | 171 | mText += "<font color=\"#FFFFFF\"> <em>" + KGlobal::locale()->formatDate( mEventDate , false )+"</em></font></h2>"; |
162 | #endif | 172 | #endif |
163 | mText += "</td></tr>\n<tr bgcolor=\"#EAF8FA\"><td>"; | 173 | mText += "</td></tr>\n<tr bgcolor=\"#EAF8FA\"><td>"; |
164 | int iii; | 174 | int iii; |
165 | mTodos.clear(); | 175 | mTodos.clear(); |
166 | QPtrList<Event> events; | 176 | QPtrList<Event> events; |
167 | QPtrList<Todo> todos = calendar()->todos(); | 177 | QPtrList<Todo> todos = calendar()->todos(); |
168 | Todo * todo; | 178 | Todo * todo; |
169 | //mText += "<h2>" + i18n("Events: ") + "</h2>\n"; | 179 | //mText += "<h2>" + i18n("Events: ") + "</h2>\n"; |
170 | int daysToShow = KOPrefs::instance()->mWhatsNextDays ; | 180 | int daysToShow = KOPrefs::instance()->mWhatsNextDays ; |
171 | bool itemAdded = false; | 181 | bool itemAdded = false; |
172 | for ( iii = 0; iii < daysToShow; ++iii ) { | 182 | for ( iii = 0; iii < daysToShow; ++iii ) { |
173 | QString date; | 183 | QString date; |
174 | itemAdded = false; | 184 | itemAdded = false; |
175 | events = calendar()->events( mEventDate, true ); | 185 | events = calendar()->events( mEventDate, true ); |
176 | 186 | ||
177 | if ( iii == 0 ) { // today !!! | 187 | if ( iii == 0 ) { // today !!! |
178 | todo = todos.first(); | 188 | todo = todos.first(); |
179 | while(todo) { | 189 | while(todo) { |
180 | if ( !todo->isCompleted() &&todo->hasDueDate() && todo->dtDue().date() < mEventDate ) { | 190 | if ( !todo->isCompleted() &&todo->hasDueDate() && todo->dtDue().date() < mEventDate ) { |
181 | if ( ! itemAdded ) { | 191 | if ( ! itemAdded ) { |
182 | appendDay ( iii, mEventDate ); | 192 | appendDay ( iii, mEventDate ); |
183 | itemAdded = true; | 193 | itemAdded = true; |
184 | 194 | ||
185 | } | 195 | } |
186 | appendEvent(todo); | 196 | appendEvent(todo); |
187 | } | 197 | } |
188 | todo = todos.next(); | 198 | todo = todos.next(); |
189 | } | 199 | } |
190 | } | 200 | } |
191 | 201 | ||
192 | 202 | ||
193 | if (events.count() > 0) { | 203 | if (events.count() > 0) { |
194 | // mText += "<p></p>"; | 204 | // mText += "<p></p>"; |
195 | // kil.loadIcon("month",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); | 205 | // kil.loadIcon("month",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); |
196 | // mText += "<h2>"; | 206 | // mText += "<h2>"; |
197 | //mText += " <img src=\""; | 207 | //mText += " <img src=\""; |
198 | //mText += ipath; | 208 | //mText += ipath; |
199 | //mText += "\">"; | 209 | //mText += "\">"; |
200 | if ( ! itemAdded ) { | 210 | if ( ! itemAdded ) { |
201 | appendDay ( iii, mEventDate ); | 211 | appendDay ( iii, mEventDate ); |
202 | itemAdded = true; | 212 | itemAdded = true; |
203 | 213 | ||
204 | } | 214 | } |
205 | Event *ev = events.first(); | 215 | Event *ev = events.first(); |
206 | while(ev) { | 216 | while(ev) { |
207 | //qDebug("+++++event append %s", ev->summary().latin1()); | 217 | //qDebug("+++++event append %s", ev->summary().latin1()); |
208 | if ( true /*!ev->recurrence()->doesRecur() || ev->recursOn( mEventDate)*/) { | 218 | if ( true /*!ev->recurrence()->doesRecur() || ev->recursOn( mEventDate)*/) { |
209 | appendEvent(ev, false , iii!= 0 ); | 219 | appendEvent(ev, false , iii!= 0 ); |
210 | } | 220 | } |
211 | ev = events.next(); | 221 | ev = events.next(); |
212 | } | 222 | } |
213 | 223 | ||
214 | //mText += "</table>\n"; | 224 | //mText += "</table>\n"; |
215 | } | 225 | } |
216 | 226 | ||
217 | todo = todos.first(); | 227 | todo = todos.first(); |
218 | while(todo) { | 228 | while(todo) { |
219 | if ( !todo->isCompleted() &&todo->hasDueDate() && todo->dtDue().date() == mEventDate ) { | 229 | if ( !todo->isCompleted() &&todo->hasDueDate() && todo->dtDue().date() == mEventDate ) { |
220 | if ( ! itemAdded ) { | 230 | if ( ! itemAdded ) { |
221 | appendDay ( iii, mEventDate ); | 231 | appendDay ( iii, mEventDate ); |
222 | itemAdded = true; | 232 | itemAdded = true; |
223 | } | 233 | } |
224 | appendEvent(todo); | 234 | appendEvent(todo); |
225 | } | 235 | } |
226 | todo = todos.next(); | 236 | todo = todos.next(); |
227 | } | 237 | } |
228 | if ( !itemAdded && iii == 0 ) { | 238 | if ( !itemAdded && iii == 0 ) { |
229 | // appendDay ( iii, mEventDate ); | 239 | // appendDay ( iii, mEventDate ); |
230 | //mText += "<table>"; | 240 | //mText += "<table>"; |
231 | // mText += "<b><font color=\"#000080\"><em>"+i18n("No event, nothing to do.") +"</em></font></b>\n"; | 241 | // mText += "<b><font color=\"#000080\"><em>"+i18n("No event, nothing to do.") +"</em></font></b>\n"; |
232 | mText += "<h3 align=\"center\"><font color=\"#008000\"><em>"+i18n("No event, nothing to do. ") +"</em></font></h3>\n"; | 242 | mText += "<h3 align=\"center\"><font color=\"#008000\"><em>"+i18n("No event, nothing to do. ") +"</em></font></h3>\n"; |
233 | //mText +="</table>"; | 243 | //mText +="</table>"; |
234 | } | 244 | } |
235 | if ( itemAdded ) | 245 | if ( itemAdded ) |
236 | mText += "</table>\n"; | 246 | mText += "</table>\n"; |
237 | mEventDate = mEventDate.addDays( 1 ); | 247 | mEventDate = mEventDate.addDays( 1 ); |
238 | } | 248 | } |
239 | 249 | ||
240 | int topmostPrios = KOPrefs::instance()->mWhatsNextPrios; | 250 | int topmostPrios = KOPrefs::instance()->mWhatsNextPrios; |
241 | if (todos.count() > 0 && topmostPrios > 0 ) { | 251 | if (todos.count() > 0 && topmostPrios > 0 ) { |
242 | // kil.loadIcon("todo",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); | 252 | // kil.loadIcon("todo",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); |
243 | // mText += "<h2>"; | 253 | // mText += "<h2>"; |
244 | //<img src=\""; | 254 | //<img src=\""; |
245 | // mText += ipath; | 255 | // mText += ipath; |
246 | // mText += "\">"; | 256 | // mText += "\">"; |
247 | // mText += i18n("Overdue To-Do:") + "</h2>\n"; | 257 | // mText += i18n("Overdue To-Do:") + "</h2>\n"; |
248 | 258 | ||
249 | //mText += "<ul>\n"; | 259 | //mText += "<ul>\n"; |
250 | bool gotone = false; | 260 | bool gotone = false; |
251 | int priority = 1; | 261 | int priority = 1; |
252 | int priosFound = 0; | 262 | int priosFound = 0; |
253 | #ifdef DESKTOP_VERSION | 263 | #ifdef DESKTOP_VERSION |
254 | mText +="<p></p>"; | 264 | mText +="<p></p>"; |
255 | #endif | 265 | #endif |
256 | 266 | ||
257 | mText +="<big><big><strong><em><font color=\"#000080\">" + i18n("Incomplete Todo:") + "</font></em></strong></big></big>\n"; | 267 | mText +="<big><big><strong><em><font color=\"#000080\">" + i18n("Incomplete Todo:") + "</font></em></strong></big></big>\n"; |
258 | mText += "<ul>\n"; | 268 | mText += "<ul>\n"; |
259 | while (!gotone && priority<6) { | 269 | while (!gotone && priority<6) { |
260 | todo = todos.first(); | 270 | todo = todos.first(); |
261 | while(todo) { | 271 | while(todo) { |
262 | if (!todo->isCompleted() && (todo->priority() == priority) ) { | 272 | if (!todo->isCompleted() && (todo->priority() == priority) ) { |
263 | if ( appendTodo(todo) ) | 273 | if ( appendTodo(todo) ) |
264 | gotone = true; | 274 | gotone = true; |
265 | } | 275 | } |
266 | todo = todos.next(); | 276 | todo = todos.next(); |
267 | } | 277 | } |
268 | if ( gotone ) { | 278 | if ( gotone ) { |
269 | gotone = false; | 279 | gotone = false; |
270 | ++priosFound; | 280 | ++priosFound; |
271 | if ( priosFound == topmostPrios ) | 281 | if ( priosFound == topmostPrios ) |
272 | break; | 282 | break; |
273 | } | 283 | } |
274 | priority++; | 284 | priority++; |
275 | // kdDebug() << "adding the todos..." << endl; | 285 | // kdDebug() << "adding the todos..." << endl; |
276 | } | 286 | } |
277 | mText += "</ul>\n"; | 287 | mText += "</ul>\n"; |
278 | } | 288 | } |
279 | 289 | ||
280 | int replys = 0; | 290 | int replys = 0; |
281 | events = calendar()->events(QDate::currentDate(), QDate(2975,12,6)); | 291 | events = calendar()->events(QDate::currentDate(), QDate(2975,12,6)); |
282 | if (events.count() > 0) { | 292 | if (events.count() > 0) { |
283 | Event *ev = events.first(); | 293 | Event *ev = events.first(); |
284 | while(ev) { | 294 | while(ev) { |
285 | Attendee *me = ev->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); | 295 | Attendee *me = ev->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); |
286 | if (me!=0) { | 296 | if (me!=0) { |
287 | if (me->status()==Attendee::NeedsAction && me->RSVP()) { | 297 | if (me->status()==Attendee::NeedsAction && me->RSVP()) { |
288 | if (replys == 0) { | 298 | if (replys == 0) { |
289 | mText += "<p></p>"; | 299 | mText += "<p></p>"; |
290 | // kil.loadIcon("reply",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); | 300 | // kil.loadIcon("reply",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); |
291 | //mText += "<h2>"; | 301 | //mText += "<h2>"; |
292 | //<img src=\""; | 302 | //<img src=\""; |
293 | // mText += ipath; | 303 | // mText += ipath; |
294 | // mText += "\">"; | 304 | // mText += "\">"; |
295 | //mText += i18n("Events and To-Dos that need a reply:") + "</h2>\n"; | 305 | //mText += i18n("Events and To-Dos that need a reply:") + "</h2>\n"; |
296 | mText +="<big><big><strong><em><font color=\"#000080\">" + i18n("Events and To-Dos that need a reply:") + "</font></em></strong></big></big>\n"; | 306 | mText +="<big><big><strong><em><font color=\"#000080\">" + i18n("Events and To-Dos that need a reply:") + "</font></em></strong></big></big>\n"; |
297 | mText += "<table>\n"; | 307 | mText += "<table>\n"; |
298 | } | 308 | } |
299 | replys++; | 309 | replys++; |
300 | appendEvent(ev,true); | 310 | appendEvent(ev,true); |
301 | } | 311 | } |
302 | } | 312 | } |
303 | ev = events.next(); | 313 | ev = events.next(); |
304 | } | 314 | } |
305 | } | 315 | } |
306 | todos = calendar()->todos(); | 316 | todos = calendar()->todos(); |
307 | if (todos.count() > 0) { | 317 | if (todos.count() > 0) { |
308 | Todo *to = todos.first(); | 318 | Todo *to = todos.first(); |
309 | while(to) { | 319 | while(to) { |
310 | if ( !to->isCompleted() ){ | 320 | if ( !to->isCompleted() ){ |
311 | Attendee *me = to->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); | 321 | Attendee *me = to->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); |
312 | if (me!=0) { | 322 | if (me!=0) { |
313 | if (me->status()==Attendee::NeedsAction && me->RSVP()) { | 323 | if (me->status()==Attendee::NeedsAction && me->RSVP()) { |
314 | if (replys == 0) { | 324 | if (replys == 0) { |
315 | mText +="<big><big><strong><em><font color=\"#000080\">" + i18n("Events and To-Dos that need a reply:") + "</font></em></strong></big></big>\n"; | 325 | mText +="<big><big><strong><em><font color=\"#000080\">" + i18n("Events and To-Dos that need a reply:") + "</font></em></strong></big></big>\n"; |
316 | mText += "<table>\n"; | 326 | mText += "<table>\n"; |
317 | } | 327 | } |
318 | replys++; | 328 | replys++; |
319 | appendEvent(to, true); | 329 | appendEvent(to, true); |
320 | } | 330 | } |
321 | } | 331 | } |
322 | } | 332 | } |
323 | to = todos.next(); | 333 | to = todos.next(); |
324 | } | 334 | } |
325 | } | 335 | } |
326 | if (replys > 0 ) mText += "</table>\n"; | 336 | if (replys > 0 ) mText += "</table>\n"; |
327 | 337 | ||
328 | 338 | ||
329 | mText += "</td></tr>\n</table>\n"; | 339 | mText += "</td></tr>\n</table></qt>\n"; |
330 | 340 | ||
331 | mView->setText(mText); | 341 | mView->setText(mText); |
332 | mView->setFocus(); | 342 | mView->setFocus(); |
333 | 343 | ||
334 | // QPixmap bPix = SmallIcon( "back" ); | 344 | // QPixmap bPix = SmallIcon( "back" ); |
335 | // qDebug("xxxxxxxxxxxxxxxxxxxxx "); | 345 | // qDebug("xxxxxxxxxxxxxxxxxxxxx "); |
336 | // QWidget* test = new QWidget(); | 346 | // QWidget* test = new QWidget(); |
337 | // test->setBackgroundMode(FixedPixmap ); | 347 | // test->setBackgroundMode(FixedPixmap ); |
338 | // test->setBackgroundPixmap ( bPix ); | 348 | // test->setBackgroundPixmap ( bPix ); |
339 | // test->resize( 300, 400 ); | 349 | // test->resize( 300, 400 ); |
340 | // test->show(); | 350 | // test->show(); |
341 | // mView->setBackgroundMode(FixedPixmap ); | 351 | // mView->setBackgroundMode(FixedPixmap ); |
342 | // mView->setBackgroundPixmap ( bPix ); | 352 | // mView->setBackgroundPixmap ( bPix ); |
353 | qDebug("%s ",mText.latin1()); | ||
343 | } | 354 | } |
344 | 355 | ||
345 | void KOWhatsNextView::appendDay( int i, QDate eventDate ) | 356 | void KOWhatsNextView::appendDay( int i, QDate eventDate ) |
346 | { | 357 | { |
347 | QString date; | 358 | QString date; |
348 | QString day = KGlobal::locale()->formatDate( eventDate , KOPrefs::instance()->mShortDateInViewer); | 359 | QString day = KGlobal::locale()->formatDate( eventDate , KOPrefs::instance()->mShortDateInViewer); |
349 | if ( ! KOPrefs::instance()->mShortDateInViewer && QApplication::desktop()->width() < 320 ) { | 360 | if ( ! KOPrefs::instance()->mShortDateInViewer && QApplication::desktop()->width() < 320 ) { |
350 | if ( i == 0 ) { | 361 | if ( i == 0 ) { |
351 | mText += "<table>\n"; | 362 | mText += "<table>\n"; |
352 | return;//date = "<em><font color=\"#008000\"><em>" + day+"</font></em>"; | 363 | return;//date = "<em><font color=\"#008000\"><em>" + day+"</font></em>"; |
353 | } | 364 | } |
354 | else if ( i == 1 ) | 365 | else if ( i == 1 ) |
355 | date = "<em><font color=\"#000080\">" + day + "</font></em>" ; | 366 | date = "<em><font color=\"#000080\">" + day + "</font></em>" ; |
356 | else date = "<em><font color=\"#000080\">" + day + "</font></em>"; | 367 | else date = "<em><font color=\"#000080\">" + day + "</font></em>"; |
357 | //mText += "<h2>" + date + "</h2>\n"; | 368 | //mText += "<h2>" + date + "</h2>\n"; |
358 | mText += "<big><big><strong>" + date + "</strong></big></big>\n"; | 369 | mText += "<big><big><strong>" + date + "</strong></big></big>\n"; |
359 | mText += "<table>\n"; | 370 | mText += "<table>\n"; |
360 | 371 | ||
361 | 372 | ||
362 | 373 | ||
363 | } else { | 374 | } else { |
364 | if ( i == 0 ) { | 375 | if ( i == 0 ) { |
365 | mText += "<table>\n"; | 376 | mText += "<table>\n"; |
366 | return;// date = "<font color=\"#008000\"><em>" +i18n("Today: ") +"</em>" + day+"</font>"; | 377 | return;// date = "<font color=\"#008000\"><em>" +i18n("Today: ") +"</em>" + day+"</font>"; |
367 | } | 378 | } |
368 | 379 | ||
369 | #ifdef DESKTOP_VERSION | 380 | #ifdef DESKTOP_VERSION |
370 | else if ( i == 1 ) { | 381 | else if ( i == 1 ) { |
371 | date = "<h2><em><font color=\"#000080\">" + i18n("Tomorrow: ") + day +"</font></em></h2>" ; | 382 | date = "<h2><em><font color=\"#000080\">" + i18n("Tomorrow: ") + day +"</font></em></h2>" ; |
372 | } | 383 | } |
373 | else date = "<h2><em><font color=\"#000080\">" + i18n("In %1 days: ").arg( i ) +day + "</font></em></h2>"; | 384 | else date = "<h2><em><font color=\"#000080\">" + i18n("In %1 days: ").arg( i ) +day + "</font></em></h2>"; |
374 | #else | 385 | #else |
375 | else if ( i == 1 ) { | 386 | else if ( i == 1 ) { |
376 | date = "<em><font color=\"#000080\">" + i18n("Tomorrow: ") + day +"</font></em>" ; | 387 | date = "<em><font color=\"#000080\">" + i18n("Tomorrow: ") + day +"</font></em>" ; |
377 | } | 388 | } |
378 | else date = "<em><font color=\"#000080\">" + i18n("In %1 days: ").arg( i ) +day + "</font></em>"; | 389 | else date = "<em><font color=\"#000080\">" + i18n("In %1 days: ").arg( i ) +day + "</font></em>"; |
379 | 390 | ||
380 | #endif | 391 | #endif |
381 | //mText += "<h2>" + date + "</h2>\n"; | 392 | //mText += "<h2>" + date + "</h2>\n"; |
382 | mText += "<big><big><strong>" + date + "</strong></big></big>\n"; | 393 | mText += "<big><big><strong>" + date + "</strong></big></big>\n"; |
383 | mText += "<table>\n"; | 394 | mText += "<table>\n"; |
384 | } | 395 | } |
385 | } | 396 | } |
386 | 397 | ||
387 | 398 | ||
388 | void KOWhatsNextView::showDates(const QDate &, const QDate &) | 399 | void KOWhatsNextView::showDates(const QDate &, const QDate &) |
389 | { | 400 | { |
390 | updateView(); | 401 | updateView(); |
391 | } | 402 | } |
392 | 403 | ||
393 | void KOWhatsNextView::showEvents(QPtrList<Event>) | 404 | void KOWhatsNextView::showEvents(QPtrList<Event>) |
394 | { | 405 | { |
395 | } | 406 | } |
396 | 407 | ||
397 | void KOWhatsNextView::changeEventDisplay(Event *, int action) | 408 | void KOWhatsNextView::changeEventDisplay(Event *, int action) |
398 | { | 409 | { |
399 | switch(action) { | 410 | switch(action) { |
400 | case KOGlobals::EVENTADDED: | 411 | case KOGlobals::EVENTADDED: |
401 | updateView(); | 412 | updateView(); |
402 | break; | 413 | break; |
403 | case KOGlobals::EVENTEDITED: | 414 | case KOGlobals::EVENTEDITED: |
404 | updateView(); | 415 | updateView(); |
405 | break; | 416 | break; |
406 | case KOGlobals::EVENTDELETED: | 417 | case KOGlobals::EVENTDELETED: |
407 | updateView(); | 418 | updateView(); |
408 | break; | 419 | break; |
409 | default: | 420 | default: |
410 | updateView(); | 421 | updateView(); |
411 | kdDebug() << "KOWhatsNextView::changeEventDisplay(): Illegal action " << action << endl; | 422 | kdDebug() << "KOWhatsNextView::changeEventDisplay(): Illegal action " << action << endl; |
412 | } | 423 | } |
413 | } | 424 | } |
414 | 425 | ||
415 | void KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed ) | 426 | void KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed ) |
416 | { | 427 | { |
417 | if ( !KOPrefs::instance()->mShowSyncEvents && ev->uid().left(15) == QString("last-syncEvent-") ) | 428 | if ( !KOPrefs::instance()->mShowSyncEvents && ev->uid().left(15) == QString("last-syncEvent-") ) |
418 | return; | 429 | return; |
419 | QDateTime cdt = QDateTime::currentDateTime(); | 430 | QDateTime cdt = QDateTime::currentDateTime(); |
420 | QDateTime noc; | 431 | QDateTime noc; |
421 | bool ok = true; | 432 | bool ok = true; |
422 | if ( reply ) { | 433 | if ( reply ) { |
423 | noc = ev->getNextOccurence( cdt, &ok ); | 434 | noc = ev->getNextOccurence( cdt, &ok ); |
424 | if (! ok && ev->type() == "Event") | 435 | if (! ok && ev->type() == "Event") |
425 | return; | 436 | return; |
426 | } | 437 | } |
427 | mText += "<tr><td><b>"; | 438 | mText += "<tr><td><b>"; |
428 | if (ev->type()=="Event") { | 439 | if (ev->type()=="Event") { |
429 | if (reply) { | 440 | if (reply) { |
430 | if (!ev->doesFloat()) | 441 | if (!ev->doesFloat()) |
431 | mText += KGlobal::locale()->formatDateTime( noc , KOPrefs::instance()->mShortDateInViewer) +": "; | 442 | mText += KGlobal::locale()->formatDateTime( noc , KOPrefs::instance()->mShortDateInViewer) +": "; |
432 | else | 443 | else |
433 | mText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": "; | 444 | mText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": "; |
434 | 445 | ||
435 | } else { | 446 | } else { |
436 | if (!ev->doesFloat()) { | 447 | if (!ev->doesFloat()) { |
437 | Event *event = static_cast<Event *>(ev); | 448 | Event *event = static_cast<Event *>(ev); |
438 | QDateTime st,end; | 449 | QDateTime st,end; |
439 | if ( event->recurrence()->doesRecur() ) { | 450 | if ( event->recurrence()->doesRecur() ) { |
440 | QDate recDate= mEventDate; | 451 | QDate recDate= mEventDate; |
441 | int days = event->dtStart().date().daysTo (event->dtEnd().date() ); | 452 | int days = event->dtStart().date().daysTo (event->dtEnd().date() ); |
442 | while ( ! event->recursOn( recDate ) ) { | 453 | while ( ! event->recursOn( recDate ) ) { |
443 | recDate = recDate.addDays( -1 ); | 454 | recDate = recDate.addDays( -1 ); |
444 | 455 | ||
445 | } | 456 | } |
446 | st = QDateTime ( recDate, event->dtStart().time() ); | 457 | st = QDateTime ( recDate, event->dtStart().time() ); |
447 | end = QDateTime ( recDate.addDays( days ), event->dtEnd().time() ); | 458 | end = QDateTime ( recDate.addDays( days ), event->dtEnd().time() ); |
448 | } | 459 | } |
449 | else { | 460 | else { |
450 | st = event->dtStart(); | 461 | st = event->dtStart(); |
451 | end = event->dtEnd(); | 462 | end = event->dtEnd(); |
452 | } | 463 | } |
453 | 464 | ||
454 | 465 | ||
455 | QString dateText; | 466 | QString dateText; |
456 | // qDebug("%s %s %s %s ", mEventDate.toString().latin1(),event->summary().latin1(), st .toString().latin1(),end.toString().latin1() ); | 467 | // qDebug("%s %s %s %s ", mEventDate.toString().latin1(),event->summary().latin1(), st .toString().latin1(),end.toString().latin1() ); |
457 | if ( st.date() < mEventDate ) | 468 | if ( st.date() < mEventDate ) |
458 | dateText = "++:++-"; | 469 | dateText = "++:++-"; |
459 | else | 470 | else |
460 | dateText = event->dtStartTimeStr() + "-"; | 471 | dateText = event->dtStartTimeStr() + "-"; |
461 | if ( end.date() > mEventDate ) | 472 | if ( end.date() > mEventDate ) |
462 | dateText += "++:++"; | 473 | dateText += "++:++"; |
463 | else | 474 | else |
464 | dateText += event->dtEndTimeStr(); | 475 | dateText += event->dtEndTimeStr(); |
465 | if ( notRed ) | 476 | if ( notRed ) |
466 | mText += dateText; | 477 | mText += dateText; |
467 | else { | 478 | else { |
468 | if ( end < cdt ) | 479 | if ( end < cdt ) |
469 | mText += "<font color=\"#F00000\">" + dateText + "</font>"; | 480 | mText += "<font color=\"#F00000\">" + dateText + "</font>"; |
470 | else if ( st < cdt ) | 481 | else if ( st < cdt ) |
471 | mText += "<font color=\"#008000\">" + dateText + "</font>"; | 482 | mText += "<font color=\"#008000\">" + dateText + "</font>"; |
472 | else | 483 | else |
473 | mText += dateText; | 484 | mText += dateText; |
474 | 485 | ||
475 | } | 486 | } |
476 | 487 | ||
477 | } else { | 488 | } else { |
478 | mText += i18n("Allday:"); | 489 | mText += i18n("Allday:"); |
479 | 490 | ||
480 | } | 491 | } |
481 | } | 492 | } |
482 | } else { | 493 | } else { |
483 | mTodos.append( ev ); | 494 | mTodos.append( ev ); |
484 | mText += i18n("ToDo:"); | 495 | mText += i18n("ToDo:"); |
485 | if (reply) { | 496 | if (reply) { |
486 | mText += " "; | 497 | mText += " "; |
487 | if ( noc != cdt ) { | 498 | if ( noc != cdt ) { |
488 | mText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": "; | 499 | mText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": "; |
489 | } | 500 | } |
490 | } else { | 501 | } else { |
491 | if ( ((Todo*)ev)->dtDue().date() < QDate::currentDate() ) { | 502 | if ( ((Todo*)ev)->dtDue().date() < QDate::currentDate() ) { |
492 | // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; | 503 | // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; |
493 | QString dfs = KGlobal::locale()->dateFormatShort(); | 504 | QString dfs = KGlobal::locale()->dateFormatShort(); |
494 | KGlobal::locale()->setDateFormatShort("%d.%b"); | 505 | KGlobal::locale()->setDateFormatShort("%d.%b"); |
495 | mText +="<font color=\"#F00000\">" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + "</font>"; | 506 | mText +="<font color=\"#F00000\">" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + "</font>"; |
496 | KGlobal::locale()->setDateFormatShort(dfs); | 507 | KGlobal::locale()->setDateFormatShort(dfs); |
497 | } else { | 508 | } else { |
498 | if (!ev->doesFloat() ) | 509 | if (!ev->doesFloat() ) |
499 | if( ( (Todo*)ev)->dtDue() < cdt ) { | 510 | if( ( (Todo*)ev)->dtDue() < cdt ) { |
500 | mText +="<font color=\"#F00000\">" + ((Todo*)ev)->dtDueTimeStr() + "</font>"; | 511 | mText +="<font color=\"#F00000\">" + ((Todo*)ev)->dtDueTimeStr() + "</font>"; |
501 | 512 | ||
502 | 513 | ||
503 | } else | 514 | } else |
504 | mText +=((Todo*)ev)->dtDueTimeStr(); | 515 | mText +=((Todo*)ev)->dtDueTimeStr(); |
505 | mTodos.append( ev ); | 516 | mTodos.append( ev ); |
506 | } | 517 | } |
507 | } | 518 | } |
508 | } | 519 | } |
509 | mText += "</b></td><td>"; | 520 | mText += "</b></td><td>"; |
510 | bool needClose = false; | 521 | bool needClose = false; |
511 | if ( ev->cancelled() ) { | 522 | if ( ev->cancelled() ) { |
512 | mText += "<font color=\"#F00000\">[c"; | 523 | mText += "<font color=\"#F00000\">[c"; |
513 | needClose =true; | 524 | needClose =true; |
514 | 525 | ||
515 | } | 526 | } |
516 | if ( ev->isAlarmEnabled() ) { | 527 | if ( ev->isAlarmEnabled() ) { |
517 | if ( !needClose) | 528 | if ( !needClose) |
518 | mText +="["; | 529 | mText +="["; |
519 | mText += "a"; | 530 | mText += "a"; |
520 | needClose =true; | 531 | needClose =true; |
521 | 532 | ||
522 | } | 533 | } |
523 | if ( ev->description().length() > 0 ) { | 534 | if ( ev->description().length() > 0 ) { |
524 | if ( !needClose) | 535 | if ( !needClose) |
525 | mText +="["; | 536 | mText +="["; |
526 | mText += "i"; | 537 | mText += "i"; |
527 | needClose =true; | 538 | needClose =true; |
528 | } | 539 | } |
529 | if ( ev->recurrence()->doesRecur() ) { | 540 | if ( ev->recurrence()->doesRecur() ) { |
530 | if ( !needClose) | 541 | if ( !needClose) |
531 | mText +="["; | 542 | mText +="["; |
532 | mText += "r"; | 543 | mText += "r"; |
533 | needClose =true; | 544 | needClose =true; |
534 | } | 545 | } |
diff --git a/libkdepim/categoryeditdialog.cpp b/libkdepim/categoryeditdialog.cpp index f719c31..a19900f 100644 --- a/libkdepim/categoryeditdialog.cpp +++ b/libkdepim/categoryeditdialog.cpp | |||
@@ -1,135 +1,137 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkdepim. | 2 | This file is part of libkdepim. |
3 | Copyright (c) 2000, 2001, 2002 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000, 2001, 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 <qstringlist.h> | 24 | #include <qstringlist.h> |
25 | #include <qlineedit.h> | 25 | #include <qlineedit.h> |
26 | #include <qlistview.h> | 26 | #include <qlistview.h> |
27 | #include <qheader.h> | 27 | #include <qheader.h> |
28 | #include <qpushbutton.h> | 28 | #include <qpushbutton.h> |
29 | #include <qapplication.h> | 29 | #include <qapplication.h> |
30 | 30 | ||
31 | #include "kpimprefs.h" | 31 | #include "kpimprefs.h" |
32 | 32 | ||
33 | #include "categoryeditdialog.h" | 33 | #include "categoryeditdialog.h" |
34 | 34 | ||
35 | using namespace KPIM; | 35 | using namespace KPIM; |
36 | 36 | ||
37 | CategoryEditDialog::CategoryEditDialog( KPimPrefs *prefs, QWidget* parent, | 37 | CategoryEditDialog::CategoryEditDialog( KPimPrefs *prefs, QWidget* parent, |
38 | const char* name, bool modal, | 38 | const char* name, bool modal, |
39 | WFlags fl ) | 39 | WFlags fl ) |
40 | : CategoryEditDialog_base( parent, name, modal, fl ), | 40 | : CategoryEditDialog_base( parent, name, modal, fl ), |
41 | mPrefs( prefs ) | 41 | mPrefs( prefs ) |
42 | { | 42 | { |
43 | mCategories->header()->hide(); | 43 | mCategories->header()->hide(); |
44 | 44 | ||
45 | QStringList::Iterator it; | 45 | QStringList::Iterator it; |
46 | bool categoriesExist=false; | 46 | bool categoriesExist=false; |
47 | for (it = mPrefs->mCustomCategories.begin(); | 47 | for (it = mPrefs->mCustomCategories.begin(); |
48 | it != mPrefs->mCustomCategories.end(); ++it ) { | 48 | it != mPrefs->mCustomCategories.end(); ++it ) { |
49 | new QListViewItem(mCategories,*it); | 49 | new QListViewItem(mCategories,*it); |
50 | categoriesExist=true; | 50 | categoriesExist=true; |
51 | } | 51 | } |
52 | 52 | ||
53 | connect(mCategories,SIGNAL(selectionChanged(QListViewItem *)), | 53 | connect(mCategories,SIGNAL(selectionChanged(QListViewItem *)), |
54 | SLOT(editItem(QListViewItem *))); | 54 | SLOT(editItem(QListViewItem *))); |
55 | connect(mEdit,SIGNAL(textChanged ( const QString & )),this,SLOT(slotTextChanged(const QString &))); | 55 | connect(mEdit,SIGNAL(textChanged ( const QString & )),this,SLOT(slotTextChanged(const QString &))); |
56 | mButtonRemove->setEnabled(categoriesExist); | 56 | mButtonRemove->setEnabled(categoriesExist); |
57 | mButtonModify->setEnabled(categoriesExist); | 57 | mButtonModify->setEnabled(categoriesExist); |
58 | mButtonAdd->setEnabled(!mEdit->text().isEmpty()); | 58 | mButtonAdd->setEnabled(!mEdit->text().isEmpty()); |
59 | if ( QApplication::desktop()->width() > 460 ) | 59 | if ( QApplication::desktop()->width() > 460 ) |
60 | resize( 300, 360 ); | 60 | resize( 300, 360 ); |
61 | else | ||
62 | showMaximized(); | ||
61 | } | 63 | } |
62 | 64 | ||
63 | /* | 65 | /* |
64 | * Destroys the object and frees any allocated resources | 66 | * Destroys the object and frees any allocated resources |
65 | */ | 67 | */ |
66 | CategoryEditDialog::~CategoryEditDialog() | 68 | CategoryEditDialog::~CategoryEditDialog() |
67 | { | 69 | { |
68 | // no need to delete child widgets, Qt does it all for us | 70 | // no need to delete child widgets, Qt does it all for us |
69 | } | 71 | } |
70 | 72 | ||
71 | void CategoryEditDialog::slotTextChanged(const QString &text) | 73 | void CategoryEditDialog::slotTextChanged(const QString &text) |
72 | { | 74 | { |
73 | mButtonAdd->setEnabled(!text.isEmpty()); | 75 | mButtonAdd->setEnabled(!text.isEmpty()); |
74 | } | 76 | } |
75 | 77 | ||
76 | void CategoryEditDialog::add() | 78 | void CategoryEditDialog::add() |
77 | { | 79 | { |
78 | if (!mEdit->text().isEmpty()) { | 80 | if (!mEdit->text().isEmpty()) { |
79 | new QListViewItem(mCategories,mEdit->text()); | 81 | new QListViewItem(mCategories,mEdit->text()); |
80 | mEdit->setText(""); | 82 | mEdit->setText(""); |
81 | mButtonRemove->setEnabled(mCategories->childCount()>0); | 83 | mButtonRemove->setEnabled(mCategories->childCount()>0); |
82 | mButtonModify->setEnabled(mCategories->childCount()>0); | 84 | mButtonModify->setEnabled(mCategories->childCount()>0); |
83 | } | 85 | } |
84 | } | 86 | } |
85 | 87 | ||
86 | void CategoryEditDialog::remove() | 88 | void CategoryEditDialog::remove() |
87 | { | 89 | { |
88 | if (mCategories->currentItem()) { | 90 | if (mCategories->currentItem()) { |
89 | delete mCategories->currentItem(); | 91 | delete mCategories->currentItem(); |
90 | mButtonRemove->setEnabled(mCategories->childCount()>0); | 92 | mButtonRemove->setEnabled(mCategories->childCount()>0); |
91 | mButtonModify->setEnabled(mCategories->childCount()>0); | 93 | mButtonModify->setEnabled(mCategories->childCount()>0); |
92 | } | 94 | } |
93 | } | 95 | } |
94 | 96 | ||
95 | void CategoryEditDialog::modify() | 97 | void CategoryEditDialog::modify() |
96 | { | 98 | { |
97 | if (!mEdit->text().isEmpty()) { | 99 | if (!mEdit->text().isEmpty()) { |
98 | if (mCategories->currentItem()) { | 100 | if (mCategories->currentItem()) { |
99 | mCategories->currentItem()->setText(0,mEdit->text()); | 101 | mCategories->currentItem()->setText(0,mEdit->text()); |
100 | } | 102 | } |
101 | } | 103 | } |
102 | } | 104 | } |
103 | void CategoryEditDialog::accept() | 105 | void CategoryEditDialog::accept() |
104 | { | 106 | { |
105 | slotOk(); | 107 | slotOk(); |
106 | } | 108 | } |
107 | 109 | ||
108 | void CategoryEditDialog::slotOk() | 110 | void CategoryEditDialog::slotOk() |
109 | { | 111 | { |
110 | slotApply(); | 112 | slotApply(); |
111 | QDialog::accept(); | 113 | QDialog::accept(); |
112 | } | 114 | } |
113 | 115 | ||
114 | void CategoryEditDialog::slotApply() | 116 | void CategoryEditDialog::slotApply() |
115 | { | 117 | { |
116 | mPrefs->mCustomCategories.clear(); | 118 | mPrefs->mCustomCategories.clear(); |
117 | 119 | ||
118 | QListViewItem *item = mCategories->firstChild(); | 120 | QListViewItem *item = mCategories->firstChild(); |
119 | while(item) { | 121 | while(item) { |
120 | mPrefs->mCustomCategories.append(item->text(0)); | 122 | mPrefs->mCustomCategories.append(item->text(0)); |
121 | item = item->nextSibling(); | 123 | item = item->nextSibling(); |
122 | } | 124 | } |
123 | mPrefs->writeConfig(); | 125 | mPrefs->writeConfig(); |
124 | 126 | ||
125 | emit categoryConfigChanged(); | 127 | emit categoryConfigChanged(); |
126 | } | 128 | } |
127 | 129 | ||
128 | void CategoryEditDialog::editItem(QListViewItem *item) | 130 | void CategoryEditDialog::editItem(QListViewItem *item) |
129 | { | 131 | { |
130 | mEdit->setText(item->text(0)); | 132 | mEdit->setText(item->text(0)); |
131 | mButtonRemove->setEnabled(true); | 133 | mButtonRemove->setEnabled(true); |
132 | mButtonModify->setEnabled(true); | 134 | mButtonModify->setEnabled(true); |
133 | } | 135 | } |
134 | 136 | ||
135 | //US #include "categoryeditdialog.moc" | 137 | //US #include "categoryeditdialog.moc" |
diff --git a/libkdepim/categoryselectdialog.cpp b/libkdepim/categoryselectdialog.cpp index 40b46cf..7df9154 100644 --- a/libkdepim/categoryselectdialog.cpp +++ b/libkdepim/categoryselectdialog.cpp | |||
@@ -1,173 +1,171 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkdepim. | 2 | This file is part of libkdepim. |
3 | Copyright (c) 2000, 2001, 2002 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000, 2001, 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 <qlistview.h> | 24 | #include <qlistview.h> |
25 | #include <qpushbutton.h> | 25 | #include <qpushbutton.h> |
26 | #include <qheader.h> | 26 | #include <qheader.h> |
27 | #include <qapp.h> | 27 | #include <qapp.h> |
28 | #include <qmessagebox.h> | 28 | #include <qmessagebox.h> |
29 | 29 | ||
30 | 30 | ||
31 | #include "categoryeditdialog.h" | 31 | #include "categoryeditdialog.h" |
32 | #include "categoryselectdialog.h" | 32 | #include "categoryselectdialog.h" |
33 | 33 | ||
34 | #include "kpimprefs.h" | 34 | #include "kpimprefs.h" |
35 | 35 | ||
36 | using namespace KPIM; | 36 | using namespace KPIM; |
37 | 37 | ||
38 | CategorySelectDialog::CategorySelectDialog( KPimPrefs *prefs, QWidget* parent, | 38 | CategorySelectDialog::CategorySelectDialog( KPimPrefs *prefs, QWidget* parent, |
39 | const char* name, | 39 | const char* name, |
40 | bool modal, WFlags fl ) | 40 | bool modal, WFlags fl ) |
41 | : CategorySelectDialog_base( parent, name, true, fl ), | 41 | : CategorySelectDialog_base( parent, name, true, fl ), |
42 | mPrefs( prefs ) | 42 | mPrefs( prefs ) |
43 | { | 43 | { |
44 | mCategories->header()->hide(); | 44 | mCategories->header()->hide(); |
45 | 45 | ||
46 | setCategories(); | 46 | setCategories(); |
47 | 47 | ||
48 | connect(mButtonEdit,SIGNAL(clicked()),this, SLOT(editCategoriesDialog())); | 48 | connect(mButtonEdit,SIGNAL(clicked()),this, SLOT(editCategoriesDialog())); |
49 | if ( qApp->desktop()->height() < 321 ) | ||
50 | setMaximumHeight( QApplication::desktop()->height() - 50 ); | ||
51 | else | ||
52 | setMaximumHeight( QApplication::desktop()->height() - 80 ); | ||
53 | if ( QApplication::desktop()->width() > 460 ) | 49 | if ( QApplication::desktop()->width() > 460 ) |
54 | resize( 260, 360 ); | 50 | resize( 300, 360 ); |
51 | else | ||
52 | showMaximized(); | ||
55 | } | 53 | } |
56 | void CategorySelectDialog::editCategoriesDialog() | 54 | void CategorySelectDialog::editCategoriesDialog() |
57 | { | 55 | { |
58 | KPIM::CategoryEditDialog* ced = new KPIM::CategoryEditDialog(mPrefs,this ); | 56 | KPIM::CategoryEditDialog* ced = new KPIM::CategoryEditDialog(mPrefs,this ); |
59 | 57 | ||
60 | ced->exec(); | 58 | ced->exec(); |
61 | delete ced; | 59 | delete ced; |
62 | setCategories(); | 60 | setCategories(); |
63 | } | 61 | } |
64 | void CategorySelectDialog::setCategories() | 62 | void CategorySelectDialog::setCategories() |
65 | { | 63 | { |
66 | mCategories->clear(); | 64 | mCategories->clear(); |
67 | mCategoryList.clear(); | 65 | mCategoryList.clear(); |
68 | 66 | ||
69 | QStringList::Iterator it; | 67 | QStringList::Iterator it; |
70 | 68 | ||
71 | for (it = mPrefs->mCustomCategories.begin(); | 69 | for (it = mPrefs->mCustomCategories.begin(); |
72 | it != mPrefs->mCustomCategories.end(); ++it ) { | 70 | it != mPrefs->mCustomCategories.end(); ++it ) { |
73 | new QCheckListItem(mCategories,*it,QCheckListItem::CheckBox); | 71 | new QCheckListItem(mCategories,*it,QCheckListItem::CheckBox); |
74 | } | 72 | } |
75 | } | 73 | } |
76 | 74 | ||
77 | CategorySelectDialog::~CategorySelectDialog() | 75 | CategorySelectDialog::~CategorySelectDialog() |
78 | { | 76 | { |
79 | } | 77 | } |
80 | 78 | ||
81 | void CategorySelectDialog::setSelected(const QStringList &selList) | 79 | void CategorySelectDialog::setSelected(const QStringList &selList) |
82 | { | 80 | { |
83 | clear(); | 81 | clear(); |
84 | 82 | ||
85 | QStringList::ConstIterator it; | 83 | QStringList::ConstIterator it; |
86 | QStringList notFound; | 84 | QStringList notFound; |
87 | bool found = false; | 85 | bool found = false; |
88 | for (it=selList.begin();it!=selList.end();++it) { | 86 | for (it=selList.begin();it!=selList.end();++it) { |
89 | //qDebug(" CategorySelectDialog::setSelected("); | 87 | //qDebug(" CategorySelectDialog::setSelected("); |
90 | QCheckListItem *item = (QCheckListItem *)mCategories->firstChild(); | 88 | QCheckListItem *item = (QCheckListItem *)mCategories->firstChild(); |
91 | while (item) { | 89 | while (item) { |
92 | if (item->text() == *it) { | 90 | if (item->text() == *it) { |
93 | item->setOn(true); | 91 | item->setOn(true); |
94 | found = true; | 92 | found = true; |
95 | break; | 93 | break; |
96 | } | 94 | } |
97 | item = (QCheckListItem *)item->nextSibling(); | 95 | item = (QCheckListItem *)item->nextSibling(); |
98 | } | 96 | } |
99 | // if ( ! found ) { | 97 | // if ( ! found ) { |
100 | 98 | ||
101 | //emit updateCategoriesGlobal(); | 99 | //emit updateCategoriesGlobal(); |
102 | // QMessageBox::information( this, "KO/E: Information!", | 100 | // QMessageBox::information( this, "KO/E: Information!", |
103 | // "Categories found, which were not\n" | 101 | // "Categories found, which were not\n" |
104 | // "in list of categories!\n" | 102 | // "in list of categories!\n" |
105 | // "message", | 103 | // "message", |
106 | // "OK", "", 0, | 104 | // "OK", "", 0, |
107 | // 0, 1 ); | 105 | // 0, 1 ); |
108 | // setSelected(selList); | 106 | // setSelected(selList); |
109 | // return; | 107 | // return; |
110 | // } | 108 | // } |
111 | } | 109 | } |
112 | } | 110 | } |
113 | 111 | ||
114 | QStringList CategorySelectDialog::selectedCategories() const | 112 | QStringList CategorySelectDialog::selectedCategories() const |
115 | { | 113 | { |
116 | return mCategoryList; | 114 | return mCategoryList; |
117 | } | 115 | } |
118 | 116 | ||
119 | void CategorySelectDialog::slotApply() | 117 | void CategorySelectDialog::slotApply() |
120 | { | 118 | { |
121 | QStringList categories; | 119 | QStringList categories; |
122 | QCheckListItem *item = (QCheckListItem *)mCategories->firstChild(); | 120 | QCheckListItem *item = (QCheckListItem *)mCategories->firstChild(); |
123 | while (item) { | 121 | while (item) { |
124 | if (item->isOn()) { | 122 | if (item->isOn()) { |
125 | categories.append(item->text()); | 123 | categories.append(item->text()); |
126 | } | 124 | } |
127 | item = (QCheckListItem *)item->nextSibling(); | 125 | item = (QCheckListItem *)item->nextSibling(); |
128 | } | 126 | } |
129 | 127 | ||
130 | QString categoriesStr = categories.join(","); | 128 | QString categoriesStr = categories.join(","); |
131 | 129 | ||
132 | mCategoryList = categories; | 130 | mCategoryList = categories; |
133 | 131 | ||
134 | emit categoriesSelected(categories); | 132 | emit categoriesSelected(categories); |
135 | emit categoriesSelected(categoriesStr); | 133 | emit categoriesSelected(categoriesStr); |
136 | } | 134 | } |
137 | void CategorySelectDialog::accept() | 135 | void CategorySelectDialog::accept() |
138 | { | 136 | { |
139 | slotOk(); | 137 | slotOk(); |
140 | } | 138 | } |
141 | 139 | ||
142 | void CategorySelectDialog::slotOk() | 140 | void CategorySelectDialog::slotOk() |
143 | { | 141 | { |
144 | slotApply(); | 142 | slotApply(); |
145 | QDialog::accept(); | 143 | QDialog::accept(); |
146 | } | 144 | } |
147 | 145 | ||
148 | void CategorySelectDialog::clear() | 146 | void CategorySelectDialog::clear() |
149 | { | 147 | { |
150 | QCheckListItem *item = (QCheckListItem *)mCategories->firstChild(); | 148 | QCheckListItem *item = (QCheckListItem *)mCategories->firstChild(); |
151 | while (item) { | 149 | while (item) { |
152 | item->setOn(false); | 150 | item->setOn(false); |
153 | item = (QCheckListItem *)item->nextSibling(); | 151 | item = (QCheckListItem *)item->nextSibling(); |
154 | } | 152 | } |
155 | } | 153 | } |
156 | 154 | ||
157 | void CategorySelectDialog::updateCategoryConfig() | 155 | void CategorySelectDialog::updateCategoryConfig() |
158 | { | 156 | { |
159 | QStringList selected; | 157 | QStringList selected; |
160 | QCheckListItem *item = (QCheckListItem *)mCategories->firstChild(); | 158 | QCheckListItem *item = (QCheckListItem *)mCategories->firstChild(); |
161 | while (item) { | 159 | while (item) { |
162 | if (item->isOn()) { | 160 | if (item->isOn()) { |
163 | selected.append(item->text()); | 161 | selected.append(item->text()); |
164 | } | 162 | } |
165 | item = (QCheckListItem *)item->nextSibling(); | 163 | item = (QCheckListItem *)item->nextSibling(); |
166 | } | 164 | } |
167 | 165 | ||
168 | setCategories(); | 166 | setCategories(); |
169 | 167 | ||
170 | setSelected(selected); | 168 | setSelected(selected); |
171 | } | 169 | } |
172 | 170 | ||
173 | //#include "categoryselectdialog.moc" | 171 | //#include "categoryselectdialog.moc" |