-rw-r--r-- | korganizer/koagendaview.cpp | 78 |
1 files changed, 45 insertions, 33 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index 6e65a03..87993ae 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp | |||
@@ -21,21 +21,33 @@ | |||
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 <qhbox.h> | 24 | #include <q3hbox.h> |
25 | #include <qvbox.h> | 25 | #include <q3vbox.h> |
26 | #include <qlabel.h> | 26 | #include <qlabel.h> |
27 | #include <qframe.h> | 27 | #include <q3frame.h> |
28 | #include <qlayout.h> | 28 | #include <qlayout.h> |
29 | #ifndef KORG_NOSPLITTER | 29 | #ifndef KORG_NOSPLITTER |
30 | #include <qsplitter.h> | 30 | #include <qsplitter.h> |
31 | #endif | 31 | #endif |
32 | #include <qfont.h> | 32 | #include <qfont.h> |
33 | #include <qfontmetrics.h> | 33 | #include <qfontmetrics.h> |
34 | #include <qpopupmenu.h> | 34 | #include <q3popupmenu.h> |
35 | #include <qtooltip.h> | 35 | #include <qtooltip.h> |
36 | #include <qpainter.h> | 36 | #include <qpainter.h> |
37 | #include <qpushbutton.h> | 37 | #include <qpushbutton.h> |
38 | #include <qapplication.h> | 38 | #include <qapplication.h> |
39 | #include <QDesktopWidget> | ||
40 | //Added by qt3to4: | ||
41 | #include <QResizeEvent> | ||
42 | #include <QPixmap> | ||
43 | #include <QMouseEvent> | ||
44 | #include <Q3GridLayout> | ||
45 | #include <Q3ValueList> | ||
46 | #include <QKeyEvent> | ||
47 | #include <Q3HBoxLayout> | ||
48 | #include <Q3VBoxLayout> | ||
49 | #include <QPaintEvent> | ||
50 | #include <Q3PtrList> | ||
39 | 51 | ||
40 | #include <kapplication.h> | 52 | #include <kapplication.h> |
41 | #include <KDGanttMinimizeSplitter.h> | 53 | #include <KDGanttMinimizeSplitter.h> |
@@ -78,8 +90,8 @@ using namespace KOrg; | |||
78 | 90 | ||
79 | #define IDLETIMEOUT 45 | 91 | #define IDLETIMEOUT 45 |
80 | 92 | ||
81 | TimeLabels::TimeLabels(int rows,QWidget *parent,const char *name,WFlags f) : | 93 | TimeLabels::TimeLabels(int rows,QWidget *parent,const char *name,Qt::WFlags f) : |
82 | QScrollView(parent,name,f) | 94 | Q3ScrollView(parent,name,f) |
83 | { | 95 | { |
84 | myPix.resize( 1, 1 ); | 96 | myPix.resize( 1, 1 ); |
85 | mRows = rows; | 97 | mRows = rows; |
@@ -95,7 +107,7 @@ TimeLabels::TimeLabels(int rows,QWidget *parent,const char *name,WFlags f) : | |||
95 | 107 | ||
96 | resizeContents(50,mRows * mCellHeight); | 108 | resizeContents(50,mRows * mCellHeight); |
97 | 109 | ||
98 | viewport()->setBackgroundMode( PaletteBackground ); | 110 | viewport()->setBackgroundMode( Qt::PaletteBackground ); |
99 | } | 111 | } |
100 | 112 | ||
101 | void TimeLabels::setCellHeight(int height) | 113 | void TimeLabels::setCellHeight(int height) |
@@ -283,7 +295,7 @@ void TimeLabels::paintEvent(QPaintEvent*) | |||
283 | //////////////////////////////////////////////////////////////////////////// | 295 | //////////////////////////////////////////////////////////////////////////// |
284 | 296 | ||
285 | EventIndicator::EventIndicator(Location loc,QWidget *parent,const char *name) | 297 | EventIndicator::EventIndicator(Location loc,QWidget *parent,const char *name) |
286 | : QFrame(parent,name) | 298 | : Q3Frame(parent,name) |
287 | { | 299 | { |
288 | mColumns = 1; | 300 | mColumns = 1; |
289 | mTopBox = 0; | 301 | mTopBox = 0; |
@@ -393,7 +405,7 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : | |||
393 | expandPix = SmallIcon("1leftrightarrow" ); | 405 | expandPix = SmallIcon("1leftrightarrow" ); |
394 | } | 406 | } |
395 | 407 | ||
396 | QBoxLayout *topLayout = new QVBoxLayout(this); | 408 | Q3BoxLayout *topLayout = new Q3VBoxLayout(this); |
397 | 409 | ||
398 | // Create day name labels for agenda columns | 410 | // Create day name labels for agenda columns |
399 | // Create agenda splitter | 411 | // Create agenda splitter |
@@ -401,13 +413,13 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : | |||
401 | mSplitterAgenda = new KDGanttMinimizeSplitter( Qt::Vertical, this); | 413 | mSplitterAgenda = new KDGanttMinimizeSplitter( Qt::Vertical, this); |
402 | mSplitterAgenda->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); | 414 | mSplitterAgenda->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); |
403 | topLayout->addWidget( mSplitterAgenda ); | 415 | topLayout->addWidget( mSplitterAgenda ); |
404 | mAllDayFrame = new QHBox(mSplitterAgenda); | 416 | mAllDayFrame = new Q3HBox(mSplitterAgenda); |
405 | mAllDayFrame->setFocusPolicy(NoFocus); | 417 | mAllDayFrame->setFocusPolicy(Qt::NoFocus); |
406 | QWidget *agendaFrame = new QWidget(mSplitterAgenda); | 418 | QWidget *agendaFrame = new QWidget(mSplitterAgenda); |
407 | agendaFrame->setFocusPolicy(NoFocus); | 419 | agendaFrame->setFocusPolicy(Qt::NoFocus); |
408 | 420 | ||
409 | // Create all-day agenda widget | 421 | // Create all-day agenda widget |
410 | mDummyAllDayLeft = new QVBox( mAllDayFrame ); | 422 | mDummyAllDayLeft = new Q3VBox( mAllDayFrame ); |
411 | 423 | ||
412 | mExpandButton = new QPushButton(mDummyAllDayLeft); | 424 | mExpandButton = new QPushButton(mDummyAllDayLeft); |
413 | mExpandButton->setPixmap( expandPix ); | 425 | mExpandButton->setPixmap( expandPix ); |
@@ -420,16 +432,16 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : | |||
420 | // QSizePolicy::Fixed ) ); | 432 | // QSizePolicy::Fixed ) ); |
421 | mExpandButton->setFixedSize( widebut, widebut); | 433 | mExpandButton->setFixedSize( widebut, widebut); |
422 | connect( mExpandButton, SIGNAL( clicked() ), SIGNAL( toggleExpand() ) ); | 434 | connect( mExpandButton, SIGNAL( clicked() ), SIGNAL( toggleExpand() ) ); |
423 | mExpandButton->setFocusPolicy(NoFocus); | 435 | mExpandButton->setFocusPolicy(Qt::NoFocus); |
424 | mAllDayAgenda = new KOAgenda(1,mAllDayFrame); | 436 | mAllDayAgenda = new KOAgenda(1,mAllDayFrame); |
425 | mAllDayAgenda->setFocusPolicy(NoFocus); | 437 | mAllDayAgenda->setFocusPolicy(Qt::NoFocus); |
426 | QLabel *dummyAllDayRight = new QLabel (mAllDayFrame); | 438 | QLabel *dummyAllDayRight = new QLabel (mAllDayFrame); |
427 | 439 | ||
428 | // Create event context menu for all day agenda | 440 | // Create event context menu for all day agenda |
429 | //mAllDayAgendaPopup = eventPopup(); | 441 | //mAllDayAgendaPopup = eventPopup(); |
430 | 442 | ||
431 | // Create agenda frame | 443 | // Create agenda frame |
432 | QGridLayout *agendaLayout = new QGridLayout(agendaFrame,4,3); | 444 | Q3GridLayout *agendaLayout = new Q3GridLayout(agendaFrame,4,3); |
433 | // QHBox *agendaFrame = new QHBox(splitterAgenda); | 445 | // QHBox *agendaFrame = new QHBox(splitterAgenda); |
434 | 446 | ||
435 | // create event indicator bars | 447 | // create event indicator bars |
@@ -437,10 +449,10 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : | |||
437 | #ifndef DESKTOP_VERSION | 449 | #ifndef DESKTOP_VERSION |
438 | mEventIndicatorTop->setPaintWidget( mSplitterAgenda ); | 450 | mEventIndicatorTop->setPaintWidget( mSplitterAgenda ); |
439 | #endif | 451 | #endif |
440 | mDayLabelsFrame = new QHBox(agendaFrame); | 452 | mDayLabelsFrame = new Q3HBox(agendaFrame); |
441 | //topLayout->addWidget(mDayLabelsFrame); | 453 | //topLayout->addWidget(mDayLabelsFrame); |
442 | mDayLabels = new QFrame (mDayLabelsFrame); | 454 | mDayLabels = new Q3Frame (mDayLabelsFrame); |
443 | mLayoutDayLabels = new QHBoxLayout(mDayLabels); | 455 | mLayoutDayLabels = new Q3HBoxLayout(mDayLabels); |
444 | agendaLayout->addMultiCellWidget(mDayLabelsFrame ,0,0,0,2); | 456 | agendaLayout->addMultiCellWidget(mDayLabelsFrame ,0,0,0,2); |
445 | agendaLayout->addWidget(mEventIndicatorTop,1,1); | 457 | agendaLayout->addWidget(mEventIndicatorTop,1,1); |
446 | 458 | ||
@@ -460,12 +472,12 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : | |||
460 | mAgenda = new KOAgenda(1,96,KOPrefs::instance()->mHourSize,agendaFrame); | 472 | mAgenda = new KOAgenda(1,96,KOPrefs::instance()->mHourSize,agendaFrame); |
461 | agendaLayout->addMultiCellWidget(mAgenda,2,2,1,2); | 473 | agendaLayout->addMultiCellWidget(mAgenda,2,2,1,2); |
462 | agendaLayout->setColStretch(1,1); | 474 | agendaLayout->setColStretch(1,1); |
463 | mAgenda->setFocusPolicy(NoFocus); | 475 | mAgenda->setFocusPolicy(Qt::NoFocus); |
464 | // Create event context menu for agenda | 476 | // Create event context menu for agenda |
465 | mAllAgendaPopup = eventPopup(); | 477 | mAllAgendaPopup = eventPopup(); |
466 | 478 | ||
467 | #if 0 | 479 | #if 0 |
468 | mAllAgendaPopup->addAdditionalItem(QIconSet(SmallIcon("bell")), | 480 | mAllAgendaPopup->addAdditionalItem(QIcon(SmallIcon("bell")), |
469 | i18n("Toggle Alarm"),mAgenda, | 481 | i18n("Toggle Alarm"),mAgenda, |
470 | SLOT(popupAlarm()),true); | 482 | SLOT(popupAlarm()),true); |
471 | 483 | ||
@@ -918,9 +930,9 @@ int KOAgendaView::currentDateCount() | |||
918 | return mSelectedDates.count(); | 930 | return mSelectedDates.count(); |
919 | } | 931 | } |
920 | 932 | ||
921 | QPtrList<Incidence> KOAgendaView::selectedIncidences() | 933 | Q3PtrList<Incidence> KOAgendaView::selectedIncidences() |
922 | { | 934 | { |
923 | QPtrList<Incidence> selected; | 935 | Q3PtrList<Incidence> selected; |
924 | Incidence *incidence; | 936 | Incidence *incidence; |
925 | 937 | ||
926 | incidence = mAgenda->selectedIncidence(); | 938 | incidence = mAgenda->selectedIncidence(); |
@@ -987,8 +999,8 @@ void KOAgendaView::updateConfig() | |||
987 | mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); | 999 | mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); |
988 | 1000 | ||
989 | // ToolTips displaying summary of events | 1001 | // ToolTips displaying summary of events |
990 | KOAgendaItem::toolTipGroup()->setEnabled(KOPrefs::instance() | 1002 | /* TODO:hacker: KOAgendaItem::toolTipGroup()->setEnabled(KOPrefs::instance() |
991 | ->mEnableToolTips); | 1003 | ->mEnableToolTips); */ |
992 | 1004 | ||
993 | //setHolidayMasks(); | 1005 | //setHolidayMasks(); |
994 | 1006 | ||
@@ -1117,7 +1129,7 @@ void KOAgendaView::showDates( const QDate &start, const QDate &end ) | |||
1117 | } | 1129 | } |
1118 | 1130 | ||
1119 | 1131 | ||
1120 | void KOAgendaView::showEvents(QPtrList<Event>) | 1132 | void KOAgendaView::showEvents(Q3PtrList<Event>) |
1121 | { | 1133 | { |
1122 | kdDebug() << "KOAgendaView::showEvents() is not yet implemented" << endl; | 1134 | kdDebug() << "KOAgendaView::showEvents() is not yet implemented" << endl; |
1123 | } | 1135 | } |
@@ -1165,11 +1177,11 @@ void KOAgendaView::fillAgenda() | |||
1165 | mMinY.resize(mSelectedDates.count()); | 1177 | mMinY.resize(mSelectedDates.count()); |
1166 | mMaxY.resize(mSelectedDates.count()); | 1178 | mMaxY.resize(mSelectedDates.count()); |
1167 | 1179 | ||
1168 | QPtrList<Event> dayEvents; | 1180 | Q3PtrList<Event> dayEvents; |
1169 | 1181 | ||
1170 | // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. | 1182 | // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. |
1171 | // Therefore, gtodoset all of them. | 1183 | // Therefore, gtodoset all of them. |
1172 | QPtrList<Todo> todos = calendar()->todos(); | 1184 | Q3PtrList<Todo> todos = calendar()->todos(); |
1173 | 1185 | ||
1174 | mAgenda->setDateList(mSelectedDates); | 1186 | mAgenda->setDateList(mSelectedDates); |
1175 | 1187 | ||
@@ -1300,7 +1312,7 @@ void KOAgendaView::fillAgenda() | |||
1300 | // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. | 1312 | // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. |
1301 | // Already completed items can be displayed on their original due date | 1313 | // Already completed items can be displayed on their original due date |
1302 | //if not KOPrefs::instance()->mShowTodoInAgenda, show overdue in agenda | 1314 | //if not KOPrefs::instance()->mShowTodoInAgenda, show overdue in agenda |
1303 | bool overdue = (!todo->isCompleted()) && (todo->dtDue() < today) && KOPrefs::instance()->mShowTodoInAgenda; | 1315 | bool overdue = (!todo->isCompleted()) && (todo->dtDue() < (QDateTime)today) && KOPrefs::instance()->mShowTodoInAgenda; |
1304 | bool fillIn = false; | 1316 | bool fillIn = false; |
1305 | if ( todo->hasCompletedDate() && todo->completed().date() == currentDate ) | 1317 | if ( todo->hasCompletedDate() && todo->completed().date() == currentDate ) |
1306 | fillIn = true; | 1318 | fillIn = true; |
@@ -1503,7 +1515,7 @@ void KOAgendaView::readSettings(KConfig *config) | |||
1503 | config->setGroup("Views"); | 1515 | config->setGroup("Views"); |
1504 | 1516 | ||
1505 | //#ifndef KORG_NOSPLITTER | 1517 | //#ifndef KORG_NOSPLITTER |
1506 | QValueList<int> sizes = config->readIntListEntry("Separator AgendaView"); | 1518 | Q3ValueList<int> sizes = config->readIntListEntry("Separator AgendaView"); |
1507 | if (sizes.count() == 2) { | 1519 | if (sizes.count() == 2) { |
1508 | if ( sizes[0] < 20 ) { | 1520 | if ( sizes[0] < 20 ) { |
1509 | sizes[1] = sizes[1] +20 - sizes[0]; | 1521 | sizes[1] = sizes[1] +20 - sizes[0]; |
@@ -1524,7 +1536,7 @@ void KOAgendaView::writeSettings(KConfig *config) | |||
1524 | config->setGroup("Views"); | 1536 | config->setGroup("Views"); |
1525 | 1537 | ||
1526 | //#ifndef KORG_NOSPLITTER | 1538 | //#ifndef KORG_NOSPLITTER |
1527 | QValueList<int> list = mSplitterAgenda->sizes(); | 1539 | Q3ValueList<int> list = mSplitterAgenda->sizes(); |
1528 | config->writeEntry("Separator AgendaView",list); | 1540 | config->writeEntry("Separator AgendaView",list); |
1529 | //qDebug("write %d %d ", list[0],list[1] ); | 1541 | //qDebug("write %d %d ", list[0],list[1] ); |
1530 | //#endif | 1542 | //#endif |
@@ -1541,7 +1553,7 @@ void KOAgendaView::setHolidayMasks() | |||
1541 | bool showSunday = KOPrefs::instance()->mExcludeHolidays && (date.dayOfWeek() == 7); | 1553 | bool showSunday = KOPrefs::instance()->mExcludeHolidays && (date.dayOfWeek() == 7); |
1542 | bool showHoliday = false; | 1554 | bool showHoliday = false; |
1543 | if ( KOPrefs::instance()->mExcludeHolidays ) { | 1555 | if ( KOPrefs::instance()->mExcludeHolidays ) { |
1544 | QPtrList<Event> events = calendar()->events( date, true ); | 1556 | Q3PtrList<Event> events = calendar()->events( date, true ); |
1545 | Event *event; | 1557 | Event *event; |
1546 | for( event = events.first(); event; event = events.next() ) { | 1558 | for( event = events.first(); event; event = events.next() ) { |
1547 | if ( event->isHoliday()) { | 1559 | if ( event->isHoliday()) { |
@@ -1663,7 +1675,7 @@ void KOAgendaView::updateTodo( Todo * t, int ) | |||
1663 | removeAD = true; | 1675 | removeAD = true; |
1664 | } | 1676 | } |
1665 | else { | 1677 | else { |
1666 | bool overdue = (!t->isCompleted()) && (t->dtDue() < QDate::currentDate()) && KOPrefs::instance()->mShowTodoInAgenda ; | 1678 | bool overdue = (!t->isCompleted()) && (t->dtDue() < (QDateTime)QDate::currentDate()) && KOPrefs::instance()->mShowTodoInAgenda ; |
1667 | if ( overdue && | 1679 | if ( overdue && |
1668 | QDate::currentDate() >= mSelectedDates.first() && | 1680 | QDate::currentDate() >= mSelectedDates.first() && |
1669 | QDate::currentDate() <= mSelectedDates.last()) { | 1681 | QDate::currentDate() <= mSelectedDates.last()) { |