summaryrefslogtreecommitdiffabout
path: root/korganizer/koagendaview.cpp
Unidiff
Diffstat (limited to 'korganizer/koagendaview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagendaview.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index 8b79788..8e9add3 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -1318,231 +1318,233 @@ void KOAgendaView::newTodo(int gx, int gy )
1318 1318
1319void KOAgendaView::updateEventIndicatorTop(int newY) 1319void KOAgendaView::updateEventIndicatorTop(int newY)
1320{ 1320{
1321 uint i; 1321 uint i;
1322 for(i=0;i<mMinY.size();++i) { 1322 for(i=0;i<mMinY.size();++i) {
1323 if (newY >= mMinY.at(i)) mEventIndicatorTop->enableColumn(i,true); 1323 if (newY >= mMinY.at(i)) mEventIndicatorTop->enableColumn(i,true);
1324 else mEventIndicatorTop->enableColumn(i,false); 1324 else mEventIndicatorTop->enableColumn(i,false);
1325 } 1325 }
1326 1326
1327 mEventIndicatorTop->update(); 1327 mEventIndicatorTop->update();
1328} 1328}
1329 1329
1330void KOAgendaView::updateEventIndicatorBottom(int newY) 1330void KOAgendaView::updateEventIndicatorBottom(int newY)
1331{ 1331{
1332 uint i; 1332 uint i;
1333 for(i=0;i<mMaxY.size();++i) { 1333 for(i=0;i<mMaxY.size();++i) {
1334 if (newY <= mMaxY.at(i)) mEventIndicatorBottom->enableColumn(i,true); 1334 if (newY <= mMaxY.at(i)) mEventIndicatorBottom->enableColumn(i,true);
1335 else mEventIndicatorBottom->enableColumn(i,false); 1335 else mEventIndicatorBottom->enableColumn(i,false);
1336 } 1336 }
1337 1337
1338 mEventIndicatorBottom->update(); 1338 mEventIndicatorBottom->update();
1339} 1339}
1340 1340
1341void KOAgendaView::startDrag(Event *event) 1341void KOAgendaView::startDrag(Event *event)
1342{ 1342{
1343#ifndef KORG_NODND 1343#ifndef KORG_NODND
1344 DndFactory factory( calendar() ); 1344 DndFactory factory( calendar() );
1345 ICalDrag *vd = factory.createDrag(event,this); 1345 ICalDrag *vd = factory.createDrag(event,this);
1346 if (vd->drag()) { 1346 if (vd->drag()) {
1347 kdDebug() << "KOAgendaView::startDrag(): Delete drag source" << endl; 1347 kdDebug() << "KOAgendaView::startDrag(): Delete drag source" << endl;
1348 } 1348 }
1349#endif 1349#endif
1350} 1350}
1351 1351
1352void KOAgendaView::readSettings() 1352void KOAgendaView::readSettings()
1353{ 1353{
1354 readSettings(KOGlobals::config()); 1354 readSettings(KOGlobals::config());
1355} 1355}
1356 1356
1357void KOAgendaView::readSettings(KConfig *config) 1357void KOAgendaView::readSettings(KConfig *config)
1358{ 1358{
1359 // kdDebug() << "KOAgendaView::readSettings()" << endl; 1359 // kdDebug() << "KOAgendaView::readSettings()" << endl;
1360 1360
1361 config->setGroup("Views"); 1361 config->setGroup("Views");
1362 1362
1363 //#ifndef KORG_NOSPLITTER 1363 //#ifndef KORG_NOSPLITTER
1364 QValueList<int> sizes = config->readIntListEntry("Separator AgendaView"); 1364 QValueList<int> sizes = config->readIntListEntry("Separator AgendaView");
1365 if (sizes.count() == 2) { 1365 if (sizes.count() == 2) {
1366 if ( sizes[0] < 20 ) { 1366 if ( sizes[0] < 20 ) {
1367 sizes[1] = sizes[1] +20 - sizes[0]; 1367 sizes[1] = sizes[1] +20 - sizes[0];
1368 sizes[0] = 20; 1368 sizes[0] = 20;
1369 } 1369 }
1370 mSplitterAgenda->setSizes(sizes); 1370 mSplitterAgenda->setSizes(sizes);
1371 // qDebug("read %d %d ",sizes[0],sizes[1] ); 1371 // qDebug("read %d %d ",sizes[0],sizes[1] );
1372 } 1372 }
1373 //#endif 1373 //#endif
1374 1374
1375 // updateConfig(); 1375 // updateConfig();
1376} 1376}
1377 1377
1378void KOAgendaView::writeSettings(KConfig *config) 1378void KOAgendaView::writeSettings(KConfig *config)
1379{ 1379{
1380 // kdDebug() << "KOAgendaView::writeSettings()" << endl; 1380 // kdDebug() << "KOAgendaView::writeSettings()" << endl;
1381 1381
1382 config->setGroup("Views"); 1382 config->setGroup("Views");
1383 1383
1384 //#ifndef KORG_NOSPLITTER 1384 //#ifndef KORG_NOSPLITTER
1385 QValueList<int> list = mSplitterAgenda->sizes(); 1385 QValueList<int> list = mSplitterAgenda->sizes();
1386 config->writeEntry("Separator AgendaView",list); 1386 config->writeEntry("Separator AgendaView",list);
1387 //qDebug("write %d %d ", list[0],list[1] ); 1387 //qDebug("write %d %d ", list[0],list[1] );
1388 //#endif 1388 //#endif
1389} 1389}
1390 1390
1391void KOAgendaView::setHolidayMasks() 1391void KOAgendaView::setHolidayMasks()
1392{ 1392{
1393 mHolidayMask.resize(mSelectedDates.count()); 1393 mHolidayMask.resize(mSelectedDates.count());
1394 1394
1395 uint i; 1395 uint i;
1396 for(i=0;i<mSelectedDates.count();++i) { 1396 for(i=0;i<mSelectedDates.count();++i) {
1397 QDate date = mSelectedDates[i]; 1397 QDate date = mSelectedDates[i];
1398 bool showSaturday = KOPrefs::instance()->mExcludeSaturdays && (date.dayOfWeek() == 6); 1398 bool showSaturday = KOPrefs::instance()->mExcludeSaturdays && (date.dayOfWeek() == 6);
1399 bool showSunday = KOPrefs::instance()->mExcludeHolidays && (date.dayOfWeek() == 7); 1399 bool showSunday = KOPrefs::instance()->mExcludeHolidays && (date.dayOfWeek() == 7);
1400 bool showHoliday = false; 1400 bool showHoliday = false;
1401 if ( KOPrefs::instance()->mExcludeHolidays ) { 1401 if ( KOPrefs::instance()->mExcludeHolidays ) {
1402 QPtrList<Event> events = calendar()->events( date, true ); 1402 QPtrList<Event> events = calendar()->events( date, true );
1403 Event *event; 1403 Event *event;
1404 for( event = events.first(); event; event = events.next() ) { 1404 for( event = events.first(); event; event = events.next() ) {
1405 if ( event->categories().contains("Holiday") || 1405 if ( event->categories().contains("Holiday") ||
1406 event->categories().contains(i18n("Holiday"))) { 1406 event->categories().contains(i18n("Holiday"))) {
1407 showHoliday = true; 1407 showHoliday = true;
1408 break; 1408 break;
1409 } 1409 }
1410 } 1410 }
1411 1411
1412 } 1412 }
1413 1413
1414#ifndef KORG_NOPLUGINS 1414#ifndef KORG_NOPLUGINS
1415 bool showHoliday = KOPrefs::instance()->mExcludeHolidays && 1415 bool showHoliday = KOPrefs::instance()->mExcludeHolidays &&
1416 !KOCore::self()->holiday(date).isEmpty(); 1416 !KOCore::self()->holiday(date).isEmpty();
1417#endif 1417#endif
1418 bool showDay = showSaturday || showSunday || showHoliday; 1418 bool showDay = showSaturday || showSunday || showHoliday;
1419 1419
1420 if (showDay) { 1420 if (showDay) {
1421 mHolidayMask.at(i) = true; 1421 mHolidayMask.at(i) = true;
1422 } else { 1422 } else {
1423 mHolidayMask.at(i) = false; 1423 mHolidayMask.at(i) = false;
1424 } 1424 }
1425 } 1425 }
1426 1426
1427 mAgenda->setHolidayMask(&mHolidayMask); 1427 mAgenda->setHolidayMask(&mHolidayMask);
1428 mAllDayAgenda->setHolidayMask(&mHolidayMask); 1428 mAllDayAgenda->setHolidayMask(&mHolidayMask);
1429} 1429}
1430 1430
1431void KOAgendaView::setContentsPos(int y) 1431void KOAgendaView::setContentsPos(int y)
1432{ 1432{
1433 mAgenda->setContentsPos(0,y); 1433 mAgenda->setContentsPos(0,y);
1434} 1434}
1435 1435
1436void KOAgendaView::setExpandedButton( bool expanded ) 1436void KOAgendaView::setExpandedButton( bool expanded )
1437{ 1437{
1438 if ( expanded ) { 1438 if ( expanded ) {
1439 mExpandButton->setPixmap( mExpandedPixmap ); 1439 mExpandButton->setPixmap( mExpandedPixmap );
1440 } else { 1440 } else {
1441 mExpandButton->setPixmap( mNotExpandedPixmap ); 1441 mExpandButton->setPixmap( mNotExpandedPixmap );
1442 } 1442 }
1443} 1443}
1444 1444
1445void KOAgendaView::clearSelection() 1445void KOAgendaView::clearSelection()
1446{ 1446{
1447 mAgenda->deselectItem(); 1447 mAgenda->deselectItem();
1448 mAllDayAgenda->deselectItem(); 1448 mAllDayAgenda->deselectItem();
1449} 1449}
1450 1450
1451void KOAgendaView::newTimeSpanSelectedAllDay(int gxStart, int gyStart, 1451void KOAgendaView::newTimeSpanSelectedAllDay(int gxStart, int gyStart,
1452 int gxEnd, int gyEnd) 1452 int gxEnd, int gyEnd)
1453{ 1453{
1454 mTimeSpanInAllDay = true; 1454 mTimeSpanInAllDay = true;
1455 newTimeSpanSelected(gxStart,gyStart,gxEnd,gyEnd); 1455 newTimeSpanSelected(gxStart,gyStart,gxEnd,gyEnd);
1456} 1456}
1457 1457
1458 1458
1459 1459
1460 1460
1461void KOAgendaView::newTimeSpanSelected(int gxStart, int gyStart, 1461void KOAgendaView::newTimeSpanSelected(int gxStart, int gyStart,
1462 int gxEnd, int gyEnd) 1462 int gxEnd, int gyEnd)
1463{ 1463{
1464 if (!mSelectedDates.count()) return; 1464 if (!mSelectedDates.count()) return;
1465 1465
1466 QDate dayStart = mSelectedDates[gxStart]; 1466 QDate dayStart = mSelectedDates[gxStart];
1467 QDate dayEnd = mSelectedDates[gxEnd]; 1467 QDate dayEnd = mSelectedDates[gxEnd];
1468 1468
1469 QTime timeStart = mAgenda->gyToTime(gyStart); 1469 QTime timeStart = mAgenda->gyToTime(gyStart);
1470 QTime timeEnd = mAgenda->gyToTime( gyEnd + 1 ); 1470 QTime timeEnd = mAgenda->gyToTime( gyEnd + 1 );
1471 1471
1472 QDateTime dtStart(dayStart,timeStart); 1472 QDateTime dtStart(dayStart,timeStart);
1473 QDateTime dtEnd(dayEnd,timeEnd); 1473 QDateTime dtEnd(dayEnd,timeEnd);
1474 1474
1475 mTimeSpanBegin = dtStart; 1475 mTimeSpanBegin = dtStart;
1476 mTimeSpanEnd = dtEnd; 1476 mTimeSpanEnd = dtEnd;
1477 1477
1478} 1478}
1479 1479
1480void KOAgendaView::deleteSelectedDateTime() 1480void KOAgendaView::deleteSelectedDateTime()
1481{ 1481{
1482 mTimeSpanBegin.setDate(QDate()); 1482 mTimeSpanBegin.setDate(QDate());
1483 mTimeSpanEnd.setDate(QDate()); 1483 mTimeSpanEnd.setDate(QDate());
1484 mTimeSpanInAllDay = false; 1484 mTimeSpanInAllDay = false;
1485} 1485}
1486 1486
1487void KOAgendaView::keyPressEvent ( QKeyEvent * e ) 1487void KOAgendaView::keyPressEvent ( QKeyEvent * e )
1488{ 1488{
1489 e->ignore(); 1489 e->ignore();
1490} 1490}
1491 1491
1492void KOAgendaView::scrollOneHourUp() 1492void KOAgendaView::scrollOneHourUp()
1493{ 1493{
1494 1494
1495 mAgenda->scrollBy ( 0, -mAgenda->contentsHeight () / 24 ); 1495 mAgenda->scrollBy ( 0, -mAgenda->contentsHeight () / 24 );
1496} 1496}
1497void KOAgendaView::scrollOneHourDown() 1497void KOAgendaView::scrollOneHourDown()
1498{ 1498{
1499 mAgenda->scrollBy ( 0, mAgenda->contentsHeight () / 24 ); 1499 mAgenda->scrollBy ( 0, mAgenda->contentsHeight () / 24 );
1500} 1500}
1501 1501
1502void KOAgendaView::setStartHour( int h ) 1502void KOAgendaView::setStartHour( int h )
1503{ 1503{
1504 mAgenda->setStartHour( h ); 1504 mAgenda->setStartHour( h );
1505 1505
1506} 1506}
1507 1507
1508void KOAgendaView::updateTodo( Todo * t, int ) 1508void KOAgendaView::updateTodo( Todo * t, int )
1509{ 1509{
1510 if ( !isVisible() )
1511 return;
1510 bool remove = false; 1512 bool remove = false;
1511 bool removeAD = false; 1513 bool removeAD = false;
1512 QDate da; 1514 QDate da;
1513 if ( t->hasCompletedDate() ) 1515 if ( t->hasCompletedDate() )
1514 da = t->completed().date(); 1516 da = t->completed().date();
1515 else 1517 else
1516 da = t->dtDue().date(); 1518 da = t->dtDue().date();
1517 if ( ! t->hasDueDate() && !t->hasCompletedDate() ) { 1519 if ( ! t->hasDueDate() && !t->hasCompletedDate() ) {
1518 remove = true; 1520 remove = true;
1519 removeAD = true; 1521 removeAD = true;
1520 } 1522 }
1521 else { 1523 else {
1522 bool overdue = (!t->isCompleted()) && (t->dtDue() < QDate::currentDate()) && KOPrefs::instance()->mShowTodoInAgenda ; 1524 bool overdue = (!t->isCompleted()) && (t->dtDue() < QDate::currentDate()) && KOPrefs::instance()->mShowTodoInAgenda ;
1523 if ( overdue && 1525 if ( overdue &&
1524 QDate::currentDate() >= mSelectedDates.first() && 1526 QDate::currentDate() >= mSelectedDates.first() &&
1525 QDate::currentDate() <= mSelectedDates.last()) { 1527 QDate::currentDate() <= mSelectedDates.last()) {
1526 removeAD = false; 1528 removeAD = false;
1527 remove = true; 1529 remove = true;
1528 } 1530 }
1529 else { 1531 else {
1530 1532
1531 if ( da < mSelectedDates.first() || 1533 if ( da < mSelectedDates.first() ||
1532 da > mSelectedDates.last() ) { 1534 da > mSelectedDates.last() ) {
1533 remove = true; 1535 remove = true;
1534 removeAD = true; 1536 removeAD = true;
1535 } else { 1537 } else {
1536 remove = t->doesFloat() && !t->hasCompletedDate(); 1538 remove = t->doesFloat() && !t->hasCompletedDate();
1537 removeAD = !remove; 1539 removeAD = !remove;
1538 } 1540 }
1539 } 1541 }
1540 } 1542 }
1541 int days = mSelectedDates.first().daysTo( da ); 1543 int days = mSelectedDates.first().daysTo( da );
1542 //qDebug("daysto %d %d %d", days, remove,removeAD ); 1544 //qDebug("daysto %d %d %d", days, remove,removeAD );
1543 mAgenda->updateTodo( t , days, remove); 1545 mAgenda->updateTodo( t , days, remove);
1544 if ( KOPrefs::instance()->mShowTodoInAgenda ) 1546 if ( KOPrefs::instance()->mShowTodoInAgenda )
1545 mAllDayAgenda->updateTodo( t , days, removeAD); 1547 mAllDayAgenda->updateTodo( t , days, removeAD);
1546 //qDebug("KOAgendaView::updateTodo( Todo *, int ) "); 1548 //qDebug("KOAgendaView::updateTodo( Todo *, int ) ");
1547 1549
1548} 1550}