summaryrefslogtreecommitdiffabout
path: root/korganizer
Unidiff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagenda.cpp2
-rw-r--r--korganizer/koagendaview.cpp2
-rw-r--r--korganizer/kolistview.cpp2
-rw-r--r--korganizer/koprefs.cpp1
-rw-r--r--korganizer/koprefs.h1
-rw-r--r--korganizer/koprefsdialog.cpp19
6 files changed, 19 insertions, 8 deletions
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp
index cdeeac5..2a2acb1 100644
--- a/korganizer/koagenda.cpp
+++ b/korganizer/koagenda.cpp
@@ -1331,512 +1331,514 @@ void KOAgenda::drawContentsToPainter( QPainter* paint, bool backgroundOnly )// i
1331 if ( mSelectedDates[selDay] == QDateTime::currentDateTime ().date() && KOPrefs::instance()->mHighlightCurrentDay) { 1331 if ( mSelectedDates[selDay] == QDateTime::currentDateTime ().date() && KOPrefs::instance()->mHighlightCurrentDay) {
1332 int x1 = cx; 1332 int x1 = cx;
1333 int y1 = 0; 1333 int y1 = 0;
1334 if (y1 < cy) y1 = cy; 1334 if (y1 < cy) y1 = cy;
1335 int x2 = cx+cw-1; 1335 int x2 = cx+cw-1;
1336 int y2 = contentsHeight(); 1336 int y2 = contentsHeight();
1337 if (y2 > cy+ch-1) y2=cy+ch-1; 1337 if (y2 > cy+ch-1) y2=cy+ch-1;
1338 if (x2 >= x1 && y2 >= y1) { 1338 if (x2 >= x1 && y2 >= y1) {
1339 int gxStart = selDay; 1339 int gxStart = selDay;
1340 int gxEnd = gxStart ; 1340 int gxEnd = gxStart ;
1341 int xStart = KOGlobals::self()->reverseLayout() ? 1341 int xStart = KOGlobals::self()->reverseLayout() ?
1342 (mColumns - 1 - gxStart)*mGridSpacingX : 1342 (mColumns - 1 - gxStart)*mGridSpacingX :
1343 gxStart*mGridSpacingX; 1343 gxStart*mGridSpacingX;
1344 if (xStart < x1) xStart = x1; 1344 if (xStart < x1) xStart = x1;
1345 int xEnd = KOGlobals::self()->reverseLayout() ? 1345 int xEnd = KOGlobals::self()->reverseLayout() ?
1346 (mColumns - gxStart)*mGridSpacingX-1 : 1346 (mColumns - gxStart)*mGridSpacingX-1 :
1347 (gxStart+1)*mGridSpacingX-1; 1347 (gxStart+1)*mGridSpacingX-1;
1348 if (xEnd > x2) xEnd = x2; 1348 if (xEnd > x2) xEnd = x2;
1349 if ( KOPrefs::instance()->mUseHighlightLightColor ) 1349 if ( KOPrefs::instance()->mUseHighlightLightColor )
1350 p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, 1350 p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1,
1351 KOPrefs::instance()->mAgendaBgColor.light()); 1351 KOPrefs::instance()->mAgendaBgColor.light());
1352 else 1352 else
1353 p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, 1353 p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1,
1354 KOPrefs::instance()->mAgendaBgColor.dark()); 1354 KOPrefs::instance()->mAgendaBgColor.dark());
1355 1355
1356 } 1356 }
1357 } 1357 }
1358 } 1358 }
1359 // Highlight working hours 1359 // Highlight working hours
1360 1360
1361 if ( !backgroundOnly ) 1361 if ( !backgroundOnly )
1362 if (mWorkingHoursEnable) { 1362 if (mWorkingHoursEnable) {
1363 int x1 = cx; 1363 int x1 = cx;
1364 int y1 = mWorkingHoursYTop; 1364 int y1 = mWorkingHoursYTop;
1365 if (y1 < cy) y1 = cy; 1365 if (y1 < cy) y1 = cy;
1366 int x2 = cx+cw-1; 1366 int x2 = cx+cw-1;
1367 // int x2 = mGridSpacingX * 5 - 1; 1367 // int x2 = mGridSpacingX * 5 - 1;
1368 // if (x2 > cx+cw-1) x2 = cx + cw - 1; 1368 // if (x2 > cx+cw-1) x2 = cx + cw - 1;
1369 int y2 = mWorkingHoursYBottom; 1369 int y2 = mWorkingHoursYBottom;
1370 if (y2 > cy+ch-1) y2=cy+ch-1; 1370 if (y2 > cy+ch-1) y2=cy+ch-1;
1371 1371
1372 if (x2 >= x1 && y2 >= y1) { 1372 if (x2 >= x1 && y2 >= y1) {
1373 // qDebug("x1 %d mGridSpacingX %d ", x1, mGridSpacingX ); 1373 // qDebug("x1 %d mGridSpacingX %d ", x1, mGridSpacingX );
1374 int gxStart = x1/mGridSpacingX; 1374 int gxStart = x1/mGridSpacingX;
1375 int gxEnd = x2/mGridSpacingX; 1375 int gxEnd = x2/mGridSpacingX;
1376 while(gxStart <= gxEnd) { 1376 while(gxStart <= gxEnd) {
1377 if (gxStart < int(mHolidayMask->count()) && 1377 if (gxStart < int(mHolidayMask->count()) &&
1378 !mHolidayMask->at(gxStart)) { 1378 !mHolidayMask->at(gxStart)) {
1379 int xStart = KOGlobals::self()->reverseLayout() ? 1379 int xStart = KOGlobals::self()->reverseLayout() ?
1380 (mColumns - 1 - gxStart)*mGridSpacingX : 1380 (mColumns - 1 - gxStart)*mGridSpacingX :
1381 gxStart*mGridSpacingX; 1381 gxStart*mGridSpacingX;
1382 if (xStart < x1) xStart = x1; 1382 if (xStart < x1) xStart = x1;
1383 int xEnd = KOGlobals::self()->reverseLayout() ? 1383 int xEnd = KOGlobals::self()->reverseLayout() ?
1384 (mColumns - gxStart)*mGridSpacingX-1 : 1384 (mColumns - gxStart)*mGridSpacingX-1 :
1385 (gxStart+1)*mGridSpacingX-1; 1385 (gxStart+1)*mGridSpacingX-1;
1386 if (xEnd > x2) xEnd = x2; 1386 if (xEnd > x2) xEnd = x2;
1387 if ( mSelectedDates[gxStart] == QDateTime::currentDateTime ().date()&& KOPrefs::instance()->mHighlightCurrentDay ) { 1387 if ( mSelectedDates[gxStart] == QDateTime::currentDateTime ().date()&& KOPrefs::instance()->mHighlightCurrentDay ) {
1388 if ( KOPrefs::instance()->mUseHighlightLightColor ) 1388 if ( KOPrefs::instance()->mUseHighlightLightColor )
1389 p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, 1389 p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1,
1390 KOPrefs::instance()->mWorkingHoursColor.light()); 1390 KOPrefs::instance()->mWorkingHoursColor.light());
1391 else 1391 else
1392 p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, 1392 p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1,
1393 KOPrefs::instance()->mWorkingHoursColor.dark()); 1393 KOPrefs::instance()->mWorkingHoursColor.dark());
1394 } else { 1394 } else {
1395 p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, 1395 p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1,
1396 KOPrefs::instance()->mWorkingHoursColor); 1396 KOPrefs::instance()->mWorkingHoursColor);
1397 } 1397 }
1398 } 1398 }
1399 ++gxStart; 1399 ++gxStart;
1400 } 1400 }
1401 } 1401 }
1402 } 1402 }
1403 /* 1403 /*
1404 int selectionX = KOGlobals::self()->reverseLayout() ? 1404 int selectionX = KOGlobals::self()->reverseLayout() ?
1405 (mColumns - 1 - mSelectionCellX) * mGridSpacingX : 1405 (mColumns - 1 - mSelectionCellX) * mGridSpacingX :
1406 mSelectionCellX * mGridSpacingX; 1406 mSelectionCellX * mGridSpacingX;
1407 1407
1408 // Draw selection 1408 // Draw selection
1409 if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && 1409 if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) &&
1410 ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) { 1410 ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) {
1411 // TODO: paint only part within cx,cy,cw,ch 1411 // TODO: paint only part within cx,cy,cw,ch
1412 p->fillRect( selectionX, mSelectionYTop, mGridSpacingX, 1412 p->fillRect( selectionX, mSelectionYTop, mGridSpacingX,
1413 mSelectionHeight, KOPrefs::instance()->mHighlightColor ); 1413 mSelectionHeight, KOPrefs::instance()->mHighlightColor );
1414 } 1414 }
1415 */ 1415 */
1416 // Draw vertical lines of grid 1416 // Draw vertical lines of grid
1417 1417
1418 int x = ((int)(cx/mGridSpacingX))*mGridSpacingX; 1418 int x = ((int)(cx/mGridSpacingX))*mGridSpacingX;
1419 if ( mGridSpacingX > 0 ) { 1419 if ( mGridSpacingX > 0 ) {
1420 while (x < cx + cw) { 1420 while (x < cx + cw) {
1421 p->drawLine(x,cy,x,cy+ch); 1421 p->drawLine(x,cy,x,cy+ch);
1422 x+=mGridSpacingX; 1422 x+=mGridSpacingX;
1423 } 1423 }
1424 } 1424 }
1425 // Draw horizontal lines of grid 1425 // Draw horizontal lines of grid
1426 int y = ((int)(cy/lGridSpacingY))*lGridSpacingY; 1426 int y = ((int)(cy/lGridSpacingY))*lGridSpacingY;
1427 if ( lGridSpacingY > 0 ) { 1427 if ( lGridSpacingY > 0 ) {
1428 while (y < cy + ch) { 1428 while (y < cy + ch) {
1429 p->setPen( SolidLine ); 1429 p->setPen( SolidLine );
1430 p->drawLine(cx,y,cx+cw,y); 1430 p->drawLine(cx,y,cx+cw,y);
1431 y+=lGridSpacingY; 1431 y+=lGridSpacingY;
1432 p->setPen( DotLine ); 1432 p->setPen( DotLine );
1433 p->drawLine(cx,y,cx+cw,y); 1433 p->drawLine(cx,y,cx+cw,y);
1434 y+=lGridSpacingY; 1434 y+=lGridSpacingY;
1435 } 1435 }
1436 p->setPen( SolidLine ); 1436 p->setPen( SolidLine );
1437 } 1437 }
1438 mPixPainter.end() ; 1438 mPixPainter.end() ;
1439} 1439}
1440 1440
1441/* 1441/*
1442 Convert srcollview contents coordinates to agenda grid coordinates. 1442 Convert srcollview contents coordinates to agenda grid coordinates.
1443*/ 1443*/
1444void KOAgenda::contentsToGrid (int x, int y, int& gx, int& gy) 1444void KOAgenda::contentsToGrid (int x, int y, int& gx, int& gy)
1445{ 1445{
1446 gx = KOGlobals::self()->reverseLayout() ? mColumns - 1 - x/mGridSpacingX : 1446 gx = KOGlobals::self()->reverseLayout() ? mColumns - 1 - x/mGridSpacingX :
1447 x/mGridSpacingX; 1447 x/mGridSpacingX;
1448 gy = y/mGridSpacingY; 1448 gy = y/mGridSpacingY;
1449} 1449}
1450 1450
1451/* 1451/*
1452 Convert agenda grid coordinates to scrollview contents coordinates. 1452 Convert agenda grid coordinates to scrollview contents coordinates.
1453*/ 1453*/
1454void KOAgenda::gridToContents (int gx, int gy, int& x, int& y) 1454void KOAgenda::gridToContents (int gx, int gy, int& x, int& y)
1455{ 1455{
1456 x = KOGlobals::self()->reverseLayout() ? (mColumns - 1 - gx)*mGridSpacingX: 1456 x = KOGlobals::self()->reverseLayout() ? (mColumns - 1 - gx)*mGridSpacingX:
1457 gx*mGridSpacingX; 1457 gx*mGridSpacingX;
1458 y = gy*mGridSpacingY; 1458 y = gy*mGridSpacingY;
1459} 1459}
1460 1460
1461 1461
1462/* 1462/*
1463 Return Y coordinate corresponding to time. Coordinates are rounded to fit into 1463 Return Y coordinate corresponding to time. Coordinates are rounded to fit into
1464 the grid. 1464 the grid.
1465*/ 1465*/
1466int KOAgenda::timeToY(const QTime &time) 1466int KOAgenda::timeToY(const QTime &time)
1467{ 1467{
1468 int minutesPerCell = 24 * 60 / mRows; 1468 int minutesPerCell = 24 * 60 / mRows;
1469 int timeMinutes = time.hour() * 60 + time.minute(); 1469 int timeMinutes = time.hour() * 60 + time.minute();
1470 int Y = (timeMinutes + (minutesPerCell / 2)) / minutesPerCell; 1470 int Y = (timeMinutes + (minutesPerCell / 2)) / minutesPerCell;
1471 return Y; 1471 return Y;
1472} 1472}
1473 1473
1474 1474
1475/* 1475/*
1476 Return time corresponding to cell y coordinate. Coordinates are rounded to 1476 Return time corresponding to cell y coordinate. Coordinates are rounded to
1477 fit into the grid. 1477 fit into the grid.
1478*/ 1478*/
1479QTime KOAgenda::gyToTime(int gy) 1479QTime KOAgenda::gyToTime(int gy)
1480{ 1480{
1481 1481
1482 int secondsPerCell = 24 * 60 * 60/ mRows; 1482 int secondsPerCell = 24 * 60 * 60/ mRows;
1483 1483
1484 int timeSeconds = secondsPerCell * gy; 1484 int timeSeconds = secondsPerCell * gy;
1485 1485
1486 QTime time( 0, 0, 0 ); 1486 QTime time( 0, 0, 0 );
1487 if ( timeSeconds < 24 * 60 * 60 ) { 1487 if ( timeSeconds < 24 * 60 * 60 ) {
1488 time = time.addSecs(timeSeconds); 1488 time = time.addSecs(timeSeconds);
1489 } else { 1489 } else {
1490 time.setHMS( 23, 59, 59 ); 1490 time.setHMS( 23, 59, 59 );
1491 } 1491 }
1492 1492
1493 return time; 1493 return time;
1494} 1494}
1495 1495
1496void KOAgenda::setStartHour(int startHour) 1496void KOAgenda::setStartHour(int startHour)
1497{ 1497{
1498 int startCell = startHour * mRows / 24; 1498 int startCell = startHour * mRows / 24;
1499 setContentsPos(0,startCell * gridSpacingY()); 1499 setContentsPos(0,startCell * gridSpacingY());
1500} 1500}
1501void KOAgenda::hideUnused() 1501void KOAgenda::hideUnused()
1502{ 1502{
1503 // experimental only 1503 // experimental only
1504 // return; 1504 // return;
1505 KOAgendaItem *item; 1505 KOAgendaItem *item;
1506 for ( item=mUnusedItems.first(); item != 0; item=mUnusedItems.next() ) { 1506 for ( item=mUnusedItems.first(); item != 0; item=mUnusedItems.next() ) {
1507 item->hide(); 1507 item->hide();
1508 } 1508 }
1509} 1509}
1510 1510
1511 1511
1512KOAgendaItem *KOAgenda::getNewItem(Incidence * event,QDate qd, QWidget* view) 1512KOAgendaItem *KOAgenda::getNewItem(Incidence * event,QDate qd, QWidget* view)
1513{ 1513{
1514 1514
1515 KOAgendaItem *fi; 1515 KOAgendaItem *fi;
1516 for ( fi=mUnusedItems.first(); fi != 0; fi=mUnusedItems.next() ) { 1516 for ( fi=mUnusedItems.first(); fi != 0; fi=mUnusedItems.next() ) {
1517 if ( fi->incidence() == event ) { 1517 if ( fi->incidence() == event ) {
1518 mUnusedItems.remove(); 1518 mUnusedItems.remove();
1519 fi->init( event, qd ); 1519 fi->init( event, qd );
1520 return fi; 1520 return fi;
1521 } 1521 }
1522 } 1522 }
1523 fi=mUnusedItems.first(); 1523 fi=mUnusedItems.first();
1524 if ( fi ) { 1524 if ( fi ) {
1525 mUnusedItems.remove(); 1525 mUnusedItems.remove();
1526 fi->init( event, qd ); 1526 fi->init( event, qd );
1527 return fi; 1527 return fi;
1528 } 1528 }
1529 // qDebug("new KOAgendaItem "); 1529 // qDebug("new KOAgendaItem ");
1530 1530
1531 KOAgendaItem* agendaItem = new KOAgendaItem( event, qd, view, mAllDayMode ); 1531 KOAgendaItem* agendaItem = new KOAgendaItem( event, qd, view, mAllDayMode );
1532 agendaItem->installEventFilter(this); 1532 agendaItem->installEventFilter(this);
1533 addChild(agendaItem,0,0); 1533 addChild(agendaItem,0,0);
1534 return agendaItem; 1534 return agendaItem;
1535} 1535}
1536KOAgendaItem * KOAgenda::getItemForTodo ( Todo * todo ) 1536KOAgendaItem * KOAgenda::getItemForTodo ( Todo * todo )
1537{ 1537{
1538 KOAgendaItem *item; 1538 KOAgendaItem *item;
1539 for ( item=mItems.first(); item != 0; item=mItems.next() ) { 1539 for ( item=mItems.first(); item != 0; item=mItems.next() ) {
1540 if ( item->incidence() == todo ) { 1540 if ( item->incidence() == todo ) {
1541 mItems.remove(); 1541 mItems.remove();
1542 return item; 1542 return item;
1543 } 1543 }
1544 } 1544 }
1545 return 0; 1545 return 0;
1546} 1546}
1547 1547
1548 1548
1549void KOAgenda::updateTodo( Todo * todo, int days, bool remove) 1549void KOAgenda::updateTodo( Todo * todo, int days, bool remove)
1550{ 1550{
1551 // ( todo->hasCompletedDate() && todo->completed().date() == currentDate )|| 1551 // ( todo->hasCompletedDate() && todo->completed().date() == currentDate )||
1552 KOAgendaItem *item; 1552 KOAgendaItem *item;
1553 item = getItemForTodo ( todo ); 1553 item = getItemForTodo ( todo );
1554 //qDebug("KOAgenda::updateTodo %d %d %d %d", this, todo, days, remove); 1554 //qDebug("KOAgenda::updateTodo %d %d %d %d", this, todo, days, remove);
1555 if ( item ) { 1555 if ( item ) {
1556 blockSignals( true ); 1556 blockSignals( true );
1557 //qDebug("item found "); 1557 //qDebug("item found ");
1558 item->hide(); 1558 item->hide();
1559 item->setCellX(-2, -1 ); 1559 item->setCellX(-2, -1 );
1560 item->select(false); 1560 item->select(false);
1561 mUnusedItems.append( item ); 1561 mUnusedItems.append( item );
1562 mItems.remove( item ); 1562 mItems.remove( item );
1563 QPtrList<KOAgendaItem> oldconflictItems = item->conflictItems(); 1563 QPtrList<KOAgendaItem> oldconflictItems = item->conflictItems();
1564 KOAgendaItem *itemit; 1564 KOAgendaItem *itemit;
1565 //globalFlagBlockAgendaItemPaint = 1; 1565 //globalFlagBlockAgendaItemPaint = 1;
1566 for ( itemit=oldconflictItems.first(); itemit != 0; 1566 for ( itemit=oldconflictItems.first(); itemit != 0;
1567 itemit=oldconflictItems.next() ) { 1567 itemit=oldconflictItems.next() ) {
1568 if ( itemit != item ) 1568 if ( itemit != item )
1569 placeSubCells(itemit); 1569 placeSubCells(itemit);
1570 } 1570 }
1571 qApp->processEvents(); 1571 qApp->processEvents();
1572 //globalFlagBlockAgendaItemPaint = 0; 1572 //globalFlagBlockAgendaItemPaint = 0;
1573 for ( itemit=oldconflictItems.first(); itemit != 0; 1573 for ( itemit=oldconflictItems.first(); itemit != 0;
1574 itemit=oldconflictItems.next() ) { 1574 itemit=oldconflictItems.next() ) {
1575 globalFlagBlockAgendaItemUpdate = 0; 1575 globalFlagBlockAgendaItemUpdate = 0;
1576 if ( itemit != item ) 1576 if ( itemit != item )
1577 itemit->repaintMe(); 1577 itemit->repaintMe();
1578 globalFlagBlockAgendaItemUpdate = 1; 1578 globalFlagBlockAgendaItemUpdate = 1;
1579 itemit->repaint(); 1579 itemit->repaint();
1580 } 1580 }
1581 blockSignals( false ); 1581 blockSignals( false );
1582 } 1582 }
1583 if ( remove ) { 1583 if ( remove ) {
1584 //qDebug("remove****************************************** "); 1584 //qDebug("remove****************************************** ");
1585 return; 1585 return;
1586 } 1586 }
1587 if ( todo->hasCompletedDate() && !KOPrefs::instance()->mShowCompletedTodoInAgenda )
1588 return;
1587 //qDebug("updateTodo+++++++++++++++++++++++++++++++++++++ "); 1589 //qDebug("updateTodo+++++++++++++++++++++++++++++++++++++ ");
1588 bool overdue = (!todo->isCompleted()) && (todo->dtDue() < QDate::currentDate())&& ( KOPrefs::instance()->mShowTodoInAgenda ); 1590 bool overdue = (!todo->isCompleted()) && (todo->dtDue() < QDate::currentDate())&& ( KOPrefs::instance()->mShowTodoInAgenda );
1589 QDate currentDate; 1591 QDate currentDate;
1590 QDateTime dt; 1592 QDateTime dt;
1591 if ( todo->hasCompletedDate() ) 1593 if ( todo->hasCompletedDate() )
1592 dt = todo->completed(); 1594 dt = todo->completed();
1593 else 1595 else
1594 dt = todo->dtDue(); 1596 dt = todo->dtDue();
1595 if ( overdue ) { 1597 if ( overdue ) {
1596 currentDate = QDate::currentDate(); 1598 currentDate = QDate::currentDate();
1597 days += todo->dtDue().date().daysTo( currentDate ); 1599 days += todo->dtDue().date().daysTo( currentDate );
1598 } 1600 }
1599 else 1601 else
1600 currentDate = dt.date(); 1602 currentDate = dt.date();
1601 1603
1602 if (( todo->doesFloat() || overdue) && !todo->hasCompletedDate() ) { 1604 if (( todo->doesFloat() || overdue) && !todo->hasCompletedDate() ) {
1603 if ( ! mAllDayMode ) return; 1605 if ( ! mAllDayMode ) return;
1604 // aldayagenda 1606 // aldayagenda
1605 globalFlagBlockAgendaItemPaint = 1; 1607 globalFlagBlockAgendaItemPaint = 1;
1606 item = insertAllDayItem(todo, currentDate,days, days); 1608 item = insertAllDayItem(todo, currentDate,days, days);
1607 item->show(); 1609 item->show();
1608 1610
1609 } 1611 }
1610 else { 1612 else {
1611 if ( mAllDayMode ) return; 1613 if ( mAllDayMode ) return;
1612 // mAgenda 1614 // mAgenda
1613 globalFlagBlockAgendaItemPaint = 1; 1615 globalFlagBlockAgendaItemPaint = 1;
1614 int endY = timeToY(dt.time()) - 1; 1616 int endY = timeToY(dt.time()) - 1;
1615 int hi = 12/KOPrefs::instance()->mHourSize; 1617 int hi = 12/KOPrefs::instance()->mHourSize;
1616 int startY = endY - 1-hi; 1618 int startY = endY - 1-hi;
1617 item = insertItem(todo,currentDate,days,startY,endY); 1619 item = insertItem(todo,currentDate,days,startY,endY);
1618 item->show(); 1620 item->show();
1619 } 1621 }
1620 qApp->processEvents(); 1622 qApp->processEvents();
1621 globalFlagBlockAgendaItemPaint = 0; 1623 globalFlagBlockAgendaItemPaint = 0;
1622 QPtrList<KOAgendaItem> oldconflictItems = item->conflictItems(); 1624 QPtrList<KOAgendaItem> oldconflictItems = item->conflictItems();
1623 KOAgendaItem *itemit; 1625 KOAgendaItem *itemit;
1624 for ( itemit=oldconflictItems.first(); itemit != 0; 1626 for ( itemit=oldconflictItems.first(); itemit != 0;
1625 itemit=oldconflictItems.next() ) { 1627 itemit=oldconflictItems.next() ) {
1626 globalFlagBlockAgendaItemUpdate = 0; 1628 globalFlagBlockAgendaItemUpdate = 0;
1627 itemit->repaintMe(); 1629 itemit->repaintMe();
1628 globalFlagBlockAgendaItemUpdate = 1; 1630 globalFlagBlockAgendaItemUpdate = 1;
1629 itemit->repaint(); 1631 itemit->repaint();
1630 } 1632 }
1631 globalFlagBlockAgendaItemUpdate = 0; 1633 globalFlagBlockAgendaItemUpdate = 0;
1632 item->repaintMe(); 1634 item->repaintMe();
1633 globalFlagBlockAgendaItemUpdate = 1; 1635 globalFlagBlockAgendaItemUpdate = 1;
1634 item->repaint(); 1636 item->repaint();
1635} 1637}
1636/* 1638/*
1637 Insert KOAgendaItem into agenda. 1639 Insert KOAgendaItem into agenda.
1638*/ 1640*/
1639KOAgendaItem *KOAgenda::insertItem (Incidence *event,QDate qd,int X,int YTop,int YBottom) 1641KOAgendaItem *KOAgenda::insertItem (Incidence *event,QDate qd,int X,int YTop,int YBottom)
1640{ 1642{
1641 if (mAllDayMode) { 1643 if (mAllDayMode) {
1642 qDebug("KOAgenda: calling insertItem in all-day mode is illegal. "); 1644 qDebug("KOAgenda: calling insertItem in all-day mode is illegal. ");
1643 return 0; 1645 return 0;
1644 } 1646 }
1645 1647
1646 KOAgendaItem *agendaItem = getNewItem(event,qd,viewport()); 1648 KOAgendaItem *agendaItem = getNewItem(event,qd,viewport());
1647 //agendaItem->setFrameStyle(WinPanel|Raised); 1649 //agendaItem->setFrameStyle(WinPanel|Raised);
1648 1650
1649 int YSize = YBottom - YTop + 1; 1651 int YSize = YBottom - YTop + 1;
1650 if (YSize < 0) { 1652 if (YSize < 0) {
1651 YSize = 1; 1653 YSize = 1;
1652 } 1654 }
1653 int iheight = mGridSpacingY * YSize; 1655 int iheight = mGridSpacingY * YSize;
1654 1656
1655 agendaItem->resize(mGridSpacingX,iheight ); 1657 agendaItem->resize(mGridSpacingX,iheight );
1656 agendaItem->setCellXY(X,YTop,YBottom); 1658 agendaItem->setCellXY(X,YTop,YBottom);
1657 agendaItem->setCellXWidth(X); 1659 agendaItem->setCellXWidth(X);
1658 1660
1659 //addChild(agendaItem,X*mGridSpacingX,YTop*mGridSpacingY); 1661 //addChild(agendaItem,X*mGridSpacingX,YTop*mGridSpacingY);
1660 mItems.append(agendaItem); 1662 mItems.append(agendaItem);
1661 1663
1662 placeSubCells(agendaItem); 1664 placeSubCells(agendaItem);
1663 1665
1664 //agendaItem->show(); 1666 //agendaItem->show();
1665 1667
1666 marcus_bains(); 1668 marcus_bains();
1667 1669
1668 return agendaItem; 1670 return agendaItem;
1669} 1671}
1670 1672
1671 1673
1672/* 1674/*
1673 Insert all-day KOAgendaItem into agenda. 1675 Insert all-day KOAgendaItem into agenda.
1674*/ 1676*/
1675KOAgendaItem *KOAgenda::insertAllDayItem (Incidence *event,QDate qd,int XBegin,int XEnd) 1677KOAgendaItem *KOAgenda::insertAllDayItem (Incidence *event,QDate qd,int XBegin,int XEnd)
1676{ 1678{
1677 if (!mAllDayMode) { 1679 if (!mAllDayMode) {
1678 return 0; 1680 return 0;
1679 } 1681 }
1680 1682
1681 KOAgendaItem *agendaItem = getNewItem(event,qd,viewport()); 1683 KOAgendaItem *agendaItem = getNewItem(event,qd,viewport());
1682 1684
1683 agendaItem->setCellXY(XBegin,0,0); 1685 agendaItem->setCellXY(XBegin,0,0);
1684 agendaItem->setCellXWidth(XEnd); 1686 agendaItem->setCellXWidth(XEnd);
1685 agendaItem->resize(mGridSpacingX * agendaItem->cellWidth(),mGridSpacingY); 1687 agendaItem->resize(mGridSpacingX * agendaItem->cellWidth(),mGridSpacingY);
1686 1688
1687 //addChild(agendaItem,XBegin*mGridSpacingX,0); 1689 //addChild(agendaItem,XBegin*mGridSpacingX,0);
1688 mItems.append(agendaItem); 1690 mItems.append(agendaItem);
1689 1691
1690 placeSubCells(agendaItem); 1692 placeSubCells(agendaItem);
1691 1693
1692 //agendaItem->show(); 1694 //agendaItem->show();
1693 1695
1694 return agendaItem; 1696 return agendaItem;
1695} 1697}
1696 1698
1697 1699
1698void KOAgenda::insertMultiItem (Event *event,QDate qd,int XBegin,int XEnd, 1700void KOAgenda::insertMultiItem (Event *event,QDate qd,int XBegin,int XEnd,
1699 int YTop,int YBottom) 1701 int YTop,int YBottom)
1700{ 1702{
1701 if (mAllDayMode) { 1703 if (mAllDayMode) {
1702 ; 1704 ;
1703 return; 1705 return;
1704 } 1706 }
1705 1707
1706 int cellX,cellYTop,cellYBottom; 1708 int cellX,cellYTop,cellYBottom;
1707 QString newtext; 1709 QString newtext;
1708 int width = XEnd - XBegin + 1; 1710 int width = XEnd - XBegin + 1;
1709 int count = 0; 1711 int count = 0;
1710 KOAgendaItem *current = 0; 1712 KOAgendaItem *current = 0;
1711 QPtrList<KOAgendaItem> multiItems; 1713 QPtrList<KOAgendaItem> multiItems;
1712 for (cellX = XBegin;cellX <= XEnd;++cellX) { 1714 for (cellX = XBegin;cellX <= XEnd;++cellX) {
1713 if (cellX == XBegin) cellYTop = YTop; 1715 if (cellX == XBegin) cellYTop = YTop;
1714 else cellYTop = 0; 1716 else cellYTop = 0;
1715 if (cellX == XEnd) cellYBottom = YBottom; 1717 if (cellX == XEnd) cellYBottom = YBottom;
1716 else cellYBottom = rows() - 1; 1718 else cellYBottom = rows() - 1;
1717 newtext = QString("(%1/%2): ").arg(++count).arg(width); 1719 newtext = QString("(%1/%2): ").arg(++count).arg(width);
1718 newtext.append(event->summary()); 1720 newtext.append(event->summary());
1719 current = insertItem(event,qd,cellX,cellYTop,cellYBottom); 1721 current = insertItem(event,qd,cellX,cellYTop,cellYBottom);
1720 current->setText(newtext); 1722 current->setText(newtext);
1721 multiItems.append(current); 1723 multiItems.append(current);
1722 } 1724 }
1723 1725
1724 KOAgendaItem *next = 0; 1726 KOAgendaItem *next = 0;
1725 KOAgendaItem *last = multiItems.last(); 1727 KOAgendaItem *last = multiItems.last();
1726 KOAgendaItem *first = multiItems.first(); 1728 KOAgendaItem *first = multiItems.first();
1727 KOAgendaItem *setFirst,*setLast; 1729 KOAgendaItem *setFirst,*setLast;
1728 current = first; 1730 current = first;
1729 while (current) { 1731 while (current) {
1730 next = multiItems.next(); 1732 next = multiItems.next();
1731 if (current == first) setFirst = 0; 1733 if (current == first) setFirst = 0;
1732 else setFirst = first; 1734 else setFirst = first;
1733 if (current == last) setLast = 0; 1735 if (current == last) setLast = 0;
1734 else setLast = last; 1736 else setLast = last;
1735 1737
1736 current->setMultiItem(setFirst,next,setLast); 1738 current->setMultiItem(setFirst,next,setLast);
1737 current = next; 1739 current = next;
1738 } 1740 }
1739 1741
1740 marcus_bains(); 1742 marcus_bains();
1741} 1743}
1742 1744
1743 1745
1744//QSizePolicy KOAgenda::sizePolicy() const 1746//QSizePolicy KOAgenda::sizePolicy() const
1745//{ 1747//{
1746 // Thought this would make the all-day event agenda minimum size and the 1748 // Thought this would make the all-day event agenda minimum size and the
1747 // normal agenda take the remaining space. But it doesn´t work. The QSplitter 1749 // normal agenda take the remaining space. But it doesn´t work. The QSplitter
1748 // don´t seem to think that an Expanding widget needs more space than a 1750 // don´t seem to think that an Expanding widget needs more space than a
1749 // Preferred one. 1751 // Preferred one.
1750 // But it doesn´t hurt, so it stays. 1752 // But it doesn´t hurt, so it stays.
1751// if (mAllDayMode) { 1753// if (mAllDayMode) {
1752// return QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Preferred); 1754// return QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Preferred);
1753// } else { 1755// } else {
1754// return QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding); 1756// return QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
1755// } 1757// }
1756//} 1758//}
1757void KOAgenda::finishResize ( ) 1759void KOAgenda::finishResize ( )
1758{ 1760{
1759 //qDebug("finishResize+++++++++++++++++++++++++++++++ ( ) "); 1761 //qDebug("finishResize+++++++++++++++++++++++++++++++ ( ) ");
1760 if ( globalFlagBlockAgenda == 0 ) { 1762 if ( globalFlagBlockAgenda == 0 ) {
1761 finishUpdate(); 1763 finishUpdate();
1762 //qDebug("finishUpdate() called "); 1764 //qDebug("finishUpdate() called ");
1763 } 1765 }
1764} 1766}
1765/* 1767/*
1766 Overridden from QScrollView to provide proper resizing of KOAgendaItems. 1768 Overridden from QScrollView to provide proper resizing of KOAgendaItems.
1767*/ 1769*/
1768void KOAgenda::resizeEvent ( QResizeEvent *ev ) 1770void KOAgenda::resizeEvent ( QResizeEvent *ev )
1769{ 1771{
1770 mSelectionHeight = 0; 1772 mSelectionHeight = 0;
1771 mResizeTimer.start( 150 , true ); 1773 mResizeTimer.start( 150 , true );
1772 computeSizes(); 1774 computeSizes();
1773 return; 1775 return;
1774 1776
1775} 1777}
1776void KOAgenda::computeSizes() 1778void KOAgenda::computeSizes()
1777{ 1779{
1778 if ( globalFlagBlockStartup ) 1780 if ( globalFlagBlockStartup )
1779 return; 1781 return;
1780 int frameOffset = frameWidth() * 2 +1; 1782 int frameOffset = frameWidth() * 2 +1;
1781 if (mAllDayMode) { 1783 if (mAllDayMode) {
1782 mGridSpacingX = (width()-frameOffset) / mColumns; 1784 mGridSpacingX = (width()-frameOffset) / mColumns;
1783 mGridSpacingY = height() - 2 * frameWidth() - 1; 1785 mGridSpacingY = height() - 2 * frameWidth() - 1;
1784 resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY + 1); 1786 resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY + 1);
1785 // mGridSpacingY = height(); 1787 // mGridSpacingY = height();
1786 // resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 ); 1788 // resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 );
1787 1789
1788 KOAgendaItem *item; 1790 KOAgendaItem *item;
1789 int subCellWidth; 1791 int subCellWidth;
1790 for ( item=mItems.first(); item != 0; item=mItems.next() ) { 1792 for ( item=mItems.first(); item != 0; item=mItems.next() ) {
1791 subCellWidth = mGridSpacingY / item->subCells(); 1793 subCellWidth = mGridSpacingY / item->subCells();
1792 item->resize(mGridSpacingX * item->cellWidth(),subCellWidth); 1794 item->resize(mGridSpacingX * item->cellWidth(),subCellWidth);
1793 moveChild(item,KOGlobals::self()->reverseLayout() ? 1795 moveChild(item,KOGlobals::self()->reverseLayout() ?
1794 (mColumns - 1 - item->cellX()) * mGridSpacingX : 1796 (mColumns - 1 - item->cellX()) * mGridSpacingX :
1795 item->cellX() * mGridSpacingX, 1797 item->cellX() * mGridSpacingX,
1796 item->subCell() * subCellWidth); 1798 item->subCell() * subCellWidth);
1797 } 1799 }
1798 KOPrefs::instance()->mAllDaySize = mGridSpacingY; 1800 KOPrefs::instance()->mAllDaySize = mGridSpacingY;
1799 } else { 1801 } else {
1800 mGridSpacingX = (width() - verticalScrollBar()->width()-frameOffset)/mColumns; 1802 mGridSpacingX = (width() - verticalScrollBar()->width()-frameOffset)/mColumns;
1801 if (height() > mGridSpacingY * mRows + 1 ) { 1803 if (height() > mGridSpacingY * mRows + 1 ) {
1802 KOPrefs::instance()->mHourSize = ((height())/mRows)+1; 1804 KOPrefs::instance()->mHourSize = ((height())/mRows)+1;
1803 mGridSpacingY = KOPrefs::instance()->mHourSize ; 1805 mGridSpacingY = KOPrefs::instance()->mHourSize ;
1804 resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 ); 1806 resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 );
1805 emit resizedSignal(); 1807 emit resizedSignal();
1806 } else 1808 } else
1807 resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 ); 1809 resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 );
1808 KOAgendaItem *item; 1810 KOAgendaItem *item;
1809 int subCellWidth; 1811 int subCellWidth;
1810 1812
1811 for ( item=mItems.first(); item != 0; item=mItems.next() ) { 1813 for ( item=mItems.first(); item != 0; item=mItems.next() ) {
1812 subCellWidth = mGridSpacingX / item->subCells(); 1814 subCellWidth = mGridSpacingX / item->subCells();
1813 item->resize(subCellWidth,item->height()); 1815 item->resize(subCellWidth,item->height());
1814 moveChild(item,(KOGlobals::self()->reverseLayout() ? 1816 moveChild(item,(KOGlobals::self()->reverseLayout() ?
1815 (mColumns - 1 - item->cellX()) * mGridSpacingX : 1817 (mColumns - 1 - item->cellX()) * mGridSpacingX :
1816 item->cellX() * mGridSpacingX) + 1818 item->cellX() * mGridSpacingX) +
1817 item->subCell() * subCellWidth,childY(item)); 1819 item->subCell() * subCellWidth,childY(item));
1818 } 1820 }
1819 } 1821 }
1820 int cw = contentsWidth(); 1822 int cw = contentsWidth();
1821 int ch = contentsHeight(); 1823 int ch = contentsHeight();
1822 if ( mAllDayMode ) { 1824 if ( mAllDayMode ) {
1823 QPixmap* paintPixAll = KOAgendaItem::paintPixAllday(); 1825 QPixmap* paintPixAll = KOAgendaItem::paintPixAllday();
1824 if ( (paintPixAll->width() < cw || paintPixAll->height() < ch) && cw > 0 && ch > 0 ) 1826 if ( (paintPixAll->width() < cw || paintPixAll->height() < ch) && cw > 0 && ch > 0 )
1825 paintPixAll->resize( cw, ch ); 1827 paintPixAll->resize( cw, ch );
1826 } else { 1828 } else {
1827 QPixmap* paintPix = KOAgendaItem::paintPix(); 1829 QPixmap* paintPix = KOAgendaItem::paintPix();
1828 if ( paintPix->width() < cw || paintPix->height() < ch ) 1830 if ( paintPix->width() < cw || paintPix->height() < ch )
1829 KOAgendaItem::resizePixmap( cw , ch ); 1831 KOAgendaItem::resizePixmap( cw , ch );
1830 } 1832 }
1831 1833
1832 checkScrollBoundaries(); 1834 checkScrollBoundaries();
1833 marcus_bains(); 1835 marcus_bains();
1834 drawContentsToPainter(); 1836 drawContentsToPainter();
1835 viewport()->repaint(false); 1837 viewport()->repaint(false);
1836} 1838}
1837 1839
1838void KOAgenda::scrollUp() 1840void KOAgenda::scrollUp()
1839{ 1841{
1840 scrollBy(0,-mScrollOffset); 1842 scrollBy(0,-mScrollOffset);
1841} 1843}
1842 1844
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index b5a4199..fd9bf29 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -983,513 +983,513 @@ void KOAgendaView::updateEventDates(KOAgendaItem *item, int type)
983 } else { 983 } else {
984 startDate = mSelectedDates[item->cellX()]; 984 startDate = mSelectedDates[item->cellX()];
985 } 985 }
986 } 986 }
987 startDt.setDate(startDate); 987 startDt.setDate(startDate);
988 988
989 if (item->incidence()->doesFloat()) { 989 if (item->incidence()->doesFloat()) {
990 endDt.setDate(startDate.addDays(item->cellWidth() - 1)); 990 endDt.setDate(startDate.addDays(item->cellWidth() - 1));
991 } else { 991 } else {
992 if ( type == KOAgenda::RESIZETOP || type == KOAgenda::MOVE ) 992 if ( type == KOAgenda::RESIZETOP || type == KOAgenda::MOVE )
993 startDt.setTime(mAgenda->gyToTime(item->cellYTop())); 993 startDt.setTime(mAgenda->gyToTime(item->cellYTop()));
994 if ( item->incidence()->type() == "Event" ) { 994 if ( item->incidence()->type() == "Event" ) {
995 if ( type == KOAgenda::MOVE ) { 995 if ( type == KOAgenda::MOVE ) {
996 endDt = startDt.addSecs(lenInSecs); 996 endDt = startDt.addSecs(lenInSecs);
997 997
998 } else if ( type == KOAgenda::RESIZEBOTTOM ) { 998 } else if ( type == KOAgenda::RESIZEBOTTOM ) {
999 if (item->lastMultiItem()) { 999 if (item->lastMultiItem()) {
1000 endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1)); 1000 endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1));
1001 endDt.setDate(startDate. 1001 endDt.setDate(startDate.
1002 addDays(item->lastMultiItem()->cellX() - item->cellX())); 1002 addDays(item->lastMultiItem()->cellX() - item->cellX()));
1003 } else { 1003 } else {
1004 endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1)); 1004 endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1));
1005 endDt.setDate(startDate); 1005 endDt.setDate(startDate);
1006 } 1006 }
1007 } 1007 }
1008 } else { 1008 } else {
1009 // todo 1009 // todo
1010 if (item->lastMultiItem()) { 1010 if (item->lastMultiItem()) {
1011 endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1)); 1011 endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1));
1012 endDt.setDate(startDate. 1012 endDt.setDate(startDate.
1013 addDays(item->lastMultiItem()->cellX() - item->cellX())); 1013 addDays(item->lastMultiItem()->cellX() - item->cellX()));
1014 } else { 1014 } else {
1015 //qDebug("tem->cellYBottom() %d",item->cellYBottom() ); 1015 //qDebug("tem->cellYBottom() %d",item->cellYBottom() );
1016 if ( item->cellYBottom() > 0 ) 1016 if ( item->cellYBottom() > 0 )
1017 endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1)); 1017 endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1));
1018 else 1018 else
1019 endDt.setTime((static_cast<Todo*>(item->incidence()))->dtDue().time()); 1019 endDt.setTime((static_cast<Todo*>(item->incidence()))->dtDue().time());
1020 endDt.setDate(startDate); 1020 endDt.setDate(startDate);
1021 } 1021 }
1022 } 1022 }
1023 } 1023 }
1024 if ( item->incidence()->type() == "Event" ) { 1024 if ( item->incidence()->type() == "Event" ) {
1025 item->incidence()->setDtStart(startDt); 1025 item->incidence()->setDtStart(startDt);
1026 (static_cast<Event*>(item->incidence()))->setDtEnd(endDt); 1026 (static_cast<Event*>(item->incidence()))->setDtEnd(endDt);
1027 } else if ( item->incidence()->type() == "Todo" ) { 1027 } else if ( item->incidence()->type() == "Todo" ) {
1028 Todo* to = static_cast<Todo*>(item->incidence()); 1028 Todo* to = static_cast<Todo*>(item->incidence());
1029 1029
1030 to->setDtDue(endDt); 1030 to->setDtDue(endDt);
1031 if ( to->hasStartDate() ) { 1031 if ( to->hasStartDate() ) {
1032 if (to->dtStart() >= to->dtDue() ) 1032 if (to->dtStart() >= to->dtDue() )
1033 to->setDtStart(to->dtDue().addDays( -2 )); 1033 to->setDtStart(to->dtDue().addDays( -2 ));
1034 } 1034 }
1035 1035
1036 } 1036 }
1037 //qDebug("KOAgendaView::updateEventDates stsart %s end %s ", startDt.toString().latin1(), endDt.toString().latin1() ); 1037 //qDebug("KOAgendaView::updateEventDates stsart %s end %s ", startDt.toString().latin1(), endDt.toString().latin1() );
1038 item->incidence()->setRevision(item->incidence()->revision()+1); 1038 item->incidence()->setRevision(item->incidence()->revision()+1);
1039 item->setItemDate(startDt.date()); 1039 item->setItemDate(startDt.date());
1040 //item->updateItem(); 1040 //item->updateItem();
1041 if ( item->incidence()->type() == "Todo" ) { 1041 if ( item->incidence()->type() == "Todo" ) {
1042 emit todoMoved((Todo*)item->incidence(), KOGlobals::EVENTEDITED ); 1042 emit todoMoved((Todo*)item->incidence(), KOGlobals::EVENTEDITED );
1043 1043
1044 } 1044 }
1045 else 1045 else
1046 emit incidenceChanged(item->incidence(), KOGlobals::EVENTEDITED); 1046 emit incidenceChanged(item->incidence(), KOGlobals::EVENTEDITED);
1047 item->updateItem(); 1047 item->updateItem();
1048} 1048}
1049 1049
1050void KOAgendaView::showDates( const QDate &start, const QDate &end ) 1050void KOAgendaView::showDates( const QDate &start, const QDate &end )
1051{ 1051{
1052 // kdDebug() << "KOAgendaView::selectDates" << endl; 1052 // kdDebug() << "KOAgendaView::selectDates" << endl;
1053 1053
1054 mSelectedDates.clear(); 1054 mSelectedDates.clear();
1055 // qDebug("KOAgendaView::showDates "); 1055 // qDebug("KOAgendaView::showDates ");
1056 QDate d = start; 1056 QDate d = start;
1057 while (d <= end) { 1057 while (d <= end) {
1058 mSelectedDates.append(d); 1058 mSelectedDates.append(d);
1059 d = d.addDays( 1 ); 1059 d = d.addDays( 1 );
1060 } 1060 }
1061 1061
1062 // and update the view 1062 // and update the view
1063 fillAgenda(); 1063 fillAgenda();
1064} 1064}
1065 1065
1066 1066
1067void KOAgendaView::showEvents(QPtrList<Event>) 1067void KOAgendaView::showEvents(QPtrList<Event>)
1068{ 1068{
1069 kdDebug() << "KOAgendaView::showEvents() is not yet implemented" << endl; 1069 kdDebug() << "KOAgendaView::showEvents() is not yet implemented" << endl;
1070} 1070}
1071 1071
1072void KOAgendaView::changeEventDisplay(Event *, int) 1072void KOAgendaView::changeEventDisplay(Event *, int)
1073{ 1073{
1074 // qDebug("KOAgendaView::changeEventDisplay "); 1074 // qDebug("KOAgendaView::changeEventDisplay ");
1075 // kdDebug() << "KOAgendaView::changeEventDisplay" << endl; 1075 // kdDebug() << "KOAgendaView::changeEventDisplay" << endl;
1076 // this should be re-written to be MUCH smarter. Right now we 1076 // this should be re-written to be MUCH smarter. Right now we
1077 // are just playing dumb. 1077 // are just playing dumb.
1078 fillAgenda(); 1078 fillAgenda();
1079} 1079}
1080 1080
1081void KOAgendaView::fillAgenda(const QDate &) 1081void KOAgendaView::fillAgenda(const QDate &)
1082{ 1082{
1083 // qDebug("KOAgendaView::fillAgenda "); 1083 // qDebug("KOAgendaView::fillAgenda ");
1084 fillAgenda(); 1084 fillAgenda();
1085} 1085}
1086 1086
1087void KOAgendaView::fillAgenda() 1087void KOAgendaView::fillAgenda()
1088{ 1088{
1089 if ( globalFlagBlockStartup ) 1089 if ( globalFlagBlockStartup )
1090 return; 1090 return;
1091 if ( globalFlagBlockAgenda == 1 ) 1091 if ( globalFlagBlockAgenda == 1 )
1092 return; 1092 return;
1093 static bool onlyOne = false; 1093 static bool onlyOne = false;
1094 if ( onlyOne ) 1094 if ( onlyOne )
1095 return; 1095 return;
1096 onlyOne = true; 1096 onlyOne = true;
1097 //if ( globalFlagBlockAgenda == 2 ) 1097 //if ( globalFlagBlockAgenda == 2 )
1098 //globalFlagBlockAgenda = 0; 1098 //globalFlagBlockAgenda = 0;
1099 // globalFlagBlockPainting = false; 1099 // globalFlagBlockPainting = false;
1100 if ( globalFlagBlockAgenda == 0 ) 1100 if ( globalFlagBlockAgenda == 0 )
1101 globalFlagBlockAgenda = 1; 1101 globalFlagBlockAgenda = 1;
1102 // clearView(); 1102 // clearView();
1103 //qDebug("fillAgenda()++++ "); 1103 //qDebug("fillAgenda()++++ ");
1104 globalFlagBlockAgendaItemPaint = 1; 1104 globalFlagBlockAgendaItemPaint = 1;
1105 1105
1106 mAllDayAgenda->changeColumns(mSelectedDates.count()); 1106 mAllDayAgenda->changeColumns(mSelectedDates.count());
1107 mAgenda->changeColumns(mSelectedDates.count()); 1107 mAgenda->changeColumns(mSelectedDates.count());
1108 qApp->processEvents(); 1108 qApp->processEvents();
1109 mEventIndicatorTop->changeColumns(mSelectedDates.count()); 1109 mEventIndicatorTop->changeColumns(mSelectedDates.count());
1110 mEventIndicatorBottom->changeColumns(mSelectedDates.count()); 1110 mEventIndicatorBottom->changeColumns(mSelectedDates.count());
1111 setHolidayMasks(); 1111 setHolidayMasks();
1112 1112
1113 //mAgenda->hideUnused(); 1113 //mAgenda->hideUnused();
1114 //mAllDayAgenda->hideUnused(); 1114 //mAllDayAgenda->hideUnused();
1115 1115
1116 // mAgenda->blockNextRepaint( false ); 1116 // mAgenda->blockNextRepaint( false );
1117 // mAgenda->viewport()->repaint(); 1117 // mAgenda->viewport()->repaint();
1118 // mAgenda->blockNextRepaint( true ); 1118 // mAgenda->blockNextRepaint( true );
1119 mMinY.resize(mSelectedDates.count()); 1119 mMinY.resize(mSelectedDates.count());
1120 mMaxY.resize(mSelectedDates.count()); 1120 mMaxY.resize(mSelectedDates.count());
1121 1121
1122 QPtrList<Event> dayEvents; 1122 QPtrList<Event> dayEvents;
1123 1123
1124 // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. 1124 // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue.
1125 // Therefore, gtodoset all of them. 1125 // Therefore, gtodoset all of them.
1126 QPtrList<Todo> todos = calendar()->todos(); 1126 QPtrList<Todo> todos = calendar()->todos();
1127 1127
1128 mAgenda->setDateList(mSelectedDates); 1128 mAgenda->setDateList(mSelectedDates);
1129 1129
1130 QDate today = QDate::currentDate(); 1130 QDate today = QDate::currentDate();
1131 1131
1132 DateList::ConstIterator dit; 1132 DateList::ConstIterator dit;
1133 int curCol = 0; 1133 int curCol = 0;
1134 for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) { 1134 for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) {
1135 QDate currentDate = *dit; 1135 QDate currentDate = *dit;
1136 // kdDebug() << "KOAgendaView::fillAgenda(): " << currentDate.toString() 1136 // kdDebug() << "KOAgendaView::fillAgenda(): " << currentDate.toString()
1137 // << endl; 1137 // << endl;
1138 1138
1139 dayEvents = calendar()->events(currentDate,true); 1139 dayEvents = calendar()->events(currentDate,true);
1140 1140
1141 // Default values, which can never be reached 1141 // Default values, which can never be reached
1142 mMinY[curCol] = mAgenda->timeToY(QTime(23,59)) + 1; 1142 mMinY[curCol] = mAgenda->timeToY(QTime(23,59)) + 1;
1143 mMaxY[curCol] = mAgenda->timeToY(QTime(0,0)) - 1; 1143 mMaxY[curCol] = mAgenda->timeToY(QTime(0,0)) - 1;
1144 1144
1145 unsigned int numEvent; 1145 unsigned int numEvent;
1146 for(numEvent=0;numEvent<dayEvents.count();++numEvent) { 1146 for(numEvent=0;numEvent<dayEvents.count();++numEvent) {
1147 Event *event = dayEvents.at(numEvent); 1147 Event *event = dayEvents.at(numEvent);
1148 if ( !KOPrefs::instance()->mShowSyncEvents && event->uid().left(2) == QString("la") ) 1148 if ( !KOPrefs::instance()->mShowSyncEvents && event->uid().left(2) == QString("la") )
1149 if ( event->uid().left(15) == QString("last-syncEvent-") ) 1149 if ( event->uid().left(15) == QString("last-syncEvent-") )
1150 continue; 1150 continue;
1151 // kdDebug() << " Event: " << event->summary() << endl; 1151 // kdDebug() << " Event: " << event->summary() << endl;
1152 1152
1153 int beginX = currentDate.daysTo(event->dtStart().date()) + curCol; 1153 int beginX = currentDate.daysTo(event->dtStart().date()) + curCol;
1154 int endX = currentDate.daysTo(event->dtEnd().date()) + curCol; 1154 int endX = currentDate.daysTo(event->dtEnd().date()) + curCol;
1155 1155
1156 // kdDebug() << " beginX: " << beginX << " endX: " << endX << endl; 1156 // kdDebug() << " beginX: " << beginX << " endX: " << endX << endl;
1157 1157
1158 if (event->doesFloat()) { 1158 if (event->doesFloat()) {
1159 if (event->recurrence()->doesRecur()) { 1159 if (event->recurrence()->doesRecur()) {
1160 if (event->isMultiDay() ) { 1160 if (event->isMultiDay() ) {
1161 endX = endX - beginX;// endX is now number of days 1161 endX = endX - beginX;// endX is now number of days
1162 if ( event->recursOn( currentDate ) ) { 1162 if ( event->recursOn( currentDate ) ) {
1163 endX += curCol; 1163 endX += curCol;
1164 beginX = curCol; 1164 beginX = curCol;
1165 mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); 1165 mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX);
1166 } else { 1166 } else {
1167 //qDebug("days %d %s",endX , currentDate.toString().latin1()); 1167 //qDebug("days %d %s",endX , currentDate.toString().latin1());
1168 QDate dateit = currentDate.addDays( -endX ); 1168 QDate dateit = currentDate.addDays( -endX );
1169 if ( event->recursOn( dateit ) ) { 1169 if ( event->recursOn( dateit ) ) {
1170 //qDebug("found %d %d %d %s", endX,curCol, curCol-endX ,dateit.toString().latin1() ); 1170 //qDebug("found %d %d %d %s", endX,curCol, curCol-endX ,dateit.toString().latin1() );
1171 if ( curCol-endX < 0 ) { 1171 if ( curCol-endX < 0 ) {
1172 mAllDayAgenda->insertAllDayItem(event,currentDate,0,curCol); 1172 mAllDayAgenda->insertAllDayItem(event,currentDate,0,curCol);
1173 } 1173 }
1174 } 1174 }
1175 } 1175 }
1176 } else { 1176 } else {
1177 mAllDayAgenda->insertAllDayItem(event,currentDate,curCol,curCol); 1177 mAllDayAgenda->insertAllDayItem(event,currentDate,curCol,curCol);
1178 } 1178 }
1179 1179
1180 } else { 1180 } else {
1181 if (beginX <= 0 && curCol == 0) { 1181 if (beginX <= 0 && curCol == 0) {
1182 mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); 1182 mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX);
1183 } else if (beginX == curCol) { 1183 } else if (beginX == curCol) {
1184 mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); 1184 mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX);
1185 } 1185 }
1186 } 1186 }
1187 } else if (event->isMultiDay()) { 1187 } else if (event->isMultiDay()) {
1188 if ( event->doesRecur () ) { 1188 if ( event->doesRecur () ) {
1189 QDate dateit = currentDate; 1189 QDate dateit = currentDate;
1190 int count = 0; 1190 int count = 0;
1191 int max = event->dtStart().daysTo( event->dtEnd() ) +2; 1191 int max = event->dtStart().daysTo( event->dtEnd() ) +2;
1192 while (! event->recursOn( dateit ) && count <= max ) { 1192 while (! event->recursOn( dateit ) && count <= max ) {
1193 ++count; 1193 ++count;
1194 dateit = dateit.addDays( -1 ); 1194 dateit = dateit.addDays( -1 );
1195 } 1195 }
1196 bool ok; 1196 bool ok;
1197 QDateTime nextOcstart = event->getNextOccurence( QDateTime(dateit) ,&ok ); 1197 QDateTime nextOcstart = event->getNextOccurence( QDateTime(dateit) ,&ok );
1198 if ( ok ) 1198 if ( ok )
1199 { 1199 {
1200 int secs = event->dtStart().secsTo( event->dtEnd() ); 1200 int secs = event->dtStart().secsTo( event->dtEnd() );
1201 QDateTime nextOcend =nextOcstart.addSecs( secs ); ; 1201 QDateTime nextOcend =nextOcstart.addSecs( secs ); ;
1202 beginX = currentDate.daysTo(nextOcstart.date()) + curCol; 1202 beginX = currentDate.daysTo(nextOcstart.date()) + curCol;
1203 endX = currentDate.daysTo(nextOcend.date()) + curCol; 1203 endX = currentDate.daysTo(nextOcend.date()) + curCol;
1204 1204
1205 } 1205 }
1206 } 1206 }
1207 int startY = mAgenda->timeToY(event->dtStart().time()); 1207 int startY = mAgenda->timeToY(event->dtStart().time());
1208 int endY = mAgenda->timeToY(event->dtEnd().time()) - 1; 1208 int endY = mAgenda->timeToY(event->dtEnd().time()) - 1;
1209 //qDebug("insert %d %d %d %d %d ",beginX,endX,startY,endY , curCol ); 1209 //qDebug("insert %d %d %d %d %d ",beginX,endX,startY,endY , curCol );
1210 if ((beginX <= 0 && curCol == 0) || beginX == curCol) { 1210 if ((beginX <= 0 && curCol == 0) || beginX == curCol) {
1211 //qDebug("insert!!! "); 1211 //qDebug("insert!!! ");
1212 mAgenda->insertMultiItem(event,currentDate,beginX,endX,startY,endY); 1212 mAgenda->insertMultiItem(event,currentDate,beginX,endX,startY,endY);
1213 } 1213 }
1214 if (beginX == curCol) { 1214 if (beginX == curCol) {
1215 mMaxY[curCol] = mAgenda->timeToY(QTime(23,59)); 1215 mMaxY[curCol] = mAgenda->timeToY(QTime(23,59));
1216 if (startY < mMinY[curCol]) mMinY[curCol] = startY; 1216 if (startY < mMinY[curCol]) mMinY[curCol] = startY;
1217 } else if (endX == curCol) { 1217 } else if (endX == curCol) {
1218 mMinY[curCol] = mAgenda->timeToY(QTime(0,0)); 1218 mMinY[curCol] = mAgenda->timeToY(QTime(0,0));
1219 if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; 1219 if (endY > mMaxY[curCol]) mMaxY[curCol] = endY;
1220 } else { 1220 } else {
1221 mMinY[curCol] = mAgenda->timeToY(QTime(0,0)); 1221 mMinY[curCol] = mAgenda->timeToY(QTime(0,0));
1222 mMaxY[curCol] = mAgenda->timeToY(QTime(23,59)); 1222 mMaxY[curCol] = mAgenda->timeToY(QTime(23,59));
1223 } 1223 }
1224 } else { 1224 } else {
1225 int startY = mAgenda->timeToY(event->dtStart().time()); 1225 int startY = mAgenda->timeToY(event->dtStart().time());
1226 int endY = mAgenda->timeToY(event->dtEnd().time()) - 1; 1226 int endY = mAgenda->timeToY(event->dtEnd().time()) - 1;
1227 if (endY < startY) endY = startY; 1227 if (endY < startY) endY = startY;
1228 mAgenda->insertItem(event,currentDate,curCol,startY,endY); 1228 mAgenda->insertItem(event,currentDate,curCol,startY,endY);
1229 if (startY < mMinY[curCol]) mMinY[curCol] = startY; 1229 if (startY < mMinY[curCol]) mMinY[curCol] = startY;
1230 if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; 1230 if (endY > mMaxY[curCol]) mMaxY[curCol] = endY;
1231 } 1231 }
1232 } 1232 }
1233 // ---------- [display Todos -------------- 1233 // ---------- [display Todos --------------
1234 unsigned int numTodo; 1234 unsigned int numTodo;
1235 for (numTodo = 0; numTodo < todos.count(); ++numTodo) { 1235 for (numTodo = 0; numTodo < todos.count(); ++numTodo) {
1236 Todo *todo = todos.at(numTodo); 1236 Todo *todo = todos.at(numTodo);
1237 1237
1238 if ( ! todo->hasDueDate() && !todo->hasCompletedDate()) continue; // todo shall not be displayed if it has no date 1238 if ( ! todo->hasDueDate() && !todo->hasCompletedDate()) continue; // todo shall not be displayed if it has no date
1239 1239 if ( todo->hasCompletedDate() && !KOPrefs::instance()->mShowCompletedTodoInAgenda ) continue;
1240 // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. 1240 // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue.
1241 // Already completed items can be displayed on their original due date 1241 // Already completed items can be displayed on their original due date
1242 //if not KOPrefs::instance()->mShowTodoInAgenda, show overdue in agenda 1242 //if not KOPrefs::instance()->mShowTodoInAgenda, show overdue in agenda
1243 bool overdue = (!todo->isCompleted()) && (todo->dtDue() < today) && KOPrefs::instance()->mShowTodoInAgenda; 1243 bool overdue = (!todo->isCompleted()) && (todo->dtDue() < today) && KOPrefs::instance()->mShowTodoInAgenda;
1244 bool fillIn = false; 1244 bool fillIn = false;
1245 if ( todo->hasCompletedDate() && todo->completed().date() == currentDate ) 1245 if ( todo->hasCompletedDate() && todo->completed().date() == currentDate )
1246 fillIn = true; 1246 fillIn = true;
1247 if ( ! fillIn && !todo->hasCompletedDate() ) 1247 if ( ! fillIn && !todo->hasCompletedDate() )
1248 fillIn = ((todo->dtDue().date() == currentDate) && !overdue) || ((currentDate == today) && overdue); 1248 fillIn = ((todo->dtDue().date() == currentDate) && !overdue) || ((currentDate == today) && overdue);
1249 if ( fillIn ) { 1249 if ( fillIn ) {
1250 if ( (todo->doesFloat() || overdue ) && !todo->hasCompletedDate() ) { // Todo has no due-time set or is already overdue 1250 if ( (todo->doesFloat() || overdue ) && !todo->hasCompletedDate() ) { // Todo has no due-time set or is already overdue
1251 if ( KOPrefs::instance()->mShowTodoInAgenda ) 1251 if ( KOPrefs::instance()->mShowTodoInAgenda )
1252 mAllDayAgenda->insertAllDayItem(todo, currentDate, curCol, curCol); 1252 mAllDayAgenda->insertAllDayItem(todo, currentDate, curCol, curCol);
1253 } 1253 }
1254 else { 1254 else {
1255 QDateTime dt; 1255 QDateTime dt;
1256 if ( todo->hasCompletedDate() ) 1256 if ( todo->hasCompletedDate() )
1257 dt = todo->completed(); 1257 dt = todo->completed();
1258 else 1258 else
1259 dt = todo->dtDue();; 1259 dt = todo->dtDue();;
1260 1260
1261 1261
1262 int endY = mAgenda->timeToY(dt.time()) - 1; 1262 int endY = mAgenda->timeToY(dt.time()) - 1;
1263 int hi = (18/KOPrefs::instance()->mHourSize); 1263 int hi = (18/KOPrefs::instance()->mHourSize);
1264 //qDebug("hei %d ",KOPrefs::instance()->mHourSize); 1264 //qDebug("hei %d ",KOPrefs::instance()->mHourSize);
1265 int startY = endY -hi; 1265 int startY = endY -hi;
1266 1266
1267 mAgenda->insertItem(todo,currentDate,curCol,startY,endY); 1267 mAgenda->insertItem(todo,currentDate,curCol,startY,endY);
1268 1268
1269 if (startY < mMinY[curCol]) mMinY[curCol] = startY; 1269 if (startY < mMinY[curCol]) mMinY[curCol] = startY;
1270 if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; 1270 if (endY > mMaxY[curCol]) mMaxY[curCol] = endY;
1271 } 1271 }
1272 } 1272 }
1273 } 1273 }
1274 // ---------- display Todos] -------------- 1274 // ---------- display Todos] --------------
1275 1275
1276 ++curCol; 1276 ++curCol;
1277 } 1277 }
1278 mAgenda->hideUnused(); 1278 mAgenda->hideUnused();
1279 mAllDayAgenda->hideUnused(); 1279 mAllDayAgenda->hideUnused();
1280 mAgenda->checkScrollBoundaries(); 1280 mAgenda->checkScrollBoundaries();
1281 1281
1282 deleteSelectedDateTime(); 1282 deleteSelectedDateTime();
1283 1283
1284 createDayLabels(); 1284 createDayLabels();
1285 emit incidenceSelected( 0 ); 1285 emit incidenceSelected( 0 );
1286 1286
1287 if ( globalFlagBlockAgenda == 2 ) { 1287 if ( globalFlagBlockAgenda == 2 ) {
1288 if ( KOPrefs::instance()->mSetTimeToDayStartAt ) 1288 if ( KOPrefs::instance()->mSetTimeToDayStartAt )
1289 setStartHour( KOPrefs::instance()->mDayBegins ); 1289 setStartHour( KOPrefs::instance()->mDayBegins );
1290 else if ( KOPrefs::instance()->mCenterOnCurrentTime ) 1290 else if ( KOPrefs::instance()->mCenterOnCurrentTime )
1291 setStartHour( QTime::currentTime ().hour() ); 1291 setStartHour( QTime::currentTime ().hour() );
1292 // qApp->processEvents(); 1292 // qApp->processEvents();
1293 } 1293 }
1294 qApp->processEvents(); 1294 qApp->processEvents();
1295 //qDebug("qApp->processEvents(); END "); 1295 //qDebug("qApp->processEvents(); END ");
1296 globalFlagBlockAgenda = 0; 1296 globalFlagBlockAgenda = 0;
1297 1297
1298 // mAgenda->hideUnused(); 1298 // mAgenda->hideUnused();
1299 //mAllDayAgenda->hideUnused(); 1299 //mAllDayAgenda->hideUnused();
1300 mAllDayAgenda->drawContentsToPainter(); 1300 mAllDayAgenda->drawContentsToPainter();
1301 mAgenda->drawContentsToPainter(); 1301 mAgenda->drawContentsToPainter();
1302 repaintAgenda(); 1302 repaintAgenda();
1303 onlyOne = false; 1303 onlyOne = false;
1304 // mAgenda->finishUpdate(); 1304 // mAgenda->finishUpdate();
1305 //mAllDayAgenda->finishUpdate(); 1305 //mAllDayAgenda->finishUpdate();
1306 1306
1307 // repaintAgenda(); 1307 // repaintAgenda();
1308 //qApp->processEvents(); 1308 //qApp->processEvents();
1309 // globalFlagBlockAgenda = 0; 1309 // globalFlagBlockAgenda = 0;
1310} 1310}
1311void KOAgendaView::repaintAgenda() 1311void KOAgendaView::repaintAgenda()
1312{ 1312{
1313 // mAllDayAgenda->drawContentsToPainter(); 1313 // mAllDayAgenda->drawContentsToPainter();
1314// mAllDayAgenda->viewport()->repaint( false ); 1314// mAllDayAgenda->viewport()->repaint( false );
1315// mAgenda->drawContentsToPainter(); 1315// mAgenda->drawContentsToPainter();
1316// mAgenda->viewport()->repaint( false ); 1316// mAgenda->viewport()->repaint( false );
1317// qApp->processEvents(); 1317// qApp->processEvents();
1318 1318
1319 //qDebug("KOAgendaView::repaintAgenda() "); 1319 //qDebug("KOAgendaView::repaintAgenda() ");
1320 //qApp->processEvents(); 1320 //qApp->processEvents();
1321 mAgenda->viewport()->repaint( false ); 1321 mAgenda->viewport()->repaint( false );
1322 mAllDayAgenda->viewport()->repaint( false ); 1322 mAllDayAgenda->viewport()->repaint( false );
1323 mAgenda->finishUpdate(); 1323 mAgenda->finishUpdate();
1324 mAllDayAgenda->finishUpdate(); 1324 mAllDayAgenda->finishUpdate();
1325} 1325}
1326 1326
1327 1327
1328void KOAgendaView::clearView() 1328void KOAgendaView::clearView()
1329{ 1329{
1330 // kdDebug() << "ClearView" << endl; 1330 // kdDebug() << "ClearView" << endl;
1331 mAllDayAgenda->clear(); 1331 mAllDayAgenda->clear();
1332 mAgenda->clear(); 1332 mAgenda->clear();
1333} 1333}
1334 1334
1335void KOAgendaView::printPreview(CalPrinter *calPrinter, const QDate &fd, 1335void KOAgendaView::printPreview(CalPrinter *calPrinter, const QDate &fd,
1336 const QDate &td) 1336 const QDate &td)
1337{ 1337{
1338#ifndef KORG_NOPRINTER 1338#ifndef KORG_NOPRINTER
1339 if (fd == td) 1339 if (fd == td)
1340 calPrinter->preview(CalPrinter::Day, fd, td); 1340 calPrinter->preview(CalPrinter::Day, fd, td);
1341 else 1341 else
1342 calPrinter->preview(CalPrinter::Week, fd, td); 1342 calPrinter->preview(CalPrinter::Week, fd, td);
1343#endif 1343#endif
1344} 1344}
1345 1345
1346// void KOAgendaView::updateMovedTodo() 1346// void KOAgendaView::updateMovedTodo()
1347// { 1347// {
1348// // updateConfig(); 1348// // updateConfig();
1349// // emit updateTodoViews(); 1349// // emit updateTodoViews();
1350// } 1350// }
1351 1351
1352void KOAgendaView::slotShowDateView( int mode , int d ) 1352void KOAgendaView::slotShowDateView( int mode , int d )
1353{ 1353{
1354 if ( d >= mSelectedDates.count() ) { 1354 if ( d >= mSelectedDates.count() ) {
1355 qDebug("KOAgendaView::slotShowDateView datecounterror %d d ", d, mSelectedDates.count() ); 1355 qDebug("KOAgendaView::slotShowDateView datecounterror %d d ", d, mSelectedDates.count() );
1356 1356
1357 } else { 1357 } else {
1358 QDate day = mSelectedDates[d]; 1358 QDate day = mSelectedDates[d];
1359 emit showDateView(mode , day ); 1359 emit showDateView(mode , day );
1360 } 1360 }
1361 1361
1362} 1362}
1363void KOAgendaView::newEvent(int gx, int gy) 1363void KOAgendaView::newEvent(int gx, int gy)
1364{ 1364{
1365 if (!mSelectedDates.count()) return; 1365 if (!mSelectedDates.count()) return;
1366 1366
1367 QDate day = mSelectedDates[gx]; 1367 QDate day = mSelectedDates[gx];
1368 1368
1369 QTime time = mAgenda->gyToTime(gy); 1369 QTime time = mAgenda->gyToTime(gy);
1370 QDateTime dt(day,time); 1370 QDateTime dt(day,time);
1371 // if ( dt < QDateTime::currentDateTime () ) 1371 // if ( dt < QDateTime::currentDateTime () )
1372 // dt = QDateTime::currentDateTime ().addSecs( 3600 ); 1372 // dt = QDateTime::currentDateTime ().addSecs( 3600 );
1373 emit newEventSignal(dt); 1373 emit newEventSignal(dt);
1374} 1374}
1375 1375
1376void KOAgendaView::newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd) 1376void KOAgendaView::newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd)
1377{ 1377{
1378 if (!mSelectedDates.count()) return; 1378 if (!mSelectedDates.count()) return;
1379 1379
1380 QDate dayStart = mSelectedDates[gxStart]; 1380 QDate dayStart = mSelectedDates[gxStart];
1381 QDate dayEnd = mSelectedDates[gxEnd]; 1381 QDate dayEnd = mSelectedDates[gxEnd];
1382 1382
1383 QTime timeStart = mAgenda->gyToTime(gyStart); 1383 QTime timeStart = mAgenda->gyToTime(gyStart);
1384 QTime timeEnd = mAgenda->gyToTime( gyEnd + 1 ); 1384 QTime timeEnd = mAgenda->gyToTime( gyEnd + 1 );
1385 1385
1386 QDateTime dtStart(dayStart,timeStart); 1386 QDateTime dtStart(dayStart,timeStart);
1387 QDateTime dtEnd(dayEnd,timeEnd); 1387 QDateTime dtEnd(dayEnd,timeEnd);
1388 1388
1389 emit newEventSignal(dtStart,dtEnd); 1389 emit newEventSignal(dtStart,dtEnd);
1390} 1390}
1391 1391
1392void KOAgendaView::newEventAllDay(int gx, int ) 1392void KOAgendaView::newEventAllDay(int gx, int )
1393{ 1393{
1394 if (!mSelectedDates.count()) return; 1394 if (!mSelectedDates.count()) return;
1395 1395
1396 QDate day = mSelectedDates[gx]; 1396 QDate day = mSelectedDates[gx];
1397 1397
1398 emit newEventSignal(day); 1398 emit newEventSignal(day);
1399} 1399}
1400void KOAgendaView::newTodoAllDay(int gx, int ) 1400void KOAgendaView::newTodoAllDay(int gx, int )
1401{ 1401{
1402 if (!mSelectedDates.count()) return; 1402 if (!mSelectedDates.count()) return;
1403 1403
1404 QDateTime day (mSelectedDates[gx] ); 1404 QDateTime day (mSelectedDates[gx] );
1405 emit newTodoSignal(day, true); 1405 emit newTodoSignal(day, true);
1406} 1406}
1407void KOAgendaView::newTodo(int gx, int gy ) 1407void KOAgendaView::newTodo(int gx, int gy )
1408{ 1408{
1409 if (!mSelectedDates.count()) return; 1409 if (!mSelectedDates.count()) return;
1410 QDate dayStart = mSelectedDates[gx]; 1410 QDate dayStart = mSelectedDates[gx];
1411 QTime timeStart = mAgenda->gyToTime(gy); 1411 QTime timeStart = mAgenda->gyToTime(gy);
1412 QDateTime dt (dayStart,timeStart); 1412 QDateTime dt (dayStart,timeStart);
1413 emit newTodoSignal( dt, false ); 1413 emit newTodoSignal( dt, false );
1414} 1414}
1415 1415
1416void KOAgendaView::updateEventIndicatorTop(int newY) 1416void KOAgendaView::updateEventIndicatorTop(int newY)
1417{ 1417{
1418 uint i; 1418 uint i;
1419 for(i=0;i<mMinY.size();++i) { 1419 for(i=0;i<mMinY.size();++i) {
1420 if (newY >= mMinY.at(i)) mEventIndicatorTop->enableColumn(i,true); 1420 if (newY >= mMinY.at(i)) mEventIndicatorTop->enableColumn(i,true);
1421 else mEventIndicatorTop->enableColumn(i,false); 1421 else mEventIndicatorTop->enableColumn(i,false);
1422 } 1422 }
1423 1423
1424 mEventIndicatorTop->update(); 1424 mEventIndicatorTop->update();
1425} 1425}
1426 1426
1427void KOAgendaView::updateEventIndicatorBottom(int newY) 1427void KOAgendaView::updateEventIndicatorBottom(int newY)
1428{ 1428{
1429 uint i; 1429 uint i;
1430 for(i=0;i<mMaxY.size();++i) { 1430 for(i=0;i<mMaxY.size();++i) {
1431 if (newY <= mMaxY.at(i)) mEventIndicatorBottom->enableColumn(i,true); 1431 if (newY <= mMaxY.at(i)) mEventIndicatorBottom->enableColumn(i,true);
1432 else mEventIndicatorBottom->enableColumn(i,false); 1432 else mEventIndicatorBottom->enableColumn(i,false);
1433 } 1433 }
1434 1434
1435 mEventIndicatorBottom->update(); 1435 mEventIndicatorBottom->update();
1436} 1436}
1437 1437
1438void KOAgendaView::startDrag(Event *event) 1438void KOAgendaView::startDrag(Event *event)
1439{ 1439{
1440#ifndef KORG_NODND 1440#ifndef KORG_NODND
1441 DndFactory factory( calendar() ); 1441 DndFactory factory( calendar() );
1442 ICalDrag *vd = factory.createDrag(event,this); 1442 ICalDrag *vd = factory.createDrag(event,this);
1443 if (vd->drag()) { 1443 if (vd->drag()) {
1444 kdDebug() << "KOAgendaView::startDrag(): Delete drag source" << endl; 1444 kdDebug() << "KOAgendaView::startDrag(): Delete drag source" << endl;
1445 } 1445 }
1446#endif 1446#endif
1447} 1447}
1448 1448
1449void KOAgendaView::readSettings() 1449void KOAgendaView::readSettings()
1450{ 1450{
1451 readSettings(KOGlobals::config()); 1451 readSettings(KOGlobals::config());
1452} 1452}
1453 1453
1454void KOAgendaView::readSettings(KConfig *config) 1454void KOAgendaView::readSettings(KConfig *config)
1455{ 1455{
1456 // kdDebug() << "KOAgendaView::readSettings()" << endl; 1456 // kdDebug() << "KOAgendaView::readSettings()" << endl;
1457 1457
1458 config->setGroup("Views"); 1458 config->setGroup("Views");
1459 1459
1460 //#ifndef KORG_NOSPLITTER 1460 //#ifndef KORG_NOSPLITTER
1461 QValueList<int> sizes = config->readIntListEntry("Separator AgendaView"); 1461 QValueList<int> sizes = config->readIntListEntry("Separator AgendaView");
1462 if (sizes.count() == 2) { 1462 if (sizes.count() == 2) {
1463 if ( sizes[0] < 20 ) { 1463 if ( sizes[0] < 20 ) {
1464 sizes[1] = sizes[1] +20 - sizes[0]; 1464 sizes[1] = sizes[1] +20 - sizes[0];
1465 sizes[0] = 20; 1465 sizes[0] = 20;
1466 } 1466 }
1467 mSplitterAgenda->setSizes(sizes); 1467 mSplitterAgenda->setSizes(sizes);
1468 // qDebug("read %d %d ",sizes[0],sizes[1] ); 1468 // qDebug("read %d %d ",sizes[0],sizes[1] );
1469 } 1469 }
1470 //#endif 1470 //#endif
1471 1471
1472 // updateConfig(); 1472 // updateConfig();
1473} 1473}
1474 1474
1475void KOAgendaView::writeSettings(KConfig *config) 1475void KOAgendaView::writeSettings(KConfig *config)
1476{ 1476{
1477 // kdDebug() << "KOAgendaView::writeSettings()" << endl; 1477 // kdDebug() << "KOAgendaView::writeSettings()" << endl;
1478 1478
1479 config->setGroup("Views"); 1479 config->setGroup("Views");
1480 1480
1481 //#ifndef KORG_NOSPLITTER 1481 //#ifndef KORG_NOSPLITTER
1482 QValueList<int> list = mSplitterAgenda->sizes(); 1482 QValueList<int> list = mSplitterAgenda->sizes();
1483 config->writeEntry("Separator AgendaView",list); 1483 config->writeEntry("Separator AgendaView",list);
1484 //qDebug("write %d %d ", list[0],list[1] ); 1484 //qDebug("write %d %d ", list[0],list[1] );
1485 //#endif 1485 //#endif
1486} 1486}
1487 1487
1488void KOAgendaView::setHolidayMasks() 1488void KOAgendaView::setHolidayMasks()
1489{ 1489{
1490 mHolidayMask.resize(mSelectedDates.count()); 1490 mHolidayMask.resize(mSelectedDates.count());
1491 1491
1492 uint i; 1492 uint i;
1493 for(i=0;i<mSelectedDates.count();++i) { 1493 for(i=0;i<mSelectedDates.count();++i) {
1494 QDate date = mSelectedDates[i]; 1494 QDate date = mSelectedDates[i];
1495 bool showSaturday = KOPrefs::instance()->mExcludeSaturdays && (date.dayOfWeek() == 6); 1495 bool showSaturday = KOPrefs::instance()->mExcludeSaturdays && (date.dayOfWeek() == 6);
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index 02247c8..5f32e79 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -182,513 +182,513 @@ bool ListItemVisitor::visit(Todo *t)
182 } 182 }
183 } else { 183 } else {
184 mItem->setText(7,"---"); 184 mItem->setText(7,"---");
185 mItem->setText(8,"---"); 185 mItem->setText(8,"---");
186 } 186 }
187 mItem->setText(9, t->cancelled() ? i18n("Yes") : i18n("No")); 187 mItem->setText(9, t->cancelled() ? i18n("Yes") : i18n("No"));
188 mItem->setText(10,t->categoriesStr()); 188 mItem->setText(10,t->categoriesStr());
189 189
190 QString key; 190 QString key;
191 QDate d; 191 QDate d;
192 if (t->hasDueDate()) { 192 if (t->hasDueDate()) {
193 d = t->dtDue().date(); 193 d = t->dtDue().date();
194 QTime tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time(); 194 QTime tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time();
195 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); 195 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute());
196 mItem->setSortKey(7,key); 196 mItem->setSortKey(7,key);
197 } 197 }
198 if ( t->hasStartDate() ) { 198 if ( t->hasStartDate() ) {
199 d = t->dtStart().date(); 199 d = t->dtStart().date();
200 QTime tm = t->doesFloat() ? QTime(0,0) : t->dtStart().time(); 200 QTime tm = t->doesFloat() ? QTime(0,0) : t->dtStart().time();
201 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); 201 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute());
202 mItem->setSortKey(1,key); 202 mItem->setSortKey(1,key);
203 } 203 }
204 return true; 204 return true;
205} 205}
206 206
207bool ListItemVisitor::visit(Journal * j) 207bool ListItemVisitor::visit(Journal * j)
208{ 208{
209 QString des = j->description().left(30); 209 QString des = j->description().left(30);
210 des = des.simplifyWhiteSpace (); 210 des = des.simplifyWhiteSpace ();
211 des.replace (QRegExp ("\\n"),"" ); 211 des.replace (QRegExp ("\\n"),"" );
212 des.replace (QRegExp ("\\r"),"" ); 212 des.replace (QRegExp ("\\r"),"" );
213 mItem->setText(0,i18n("Journal: ")+des.left(25)); 213 mItem->setText(0,i18n("Journal: ")+des.left(25));
214 mItem->setText(1,j->dtStartDateStr()); 214 mItem->setText(1,j->dtStartDateStr());
215 mItem->setText(2,"---"); 215 mItem->setText(2,"---");
216 mItem->setText(3,"---"); 216 mItem->setText(3,"---");
217 mItem->setText(4,"---"); 217 mItem->setText(4,"---");
218 mItem->setText(5,"---"); 218 mItem->setText(5,"---");
219 mItem->setText(6,"---"); 219 mItem->setText(6,"---");
220 mItem->setText(7,j->dtStartDateStr()); 220 mItem->setText(7,j->dtStartDateStr());
221 mItem->setText(8,"---"); 221 mItem->setText(8,"---");
222 mItem->setText(9,"---"); 222 mItem->setText(9,"---");
223 mItem->setText(10,i18n("Last Modified: ")+ KGlobal::locale()->formatDateTime( j->lastModified() , true) ); 223 mItem->setText(10,i18n("Last Modified: ")+ KGlobal::locale()->formatDateTime( j->lastModified() , true) );
224 224
225 QString key; 225 QString key;
226 QDate d = j->dtStart().date(); 226 QDate d = j->dtStart().date();
227 key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); 227 key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day());
228 mItem->setSortKey(1,key); 228 mItem->setSortKey(1,key);
229 mItem->setSortKey(7,key); 229 mItem->setSortKey(7,key);
230 230
231 return true; 231 return true;
232} 232}
233 233
234KOListView::KOListView(Calendar *calendar, QWidget *parent, 234KOListView::KOListView(Calendar *calendar, QWidget *parent,
235 const char *name) 235 const char *name)
236 : KOEventView(calendar, parent, name) 236 : KOEventView(calendar, parent, name)
237{ 237{
238 mActiveItem = 0; 238 mActiveItem = 0;
239 mListView = new KOListViewListView(this); 239 mListView = new KOListViewListView(this);
240 mListView->addColumn(i18n("Summary")); 240 mListView->addColumn(i18n("Summary"));
241 mListView->addColumn(i18n("Start Date")); 241 mListView->addColumn(i18n("Start Date"));
242 mListView->addColumn(i18n("Start Time")); 242 mListView->addColumn(i18n("Start Time"));
243 mListView->addColumn(i18n("End Date")); 243 mListView->addColumn(i18n("End Date"));
244 mListView->addColumn(i18n("End Time")); 244 mListView->addColumn(i18n("End Time"));
245 mListView->addColumn(i18n("Alarm")); // alarm set? 245 mListView->addColumn(i18n("Alarm")); // alarm set?
246 mListView->addColumn(i18n("Recurs")); // recurs? 246 mListView->addColumn(i18n("Recurs")); // recurs?
247 mListView->addColumn(i18n("Due Date")); 247 mListView->addColumn(i18n("Due Date"));
248 mListView->addColumn(i18n("Due Time")); 248 mListView->addColumn(i18n("Due Time"));
249 mListView->addColumn(i18n("Cancelled")); 249 mListView->addColumn(i18n("Cancelled"));
250 mListView->addColumn(i18n("Categories")); 250 mListView->addColumn(i18n("Categories"));
251 251
252 mListView->setColumnAlignment(0,AlignLeft); 252 mListView->setColumnAlignment(0,AlignLeft);
253 mListView->setColumnAlignment(1,AlignLeft); 253 mListView->setColumnAlignment(1,AlignLeft);
254 mListView->setColumnAlignment(2,AlignHCenter); 254 mListView->setColumnAlignment(2,AlignHCenter);
255 mListView->setColumnAlignment(3,AlignLeft); 255 mListView->setColumnAlignment(3,AlignLeft);
256 mListView->setColumnAlignment(4,AlignHCenter); 256 mListView->setColumnAlignment(4,AlignHCenter);
257 mListView->setColumnAlignment(5,AlignLeft); 257 mListView->setColumnAlignment(5,AlignLeft);
258 mListView->setColumnAlignment(6,AlignLeft); 258 mListView->setColumnAlignment(6,AlignLeft);
259 mListView->setColumnAlignment(7,AlignLeft); 259 mListView->setColumnAlignment(7,AlignLeft);
260 mListView->setColumnAlignment(8,AlignLeft); 260 mListView->setColumnAlignment(8,AlignLeft);
261 mListView->setColumnAlignment(9,AlignLeft); 261 mListView->setColumnAlignment(9,AlignLeft);
262 mListView->setColumnAlignment(10,AlignLeft); 262 mListView->setColumnAlignment(10,AlignLeft);
263 mListView->setColumnWidthMode(10, QListView::Manual); 263 mListView->setColumnWidthMode(10, QListView::Manual);
264 mKOListViewWhatsThis = new KOListViewWhatsThis(mListView->viewport(),this); 264 mKOListViewWhatsThis = new KOListViewWhatsThis(mListView->viewport(),this);
265 265
266 int iii = 0; 266 int iii = 0;
267 for ( iii = 0; iii< 10 ; ++iii ) 267 for ( iii = 0; iii< 10 ; ++iii )
268 mListView->setColumnWidthMode( iii, QListView::Manual ); 268 mListView->setColumnWidthMode( iii, QListView::Manual );
269 269
270 QBoxLayout *layoutTop = new QVBoxLayout(this); 270 QBoxLayout *layoutTop = new QVBoxLayout(this);
271 layoutTop->addWidget(mListView); 271 layoutTop->addWidget(mListView);
272 mListView->setFont ( KOPrefs::instance()->mListViewFont ); 272 mListView->setFont ( KOPrefs::instance()->mListViewFont );
273 mPopupMenu = eventPopup(); 273 mPopupMenu = eventPopup();
274 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 274 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
275 i18n("Select all"),this, 275 i18n("Select all"),this,
276 SLOT(allSelection()),true); 276 SLOT(allSelection()),true);
277 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 277 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
278 i18n("Deselect all"),this, 278 i18n("Deselect all"),this,
279 SLOT(clearSelection()),true); 279 SLOT(clearSelection()),true);
280 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 280 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
281 i18n("Delete all selected"),this, 281 i18n("Delete all selected"),this,
282 SLOT(deleteAll()),true); 282 SLOT(deleteAll()),true);
283 mPopupMenu->insertSeparator(); 283 mPopupMenu->insertSeparator();
284 QPopupMenu * exportPO = new QPopupMenu ( this ); 284 QPopupMenu * exportPO = new QPopupMenu ( this );
285 mPopupMenu->insertItem( i18n("Export selected"), exportPO ); 285 mPopupMenu->insertItem( i18n("Export selected"), exportPO );
286 exportPO->insertItem( i18n("As iCal (ics) file..."),this, 286 exportPO->insertItem( i18n("As iCal (ics) file..."),this,
287 SLOT(saveToFile())); 287 SLOT(saveToFile()));
288 exportPO->insertItem( i18n("As vCal (vcs) file..."),this, 288 exportPO->insertItem( i18n("As vCal (vcs) file..."),this,
289 SLOT(saveToFileVCS())); 289 SLOT(saveToFileVCS()));
290 exportPO->insertItem( i18n("Journal/Details..."),this, 290 exportPO->insertItem( i18n("Journal/Details..."),this,
291 SLOT(saveDescriptionToFile())); 291 SLOT(saveDescriptionToFile()));
292 // mPopupMenu->insertSeparator(); 292 // mPopupMenu->insertSeparator();
293 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 293 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
294 i18n("Add Categ. to selected..."),this, 294 i18n("Add Categ. to selected..."),this,
295 SLOT(addCat()),true); 295 SLOT(addCat()),true);
296 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 296 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
297 i18n("Set Categ. for selected..."),this, 297 i18n("Set Categ. for selected..."),this,
298 SLOT(setCat()),true); 298 SLOT(setCat()),true);
299 //mPopupMenu->insertSeparator(); 299 //mPopupMenu->insertSeparator();
300 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 300 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
301 i18n("Set alarm for selected..."),this, 301 i18n("Set alarm for selected..."),this,
302 SLOT(setAlarm()),true); 302 SLOT(setAlarm()),true);
303 303
304 304
305#ifndef DESKTOP_VERSION 305#ifndef DESKTOP_VERSION
306 mPopupMenu->insertSeparator(); 306 mPopupMenu->insertSeparator();
307 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 307 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
308 i18n("Beam selected via IR"),this, 308 i18n("Beam selected via IR"),this,
309 SLOT(beamSelected()),true); 309 SLOT(beamSelected()),true);
310#endif 310#endif
311 /* 311 /*
312 mPopupMenu = new QPopupMenu; 312 mPopupMenu = new QPopupMenu;
313 mPopupMenu->insertItem(i18n("Edit Event"), this, 313 mPopupMenu->insertItem(i18n("Edit Event"), this,
314 SLOT (editEvent())); 314 SLOT (editEvent()));
315 mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this, 315 mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this,
316 SLOT (deleteEvent())); 316 SLOT (deleteEvent()));
317 mPopupMenu->insertSeparator(); 317 mPopupMenu->insertSeparator();
318 mPopupMenu->insertItem(i18n("Show Dates"), this, 318 mPopupMenu->insertItem(i18n("Show Dates"), this,
319 SLOT(showDates())); 319 SLOT(showDates()));
320 mPopupMenu->insertItem(i18n("Hide Dates"), this, 320 mPopupMenu->insertItem(i18n("Hide Dates"), this,
321 SLOT(hideDates())); 321 SLOT(hideDates()));
322 */ 322 */
323 QObject::connect(mListView,SIGNAL( newEvent()), 323 QObject::connect(mListView,SIGNAL( newEvent()),
324 this,SIGNAL(signalNewEvent())); 324 this,SIGNAL(signalNewEvent()));
325 QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)), 325 QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)),
326 this,SLOT(defaultItemAction(QListViewItem *))); 326 this,SLOT(defaultItemAction(QListViewItem *)));
327 QObject::connect(mListView,SIGNAL(rightButtonPressed( QListViewItem *, 327 QObject::connect(mListView,SIGNAL(rightButtonPressed( QListViewItem *,
328 const QPoint &, int )), 328 const QPoint &, int )),
329 this,SLOT(popupMenu(QListViewItem *,const QPoint &,int))); 329 this,SLOT(popupMenu(QListViewItem *,const QPoint &,int)));
330 QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)), 330 QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)),
331 SLOT(processSelectionChange(QListViewItem *))); 331 SLOT(processSelectionChange(QListViewItem *)));
332 QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)), 332 QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)),
333 SIGNAL(showIncidenceSignal(Incidence *)) ); 333 SIGNAL(showIncidenceSignal(Incidence *)) );
334 334
335 readSettings(KOGlobals::config(),"KOListView Layout"); 335 readSettings(KOGlobals::config(),"KOListView Layout");
336} 336}
337 337
338KOListView::~KOListView() 338KOListView::~KOListView()
339{ 339{
340 delete mPopupMenu; 340 delete mPopupMenu;
341#if QT_VERSION >= 0x030000 341#if QT_VERSION >= 0x030000
342 342
343#else 343#else
344 delete mKOListViewWhatsThis; 344 delete mKOListViewWhatsThis;
345#endif 345#endif
346} 346}
347 347
348QString KOListView::getWhatsThisText(QPoint p) 348QString KOListView::getWhatsThisText(QPoint p)
349{ 349{
350 KOListViewItem* item = ( KOListViewItem* ) mListView->itemAt( p ); 350 KOListViewItem* item = ( KOListViewItem* ) mListView->itemAt( p );
351 if ( item ) 351 if ( item )
352 return KIncidenceFormatter::instance()->getFormattedText( item->data(), 352 return KIncidenceFormatter::instance()->getFormattedText( item->data(),
353 KOPrefs::instance()->mWTshowDetails, 353 KOPrefs::instance()->mWTshowDetails,
354 KOPrefs::instance()->mWTshowCreated, 354 KOPrefs::instance()->mWTshowCreated,
355 KOPrefs::instance()->mWTshowChanged); 355 KOPrefs::instance()->mWTshowChanged);
356 return i18n("That is the list view" ); 356 return i18n("That is the list view" );
357 357
358} 358}
359 359
360void KOListView::updateList() 360void KOListView::updateList()
361{ 361{
362 // qDebug(" KOListView::updateList() "); 362 // qDebug(" KOListView::updateList() ");
363 363
364} 364}
365 365
366void KOListView::addCat( ) 366void KOListView::addCat( )
367{ 367{
368 setCategories( false ); 368 setCategories( false );
369} 369}
370void KOListView::setCat() 370void KOListView::setCat()
371{ 371{
372 setCategories( true ); 372 setCategories( true );
373} 373}
374void KOListView::setAlarm() 374void KOListView::setAlarm()
375{ 375{
376 KOAlarmPrefs kap( this); 376 KOAlarmPrefs kap( this);
377 if ( !kap.exec() ) 377 if ( !kap.exec() )
378 return; 378 return;
379 QStringList itemList; 379 QStringList itemList;
380 QPtrList<KOListViewItem> sel ; 380 QPtrList<KOListViewItem> sel ;
381 QListViewItem *qitem = mListView->firstChild (); 381 QListViewItem *qitem = mListView->firstChild ();
382 while ( qitem ) { 382 while ( qitem ) {
383 if ( qitem->isSelected() ) { 383 if ( qitem->isSelected() ) {
384 Incidence* inc = ((KOListViewItem *) qitem)->data(); 384 Incidence* inc = ((KOListViewItem *) qitem)->data();
385 if ( inc->type() != "Journal" ) { 385 if ( inc->type() != "Journal" ) {
386 if ( inc->type() == "Todo" ) { 386 if ( inc->type() == "Todo" ) {
387 if ( ((Todo*)inc)->hasDueDate() ) 387 if ( ((Todo*)inc)->hasDueDate() )
388 sel.append(((KOListViewItem *)qitem)); 388 sel.append(((KOListViewItem *)qitem));
389 } else 389 } else
390 sel.append(((KOListViewItem *)qitem)); 390 sel.append(((KOListViewItem *)qitem));
391 } 391 }
392 } 392 }
393 qitem = qitem->nextSibling(); 393 qitem = qitem->nextSibling();
394 } 394 }
395 int count = 0; 395 int count = 0;
396 KOListViewItem * item, *temp; 396 KOListViewItem * item, *temp;
397 item = sel.first(); 397 item = sel.first();
398 Incidence* inc; 398 Incidence* inc;
399 while ( item ) { 399 while ( item ) {
400 inc = item->data(); 400 inc = item->data();
401 ++count; 401 ++count;
402 if (kap.mAlarmButton->isChecked()) { 402 if (kap.mAlarmButton->isChecked()) {
403 if (inc->alarms().count() == 0) 403 if (inc->alarms().count() == 0)
404 inc->newAlarm(); 404 inc->newAlarm();
405 QPtrList<Alarm> alarms = inc->alarms(); 405 QPtrList<Alarm> alarms = inc->alarms();
406 Alarm *alarm; 406 Alarm *alarm;
407 for (alarm = alarms.first(); alarm; alarm = alarms.next() ) { 407 for (alarm = alarms.first(); alarm; alarm = alarms.next() ) {
408 alarm->setEnabled(true); 408 alarm->setEnabled(true);
409 int j = kap.mAlarmTimeEdit->value()* -60; 409 int j = kap.mAlarmTimeEdit->value()* -60;
410 if (kap.mAlarmIncrCombo->currentItem() == 1) 410 if (kap.mAlarmIncrCombo->currentItem() == 1)
411 j = j * 60; 411 j = j * 60;
412 else if (kap.mAlarmIncrCombo->currentItem() == 2) 412 else if (kap.mAlarmIncrCombo->currentItem() == 2)
413 j = j * (60 * 24); 413 j = j * (60 * 24);
414 alarm->setStartOffset( j ); 414 alarm->setStartOffset( j );
415 415
416 if (!kap.mAlarmProgram.isEmpty() && kap.mAlarmProgramButton->isOn()) { 416 if (!kap.mAlarmProgram.isEmpty() && kap.mAlarmProgramButton->isOn()) {
417 alarm->setProcedureAlarm(kap.mAlarmProgram); 417 alarm->setProcedureAlarm(kap.mAlarmProgram);
418 } 418 }
419 else if (!kap.mAlarmSound.isEmpty() && kap.mAlarmSoundButton->isOn()) 419 else if (!kap.mAlarmSound.isEmpty() && kap.mAlarmSoundButton->isOn())
420 alarm->setAudioAlarm(kap.mAlarmSound); 420 alarm->setAudioAlarm(kap.mAlarmSound);
421 else 421 else
422 alarm->setType(Alarm::Invalid); 422 alarm->setType(Alarm::Invalid);
423 //alarm->setAudioAlarm("default"); 423 //alarm->setAudioAlarm("default");
424 // TODO: Deal with multiple alarms 424 // TODO: Deal with multiple alarms
425 break; // For now, stop after the first alarm 425 break; // For now, stop after the first alarm
426 } 426 }
427 } else { 427 } else {
428 Alarm* alarm = inc->alarms().first(); 428 Alarm* alarm = inc->alarms().first();
429 if ( alarm ) { 429 if ( alarm ) {
430 alarm->setEnabled(false); 430 alarm->setEnabled(false);
431 alarm->setType(Alarm::Invalid); 431 alarm->setType(Alarm::Invalid);
432 } 432 }
433 } 433 }
434 ListItemVisitor v(item, mStartDate ); 434 ListItemVisitor v(item, mStartDate );
435 inc->accept(v); 435 inc->accept(v);
436 item = sel.next(); 436 item = sel.next();
437 } 437 }
438 topLevelWidget()->setCaption( i18n("Canged alarm for %1 items").arg( count ) ); 438 topLevelWidget()->setCaption( i18n("Changed alarm for %1 items").arg( count ) );
439 qDebug("KO: Set alarm for %d items", count); 439 qDebug("KO: Set alarm for %d items", count);
440 calendar()->reInitAlarmSettings(); 440 calendar()->reInitAlarmSettings();
441 QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); 441 QTimer::singleShot( 1, this, SLOT ( resetFocus() ) );
442} 442}
443void KOListView::setCategories( bool removeOld ) 443void KOListView::setCategories( bool removeOld )
444{ 444{
445 445
446 KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); 446 KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 );
447 csd->setColorEnabled(); 447 csd->setColorEnabled();
448 if (! csd->exec()) { 448 if (! csd->exec()) {
449 delete csd; 449 delete csd;
450 return; 450 return;
451 } 451 }
452 QStringList catList = csd->selectedCategories(); 452 QStringList catList = csd->selectedCategories();
453 delete csd; 453 delete csd;
454 // if ( catList.count() == 0 ) 454 // if ( catList.count() == 0 )
455 // return; 455 // return;
456 //catList.sort(); 456 //catList.sort();
457 QString categoriesStr = catList.join(","); 457 QString categoriesStr = catList.join(",");
458 int i; 458 int i;
459 QStringList itemList; 459 QStringList itemList;
460 QPtrList<KOListViewItem> sel ; 460 QPtrList<KOListViewItem> sel ;
461 QListViewItem *qitem = mListView->firstChild (); 461 QListViewItem *qitem = mListView->firstChild ();
462 while ( qitem ) { 462 while ( qitem ) {
463 if ( qitem->isSelected() ) { 463 if ( qitem->isSelected() ) {
464 sel.append(((KOListViewItem *)qitem)); 464 sel.append(((KOListViewItem *)qitem));
465 } 465 }
466 qitem = qitem->nextSibling(); 466 qitem = qitem->nextSibling();
467 } 467 }
468 KOListViewItem * item, *temp; 468 KOListViewItem * item, *temp;
469 item = sel.first(); 469 item = sel.first();
470 if( item ) { 470 if( item ) {
471 Incidence* inc = item->data() ; 471 Incidence* inc = item->data() ;
472 bool setSub = false; 472 bool setSub = false;
473 if( inc->type() == "Todo" && sel.count() == 1 && inc->relations().count() > 0 ) { 473 if( inc->type() == "Todo" && sel.count() == 1 && inc->relations().count() > 0 ) {
474 int result = KMessageBox::warningYesNoCancel(this, 474 int result = KMessageBox::warningYesNoCancel(this,
475 i18n("The todo\n%1\nhas subtodos!\nDo you want to set\nthe categories for\nall subtodos as well?").arg( inc->summary().left ( 25 ) ), 475 i18n("The todo\n%1\nhas subtodos!\nDo you want to set\nthe categories for\nall subtodos as well?").arg( inc->summary().left ( 25 ) ),
476 i18n("Todo has subtodos"), 476 i18n("Todo has subtodos"),
477 i18n("Yes"), 477 i18n("Yes"),
478 i18n("No")); 478 i18n("No"));
479 if (result == KMessageBox::Cancel) item = 0; 479 if (result == KMessageBox::Cancel) item = 0;
480 if (result == KMessageBox::Yes) setSub = true; 480 if (result == KMessageBox::Yes) setSub = true;
481 } 481 }
482 while ( item ) { 482 while ( item ) {
483 inc = item->data(); 483 inc = item->data();
484 if ( removeOld ) { 484 if ( removeOld ) {
485 inc->setCategories( catList, setSub ); 485 inc->setCategories( catList, setSub );
486 } else { 486 } else {
487 inc->addCategories( catList, setSub ); 487 inc->addCategories( catList, setSub );
488 } 488 }
489 ListItemVisitor v(item, mStartDate ); 489 ListItemVisitor v(item, mStartDate );
490 inc->accept(v); 490 inc->accept(v);
491 item = sel.next(); 491 item = sel.next();
492 } 492 }
493 } 493 }
494 QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); 494 QTimer::singleShot( 1, this, SLOT ( resetFocus() ) );
495} 495}
496 496
497void KOListView::beamSelected() 497void KOListView::beamSelected()
498{ 498{
499 int icount = 0; 499 int icount = 0;
500 QPtrList<Incidence> delSel ; 500 QPtrList<Incidence> delSel ;
501 QListViewItem *item = mListView->firstChild (); 501 QListViewItem *item = mListView->firstChild ();
502 while ( item ) { 502 while ( item ) {
503 if ( item->isSelected() ) { 503 if ( item->isSelected() ) {
504 delSel.append(((KOListViewItem *)item)->data()); 504 delSel.append(((KOListViewItem *)item)->data());
505 ++icount; 505 ++icount;
506 } 506 }
507 507
508 item = item->nextSibling(); 508 item = item->nextSibling();
509 } 509 }
510 if ( icount ) { 510 if ( icount ) {
511 emit beamIncidenceList( delSel ); 511 emit beamIncidenceList( delSel );
512 return; 512 return;
513 QString fn ; 513 QString fn ;
514 fn = QDir::homeDirPath()+"/kopitempbeamfile.vcs"; 514 fn = QDir::homeDirPath()+"/kopitempbeamfile.vcs";
515 QString mes; 515 QString mes;
516 bool createbup = true; 516 bool createbup = true;
517 if ( createbup ) { 517 if ( createbup ) {
518 QString description = "\n"; 518 QString description = "\n";
519 CalendarLocal* cal = new CalendarLocal(); 519 CalendarLocal* cal = new CalendarLocal();
520 cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 520 cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
521 Incidence *incidence = delSel.first(); 521 Incidence *incidence = delSel.first();
522 while ( incidence ) { 522 while ( incidence ) {
523 Incidence *in = incidence->clone(); 523 Incidence *in = incidence->clone();
524 description += in->summary() + "\n"; 524 description += in->summary() + "\n";
525 cal->addIncidence( in ); 525 cal->addIncidence( in );
526 incidence = delSel.next(); 526 incidence = delSel.next();
527 } 527 }
528 FileStorage storage( cal, fn, new VCalFormat ); 528 FileStorage storage( cal, fn, new VCalFormat );
529 storage.save(); 529 storage.save();
530 delete cal; 530 delete cal;
531 mes = i18n("KO/Pi: Ready for beaming"); 531 mes = i18n("KO/Pi: Ready for beaming");
532 topLevelWidget()->setCaption(mes); 532 topLevelWidget()->setCaption(mes);
533 533
534#ifndef DESKTOP_VERSION 534#ifndef DESKTOP_VERSION
535 Ir *ir = new Ir( this ); 535 Ir *ir = new Ir( this );
536 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); 536 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) );
537 ir->send( fn, description, "text/x-vCalendar" ); 537 ir->send( fn, description, "text/x-vCalendar" );
538#endif 538#endif
539 } 539 }
540 } 540 }
541} 541}
542void KOListView::beamDone( Ir *ir ) 542void KOListView::beamDone( Ir *ir )
543{ 543{
544#ifndef DESKTOP_VERSION 544#ifndef DESKTOP_VERSION
545 delete ir; 545 delete ir;
546#endif 546#endif
547 topLevelWidget()->setCaption(i18n("KO/Pi:Beaming done")); 547 topLevelWidget()->setCaption(i18n("KO/Pi:Beaming done"));
548} 548}
549 549
550void KOListView::saveDescriptionToFile() 550void KOListView::saveDescriptionToFile()
551{ 551{
552 552
553 int result = QMessageBox::warning( this, i18n("KO/Pi: Information!"), 553 int result = QMessageBox::warning( this, i18n("KO/Pi: Information!"),
554 i18n("This saves the text/details of selected\nJournals and Events/Todos\nto a text file."), 554 i18n("This saves the text/details of selected\nJournals and Events/Todos\nto a text file."),
555 i18n("Continue"), i18n("Cancel"), 0, 555 i18n("Continue"), i18n("Cancel"), 0,
556 0, 1 ); 556 0, 1 );
557 if ( result != 0 ) { 557 if ( result != 0 ) {
558 return; 558 return;
559 } 559 }
560 int icount = 0; 560 int icount = 0;
561 QPtrList<Incidence> delSel ; 561 QPtrList<Incidence> delSel ;
562 QListViewItem *item = mListView->firstChild (); 562 QListViewItem *item = mListView->firstChild ();
563 while ( item ) { 563 while ( item ) {
564 if ( item->isSelected() ) { 564 if ( item->isSelected() ) {
565 delSel.append(((KOListViewItem *)item)->data()); 565 delSel.append(((KOListViewItem *)item)->data());
566 ++icount; 566 ++icount;
567 } 567 }
568 568
569 item = item->nextSibling(); 569 item = item->nextSibling();
570 } 570 }
571 if ( icount ) { 571 if ( icount ) {
572 QString fn = KOPrefs::instance()->mLastSaveFile; 572 QString fn = KOPrefs::instance()->mLastSaveFile;
573 fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this ); 573 fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this );
574 574
575 if ( fn == "" ) 575 if ( fn == "" )
576 return; 576 return;
577 QFileInfo info; 577 QFileInfo info;
578 info.setFile( fn ); 578 info.setFile( fn );
579 QString mes; 579 QString mes;
580 bool createbup = true; 580 bool createbup = true;
581 if ( info. exists() ) { 581 if ( info. exists() ) {
582 mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); 582 mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) );
583 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 583 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
584 i18n("Overwrite!"), i18n("Cancel"), 0, 584 i18n("Overwrite!"), i18n("Cancel"), 0,
585 0, 1 ); 585 0, 1 );
586 if ( result != 0 ) { 586 if ( result != 0 ) {
587 createbup = false; 587 createbup = false;
588 } 588 }
589 } 589 }
590 if ( createbup ) { 590 if ( createbup ) {
591 QString text = i18n("KO/Pi Description/Journal save file.\nSave date: ") + 591 QString text = i18n("KO/Pi Description/Journal save file.\nSave date: ") +
592 KGlobal::locale()->formatDateTime(QDateTime::currentDateTime(), false); 592 KGlobal::locale()->formatDateTime(QDateTime::currentDateTime(), false);
593 Incidence *incidence = delSel.first(); 593 Incidence *incidence = delSel.first();
594 icount = 0; 594 icount = 0;
595 while ( incidence ) { 595 while ( incidence ) {
596 if ( incidence->type() == "Journal" ) { 596 if ( incidence->type() == "Journal" ) {
597 text += "\n************************************\n"; 597 text += "\n************************************\n";
598 text += i18n("Journal from: ") +incidence->dtStartDateStr( false ); 598 text += i18n("Journal from: ") +incidence->dtStartDateStr( false );
599 text +="\n" + i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false); 599 text +="\n" + i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false);
600 text +="\n" + i18n("Description: ") + "\n"+ incidence->description(); 600 text +="\n" + i18n("Description: ") + "\n"+ incidence->description();
601 ++icount; 601 ++icount;
602 602
603 } else { 603 } else {
604 if ( !incidence->description().isEmpty() ) { 604 if ( !incidence->description().isEmpty() ) {
605 text += "\n************************************\n"; 605 text += "\n************************************\n";
606 if ( incidence->type() == "Todo" ) 606 if ( incidence->type() == "Todo" )
607 text += i18n("To-Do: "); 607 text += i18n("To-Do: ");
608 text += incidence->summary(); 608 text += incidence->summary();
609 if ( incidence->hasStartDate() ) 609 if ( incidence->hasStartDate() )
610 text +="\n"+ i18n("Start Date: ") + incidence->dtStartStr( false ); 610 text +="\n"+ i18n("Start Date: ") + incidence->dtStartStr( false );
611 text +="\n"+ i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false); 611 text +="\n"+ i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false);
612 if ( !incidence->location().isEmpty() ) 612 if ( !incidence->location().isEmpty() )
613 text += "\n" +i18n("Location: ") + incidence->location(); 613 text += "\n" +i18n("Location: ") + incidence->location();
614 text += "\n" + i18n("Description: ") + "\n" + incidence->description(); 614 text += "\n" + i18n("Description: ") + "\n" + incidence->description();
615 ++icount; 615 ++icount;
616 616
617 } 617 }
618 } 618 }
619 incidence = delSel.next(); 619 incidence = delSel.next();
620 } 620 }
621 QFile file( fn ); 621 QFile file( fn );
622 if (!file.open( IO_WriteOnly ) ) { 622 if (!file.open( IO_WriteOnly ) ) {
623 topLevelWidget()->setCaption(i18n("File open error - nothing saved!") ); 623 topLevelWidget()->setCaption(i18n("File open error - nothing saved!") );
624 return; 624 return;
625 } 625 }
626 QTextStream ts( &file ); 626 QTextStream ts( &file );
627 ts << text; 627 ts << text;
628 file.close(); 628 file.close();
629 //qDebug("%s ", text.latin1()); 629 //qDebug("%s ", text.latin1());
630 mes = i18n("KO/Pi:Saved %1 descriptions/journals").arg(icount ); 630 mes = i18n("KO/Pi:Saved %1 descriptions/journals").arg(icount );
631 KOPrefs::instance()->mLastSaveFile = fn; 631 KOPrefs::instance()->mLastSaveFile = fn;
632 topLevelWidget()->setCaption(mes); 632 topLevelWidget()->setCaption(mes);
633 } 633 }
634 } 634 }
635} 635}
636void KOListView::saveToFileVCS() 636void KOListView::saveToFileVCS()
637{ 637{
638 writeToFile( false ); 638 writeToFile( false );
639} 639}
640void KOListView::saveToFile() 640void KOListView::saveToFile()
641{ 641{
642 writeToFile( true ); 642 writeToFile( true );
643} 643}
644void KOListView::writeToFile( bool iCal ) 644void KOListView::writeToFile( bool iCal )
645{ 645{
646 646
647 int icount = 0; 647 int icount = 0;
648 QPtrList<Incidence> delSel ; 648 QPtrList<Incidence> delSel ;
649 QListViewItem *item = mListView->firstChild (); 649 QListViewItem *item = mListView->firstChild ();
650 bool journal = iCal; // warn only for vCal 650 bool journal = iCal; // warn only for vCal
651 while ( item ) { 651 while ( item ) {
652 if ( item->isSelected() ) { 652 if ( item->isSelected() ) {
653 if ( !journal ) 653 if ( !journal )
654 if ( ((KOListViewItem *)item)->data()->type() == "Journal") 654 if ( ((KOListViewItem *)item)->data()->type() == "Journal")
655 journal = true; 655 journal = true;
656 delSel.append(((KOListViewItem *)item)->data()); 656 delSel.append(((KOListViewItem *)item)->data());
657 ++icount; 657 ++icount;
658 } 658 }
659 659
660 item = item->nextSibling(); 660 item = item->nextSibling();
661 } 661 }
662 if ( !iCal && journal ) { 662 if ( !iCal && journal ) {
663 int result = KMessageBox::warningContinueCancel(this, 663 int result = KMessageBox::warningContinueCancel(this,
664 i18n("The journal entries can not be\nexported to a vCalendar file."), 664 i18n("The journal entries can not be\nexported to a vCalendar file."),
665 i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"), 665 i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"),
666 true); 666 true);
667 if (result != KMessageBox::Continue) return; 667 if (result != KMessageBox::Continue) return;
668 } 668 }
669 if ( icount ) { 669 if ( icount ) {
670 QString fn = KOPrefs::instance()->mLastSaveFile; 670 QString fn = KOPrefs::instance()->mLastSaveFile;
671 QString extension; 671 QString extension;
672 if ( iCal ) { 672 if ( iCal ) {
673 if ( fn.right( 4 ).lower() == ".vcs" ) { 673 if ( fn.right( 4 ).lower() == ".vcs" ) {
674 fn = fn.left( fn.length() -3) + "ics"; 674 fn = fn.left( fn.length() -3) + "ics";
675 } 675 }
676 } else { 676 } else {
677 if ( fn.right( 4 ).lower() == ".ics" ) { 677 if ( fn.right( 4 ).lower() == ".ics" ) {
678 fn = fn.left( fn.length() -3) + "vcs"; 678 fn = fn.left( fn.length() -3) + "vcs";
679 } 679 }
680 } 680 }
681 fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this ); 681 fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this );
682 682
683 if ( fn == "" ) 683 if ( fn == "" )
684 return; 684 return;
685 QFileInfo info; 685 QFileInfo info;
686 info.setFile( fn ); 686 info.setFile( fn );
687 QString mes; 687 QString mes;
688 bool createbup = true; 688 bool createbup = true;
689 if ( info. exists() ) { 689 if ( info. exists() ) {
690 mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); 690 mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) );
691 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 691 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
692 i18n("Overwrite!"), i18n("Cancel"), 0, 692 i18n("Overwrite!"), i18n("Cancel"), 0,
693 0, 1 ); 693 0, 1 );
694 if ( result != 0 ) { 694 if ( result != 0 ) {
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp
index 34044ab..8f951ee 100644
--- a/korganizer/koprefs.cpp
+++ b/korganizer/koprefs.cpp
@@ -1,378 +1,379 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <time.h> 24#include <time.h>
25#ifndef _WIN32_ 25#ifndef _WIN32_
26#include <unistd.h> 26#include <unistd.h>
27#endif 27#endif
28#include <qdir.h> 28#include <qdir.h>
29#include <qtextstream.h> 29#include <qtextstream.h>
30#include <qtextcodec.h> 30#include <qtextcodec.h>
31#include <qstring.h> 31#include <qstring.h>
32#include <qregexp.h> 32#include <qregexp.h>
33#include <qfont.h> 33#include <qfont.h>
34#include <qcolor.h> 34#include <qcolor.h>
35#include <qstringlist.h> 35#include <qstringlist.h>
36#include <stdlib.h> 36#include <stdlib.h>
37 37
38#include <kglobal.h> 38#include <kglobal.h>
39#include <kglobalsettings.h> 39#include <kglobalsettings.h>
40#include <kconfig.h> 40#include <kconfig.h>
41#include <klocale.h> 41#include <klocale.h>
42#include <kdebug.h> 42#include <kdebug.h>
43#include <kemailsettings.h> 43#include <kemailsettings.h>
44#include <kstaticdeleter.h> 44#include <kstaticdeleter.h>
45#include <libkdepim/kpimglobalprefs.h> 45#include <libkdepim/kpimglobalprefs.h>
46 46
47#include "koprefs.h" 47#include "koprefs.h"
48#include "mainwindow.h" 48#include "mainwindow.h"
49 49
50KOPrefs *KOPrefs::mInstance = 0; 50KOPrefs *KOPrefs::mInstance = 0;
51static KStaticDeleter<KOPrefs> insd; 51static KStaticDeleter<KOPrefs> insd;
52 52
53KOPrefs::KOPrefs() : 53KOPrefs::KOPrefs() :
54 KPimPrefs("korganizerrc") 54 KPimPrefs("korganizerrc")
55{ 55{
56 mCategoryColors.setAutoDelete(true); 56 mCategoryColors.setAutoDelete(true);
57 fillMailDefaults(); 57 fillMailDefaults();
58 mDefaultCategoryColor = QColor(175,210,255);//196,196,196); 58 mDefaultCategoryColor = QColor(175,210,255);//196,196,196);
59 QColor defaultHolidayColor = QColor(255,0,0); 59 QColor defaultHolidayColor = QColor(255,0,0);
60 QColor defaultHighlightColor = QColor(129,112,255);//64,64,255); 60 QColor defaultHighlightColor = QColor(129,112,255);//64,64,255);
61 QColor defaultAgendaBgColor = QColor(239,241,169);//128,128,128); 61 QColor defaultAgendaBgColor = QColor(239,241,169);//128,128,128);
62 QColor defaultWorkingHoursColor = QColor(170,223,150);//160,160,160); 62 QColor defaultWorkingHoursColor = QColor(170,223,150);//160,160,160);
63 QColor defaultTodoDueTodayColor = QColor(255,220,100); 63 QColor defaultTodoDueTodayColor = QColor(255,220,100);
64 QColor defaultTodoOverdueColor = QColor(255,153,125); 64 QColor defaultTodoOverdueColor = QColor(255,153,125);
65 QColor defaultTodoRunColor = QColor(99,194,30); 65 QColor defaultTodoRunColor = QColor(99,194,30);
66 KPrefs::setCurrentGroup("General"); 66 KPrefs::setCurrentGroup("General");
67 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); 67 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false);
68 addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true); 68 addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true);
69 addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true); 69 addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true);
70 addItemBool("ShowIconSearch",&mShowIconSearch,true); 70 addItemBool("ShowIconSearch",&mShowIconSearch,true);
71 addItemBool("ShowIconList",&mShowIconList,true); 71 addItemBool("ShowIconList",&mShowIconList,true);
72 addItemBool("ShowIconDay1",&mShowIconDay1,true); 72 addItemBool("ShowIconDay1",&mShowIconDay1,true);
73 addItemBool("ShowIconDay5",&mShowIconDay5,true); 73 addItemBool("ShowIconDay5",&mShowIconDay5,true);
74 addItemBool("ShowIconDay6",&mShowIconDay6,true); 74 addItemBool("ShowIconDay6",&mShowIconDay6,true);
75 addItemBool("ShowIconDay7",&mShowIconDay7,true); 75 addItemBool("ShowIconDay7",&mShowIconDay7,true);
76 addItemBool("ShowIconMonth",&mShowIconMonth,true); 76 addItemBool("ShowIconMonth",&mShowIconMonth,true);
77 addItemBool("ShowIconTodoview",&mShowIconTodoview,true); 77 addItemBool("ShowIconTodoview",&mShowIconTodoview,true);
78 addItemBool("ShowIconBackFast",&mShowIconBackFast,true); 78 addItemBool("ShowIconBackFast",&mShowIconBackFast,true);
79 addItemBool("ShowIconBack",&mShowIconBack,true); 79 addItemBool("ShowIconBack",&mShowIconBack,true);
80 addItemBool("ShowIconToday",&mShowIconToday,true); 80 addItemBool("ShowIconToday",&mShowIconToday,true);
81 addItemBool("ShowIconForward",&mShowIconForward,true); 81 addItemBool("ShowIconForward",&mShowIconForward,true);
82 addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true); 82 addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true);
83 addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,true); 83 addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,true);
84 addItemBool("ShowIconWeekNum",&mShowIconWeekNum,true); 84 addItemBool("ShowIconWeekNum",&mShowIconWeekNum,true);
85 addItemBool("ShowIconNextDays",&mShowIconNextDays,true); 85 addItemBool("ShowIconNextDays",&mShowIconNextDays,true);
86 addItemBool("ShowIconNext",&mShowIconNext,true); 86 addItemBool("ShowIconNext",&mShowIconNext,true);
87 addItemBool("ShowIconJournal",&mShowIconJournal,true); 87 addItemBool("ShowIconJournal",&mShowIconJournal,true);
88 addItemBool("ShowIconStretch",&mShowIconStretch,true); 88 addItemBool("ShowIconStretch",&mShowIconStretch,true);
89 addItemBool("ShowIconFilter",&mShowIconFilter,false); 89 addItemBool("ShowIconFilter",&mShowIconFilter,false);
90 addItemBool("ShowIconOnetoolbar",&mShowIconOnetoolbar,true); 90 addItemBool("ShowIconOnetoolbar",&mShowIconOnetoolbar,true);
91 91
92 bool addIcons = false; 92 bool addIcons = false;
93#ifdef DESKTOP_VERSION 93#ifdef DESKTOP_VERSION
94 addIcons = true; 94 addIcons = true;
95#endif 95#endif
96 addItemBool("ShowIconNavigator",&mShowIconNavigator,addIcons); 96 addItemBool("ShowIconNavigator",&mShowIconNavigator,addIcons);
97 addItemBool("ShowIconAllday",&mShowIconAllday,addIcons); 97 addItemBool("ShowIconAllday",&mShowIconAllday,addIcons);
98 addItemBool("ShowIconFilterview",&mShowIconFilterview,addIcons); 98 addItemBool("ShowIconFilterview",&mShowIconFilterview,addIcons);
99 addItemBool("ShowIconToggleFull",&mShowIconToggleFull,addIcons); 99 addItemBool("ShowIconToggleFull",&mShowIconToggleFull,addIcons);
100 100
101 addItemInt("LastLoadedLanguage",&mOldLanguage,0); 101 addItemInt("LastLoadedLanguage",&mOldLanguage,0);
102 102
103 addItemBool("AskForQuit",&mAskForQuit,false); 103 addItemBool("AskForQuit",&mAskForQuit,false);
104 104
105#ifndef DESKTOP_VERSION 105#ifndef DESKTOP_VERSION
106 addItemBool("ShowFullMenu",&mShowFullMenu,false); 106 addItemBool("ShowFullMenu",&mShowFullMenu,false);
107#else 107#else
108 addItemBool("ShowFullMenu",&mShowFullMenu,true); 108 addItemBool("ShowFullMenu",&mShowFullMenu,true);
109#endif 109#endif
110 addItemBool("ToolBarHor",&mToolBarHor, true ); 110 addItemBool("ToolBarHor",&mToolBarHor, true );
111 addItemBool("ToolBarUp",&mToolBarUp, false ); 111 addItemBool("ToolBarUp",&mToolBarUp, false );
112 addItemBool("ToolBarHorV",&mToolBarHorV, true ); 112 addItemBool("ToolBarHorV",&mToolBarHorV, true );
113 addItemBool("ToolBarUpV",&mToolBarUpV, false ); 113 addItemBool("ToolBarUpV",&mToolBarUpV, false );
114 addItemBool("ToolBarHorN",&mToolBarHorN, true ); 114 addItemBool("ToolBarHorN",&mToolBarHorN, true );
115 addItemBool("ToolBarUpN",&mToolBarUpN, false ); 115 addItemBool("ToolBarUpN",&mToolBarUpN, false );
116 addItemBool("ToolBarHorF",&mToolBarHorF, true ); 116 addItemBool("ToolBarHorF",&mToolBarHorF, true );
117 addItemBool("ToolBarUpF",&mToolBarUpF, false ); 117 addItemBool("ToolBarUpF",&mToolBarUpF, false );
118 addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false ); 118 addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false );
119 addItemInt("Whats Next Days",&mWhatsNextDays,3); 119 addItemInt("Whats Next Days",&mWhatsNextDays,3);
120 addItemInt("Whats Next Prios",&mWhatsNextPrios,1); 120 addItemInt("Whats Next Prios",&mWhatsNextPrios,1);
121 121
122 addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true); 122 addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true);
123 addItemBool("ShowCompletedTodoInAgenda",&mShowCompletedTodoInAgenda,true);
123 addItemBool("ShowTimeInAgenda",&mShowTimeInAgenda,true); 124 addItemBool("ShowTimeInAgenda",&mShowTimeInAgenda,true);
124 addItemBool("HideNonStartedTodos",&mHideNonStartedTodos,false); 125 addItemBool("HideNonStartedTodos",&mHideNonStartedTodos,false);
125 addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true); 126 addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true);
126 addItemInt("AllDay Size",&mAllDaySize,28); 127 addItemInt("AllDay Size",&mAllDaySize,28);
127 QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav"; 128 QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav";
128 addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm ); 129 addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm );
129 130
130 addItemStringList("LocationDefaults",&mLocationDefaults ); 131 addItemStringList("LocationDefaults",&mLocationDefaults );
131 addItemStringList("EventSummary User",&mEventSummaryUser); 132 addItemStringList("EventSummary User",&mEventSummaryUser);
132 addItemStringList("TodoSummary User",&mTodoSummaryUser); 133 addItemStringList("TodoSummary User",&mTodoSummaryUser);
133 134
134 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); 135 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false);
135 addItemBool("Enable Project View",&mEnableProjectView,false); 136 addItemBool("Enable Project View",&mEnableProjectView,false);
136 addItemBool("Auto Save",&mAutoSave,false); 137 addItemBool("Auto Save",&mAutoSave,false);
137 addItemInt("Auto Save Interval",&mAutoSaveInterval,3); 138 addItemInt("Auto Save Interval",&mAutoSaveInterval,3);
138 addItemBool("Confirm Deletes",&mConfirm,true); 139 addItemBool("Confirm Deletes",&mConfirm,true);
139 addItemString("Archive File",&mArchiveFile); 140 addItemString("Archive File",&mArchiveFile);
140 addItemString("Html Export File",&mHtmlExportFile, 141 addItemString("Html Export File",&mHtmlExportFile,
141 QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html")); 142 QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html"));
142 addItemBool("Html With Save",&mHtmlWithSave,false); 143 addItemBool("Html With Save",&mHtmlWithSave,false);
143 144
144 KPrefs::setCurrentGroup("Personal Settings"); 145 KPrefs::setCurrentGroup("Personal Settings");
145 146
146 addItemInt("Mail Client",&mMailClient,MailClientKMail); 147 addItemInt("Mail Client",&mMailClient,MailClientKMail);
147 addItemBool("Use Control Center Email",&mEmailControlCenter,false); 148 addItemBool("Use Control Center Email",&mEmailControlCenter,false);
148 addItemBool("Bcc",&mBcc,false); 149 addItemBool("Bcc",&mBcc,false);
149 150
150 KPrefs::setCurrentGroup("Time & Date"); 151 KPrefs::setCurrentGroup("Time & Date");
151 152
152 153
153 addItemInt("Default Start Time",&mStartTime,10); 154 addItemInt("Default Start Time",&mStartTime,10);
154 addItemInt("Default Duration",&mDefaultDuration,2); 155 addItemInt("Default Duration",&mDefaultDuration,2);
155 addItemInt("Default Alarm Time",&mAlarmTime,3); 156 addItemInt("Default Alarm Time",&mAlarmTime,3);
156 KPrefs::setCurrentGroup("AlarmSettings"); 157 KPrefs::setCurrentGroup("AlarmSettings");
157 addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20); 158 addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20);
158 addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7); 159 addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7);
159 addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5); 160 addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5);
160 addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3); 161 addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3);
161 162
162 163
163 KPrefs::setCurrentGroup("Calendar"); 164 KPrefs::setCurrentGroup("Calendar");
164 165
165 addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar); 166 addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar);
166 167
167 KPrefs::setCurrentGroup("Fonts"); 168 KPrefs::setCurrentGroup("Fonts");
168 // qDebug(" KPrefs::setCurrentGroup(Fonts); "); 169 // qDebug(" KPrefs::setCurrentGroup(Fonts); ");
169 QFont fon = KGlobalSettings::generalFont(); 170 QFont fon = KGlobalSettings::generalFont();
170 addItemFont("TimeBar Font",&mTimeBarFont,fon ); 171 addItemFont("TimeBar Font",&mTimeBarFont,fon );
171 addItemFont("MonthView Font",&mMonthViewFont,fon); 172 addItemFont("MonthView Font",&mMonthViewFont,fon);
172 addItemFont("AgendaView Font",&mAgendaViewFont,fon); 173 addItemFont("AgendaView Font",&mAgendaViewFont,fon);
173 addItemFont("MarcusBains Font",&mMarcusBainsFont,fon); 174 addItemFont("MarcusBains Font",&mMarcusBainsFont,fon);
174 addItemFont("TimeLabels Font",&mTimeLabelsFont,fon); 175 addItemFont("TimeLabels Font",&mTimeLabelsFont,fon);
175 addItemFont("TodoView Font",&mTodoViewFont,fon); 176 addItemFont("TodoView Font",&mTodoViewFont,fon);
176 addItemFont("ListView Font",&mListViewFont,fon); 177 addItemFont("ListView Font",&mListViewFont,fon);
177 addItemFont("DateNavigator Font",&mDateNavigatorFont,fon); 178 addItemFont("DateNavigator Font",&mDateNavigatorFont,fon);
178 addItemFont("EditBox Font",&mEditBoxFont,fon); 179 addItemFont("EditBox Font",&mEditBoxFont,fon);
179 addItemFont("JournalView Font",&mJornalViewFont,fon); 180 addItemFont("JournalView Font",&mJornalViewFont,fon);
180 addItemFont("WhatsNextView Font",&mWhatsNextFont,fon); 181 addItemFont("WhatsNextView Font",&mWhatsNextFont,fon);
181 addItemFont("EventView Font",&mEventViewFont,fon); 182 addItemFont("EventView Font",&mEventViewFont,fon);
182 183
183 KPrefs::setCurrentGroup("RemoteSyncing"); 184 KPrefs::setCurrentGroup("RemoteSyncing");
184 addItemString("ActiveSyncPort",&mActiveSyncPort,"9197" ); 185 addItemString("ActiveSyncPort",&mActiveSyncPort,"9197" );
185 addItemString("ActiveSyncIP",&mActiveSyncIP,"192.168.0.40" ); 186 addItemString("ActiveSyncIP",&mActiveSyncIP,"192.168.0.40" );
186 addItemBool("ShowSyncEvents",&mShowSyncEvents,false); 187 addItemBool("ShowSyncEvents",&mShowSyncEvents,false);
187 addItemInt("LastSyncTime",&mLastSyncTime,0); 188 addItemInt("LastSyncTime",&mLastSyncTime,0);
188 189
189#ifdef _WIN32_ 190#ifdef _WIN32_
190 QString hdp= locateLocal("data","korganizer")+"\\\\"; 191 QString hdp= locateLocal("data","korganizer")+"\\\\";
191#else 192#else
192 QString hdp= locateLocal("data","korganizer")+"/"; 193 QString hdp= locateLocal("data","korganizer")+"/";
193#endif 194#endif
194 195
195 KPrefs::setCurrentGroup("LoadSaveFileNames"); 196 KPrefs::setCurrentGroup("LoadSaveFileNames");
196 197
197 addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" ); 198 addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" );
198 addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" ); 199 addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" );
199 addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" ); 200 addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" );
200 addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" ); 201 addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" );
201 202
202 203
203 KPrefs::setCurrentGroup("Locale"); 204 KPrefs::setCurrentGroup("Locale");
204 addItemBool("ShortDateInViewer",&mShortDateInViewer,false); 205 addItemBool("ShortDateInViewer",&mShortDateInViewer,false);
205 206
206 207
207 KPrefs::setCurrentGroup("Colors"); 208 KPrefs::setCurrentGroup("Colors");
208 addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor); 209 addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor);
209 addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor); 210 addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor);
210 addItemColor("Event Color",&mEventColor,mDefaultCategoryColor); 211 addItemColor("Event Color",&mEventColor,mDefaultCategoryColor);
211 addItemColor("Todo done Color",&mTodoDoneColor,QColor(111,255,115) ); 212 addItemColor("Todo done Color",&mTodoDoneColor,QColor(111,255,115) );
212 addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor); 213 addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor);
213 addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor); 214 addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor);
214 addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor); 215 addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor);
215 addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor); 216 addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor);
216 addItemColor("Todo running Color",&mTodoRunColor,defaultTodoRunColor); 217 addItemColor("Todo running Color",&mTodoRunColor,defaultTodoRunColor);
217 addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 )); 218 addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 ));
218 addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 )); 219 addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 ));
219 addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 )); 220 addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 ));
220 addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true); 221 addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true);
221 addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true); 222 addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true);
222 addItemBool("MonthViewWeek",&mMonthViewWeek,false); 223 addItemBool("MonthViewWeek",&mMonthViewWeek,false);
223 addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false); 224 addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false);
224 addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 )); 225 addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 ));
225 addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 )); 226 addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 ));
226 addItemBool("UseAppColors",&mUseAppColors,false); 227 addItemBool("UseAppColors",&mUseAppColors,false);
227 228
228 229
229 230
230 KPrefs::setCurrentGroup("Views"); 231 KPrefs::setCurrentGroup("Views");
231 addItemBool("Block Popup Menu",&mBlockPopupMenu,true); 232 addItemBool("Block Popup Menu",&mBlockPopupMenu,true);
232 addItemBool("Show Date Navigator",&mShowDateNavigator,true); 233 addItemBool("Show Date Navigator",&mShowDateNavigator,true);
233 addItemInt("Hour Size",&mHourSize,8); 234 addItemInt("Hour Size",&mHourSize,8);
234 addItemBool("Show Daily Recurrences",&mDailyRecur,true); 235 addItemBool("Show Daily Recurrences",&mDailyRecur,true);
235 addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true); 236 addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true);
236 addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true); 237 addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true);
237 addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true); 238 addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true);
238 addItemBool("ShowShortMonthName",&mMonthShowShort,false); 239 addItemBool("ShowShortMonthName",&mMonthShowShort,false);
239 addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true); 240 addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true);
240 addItemBool("ShowTimesInMonthCell",&mMonthShowTimes,true); 241 addItemBool("ShowTimesInMonthCell",&mMonthShowTimes,true);
241#ifdef DESKTOP_VERION 242#ifdef DESKTOP_VERION
242 addItemBool("Enable ToolTips",&mEnableToolTips,true); 243 addItemBool("Enable ToolTips",&mEnableToolTips,true);
243#else 244#else
244 addItemBool("Enable ToolTips",&mEnableToolTips,false); 245 addItemBool("Enable ToolTips",&mEnableToolTips,false);
245#endif 246#endif
246 addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false); 247 addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false);
247 addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false); 248 addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false);
248 addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true); 249 addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true);
249 addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true); 250 addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true);
250 addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,true); 251 addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,true);
251 addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false); 252 addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false);
252 addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false); 253 addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false);
253 addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true); 254 addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true);
254 addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true); 255 addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true);
255 addItemBool("WNViewShowsParents",&mWNViewShowsParents,true);; 256 addItemBool("WNViewShowsParents",&mWNViewShowsParents,true);;
256 addItemBool("WNViewShowsPast",&mWNViewShowsPast,true); 257 addItemBool("WNViewShowsPast",&mWNViewShowsPast,true);
257 addItemBool("WNViewShowLocation",&mWNViewShowLocation,false); 258 addItemBool("WNViewShowLocation",&mWNViewShowLocation,false);
258 addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false); 259 addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false);
259 addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true); 260 addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true);
260 addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false); 261 addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false);
261 addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false); 262 addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false);
262 addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,true); 263 addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,true);
263 addItemBool("MonthViewUsesBigFont",&mMonthViewUsesBigFont,true); 264 addItemBool("MonthViewUsesBigFont",&mMonthViewUsesBigFont,true);
264 addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false); 265 addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false);
265 addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false); 266 addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false);
266#ifdef DESKTOP_VERSION 267#ifdef DESKTOP_VERSION
267 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true); 268 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true);
268#else 269#else
269 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false); 270 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false);
270#endif 271#endif
271 addItemInt("Day Begins",&mDayBegins,7); 272 addItemInt("Day Begins",&mDayBegins,7);
272 addItemInt("Working Hours Start",&mWorkingHoursStart,8); 273 addItemInt("Working Hours Start",&mWorkingHoursStart,8);
273 addItemInt("Working Hours End",&mWorkingHoursEnd,17); 274 addItemInt("Working Hours End",&mWorkingHoursEnd,17);
274 addItemBool("Exclude Holidays",&mExcludeHolidays,true); 275 addItemBool("Exclude Holidays",&mExcludeHolidays,true);
275 addItemBool("Exclude Saturdays",&mExcludeSaturdays,true); 276 addItemBool("Exclude Saturdays",&mExcludeSaturdays,true);
276 277
277 addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false); 278 addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false);
278 addItemBool("Full View Month",&mFullViewMonth,true); 279 addItemBool("Full View Month",&mFullViewMonth,true);
279 addItemBool("Full View Todo",&mFullViewTodo,true); 280 addItemBool("Full View Todo",&mFullViewTodo,true);
280 addItemBool("Quick Todo",&mEnableQuickTodo,false); 281 addItemBool("Quick Todo",&mEnableQuickTodo,false);
281 282
282 addItemInt("Next X Days",&mNextXDays,3); 283 addItemInt("Next X Days",&mNextXDays,3);
283 284
284 KPrefs::setCurrentGroup("Printer"); 285 KPrefs::setCurrentGroup("Printer");
285 286
286 KPrefs::setCurrentGroup("Layout"); 287 KPrefs::setCurrentGroup("Layout");
287 288
288 addItemBool("CompactDialogs",&mCompactDialogs,false); 289 addItemBool("CompactDialogs",&mCompactDialogs,false);
289 addItemBool("VerticalScreen",&mVerticalScreen,true); 290 addItemBool("VerticalScreen",&mVerticalScreen,true);
290 291
291 KPrefs::setCurrentGroup("KOrganizer Plugins"); 292 KPrefs::setCurrentGroup("KOrganizer Plugins");
292 293
293 addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays"); 294 addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays");
294 295
295 KPrefs::setCurrentGroup("Group Scheduling"); 296 KPrefs::setCurrentGroup("Group Scheduling");
296 297
297 addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail); 298 addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail);
298 addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend); 299 addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend);
299 addItemStringList("AdditionalMails",&mAdditionalMails,""); 300 addItemStringList("AdditionalMails",&mAdditionalMails,"");
300 addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto); 301 addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto);
301 addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto); 302 addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto);
302 addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto); 303 addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto);
303 addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto); 304 addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto);
304 addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto); 305 addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto);
305 306
306 KPrefs::setCurrentGroup( "Editors" ); 307 KPrefs::setCurrentGroup( "Editors" );
307 308
308 addItemStringList( "EventTemplates", &mEventTemplates ); 309 addItemStringList( "EventTemplates", &mEventTemplates );
309 addItemStringList( "TodoTemplates", &mTodoTemplates ); 310 addItemStringList( "TodoTemplates", &mTodoTemplates );
310 311
311 addItemInt("DestinationPolicy",&mDestination,standardDestination); 312 addItemInt("DestinationPolicy",&mDestination,standardDestination);
312 313
313 KPrefs::setCurrentGroup( "ViewOptions" ); 314 KPrefs::setCurrentGroup( "ViewOptions" );
314 addItemBool("EVshowDetails",&mEVshowDetails,true); 315 addItemBool("EVshowDetails",&mEVshowDetails,true);
315 addItemBool("EVshowCreated",&mEVshowCreated,true); 316 addItemBool("EVshowCreated",&mEVshowCreated,true);
316 addItemBool("EVshowChanged",&mEVshowChanged,true); 317 addItemBool("EVshowChanged",&mEVshowChanged,true);
317 addItemBool("WTshowDetails",&mWTshowDetails,false); 318 addItemBool("WTshowDetails",&mWTshowDetails,false);
318 addItemBool("WTshowCreated",&mWTshowCreated,false); 319 addItemBool("WTshowCreated",&mWTshowCreated,false);
319 addItemBool("WTshowChanged",&mWTshowChanged,false); 320 addItemBool("WTshowChanged",&mWTshowChanged,false);
320 321
321} 322}
322 323
323 324
324KOPrefs::~KOPrefs() 325KOPrefs::~KOPrefs()
325{ 326{
326 if (mInstance == this) 327 if (mInstance == this)
327 mInstance = insd.setObject(0); 328 mInstance = insd.setObject(0);
328 329
329 //qDebug("KOPrefs::~KOPrefs() "); 330 //qDebug("KOPrefs::~KOPrefs() ");
330} 331}
331 332
332 333
333KOPrefs *KOPrefs::instance() 334KOPrefs *KOPrefs::instance()
334{ 335{
335 if (!mInstance) { 336 if (!mInstance) {
336 mInstance = insd.setObject(new KOPrefs()); 337 mInstance = insd.setObject(new KOPrefs());
337 mInstance->readConfig(); 338 mInstance->readConfig();
338 } 339 }
339 340
340 return mInstance; 341 return mInstance;
341} 342}
342 343
343void KOPrefs::usrSetDefaults() 344void KOPrefs::usrSetDefaults()
344{ 345{
345 346
346} 347}
347 348
348void KOPrefs::fillMailDefaults() 349void KOPrefs::fillMailDefaults()
349{ 350{
350 if (mName.isEmpty()) mName = i18n("Anonymous"); 351 if (mName.isEmpty()) mName = i18n("Anonymous");
351 if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere"); 352 if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere");
352} 353}
353 354
354void KOPrefs::setTimeZoneIdDefault() 355void KOPrefs::setTimeZoneIdDefault()
355{ 356{
356 ; 357 ;
357} 358}
358 359
359void KOPrefs::setAllDefaults() 360void KOPrefs::setAllDefaults()
360{ 361{
361 setCategoryDefaults(); 362 setCategoryDefaults();
362 mEventSummaryUser = getDefaultList() ; 363 mEventSummaryUser = getDefaultList() ;
363 mTodoSummaryUser = getDefaultList() ; 364 mTodoSummaryUser = getDefaultList() ;
364 mLocationDefaults = getLocationDefaultList(); 365 mLocationDefaults = getLocationDefaultList();
365} 366}
366 367
367void KOPrefs::setCategoryDefaults() 368void KOPrefs::setCategoryDefaults()
368{ 369{
369 mCustomCategories.clear(); 370 mCustomCategories.clear();
370 mCustomCategories = getDefaultList(); 371 mCustomCategories = getDefaultList();
371 372
372 QStringList::Iterator it; 373 QStringList::Iterator it;
373 for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { 374 for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) {
374 setCategoryColor(*it,mDefaultCategoryColor); 375 setCategoryColor(*it,mDefaultCategoryColor);
375 } 376 }
376} 377}
377QStringList KOPrefs::getLocationDefaultList() 378QStringList KOPrefs::getLocationDefaultList()
378{ 379{
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h
index e06df1c..864cf1b 100644
--- a/korganizer/koprefs.h
+++ b/korganizer/koprefs.h
@@ -1,320 +1,321 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23#ifndef KOPREFS_H 23#ifndef KOPREFS_H
24#define KOPREFS_H 24#define KOPREFS_H
25 25
26 26
27#include <libkdepim/kpimprefs.h> 27#include <libkdepim/kpimprefs.h>
28#include <qdict.h> 28#include <qdict.h>
29 29
30class KConfig; 30class KConfig;
31class QFont; 31class QFont;
32class QColor; 32class QColor;
33class QStringList; 33class QStringList;
34 34
35#define VIEW_WN_VIEW 1 35#define VIEW_WN_VIEW 1
36#define VIEW_NX_VIEW 2 36#define VIEW_NX_VIEW 2
37#define VIEW_J_VIEW 3 37#define VIEW_J_VIEW 3
38#define VIEW_A_VIEW 4 38#define VIEW_A_VIEW 4
39#define VIEW_ML_VIEW 5 39#define VIEW_ML_VIEW 5
40#define VIEW_M_VIEW 6 40#define VIEW_M_VIEW 6
41#define VIEW_L_VIEW 7 41#define VIEW_L_VIEW 7
42#define VIEW_T_VIEW 8 42#define VIEW_T_VIEW 8
43 43
44class KOPrefs : public KPimPrefs 44class KOPrefs : public KPimPrefs
45{ 45{
46 public: 46 public:
47 enum { FormatVCalendar, FormatICalendar }; 47 enum { FormatVCalendar, FormatICalendar };
48 enum { MailClientKMail, MailClientSendmail }; 48 enum { MailClientKMail, MailClientSendmail };
49 enum { IMIPDummy, IMIPKMail }; 49 enum { IMIPDummy, IMIPKMail };
50 enum { IMIPOutbox, IMIPdirectsend }; 50 enum { IMIPOutbox, IMIPdirectsend };
51 enum { neverAuto, addressbookAuto, selectedAuto }; 51 enum { neverAuto, addressbookAuto, selectedAuto };
52 enum { standardDestination, askDestination }; 52 enum { standardDestination, askDestination };
53 53
54 virtual ~KOPrefs(); 54 virtual ~KOPrefs();
55 55
56 /** Get instance of KOPrefs. It is made sure that there is only one 56 /** Get instance of KOPrefs. It is made sure that there is only one
57 instance. */ 57 instance. */
58 static KOPrefs *instance(); 58 static KOPrefs *instance();
59 59
60 /** Set preferences to default values */ 60 /** Set preferences to default values */
61 void usrSetDefaults(); 61 void usrSetDefaults();
62 62
63 /** Read preferences from config file */ 63 /** Read preferences from config file */
64 void usrReadConfig(); 64 void usrReadConfig();
65 65
66 /** Write preferences to config file */ 66 /** Write preferences to config file */
67 void usrWriteConfig(); 67 void usrWriteConfig();
68 void setCategoryDefaults(); 68 void setCategoryDefaults();
69 void setAllDefaults(); 69 void setAllDefaults();
70 70
71 protected: 71 protected:
72 void setTimeZoneIdDefault(); 72 void setTimeZoneIdDefault();
73 73
74 /** Fill empty mail fields with default values. */ 74 /** Fill empty mail fields with default values. */
75 void fillMailDefaults(); 75 void fillMailDefaults();
76 76
77 private: 77 private:
78 /** Constructor disabled for public. Use instance() to create a KOPrefs 78 /** Constructor disabled for public. Use instance() to create a KOPrefs
79 object. */ 79 object. */
80 KOPrefs(); 80 KOPrefs();
81 81
82 static KOPrefs *mInstance; 82 static KOPrefs *mInstance;
83 QStringList getDefaultList(); 83 QStringList getDefaultList();
84 QStringList getLocationDefaultList(); 84 QStringList getLocationDefaultList();
85 public: 85 public:
86 // preferences data 86 // preferences data
87 KConfig* getConfig(); 87 KConfig* getConfig();
88 void setFullName(const QString &); 88 void setFullName(const QString &);
89 QString fullName(); 89 QString fullName();
90 void setEmail(const QString &); 90 void setEmail(const QString &);
91 QString email(); 91 QString email();
92 92
93 QString mAdditional; 93 QString mAdditional;
94 94
95 bool mEmailControlCenter; 95 bool mEmailControlCenter;
96 96
97 bool mBcc; 97 bool mBcc;
98 bool mAutoSave; 98 bool mAutoSave;
99 int mAutoSaveInterval; 99 int mAutoSaveInterval;
100 bool mConfirm; 100 bool mConfirm;
101 101
102 bool mEnableGroupScheduling; 102 bool mEnableGroupScheduling;
103 bool mEnableProjectView; 103 bool mEnableProjectView;
104 104
105 int mDefaultFormat; 105 int mDefaultFormat;
106 int mMailClient; 106 int mMailClient;
107 107
108 int mStartTime; 108 int mStartTime;
109 int mDefaultDuration; 109 int mDefaultDuration;
110 int mAlarmTime; 110 int mAlarmTime;
111 111
112 int mWorkingHoursStart; 112 int mWorkingHoursStart;
113 int mWorkingHoursEnd; 113 int mWorkingHoursEnd;
114 bool mExcludeHolidays; 114 bool mExcludeHolidays;
115 bool mExcludeSaturdays; 115 bool mExcludeSaturdays;
116 bool mMarcusBainsShowSeconds; 116 bool mMarcusBainsShowSeconds;
117 117
118 QFont mTimeBarFont; 118 QFont mTimeBarFont;
119 QFont mMonthViewFont; 119 QFont mMonthViewFont;
120 QFont mAgendaViewFont; 120 QFont mAgendaViewFont;
121 QFont mMarcusBainsFont; 121 QFont mMarcusBainsFont;
122 QFont mTimeLabelsFont; 122 QFont mTimeLabelsFont;
123 QFont mTodoViewFont; 123 QFont mTodoViewFont;
124 QFont mListViewFont; 124 QFont mListViewFont;
125 QFont mDateNavigatorFont; 125 QFont mDateNavigatorFont;
126 QFont mEditBoxFont; 126 QFont mEditBoxFont;
127 QFont mJornalViewFont; 127 QFont mJornalViewFont;
128 QFont mWhatsNextFont; 128 QFont mWhatsNextFont;
129 QFont mEventViewFont; 129 QFont mEventViewFont;
130 130
131 131
132 132
133 133
134 QColor mHolidayColor; 134 QColor mHolidayColor;
135 QColor mHighlightColor; 135 QColor mHighlightColor;
136 QColor mEventColor; 136 QColor mEventColor;
137 QColor mTodoDoneColor; 137 QColor mTodoDoneColor;
138 QColor mAgendaBgColor; 138 QColor mAgendaBgColor;
139 QColor mWorkingHoursColor; 139 QColor mWorkingHoursColor;
140 QColor mTodoDueTodayColor; 140 QColor mTodoDueTodayColor;
141 QColor mTodoOverdueColor; 141 QColor mTodoOverdueColor;
142 QColor mTodoRunColor; 142 QColor mTodoRunColor;
143 QColor mMonthViewEvenColor; 143 QColor mMonthViewEvenColor;
144 QColor mMonthViewOddColor; 144 QColor mMonthViewOddColor;
145 QColor mMonthViewHolidayColor; 145 QColor mMonthViewHolidayColor;
146 bool mMonthViewUsesDayColors; 146 bool mMonthViewUsesDayColors;
147 bool mMonthViewSatSunTog; 147 bool mMonthViewSatSunTog;
148 bool mMonthViewWeek; 148 bool mMonthViewWeek;
149 QColor mAppColor1; 149 QColor mAppColor1;
150 QColor mAppColor2; 150 QColor mAppColor2;
151 bool mUseAppColors; 151 bool mUseAppColors;
152 152
153 int mDayBegins; 153 int mDayBegins;
154 int mHourSize; 154 int mHourSize;
155 int mAllDaySize; 155 int mAllDaySize;
156 bool mShowFullMenu; 156 bool mShowFullMenu;
157 bool mDailyRecur; 157 bool mDailyRecur;
158 bool mWeeklyRecur; 158 bool mWeeklyRecur;
159 bool mMonthDailyRecur; 159 bool mMonthDailyRecur;
160 bool mMonthWeeklyRecur; 160 bool mMonthWeeklyRecur;
161 bool mMonthShowIcons; 161 bool mMonthShowIcons;
162 bool mMonthShowTimes; 162 bool mMonthShowTimes;
163 bool mMonthShowShort; 163 bool mMonthShowShort;
164 bool mEnableToolTips; 164 bool mEnableToolTips;
165 bool mEnableMonthScroll; 165 bool mEnableMonthScroll;
166 bool mFullViewMonth; 166 bool mFullViewMonth;
167 bool mMonthViewUsesCategoryColor; 167 bool mMonthViewUsesCategoryColor;
168 bool mFullViewTodo; 168 bool mFullViewTodo;
169 bool mShowCompletedTodo; 169 bool mShowCompletedTodo;
170 bool mMarcusBainsEnabled; 170 bool mMarcusBainsEnabled;
171 int mNextXDays; 171 int mNextXDays;
172 int mWhatsNextDays; 172 int mWhatsNextDays;
173 int mWhatsNextPrios; 173 int mWhatsNextPrios;
174 bool mEnableQuickTodo; 174 bool mEnableQuickTodo;
175 175
176 bool mCompactDialogs; 176 bool mCompactDialogs;
177 bool mVerticalScreen; 177 bool mVerticalScreen;
178 178
179 bool mShowIconNewTodo; 179 bool mShowIconNewTodo;
180 bool mShowIconNewEvent; 180 bool mShowIconNewEvent;
181 bool mShowIconSearch; 181 bool mShowIconSearch;
182 bool mShowIconList; 182 bool mShowIconList;
183 bool mShowIconDay1; 183 bool mShowIconDay1;
184 bool mShowIconDay5; 184 bool mShowIconDay5;
185 bool mShowIconDay6; 185 bool mShowIconDay6;
186 bool mShowIconDay7; 186 bool mShowIconDay7;
187 bool mShowIconMonth; 187 bool mShowIconMonth;
188 bool mShowIconTodoview; 188 bool mShowIconTodoview;
189 bool mShowIconBackFast; 189 bool mShowIconBackFast;
190 bool mShowIconBack; 190 bool mShowIconBack;
191 bool mShowIconToday; 191 bool mShowIconToday;
192 bool mShowIconForward; 192 bool mShowIconForward;
193 bool mShowIconForwardFast; 193 bool mShowIconForwardFast;
194 bool mShowIconWhatsThis; 194 bool mShowIconWhatsThis;
195 bool mShowIconWeekNum; 195 bool mShowIconWeekNum;
196 bool mShowIconNextDays; 196 bool mShowIconNextDays;
197 bool mShowIconNext; 197 bool mShowIconNext;
198 bool mShowIconJournal; 198 bool mShowIconJournal;
199 bool mShowIconFilter; 199 bool mShowIconFilter;
200 bool mShowIconOnetoolbar; 200 bool mShowIconOnetoolbar;
201 bool mShowIconNavigator; 201 bool mShowIconNavigator;
202 bool mShowIconAllday; 202 bool mShowIconAllday;
203 bool mShowIconFilterview; 203 bool mShowIconFilterview;
204 bool mShowIconToggleFull; 204 bool mShowIconToggleFull;
205 205
206 bool mShowIconStretch; 206 bool mShowIconStretch;
207 207
208 bool mToolBarHor; 208 bool mToolBarHor;
209 bool mToolBarUp; 209 bool mToolBarUp;
210 bool mToolBarHorV; 210 bool mToolBarHorV;
211 bool mToolBarUpV; 211 bool mToolBarUpV;
212 bool mToolBarHorN; 212 bool mToolBarHorN;
213 bool mToolBarUpN; 213 bool mToolBarUpN;
214 bool mToolBarHorF; 214 bool mToolBarHorF;
215 bool mToolBarUpF; 215 bool mToolBarUpF;
216 bool mToolBarMiniIcons; 216 bool mToolBarMiniIcons;
217 217
218 bool mAskForQuit; 218 bool mAskForQuit;
219 bool mUsePassWd; 219 bool mUsePassWd;
220 bool mShowSyncEvents; 220 bool mShowSyncEvents;
221 bool mShowTodoInAgenda; 221 bool mShowTodoInAgenda;
222 bool mShowCompletedTodoInAgenda;
222 bool mShowTimeInAgenda; 223 bool mShowTimeInAgenda;
223 bool mHideNonStartedTodos; 224 bool mHideNonStartedTodos;
224 225
225 bool mBlockPopupMenu; 226 bool mBlockPopupMenu;
226 227
227 int mLastSyncTime; 228 int mLastSyncTime;
228 void setCategoryColor(QString cat,const QColor & color); 229 void setCategoryColor(QString cat,const QColor & color);
229 QColor *categoryColor(QString cat); 230 QColor *categoryColor(QString cat);
230 231
231 QString mArchiveFile; 232 QString mArchiveFile;
232 QString mHtmlExportFile; 233 QString mHtmlExportFile;
233 bool mHtmlWithSave; 234 bool mHtmlWithSave;
234 235
235 QStringList mSelectedPlugins; 236 QStringList mSelectedPlugins;
236 237
237 QString mLastImportFile; 238 QString mLastImportFile;
238 QString mLastVcalFile; 239 QString mLastVcalFile;
239 QString mLastSaveFile; 240 QString mLastSaveFile;
240 QString mLastLoadFile; 241 QString mLastLoadFile;
241 242
242 243
243 QString mDefaultAlarmFile; 244 QString mDefaultAlarmFile;
244 int mIMIPScheduler; 245 int mIMIPScheduler;
245 int mIMIPSend; 246 int mIMIPSend;
246 QStringList mAdditionalMails; 247 QStringList mAdditionalMails;
247 int mIMIPAutoRefresh; 248 int mIMIPAutoRefresh;
248 int mIMIPAutoInsertReply; 249 int mIMIPAutoInsertReply;
249 int mIMIPAutoInsertRequest; 250 int mIMIPAutoInsertRequest;
250 int mIMIPAutoFreeBusy; 251 int mIMIPAutoFreeBusy;
251 int mIMIPAutoFreeBusyReply; 252 int mIMIPAutoFreeBusyReply;
252 253
253 QStringList mTodoTemplates; 254 QStringList mTodoTemplates;
254 QStringList mEventTemplates; 255 QStringList mEventTemplates;
255 256
256 int mDestination; 257 int mDestination;
257 258
258 259
259 bool mEditOnDoubleClick; 260 bool mEditOnDoubleClick;
260 bool mViewChangeHoldFullscreen; 261 bool mViewChangeHoldFullscreen;
261 bool mViewChangeHoldNonFullscreen; 262 bool mViewChangeHoldNonFullscreen;
262 bool mCenterOnCurrentTime; 263 bool mCenterOnCurrentTime;
263 bool mSetTimeToDayStartAt; 264 bool mSetTimeToDayStartAt;
264 bool mHighlightCurrentDay; 265 bool mHighlightCurrentDay;
265 bool mUseHighlightLightColor; 266 bool mUseHighlightLightColor;
266 bool mListViewMonthTimespan; 267 bool mListViewMonthTimespan;
267 bool mWNViewShowsParents; 268 bool mWNViewShowsParents;
268 bool mWNViewShowsPast; 269 bool mWNViewShowsPast;
269 bool mWNViewShowLocation; 270 bool mWNViewShowLocation;
270 bool mTodoViewShowsPercentage; 271 bool mTodoViewShowsPercentage;
271 bool mTodoViewUsesCatColors; 272 bool mTodoViewUsesCatColors;
272 bool mMonthViewUsesBigFont; 273 bool mMonthViewUsesBigFont;
273 bool mTodoViewUsesSmallFont; 274 bool mTodoViewUsesSmallFont;
274 bool mTodoViewUsesForegroundColor; 275 bool mTodoViewUsesForegroundColor;
275 bool mMonthViewUsesForegroundColor; 276 bool mMonthViewUsesForegroundColor;
276 277
277 bool mHightlightDateTimeEdit; 278 bool mHightlightDateTimeEdit;
278 bool mShortDateInViewer; 279 bool mShortDateInViewer;
279 280
280 bool mShowDateNavigator; 281 bool mShowDateNavigator;
281 282
282 QStringList mLocationDefaults; 283 QStringList mLocationDefaults;
283 QStringList mEventSummaryUser; 284 QStringList mEventSummaryUser;
284 QStringList mTodoSummaryUser; 285 QStringList mTodoSummaryUser;
285 286
286 bool mUseInternalAlarmNotification; 287 bool mUseInternalAlarmNotification;
287 int mAlarmPlayBeeps; 288 int mAlarmPlayBeeps;
288 int mAlarmSuspendTime; 289 int mAlarmSuspendTime;
289 int mAlarmSuspendCount; 290 int mAlarmSuspendCount;
290 int mAlarmBeepInterval; 291 int mAlarmBeepInterval;
291 int mOldLanguage; 292 int mOldLanguage;
292 int mOldLoadedLanguage; 293 int mOldLoadedLanguage;
293 294
294 295
295 QString mActiveSyncPort; 296 QString mActiveSyncPort;
296 QString mActiveSyncIP; 297 QString mActiveSyncIP;
297 298
298 // settings for eventviewer 299 // settings for eventviewer
299 bool mEVshowDetails; 300 bool mEVshowDetails;
300 bool mEVshowCreated; 301 bool mEVshowCreated;
301 bool mEVshowChanged; 302 bool mEVshowChanged;
302 bool mWTshowDetails; 303 bool mWTshowDetails;
303 bool mWTshowCreated; 304 bool mWTshowCreated;
304 bool mWTshowChanged; 305 bool mWTshowChanged;
305 306
306 int mCurrentDisplayedView; 307 int mCurrentDisplayedView;
307 308
308 private: 309 private:
309 QDict<QColor> mCategoryColors; 310 QDict<QColor> mCategoryColors;
310 QColor mDefaultCategoryColor; 311 QColor mDefaultCategoryColor;
311 312
312 QFont mDefaultTimeBarFont; 313 QFont mDefaultTimeBarFont;
313 QFont mDefaultViewFont; 314 QFont mDefaultViewFont;
314 QFont mDefaultMonthViewFont; 315 QFont mDefaultMonthViewFont;
315 316
316 QString mName; 317 QString mName;
317 QString mEmail; 318 QString mEmail;
318}; 319};
319 320
320#endif 321#endif
diff --git a/korganizer/koprefsdialog.cpp b/korganizer/koprefsdialog.cpp
index e4bee63..c9477e3 100644
--- a/korganizer/koprefsdialog.cpp
+++ b/korganizer/koprefsdialog.cpp
@@ -463,738 +463,745 @@ void KOPrefsDialog::setupMainTab()
463 KPrefsDialogWidRadios *defaultFormatGroup = 463 KPrefsDialogWidRadios *defaultFormatGroup =
464 addWidRadios(i18n("Default Calendar Format"), 464 addWidRadios(i18n("Default Calendar Format"),
465 &(KOPrefs::instance()->mDefaultFormat),topFrame); 465 &(KOPrefs::instance()->mDefaultFormat),topFrame);
466 defaultFormatGroup->addRadio(i18n("vCalendar")); 466 defaultFormatGroup->addRadio(i18n("vCalendar"));
467 defaultFormatGroup->addRadio(i18n("iCalendar")); 467 defaultFormatGroup->addRadio(i18n("iCalendar"));
468 468
469 topLayout->addMultiCellWidget(defaultFormatGroup->groupBox(),10,10,0,1); 469 topLayout->addMultiCellWidget(defaultFormatGroup->groupBox(),10,10,0,1);
470 470
471 // Default format unconditionally is iCalendar 471 // Default format unconditionally is iCalendar
472 defaultFormatGroup->groupBox()->hide(); 472 defaultFormatGroup->groupBox()->hide();
473 473
474 KPrefsDialogWidRadios *mailClientGroup = 474 KPrefsDialogWidRadios *mailClientGroup =
475 addWidRadios(i18n("Mail Client"),&(KOPrefs::instance()->mMailClient), 475 addWidRadios(i18n("Mail Client"),&(KOPrefs::instance()->mMailClient),
476 topFrame); 476 topFrame);
477 mailClientGroup->addRadio(i18n("KMail")); 477 mailClientGroup->addRadio(i18n("KMail"));
478 mailClientGroup->addRadio(i18n("Sendmail")); 478 mailClientGroup->addRadio(i18n("Sendmail"));
479 topLayout->addMultiCellWidget(mailClientGroup->groupBox(),11,11,0,1); 479 topLayout->addMultiCellWidget(mailClientGroup->groupBox(),11,11,0,1);
480 480
481 KPrefsDialogWidBool *htmlsave = 481 KPrefsDialogWidBool *htmlsave =
482 addWidBool(i18n("Export to HTML with every save"),&(KOPrefs::instance()->mHtmlWithSave), 482 addWidBool(i18n("Export to HTML with every save"),&(KOPrefs::instance()->mHtmlWithSave),
483 topFrame); 483 topFrame);
484 topLayout->addMultiCellWidget(htmlsave->checkBox(),12,12,0,1); 484 topLayout->addMultiCellWidget(htmlsave->checkBox(),12,12,0,1);
485 485
486 KPrefsDialogWidRadios *destinationGroup = 486 KPrefsDialogWidRadios *destinationGroup =
487 addWidRadios(i18n("New Events/Todos should"),&(KOPrefs::instance()->mDestination), 487 addWidRadios(i18n("New Events/Todos should"),&(KOPrefs::instance()->mDestination),
488 topFrame); 488 topFrame);
489 destinationGroup->addRadio(i18n("be added to the standard resource")); 489 destinationGroup->addRadio(i18n("be added to the standard resource"));
490 destinationGroup->addRadio(i18n("be asked which resource to use")); 490 destinationGroup->addRadio(i18n("be asked which resource to use"));
491 topLayout->addMultiCellWidget(destinationGroup->groupBox(),13,13,0,1); 491 topLayout->addMultiCellWidget(destinationGroup->groupBox(),13,13,0,1);
492 492
493 topLayout->setRowStretch(14,1); 493 topLayout->setRowStretch(14,1);
494 */ 494 */
495} 495}
496 496
497 497
498void KOPrefsDialog::setupTimeTab() 498void KOPrefsDialog::setupTimeTab()
499{ 499{
500 QFrame *topFrame = addPage(i18n("Time"),0,0); 500 QFrame *topFrame = addPage(i18n("Time"),0,0);
501 // DesktopIcon("clock",KIcon::SizeMedium)); 501 // DesktopIcon("clock",KIcon::SizeMedium));
502 502
503 QGridLayout *topLayout = new QGridLayout(topFrame,4,2); 503 QGridLayout *topLayout = new QGridLayout(topFrame,4,2);
504 topLayout->setSpacing(mSpacingHint); 504 topLayout->setSpacing(mSpacingHint);
505 topLayout->setMargin(mMarginHint); 505 topLayout->setMargin(mMarginHint);
506 506
507 QHBox *dummy = new QHBox(topFrame); 507 QHBox *dummy = new QHBox(topFrame);
508 KPrefsDialogWidTime *dayBegins = 508 KPrefsDialogWidTime *dayBegins =
509 addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins), 509 addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins),
510 dummy); 510 dummy);
511 //topLayout->addWidget(dayBegins->label(),2,0); 511 //topLayout->addWidget(dayBegins->label(),2,0);
512 512
513 //topLayout->addWidget(dayBegins->spinBox(),2,1); 513 //topLayout->addWidget(dayBegins->spinBox(),2,1);
514 topLayout->addMultiCellWidget(dummy,0,0,0,1); 514 topLayout->addMultiCellWidget(dummy,0,0,0,1);
515 515
516 topLayout->addWidget(new QLabel(i18n("Default appointment time:"), 516 topLayout->addWidget(new QLabel(i18n("Default appointment time:"),
517 topFrame),1,0); 517 topFrame),1,0);
518 mStartTimeSpin = new QSpinBox(0,23,1,topFrame); 518 mStartTimeSpin = new QSpinBox(0,23,1,topFrame);
519 mStartTimeSpin->setSuffix(":00"); 519 mStartTimeSpin->setSuffix(":00");
520 topLayout->addWidget(mStartTimeSpin,1,1); 520 topLayout->addWidget(mStartTimeSpin,1,1);
521 521
522 topLayout->addWidget(new QLabel(i18n("Def. duration of new app.:"), 522 topLayout->addWidget(new QLabel(i18n("Def. duration of new app.:"),
523 topFrame),2,0); 523 topFrame),2,0);
524 mDefaultDurationSpin = new QSpinBox(0,23,1,topFrame); 524 mDefaultDurationSpin = new QSpinBox(0,23,1,topFrame);
525 mDefaultDurationSpin->setSuffix(":00"); 525 mDefaultDurationSpin->setSuffix(":00");
526 topLayout->addWidget(mDefaultDurationSpin,2,1); 526 topLayout->addWidget(mDefaultDurationSpin,2,1);
527 527
528 QStringList alarmList; 528 QStringList alarmList;
529 alarmList << i18n("1 minute") << i18n("5 minutes") << i18n("10 minutes") 529 alarmList << i18n("1 minute") << i18n("5 minutes") << i18n("10 minutes")
530 << i18n("15 minutes") << i18n("30 minutes")<< i18n("1 hour")<< i18n("3 hours") << i18n("24 hours") ; 530 << i18n("15 minutes") << i18n("30 minutes")<< i18n("1 hour")<< i18n("3 hours") << i18n("24 hours") ;
531 topLayout->addWidget(new QLabel(i18n("Default alarm time:"),topFrame), 531 topLayout->addWidget(new QLabel(i18n("Default alarm time:"),topFrame),
532 3,0); 532 3,0);
533 mAlarmTimeCombo = new QComboBox(topFrame); 533 mAlarmTimeCombo = new QComboBox(topFrame);
534 mAlarmTimeCombo->insertStringList(alarmList); 534 mAlarmTimeCombo->insertStringList(alarmList);
535 topLayout->addWidget(mAlarmTimeCombo,3,1); 535 topLayout->addWidget(mAlarmTimeCombo,3,1);
536 536
537 537
538 QGroupBox *workingHoursGroup = new QGroupBox(1,Horizontal, 538 QGroupBox *workingHoursGroup = new QGroupBox(1,Horizontal,
539 i18n("Working Hours"), 539 i18n("Working Hours"),
540 topFrame); 540 topFrame);
541 topLayout->addMultiCellWidget(workingHoursGroup,4,4,0,1); 541 topLayout->addMultiCellWidget(workingHoursGroup,4,4,0,1);
542 workingHoursGroup->layout()->setSpacing( 0 ); 542 workingHoursGroup->layout()->setSpacing( 0 );
543 workingHoursGroup->layout()->setMargin( 4 ); 543 workingHoursGroup->layout()->setMargin( 4 );
544 QHBox *workStartBox = new QHBox(workingHoursGroup); 544 QHBox *workStartBox = new QHBox(workingHoursGroup);
545 // workStartBox->setMargin( 0 ); 545 // workStartBox->setMargin( 0 );
546 addWidTime(i18n("Daily starting hour:"), 546 addWidTime(i18n("Daily starting hour:"),
547 &(KOPrefs::instance()->mWorkingHoursStart),workStartBox); 547 &(KOPrefs::instance()->mWorkingHoursStart),workStartBox);
548 548
549 QHBox *workEndBox = new QHBox(workingHoursGroup); 549 QHBox *workEndBox = new QHBox(workingHoursGroup);
550 //workEndBox->setMargin( 0 ); 550 //workEndBox->setMargin( 0 );
551 addWidTime(i18n("Daily ending hour:"), 551 addWidTime(i18n("Daily ending hour:"),
552 &(KOPrefs::instance()->mWorkingHoursEnd),workEndBox); 552 &(KOPrefs::instance()->mWorkingHoursEnd),workEndBox);
553 QVBox *excludeBox = new QVBox(workingHoursGroup); 553 QVBox *excludeBox = new QVBox(workingHoursGroup);
554 //excludeBox->setMargin( 0 ); 554 //excludeBox->setMargin( 0 );
555 addWidBool(i18n("Exclude holidays"), 555 addWidBool(i18n("Exclude holidays"),
556 &(KOPrefs::instance()->mExcludeHolidays),excludeBox); 556 &(KOPrefs::instance()->mExcludeHolidays),excludeBox);
557 557
558 addWidBool(i18n("Exclude Saturdays"), 558 addWidBool(i18n("Exclude Saturdays"),
559 &(KOPrefs::instance()->mExcludeSaturdays),excludeBox); 559 &(KOPrefs::instance()->mExcludeSaturdays),excludeBox);
560 560
561// KPrefsDialogWidBool *marcusBainsShowSeconds = addWidBool(i18n("Show seconds on Marcus Bains line"), 561// KPrefsDialogWidBool *marcusBainsShowSeconds = addWidBool(i18n("Show seconds on Marcus Bains line"),
562 // &(KOPrefs::instance()->mMarcusBainsShowSeconds), 562 // &(KOPrefs::instance()->mMarcusBainsShowSeconds),
563 // topFrame); 563 // topFrame);
564// topLayout->addWidget(marcusBainsShowSeconds->checkBox(),5,0); 564// topLayout->addWidget(marcusBainsShowSeconds->checkBox(),5,0);
565 565
566 // topLayout->setRowStretch(6,1); 566 // topLayout->setRowStretch(6,1);
567} 567}
568 568
569 569
570void KOPrefsDialog::setupViewsTab() 570void KOPrefsDialog::setupViewsTab()
571{ 571{
572 572
573 QFrame *topFrame = addPage(i18n("Views"),0,0); 573 QFrame *topFrame = addPage(i18n("Views"),0,0);
574 // DesktopIcon("viewmag",KIcon::SizeMedium)); 574 // DesktopIcon("viewmag",KIcon::SizeMedium));
575 575
576 QGridLayout *topLayout = new QGridLayout(topFrame,6,1); 576 QGridLayout *topLayout = new QGridLayout(topFrame,6,1);
577 topLayout->setSpacing(mSpacingHint); 577 topLayout->setSpacing(mSpacingHint);
578 topLayout->setMargin(mMarginHint); 578 topLayout->setMargin(mMarginHint);
579 579
580// QBoxLayout *dayBeginsLayout = new QHBoxLayout; 580// QBoxLayout *dayBeginsLayout = new QHBoxLayout;
581// topLayout->addLayout(dayBeginsLayout,0,0); 581// topLayout->addLayout(dayBeginsLayout,0,0);
582 582
583// KPrefsDialogWidTime *dayBegins = 583// KPrefsDialogWidTime *dayBegins =
584// addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins), 584// addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins),
585// topFrame); 585// topFrame);
586// dayBeginsLayout->addWidget(dayBegins->label()); 586// dayBeginsLayout->addWidget(dayBegins->label());
587// dayBeginsLayout->addStretch(1); 587// dayBeginsLayout->addStretch(1);
588// dayBeginsLayout->addWidget(dayBegins->spinBox()); 588// dayBeginsLayout->addWidget(dayBegins->spinBox());
589 589
590// QBoxLayout *nextDaysLayout = new QHBoxLayout; 590// QBoxLayout *nextDaysLayout = new QHBoxLayout;
591// topLayout->addLayout(nextDaysLayout,1,0); 591// topLayout->addLayout(nextDaysLayout,1,0);
592// nextDaysLayout->addWidget(new QLabel(i18n("Days to show in Next-X-Days view:"),topFrame)); 592// nextDaysLayout->addWidget(new QLabel(i18n("Days to show in Next-X-Days view:"),topFrame));
593// mNextXDaysSpin = new QSpinBox(2,14,1,topFrame); 593// mNextXDaysSpin = new QSpinBox(2,14,1,topFrame);
594// nextDaysLayout->addStretch(1); 594// nextDaysLayout->addStretch(1);
595// nextDaysLayout->addWidget(mNextXDaysSpin); 595// nextDaysLayout->addWidget(mNextXDaysSpin);
596 596
597 597
598 int ii = 0; 598 int ii = 0;
599 KPrefsDialogWidBool *dummy = 599 KPrefsDialogWidBool *dummy =
600 addWidBool(i18n("Edit item on doubleclick (if not, show)"), 600 addWidBool(i18n("Edit item on doubleclick (if not, show)"),
601 &(KOPrefs::instance()->mEditOnDoubleClick),topFrame); 601 &(KOPrefs::instance()->mEditOnDoubleClick),topFrame);
602 topLayout->addWidget(dummy->checkBox(),ii++,0); 602 topLayout->addWidget(dummy->checkBox(),ii++,0);
603 603
604 604
605 605
606 606
607 607
608 608
609 // topLayout->addWidget(hourSizeGroup,ii++,0); 609 // topLayout->addWidget(hourSizeGroup,ii++,0);
610 // topLayout->addMultiCellWidget(hourSizeGroup,ii,ii,0,0); 610 // topLayout->addMultiCellWidget(hourSizeGroup,ii,ii,0,0);
611 //topLayout->setRowStretch(11,1); 611 //topLayout->setRowStretch(11,1);
612 612
613 613
614 614
615 615
616#if 0 616#if 0
617 617
618 topFrame = addPage(i18n("ViewChange"),0,0); 618 topFrame = addPage(i18n("ViewChange"),0,0);
619 // DesktopIcon("viewmag",KIcon::SizeMedium)); 619 // DesktopIcon("viewmag",KIcon::SizeMedium));
620 620
621 topLayout = new QGridLayout(topFrame,6,1); 621 topLayout = new QGridLayout(topFrame,6,1);
622 topLayout->setSpacing(mSpacingHint); 622 topLayout->setSpacing(mSpacingHint);
623 topLayout->setMargin(mMarginHint); 623 topLayout->setMargin(mMarginHint);
624 ii = 0; 624 ii = 0;
625 625
626#endif 626#endif
627 627
628 dummy = 628 dummy =
629 addWidBool(i18n("Hold fullscreen on view change"), 629 addWidBool(i18n("Hold fullscreen on view change"),
630 &(KOPrefs::instance()->mViewChangeHoldFullscreen),topFrame); 630 &(KOPrefs::instance()->mViewChangeHoldFullscreen),topFrame);
631 topLayout->addWidget(dummy->checkBox(),ii++,0); 631 topLayout->addWidget(dummy->checkBox(),ii++,0);
632 632
633 dummy = 633 dummy =
634 addWidBool(i18n("Hold non-fullscreen on view change"), 634 addWidBool(i18n("Hold non-fullscreen on view change"),
635 &(KOPrefs::instance()->mViewChangeHoldNonFullscreen),topFrame); 635 &(KOPrefs::instance()->mViewChangeHoldNonFullscreen),topFrame);
636 topLayout->addWidget(dummy->checkBox(),ii++,0); 636 topLayout->addWidget(dummy->checkBox(),ii++,0);
637 637
638 638
639 639
640 KPrefsDialogWidBool *fullViewMonth = 640 KPrefsDialogWidBool *fullViewMonth =
641 addWidBool(i18n("Next days view uses full window"), 641 addWidBool(i18n("Next days view uses full window"),
642 &(KOPrefs::instance()->mFullViewMonth),topFrame); 642 &(KOPrefs::instance()->mFullViewMonth),topFrame);
643 topLayout->addWidget(fullViewMonth->checkBox(),ii++,0); 643 topLayout->addWidget(fullViewMonth->checkBox(),ii++,0);
644 644
645 645
646 KPrefsDialogWidBool *fullViewTodo = 646 KPrefsDialogWidBool *fullViewTodo =
647 addWidBool(i18n("Event list view uses full window"), 647 addWidBool(i18n("Event list view uses full window"),
648 &(KOPrefs::instance()->mFullViewTodo),topFrame); 648 &(KOPrefs::instance()->mFullViewTodo),topFrame);
649 topLayout->addWidget(fullViewTodo->checkBox(),ii++,0); 649 topLayout->addWidget(fullViewTodo->checkBox(),ii++,0);
650 dummy = 650 dummy =
651 addWidBool(i18n("Listview uses monthly timespan"), 651 addWidBool(i18n("Listview uses monthly timespan"),
652 &(KOPrefs::instance()->mListViewMonthTimespan),topFrame); 652 &(KOPrefs::instance()->mListViewMonthTimespan),topFrame);
653 topLayout->addWidget(dummy->checkBox(),ii++,0); 653 topLayout->addWidget(dummy->checkBox(),ii++,0);
654 dummy = 654 dummy =
655 addWidBool(i18n("Highlight selection in Time Edit"), 655 addWidBool(i18n("Highlight selection in Time Edit"),
656 &(KOPrefs::instance()->mHightlightDateTimeEdit),topFrame); 656 &(KOPrefs::instance()->mHightlightDateTimeEdit),topFrame);
657 topLayout->addWidget( dummy->checkBox(), ii++,0); 657 topLayout->addWidget( dummy->checkBox(), ii++,0);
658 658
659 KPrefsDialogWidBool *dailyRecur = 659 KPrefsDialogWidBool *dailyRecur =
660 addWidBool(i18n("Show events that recur daily in date nav."), 660 addWidBool(i18n("Show events that recur daily in date nav."),
661 &(KOPrefs::instance()->mDailyRecur),topFrame); 661 &(KOPrefs::instance()->mDailyRecur),topFrame);
662 topLayout->addWidget(dailyRecur->checkBox(),ii++,0); 662 topLayout->addWidget(dailyRecur->checkBox(),ii++,0);
663 663
664 KPrefsDialogWidBool *weeklyRecur = 664 KPrefsDialogWidBool *weeklyRecur =
665 addWidBool(i18n("Show ev. that recur weekly in date nav."), 665 addWidBool(i18n("Show ev. that recur weekly in date nav."),
666 &(KOPrefs::instance()->mWeeklyRecur),topFrame); 666 &(KOPrefs::instance()->mWeeklyRecur),topFrame);
667 topLayout->addWidget(weeklyRecur->checkBox(),ii++,0); 667 topLayout->addWidget(weeklyRecur->checkBox(),ii++,0);
668 668
669#ifdef DESKTOP_VERSION 669#ifdef DESKTOP_VERSION
670 KPrefsDialogWidBool *enableToolTips = 670 KPrefsDialogWidBool *enableToolTips =
671 addWidBool(i18n("Enable tooltips displaying summary of ev."), 671 addWidBool(i18n("Enable tooltips displaying summary of ev."),
672 &(KOPrefs::instance()->mEnableToolTips),topFrame); 672 &(KOPrefs::instance()->mEnableToolTips),topFrame);
673 topLayout->addWidget(enableToolTips->checkBox(),ii++,0); 673 topLayout->addWidget(enableToolTips->checkBox(),ii++,0);
674#endif 674#endif
675 // ********************************************************* 675 // *********************************************************
676 676
677 topFrame = addPage(i18n("Agenda View"),0,0); 677 topFrame = addPage(i18n("Agenda View"),0,0);
678 // DesktopIcon("viewmag",KIcon::SizeMedium)); 678 // DesktopIcon("viewmag",KIcon::SizeMedium));
679 679
680 topLayout = new QGridLayout(topFrame,5,1); 680 topLayout = new QGridLayout(topFrame,5,1);
681 topLayout->setSpacing(mSpacingHint); 681 topLayout->setSpacing(mSpacingHint);
682 topLayout->setMargin(mMarginHint); 682 topLayout->setMargin(mMarginHint);
683 ii = 0; 683 ii = 0;
684 684
685 685
686 dummy = 686 dummy =
687 addWidBool(i18n("Show time in agenda items"), 687 addWidBool(i18n("Show time in agenda items"),
688 &(KOPrefs::instance()->mShowTimeInAgenda),topFrame); 688 &(KOPrefs::instance()->mShowTimeInAgenda),topFrame);
689 topLayout->addWidget(dummy->checkBox(),ii++,0); 689 topLayout->addWidget(dummy->checkBox(),ii++,0);
690 690
691 dummy = 691 dummy =
692 addWidBool(i18n("Highlight current day in agenda"), 692 addWidBool(i18n("Highlight current day in agenda"),
693 &(KOPrefs::instance()->mHighlightCurrentDay),topFrame); 693 &(KOPrefs::instance()->mHighlightCurrentDay),topFrame);
694 topLayout->addWidget(dummy->checkBox(),ii++,0); 694 topLayout->addWidget(dummy->checkBox(),ii++,0);
695 695
696 dummy = 696 dummy =
697 addWidBool(i18n("Use light color for highlight current day"), 697 addWidBool(i18n("Use light color for highlight current day"),
698 &(KOPrefs::instance()->mUseHighlightLightColor),topFrame); 698 &(KOPrefs::instance()->mUseHighlightLightColor),topFrame);
699 topLayout->addWidget(dummy->checkBox(),ii++,0); 699 topLayout->addWidget(dummy->checkBox(),ii++,0);
700 700
701 701
702 KPrefsDialogWidBool *marcusBainsEnabled = 702 KPrefsDialogWidBool *marcusBainsEnabled =
703 addWidBool(i18n("Show current time"), 703 addWidBool(i18n("Show current time"),
704 &(KOPrefs::instance()->mMarcusBainsEnabled),topFrame); 704 &(KOPrefs::instance()->mMarcusBainsEnabled),topFrame);
705 topLayout->addWidget(marcusBainsEnabled->checkBox(),ii++,0); 705 topLayout->addWidget(marcusBainsEnabled->checkBox(),ii++,0);
706 706
707 707
708 dummy = 708 dummy =
709 addWidBool(i18n("Set agenda to DayBeginsAt on change"), 709 addWidBool(i18n("Set agenda to DayBeginsAt on change"),
710 &(KOPrefs::instance()->mSetTimeToDayStartAt),topFrame); 710 &(KOPrefs::instance()->mSetTimeToDayStartAt),topFrame);
711 topLayout->addWidget(dummy->checkBox(),ii++,0); 711 topLayout->addWidget(dummy->checkBox(),ii++,0);
712 712
713 dummy = 713 dummy =
714 addWidBool(i18n("Set agenda to current time on change"), 714 addWidBool(i18n("Set agenda to current time on change"),
715 &(KOPrefs::instance()->mCenterOnCurrentTime),topFrame); 715 &(KOPrefs::instance()->mCenterOnCurrentTime),topFrame);
716 topLayout->addWidget(dummy->checkBox(),ii++,0); 716 topLayout->addWidget(dummy->checkBox(),ii++,0);
717 717
718 718
719 dummy =
720 addWidBool(i18n("Allday Agenda view shows todos"),
721 &(KOPrefs::instance()->mShowTodoInAgenda),topFrame);
722 topLayout->addWidget(dummy->checkBox(),ii++,0);
723
724
725
726 dummy =
727 addWidBool(i18n("Agenda view shows completed todos"),
728 &(KOPrefs::instance()->mShowCompletedTodoInAgenda),topFrame);
729 topLayout->addWidget(dummy->checkBox(),ii++,0);
719 730
720 731
721 732
722 733
723 734
724 topFrame = addPage(i18n("Month View"),0,0); 735 topFrame = addPage(i18n("Month View"),0,0);
725 // DesktopIcon("viewmag",KIcon::SizeMedium)); 736 // DesktopIcon("viewmag",KIcon::SizeMedium));
726 737
727 topLayout = new QGridLayout(topFrame,5,1); 738 topLayout = new QGridLayout(topFrame,5,1);
728 topLayout->setSpacing(mSpacingHint); 739 topLayout->setSpacing(mSpacingHint);
729 topLayout->setMargin(mMarginHint); 740 topLayout->setMargin(mMarginHint);
730 ii = 0; 741 ii = 0;
731 QLabel *lab; 742 QLabel *lab;
732 QHBox *habo = new QHBox( topFrame ); 743 QHBox *habo = new QHBox( topFrame );
733 if ( QApplication::desktop()->width() <= 480 ) { 744 if ( QApplication::desktop()->width() <= 480 ) {
734 lab = new QLabel ( i18n("Show events that recur "), topFrame ); 745 lab = new QLabel ( i18n("Show events that recur "), topFrame );
735 topLayout->addMultiCellWidget(lab,ii, ii,0,1); 746 topLayout->addMultiCellWidget(lab,ii, ii,0,1);
736 ii++; 747 ii++;
737 } else { 748 } else {
738 new QLabel ( i18n("Show events that recur "), habo ); 749 new QLabel ( i18n("Show events that recur "), habo );
739 } 750 }
740 dailyRecur = 751 dailyRecur =
741 addWidBool(i18n("daily"), 752 addWidBool(i18n("daily"),
742 &(KOPrefs::instance()->mMonthDailyRecur),habo); 753 &(KOPrefs::instance()->mMonthDailyRecur),habo);
743 // topLayout->addWidget(dailyRecur->checkBox(),ii++,0); 754 // topLayout->addWidget(dailyRecur->checkBox(),ii++,0);
744 755
745 weeklyRecur = 756 weeklyRecur =
746 addWidBool(i18n("weekly"), 757 addWidBool(i18n("weekly"),
747 &(KOPrefs::instance()->mMonthWeeklyRecur),habo); 758 &(KOPrefs::instance()->mMonthWeeklyRecur),habo);
748 topLayout->addMultiCellWidget(habo,ii, ii,0,1); 759 topLayout->addMultiCellWidget(habo,ii, ii,0,1);
749 ii++; 760 ii++;
750 761
751 762
752 habo = new QHBox( topFrame ); 763 habo = new QHBox( topFrame );
753 if ( QApplication::desktop()->width() <= 480 ) { 764 if ( QApplication::desktop()->width() <= 480 ) {
754 lab = new QLabel (i18n("Show in every cell ") , topFrame ); 765 lab = new QLabel (i18n("Show in every cell ") , topFrame );
755 topLayout->addMultiCellWidget(lab,ii, ii,0,1); 766 topLayout->addMultiCellWidget(lab,ii, ii,0,1);
756 ii++; 767 ii++;
757 768
758 } else { 769 } else {
759 new QLabel ( i18n("Show in every cell "), habo ); 770 new QLabel ( i18n("Show in every cell "), habo );
760 } 771 }
761 weeklyRecur = 772 weeklyRecur =
762 addWidBool(i18n("short month"), 773 addWidBool(i18n("short month"),
763 &(KOPrefs::instance()->mMonthShowShort),habo); 774 &(KOPrefs::instance()->mMonthShowShort),habo);
764 weeklyRecur = 775 weeklyRecur =
765 addWidBool(i18n("icons"), 776 addWidBool(i18n("icons"),
766 &(KOPrefs::instance()->mMonthShowIcons),habo); 777 &(KOPrefs::instance()->mMonthShowIcons),habo);
767 weeklyRecur = 778 weeklyRecur =
768 addWidBool(i18n("times"), 779 addWidBool(i18n("times"),
769 &(KOPrefs::instance()->mMonthShowTimes),habo); 780 &(KOPrefs::instance()->mMonthShowTimes),habo);
770 topLayout->addMultiCellWidget(habo,ii, ii,0,1); 781 topLayout->addMultiCellWidget(habo,ii, ii,0,1);
771 ii++; 782 ii++;
772#ifdef DESKTOP_VERSION 783#ifdef DESKTOP_VERSION
773 KPrefsDialogWidBool *enableMonthScroll = 784 KPrefsDialogWidBool *enableMonthScroll =
774 addWidBool(i18n("Enable scrollbars in month view cells"), 785 addWidBool(i18n("Enable scrollbars in month view cells"),
775 &(KOPrefs::instance()->mEnableMonthScroll),topFrame); 786 &(KOPrefs::instance()->mEnableMonthScroll),topFrame);
776 topLayout->addWidget(enableMonthScroll->checkBox(),ii++,0); 787 topLayout->addWidget(enableMonthScroll->checkBox(),ii++,0);
777#endif 788#endif
778 dummy = 789 dummy =
779 addWidBool(i18n("Week view mode uses bigger font"), 790 addWidBool(i18n("Week view mode uses bigger font"),
780 &(KOPrefs::instance()->mMonthViewUsesBigFont),topFrame); 791 &(KOPrefs::instance()->mMonthViewUsesBigFont),topFrame);
781 topLayout->addWidget(dummy->checkBox(),ii++,0); 792 topLayout->addWidget(dummy->checkBox(),ii++,0);
782 dummy = 793 dummy =
783 addWidBool(i18n("Show Sat/Sun together"), 794 addWidBool(i18n("Show Sat/Sun together"),
784 &(KOPrefs::instance()->mMonthViewSatSunTog),topFrame); 795 &(KOPrefs::instance()->mMonthViewSatSunTog),topFrame);
785 topLayout->addWidget(dummy->checkBox(),ii++,0); 796 topLayout->addWidget(dummy->checkBox(),ii++,0);
786 797
787 KPrefsDialogWidBool *coloredCategoriesInMonthView = 798 KPrefsDialogWidBool *coloredCategoriesInMonthView =
788 addWidBool(i18n("Month view uses category colors"), 799 addWidBool(i18n("Month view uses category colors"),
789 &(KOPrefs::instance()->mMonthViewUsesCategoryColor),topFrame); 800 &(KOPrefs::instance()->mMonthViewUsesCategoryColor),topFrame);
790 topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); 801 topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0);
791 802
792 dummy = 803 dummy =
793 addWidBool(i18n("Categorie colors are applied to text"), 804 addWidBool(i18n("Category colors are applied to text"),
794 &(KOPrefs::instance()->mMonthViewUsesForegroundColor),topFrame); 805 &(KOPrefs::instance()->mMonthViewUsesForegroundColor),topFrame);
795 topLayout->addWidget(dummy->checkBox(),ii++,0); 806 topLayout->addWidget(dummy->checkBox(),ii++,0);
796 coloredCategoriesInMonthView = 807 coloredCategoriesInMonthView =
797 addWidBool(i18n("Month view uses day colors"), 808 addWidBool(i18n("Month view uses day colors"),
798 &(KOPrefs::instance()->mMonthViewUsesDayColors),topFrame); 809 &(KOPrefs::instance()->mMonthViewUsesDayColors),topFrame);
799 topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); 810 topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0);
800 811
801 KPrefsDialogWidColor *holidayColor = 812 KPrefsDialogWidColor *holidayColor =
802 addWidColor(i18n("Day color odd months"), 813 addWidColor(i18n("Day color odd months"),
803 &(KOPrefs::instance()->mMonthViewOddColor),topFrame); 814 &(KOPrefs::instance()->mMonthViewOddColor),topFrame);
804 topLayout->addWidget(holidayColor->label(),ii,0); 815 topLayout->addWidget(holidayColor->label(),ii,0);
805 topLayout->addWidget(holidayColor->button(),ii++,1); 816 topLayout->addWidget(holidayColor->button(),ii++,1);
806 817
807 holidayColor = 818 holidayColor =
808 addWidColor(i18n("Day color even months"), 819 addWidColor(i18n("Day color even months"),
809 &(KOPrefs::instance()->mMonthViewEvenColor),topFrame); 820 &(KOPrefs::instance()->mMonthViewEvenColor),topFrame);
810 topLayout->addWidget(holidayColor->label(),ii,0); 821 topLayout->addWidget(holidayColor->label(),ii,0);
811 topLayout->addWidget(holidayColor->button(),ii++,1); 822 topLayout->addWidget(holidayColor->button(),ii++,1);
812 823
813 824
814 holidayColor = 825 holidayColor =
815 addWidColor(i18n("Color for Sundays + category \"Holiday\""), 826 addWidColor(i18n("Color for Sundays + category \"Holiday\""),
816 &(KOPrefs::instance()->mMonthViewHolidayColor),topFrame); 827 &(KOPrefs::instance()->mMonthViewHolidayColor),topFrame);
817 topLayout->addWidget(holidayColor->label(),ii,0); 828 topLayout->addWidget(holidayColor->label(),ii,0);
818 topLayout->addWidget(holidayColor->button(),ii++,1); 829 topLayout->addWidget(holidayColor->button(),ii++,1);
819 // *********************** What'sNext View 830 // *********************** What'sNext View
820 topFrame = addPage(i18n("What's Next View"),0,0); 831 topFrame = addPage(i18n("What's Next View"),0,0);
821 // DesktopIcon("viewmag",KIcon::SizeMedium)); 832 // DesktopIcon("viewmag",KIcon::SizeMedium));
822 833
823 topLayout = new QGridLayout(topFrame,4,1); 834 topLayout = new QGridLayout(topFrame,4,1);
824 topLayout->setSpacing(mSpacingHint); 835 topLayout->setSpacing(mSpacingHint);
825 topLayout->setMargin(mMarginHint); 836 topLayout->setMargin(mMarginHint);
826 ii = 0; 837 ii = 0;
827 838
828 839
829 QHBox* hdummy = new QHBox(topFrame); 840 QHBox* hdummy = new QHBox(topFrame);
830 new QLabel(i18n("Days in What's Next:"),hdummy); 841 new QLabel(i18n("Days in What's Next:"),hdummy);
831 mWhatsNextSpin = new QSpinBox(1,14,1,hdummy); 842 mWhatsNextSpin = new QSpinBox(1,14,1,hdummy);
832 843
833 topLayout->addWidget(hdummy,ii++,0); 844 topLayout->addWidget(hdummy,ii++,0);
834 845
835 QHBox *prioBox = new QHBox(topFrame); 846 QHBox *prioBox = new QHBox(topFrame);
836 // intervalBox->setSpacing(mSpacingHint); 847 // intervalBox->setSpacing(mSpacingHint);
837 topLayout->addWidget(prioBox,ii++,0); 848 topLayout->addWidget(prioBox,ii++,0);
838 849
839 QLabel *prioLabel = new QLabel(i18n("Number of max.displayed todo prios:"), prioBox); 850 QLabel *prioLabel = new QLabel(i18n("Number of max.displayed todo prios:"), prioBox);
840 mPrioSpin = new QSpinBox(0,5,1,prioBox); 851 mPrioSpin = new QSpinBox(0,5,1,prioBox);
841 if ( QApplication::desktop()->width() < 300 ) 852 if ( QApplication::desktop()->width() < 300 )
842 mPrioSpin->setFixedWidth( 40 ); 853 mPrioSpin->setFixedWidth( 40 );
843 854
844 KPrefsDialogWidBool *passwdk = 855 KPrefsDialogWidBool *passwdk =
845 856
846 addWidBool(i18n("Show events, that are done"), 857 addWidBool(i18n("Show events that are done"),
847 &(KOPrefs::instance()->mWNViewShowsPast),topFrame); 858 &(KOPrefs::instance()->mWNViewShowsPast),topFrame);
848 topLayout->addWidget(passwdk->checkBox(), ii++,0); 859 topLayout->addWidget(passwdk->checkBox(), ii++,0);
849 passwdk = 860 passwdk =
850 addWidBool(i18n("Show parent To-Do's"), 861 addWidBool(i18n("Show parent To-Do's"),
851 &(KOPrefs::instance()->mWNViewShowsParents),topFrame); 862 &(KOPrefs::instance()->mWNViewShowsParents),topFrame);
852 topLayout->addWidget(passwdk->checkBox(), ii++,0); 863 topLayout->addWidget(passwdk->checkBox(), ii++,0);
853 864
854 passwdk = 865 passwdk =
855 addWidBool(i18n("Show location"), 866 addWidBool(i18n("Show location"),
856 &(KOPrefs::instance()->mWNViewShowLocation),topFrame); 867 &(KOPrefs::instance()->mWNViewShowLocation),topFrame);
857 topLayout->addWidget(passwdk->checkBox(), ii++,0); 868 topLayout->addWidget(passwdk->checkBox(), ii++,0);
858 869
859 870
860 passwdk = 871 passwdk =
861 addWidBool(i18n("Use short date in WN+Event view"), 872 addWidBool(i18n("Use short date in WN+Event view"),
862 &(KOPrefs::instance()->mShortDateInViewer),topFrame); 873 &(KOPrefs::instance()->mShortDateInViewer),topFrame);
863 topLayout->addWidget(passwdk->checkBox(), ii++,0); 874 topLayout->addWidget(passwdk->checkBox(), ii++,0);
864 875
865 876
866 877
867 878
868 // *********************** Todo View 879 // *********************** Todo View
869 880
870 topFrame = addPage(i18n("Todo View"),0,0); 881 topFrame = addPage(i18n("Todo View"),0,0);
871 // DesktopIcon("viewmag",KIcon::SizeMedium)); 882 // DesktopIcon("viewmag",KIcon::SizeMedium));
872 883
873 topLayout = new QGridLayout(topFrame,4,1); 884 topLayout = new QGridLayout(topFrame,4,1);
874 topLayout->setSpacing(mSpacingHint); 885 topLayout->setSpacing(mSpacingHint);
875 topLayout->setMargin(mMarginHint); 886 topLayout->setMargin(mMarginHint);
876 ii = 0; 887 ii = 0;
877dummy = 888dummy =
878 addWidBool(i18n("Hide not running Todos in To-do view"), 889 addWidBool(i18n("Hide not running Todos in To-do view"),
879 &(KOPrefs::instance()->mHideNonStartedTodos),topFrame); 890 &(KOPrefs::instance()->mHideNonStartedTodos),topFrame);
880 topLayout->addWidget(dummy->checkBox(),ii++,0); 891 topLayout->addWidget(dummy->checkBox(),ii++,0);
881 892
882 893
883 KPrefsDialogWidBool *showCompletedTodo = 894 KPrefsDialogWidBool *showCompletedTodo =
884 addWidBool(i18n("To-do view shows completed Todos"), 895 addWidBool(i18n("To-do view shows completed Todos"),
885 &(KOPrefs::instance()->mShowCompletedTodo),topFrame); 896 &(KOPrefs::instance()->mShowCompletedTodo),topFrame);
886 topLayout->addWidget(showCompletedTodo->checkBox(),ii++,0); 897 topLayout->addWidget(showCompletedTodo->checkBox(),ii++,0);
887 dummy = 898 dummy =
888 addWidBool(i18n("To-do view shows complete as 'xx %'"), 899 addWidBool(i18n("To-do view shows complete as 'xx %'"),
889 &(KOPrefs::instance()->mTodoViewShowsPercentage),topFrame); 900 &(KOPrefs::instance()->mTodoViewShowsPercentage),topFrame);
890 topLayout->addWidget(dummy->checkBox(),ii++,0); 901 topLayout->addWidget(dummy->checkBox(),ii++,0);
891 902
892 dummy = 903 dummy =
893 addWidBool(i18n("Small To-do view uses smaller font"), 904 addWidBool(i18n("Small To-do view uses smaller font"),
894 &(KOPrefs::instance()->mTodoViewUsesSmallFont),topFrame); 905 &(KOPrefs::instance()->mTodoViewUsesSmallFont),topFrame);
895 topLayout->addWidget(dummy->checkBox(),ii++,0); 906 topLayout->addWidget(dummy->checkBox(),ii++,0);
896 907
897 908
898 909
899 dummy = 910 dummy =
900 addWidBool(i18n("Todo view uses category colors"), 911 addWidBool(i18n("Todo view uses category colors"),
901 &(KOPrefs::instance()->mTodoViewUsesCatColors),topFrame); 912 &(KOPrefs::instance()->mTodoViewUsesCatColors),topFrame);
902 topLayout->addWidget(dummy->checkBox(),ii++,0); 913 topLayout->addWidget(dummy->checkBox(),ii++,0);
903 914
904 915
905 QWidget* wid = new QWidget( topFrame ); 916 QWidget* wid = new QWidget( topFrame );
906 // Todo run today color 917 // Todo run today color
907 KPrefsDialogWidColor *todoRunColor = 918 KPrefsDialogWidColor *todoRunColor =
908 addWidColor(i18n("Color for running todos:"), 919 addWidColor(i18n("Color for running todos:"),
909 &(KOPrefs::instance()->mTodoRunColor),wid); 920 &(KOPrefs::instance()->mTodoRunColor),wid);
910 QHBoxLayout *widLayout = new QHBoxLayout(wid); 921 QHBoxLayout *widLayout = new QHBoxLayout(wid);
911 widLayout->addWidget( todoRunColor->label() ); 922 widLayout->addWidget( todoRunColor->label() );
912 widLayout->addWidget( todoRunColor->button() ); 923 widLayout->addWidget( todoRunColor->button() );
913 topLayout->addWidget(wid,ii++,0); 924 topLayout->addWidget(wid,ii++,0);
914 925
915 wid = new QWidget( topFrame ); 926 wid = new QWidget( topFrame );
916 // Todo due today color 927 // Todo due today color
917 KPrefsDialogWidColor *todoDueTodayColor = 928 KPrefsDialogWidColor *todoDueTodayColor =
918 addWidColor(i18n("Todo due today color:"), 929 addWidColor(i18n("Todo due today color:"),
919 &(KOPrefs::instance()->mTodoDueTodayColor),wid); 930 &(KOPrefs::instance()->mTodoDueTodayColor),wid);
920 widLayout = new QHBoxLayout(wid); 931 widLayout = new QHBoxLayout(wid);
921 widLayout->addWidget( todoDueTodayColor->label() ); 932 widLayout->addWidget( todoDueTodayColor->label() );
922 widLayout->addWidget( todoDueTodayColor->button() ); 933 widLayout->addWidget( todoDueTodayColor->button() );
923 topLayout->addWidget(wid,ii++,0); 934 topLayout->addWidget(wid,ii++,0);
924 //topLayout->addWidget(todoDueTodayColor->button(),ii++,1); 935 //topLayout->addWidget(todoDueTodayColor->button(),ii++,1);
925 936
926 // Todo overdue color 937 // Todo overdue color
927 wid = new QWidget( topFrame ); 938 wid = new QWidget( topFrame );
928 widLayout = new QHBoxLayout(wid); 939 widLayout = new QHBoxLayout(wid);
929 KPrefsDialogWidColor *todoOverdueColor = 940 KPrefsDialogWidColor *todoOverdueColor =
930 addWidColor(i18n("Todo overdue color:"), 941 addWidColor(i18n("Todo overdue color:"),
931 &(KOPrefs::instance()->mTodoOverdueColor),wid); 942 &(KOPrefs::instance()->mTodoOverdueColor),wid);
932 widLayout->addWidget(todoOverdueColor->label()); 943 widLayout->addWidget(todoOverdueColor->label());
933 widLayout->addWidget(todoOverdueColor->button()); 944 widLayout->addWidget(todoOverdueColor->button());
934 topLayout->addWidget(wid,ii++,0); 945 topLayout->addWidget(wid,ii++,0);
935 946
936 dummy = 947 dummy =
937 addWidBool(i18n("Colors are applied to text"), 948 addWidBool(i18n("Colors are applied to text"),
938 &(KOPrefs::instance()->mTodoViewUsesForegroundColor),topFrame); 949 &(KOPrefs::instance()->mTodoViewUsesForegroundColor),topFrame);
939 topLayout->addWidget(dummy->checkBox(),ii++,0); 950 topLayout->addWidget(dummy->checkBox(),ii++,0);
940 951
941 dummy =
942 addWidBool(i18n("Allday Agenda view shows todos"),
943 &(KOPrefs::instance()->mShowTodoInAgenda),topFrame);
944 topLayout->addWidget(dummy->checkBox(),ii++,0);
945 952
946 953
947 topFrame = addPage(i18n("View Options"),0,0); 954 topFrame = addPage(i18n("View Options"),0,0);
948 955
949 topLayout = new QGridLayout(topFrame,4,1); 956 topLayout = new QGridLayout(topFrame,4,1);
950 topLayout->setSpacing(mSpacingHint); 957 topLayout->setSpacing(mSpacingHint);
951 topLayout->setMargin(mMarginHint); 958 topLayout->setMargin(mMarginHint);
952 ii = 0; 959 ii = 0;
953 960
954 dummy = 961 dummy =
955 addWidBool(i18n("Show Sync Events"), 962 addWidBool(i18n("Show Sync Events"),
956 &(KOPrefs::instance()->mShowSyncEvents),topFrame); 963 &(KOPrefs::instance()->mShowSyncEvents),topFrame);
957 topLayout->addWidget(dummy->checkBox(), ii++,0); 964 topLayout->addWidget(dummy->checkBox(), ii++,0);
958 965
959 lab = new QLabel( i18n("Show in todo/event viewer:"), topFrame); 966 lab = new QLabel( i18n("Show in todo/event viewer:"), topFrame);
960 topLayout->addWidget(lab ,ii++,0); 967 topLayout->addWidget(lab ,ii++,0);
961 968
962 dummy = addWidBool(i18n("Details"), 969 dummy = addWidBool(i18n("Details"),
963 &(KOPrefs::instance()->mEVshowDetails),topFrame); 970 &(KOPrefs::instance()->mEVshowDetails),topFrame);
964 topLayout->addWidget(dummy->checkBox(),ii++,0); 971 topLayout->addWidget(dummy->checkBox(),ii++,0);
965 dummy = addWidBool(i18n("Created time"), 972 dummy = addWidBool(i18n("Created time"),
966 &(KOPrefs::instance()->mEVshowCreated),topFrame); 973 &(KOPrefs::instance()->mEVshowCreated),topFrame);
967 topLayout->addWidget(dummy->checkBox(),ii++,0); 974 topLayout->addWidget(dummy->checkBox(),ii++,0);
968 dummy = addWidBool(i18n("Last modified time"), 975 dummy = addWidBool(i18n("Last modified time"),
969 &(KOPrefs::instance()->mEVshowChanged),topFrame); 976 &(KOPrefs::instance()->mEVshowChanged),topFrame);
970 topLayout->addWidget(dummy->checkBox(),ii++,0); 977 topLayout->addWidget(dummy->checkBox(),ii++,0);
971 978
972 979
973 lab = new QLabel( i18n("Show in What'sThis quick overview:"), topFrame); 980 lab = new QLabel( i18n("Show in What'sThis quick overview:"), topFrame);
974 topLayout->addWidget(lab ,ii++,0); 981 topLayout->addWidget(lab ,ii++,0);
975 982
976 dummy = addWidBool(i18n("Details"), 983 dummy = addWidBool(i18n("Details"),
977 &(KOPrefs::instance()->mWTshowDetails),topFrame); 984 &(KOPrefs::instance()->mWTshowDetails),topFrame);
978 topLayout->addWidget(dummy->checkBox(),ii++,0); 985 topLayout->addWidget(dummy->checkBox(),ii++,0);
979 dummy = addWidBool(i18n("Created time"), 986 dummy = addWidBool(i18n("Created time"),
980 &(KOPrefs::instance()->mWTshowCreated),topFrame); 987 &(KOPrefs::instance()->mWTshowCreated),topFrame);
981 topLayout->addWidget(dummy->checkBox(),ii++,0); 988 topLayout->addWidget(dummy->checkBox(),ii++,0);
982 dummy = addWidBool(i18n("Last modified time"), 989 dummy = addWidBool(i18n("Last modified time"),
983 &(KOPrefs::instance()->mWTshowChanged),topFrame); 990 &(KOPrefs::instance()->mWTshowChanged),topFrame);
984 topLayout->addWidget(dummy->checkBox(),ii++,0); 991 topLayout->addWidget(dummy->checkBox(),ii++,0);
985 992
986 993
987 topFrame = addPage(i18n("Alarm"),0,0); 994 topFrame = addPage(i18n("Alarm"),0,0);
988 // DesktopIcon("viewmag",KIcon::SizeMedium)); 995 // DesktopIcon("viewmag",KIcon::SizeMedium));
989 996
990 topLayout = new QGridLayout(topFrame,2,1); 997 topLayout = new QGridLayout(topFrame,2,1);
991 topLayout->setSpacing(mSpacingHint); 998 topLayout->setSpacing(mSpacingHint);
992 topLayout->setMargin(mMarginHint); 999 topLayout->setMargin(mMarginHint);
993 int iii = 0; 1000 int iii = 0;
994 1001
995 dummy = 1002 dummy =
996 addWidBool(i18n("Use internal alarm notification"), 1003 addWidBool(i18n("Use internal alarm notification"),
997 &(KOPrefs::instance()->mUseInternalAlarmNotification),topFrame); 1004 &(KOPrefs::instance()->mUseInternalAlarmNotification),topFrame);
998 topLayout->addWidget(dummy->checkBox(),iii++,0); 1005 topLayout->addWidget(dummy->checkBox(),iii++,0);
999 lab = new QLabel( i18n("Note: KO/Pi must be running to notify you about an alarm. Recommended for use on Zaurus: Disable this option and install KO/Pi alarm applet.\n"), topFrame); 1006 lab = new QLabel( i18n("Note: KO/Pi must be running to notify you about an alarm. Recommended for use on Zaurus: Disable this option and install KO/Pi alarm applet.\n"), topFrame);
1000 1007
1001 topLayout->addWidget(lab ,iii++,0); 1008 topLayout->addWidget(lab ,iii++,0);
1002#ifndef DESKTOP_VERSION 1009#ifndef DESKTOP_VERSION
1003 lab->setAlignment( AlignLeft|WordBreak|AlignTop); 1010 lab->setAlignment( AlignLeft|WordBreak|AlignTop);
1004#else 1011#else
1005 lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop); 1012 lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop);
1006 lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) ); 1013 lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) );
1007#endif 1014#endif
1008 1015
1009 QHBox* dummyBox = new QHBox(topFrame); 1016 QHBox* dummyBox = new QHBox(topFrame);
1010 new QLabel(i18n("Play beeps count:"),dummyBox); 1017 new QLabel(i18n("Play beeps count:"),dummyBox);
1011 mAlarmPlayBeeps = new QSpinBox(0,500,1,dummyBox); 1018 mAlarmPlayBeeps = new QSpinBox(0,500,1,dummyBox);
1012 topLayout->addWidget(dummyBox,iii++,0); 1019 topLayout->addWidget(dummyBox,iii++,0);
1013 1020
1014 dummyBox = new QHBox(topFrame); 1021 dummyBox = new QHBox(topFrame);
1015 new QLabel(i18n("Beeps interval in sec:"),dummyBox); 1022 new QLabel(i18n("Beeps interval in sec:"),dummyBox);
1016 mAlarmBeepInterval = new QSpinBox(1,600,1,dummyBox); 1023 mAlarmBeepInterval = new QSpinBox(1,600,1,dummyBox);
1017 topLayout->addWidget(dummyBox,iii++,0); 1024 topLayout->addWidget(dummyBox,iii++,0);
1018 1025
1019 dummyBox = new QHBox(topFrame); 1026 dummyBox = new QHBox(topFrame);
1020 new QLabel(i18n("Default suspend time in min:"),dummyBox); 1027 new QLabel(i18n("Default suspend time in min:"),dummyBox);
1021 mAlarmSuspendTime = new QSpinBox(1,600,1,dummyBox); 1028 mAlarmSuspendTime = new QSpinBox(1,600,1,dummyBox);
1022 topLayout->addWidget(dummyBox,iii++,0); 1029 topLayout->addWidget(dummyBox,iii++,0);
1023 1030
1024 dummyBox = new QHBox(topFrame); 1031 dummyBox = new QHBox(topFrame);
1025 new QLabel(i18n("Auto suspend count:"),dummyBox); 1032 new QLabel(i18n("Auto suspend count:"),dummyBox);
1026 mAlarmSuspendCount = new QSpinBox(0,60,1,dummyBox); 1033 mAlarmSuspendCount = new QSpinBox(0,60,1,dummyBox);
1027 topLayout->addWidget(dummyBox,iii++,0); 1034 topLayout->addWidget(dummyBox,iii++,0);
1028 1035
1029 1036
1030 1037
1031 QHBox* hbo = new QHBox ( topFrame ); 1038 QHBox* hbo = new QHBox ( topFrame );
1032 mDefaultAlarmFile = new QLineEdit(hbo); 1039 mDefaultAlarmFile = new QLineEdit(hbo);
1033 QPushButton * loadTemplate = new QPushButton(hbo); 1040 QPushButton * loadTemplate = new QPushButton(hbo);
1034 QPixmap icon; 1041 QPixmap icon;
1035 if ( QApplication::desktop()->width() < 321 ) 1042 if ( QApplication::desktop()->width() < 321 )
1036 icon = SmallIcon("fileimport16"); 1043 icon = SmallIcon("fileimport16");
1037 else 1044 else
1038 icon = SmallIcon("fileimport"); 1045 icon = SmallIcon("fileimport");
1039 loadTemplate->setIconSet (icon ) ; 1046 loadTemplate->setIconSet (icon ) ;
1040 connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( selectSoundFile() ) ); 1047 connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( selectSoundFile() ) );
1041 int size = loadTemplate->sizeHint().height(); 1048 int size = loadTemplate->sizeHint().height();
1042 loadTemplate->setFixedSize( size, size ); 1049 loadTemplate->setFixedSize( size, size );
1043 //lab = new QLabel( i18n("This setting is useless for 5500 user!"), topFrame); 1050 //lab = new QLabel( i18n("This setting is useless for 5500 user!"), topFrame);
1044 // topLayout->addWidget(lab ,iii++,0); 1051 // topLayout->addWidget(lab ,iii++,0);
1045 lab = new QLabel( i18n("Alarm *.wav file for newly created alarm:"), topFrame); 1052 lab = new QLabel( i18n("Alarm *.wav file for newly created alarm:"), topFrame);
1046 topLayout->addWidget(lab ,iii++,0); 1053 topLayout->addWidget(lab ,iii++,0);
1047 topLayout->addWidget(hbo,iii++,0); 1054 topLayout->addWidget(hbo,iii++,0);
1048 // lab = new QLabel( i18n("Note: This does not mean, that for every alarm this file is replayed. This file here is associated with a newly created alarm."), topFrame); 1055 // lab = new QLabel( i18n("Note: This does not mean, that for every alarm this file is replayed. This file here is associated with a newly created alarm."), topFrame);
1049 1056
1050// topLayout->addWidget(lab ,iii++,0); 1057// topLayout->addWidget(lab ,iii++,0);
1051// #ifndef DESKTOP_VERSION 1058// #ifndef DESKTOP_VERSION
1052// lab->setAlignment( AlignLeft|WordBreak|AlignTop); 1059// lab->setAlignment( AlignLeft|WordBreak|AlignTop);
1053// #else 1060// #else
1054// lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop); 1061// lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop);
1055// lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) ); 1062// lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) );
1056// #endif 1063// #endif
1057 1064
1058 1065
1059} 1066}
1060 1067
1061void KOPrefsDialog::selectSoundFile() 1068void KOPrefsDialog::selectSoundFile()
1062{ 1069{
1063 QString fileName = mDefaultAlarmFile->text(); 1070 QString fileName = mDefaultAlarmFile->text();
1064 fileName = KFileDialog::getSaveFileName( mDefaultAlarmFile->text() , "Choose default alarm file", this ); 1071 fileName = KFileDialog::getSaveFileName( mDefaultAlarmFile->text() , "Choose default alarm file", this );
1065 if ( fileName.length() > 0 ) 1072 if ( fileName.length() > 0 )
1066 mDefaultAlarmFile->setText( fileName ); 1073 mDefaultAlarmFile->setText( fileName );
1067} 1074}
1068void KOPrefsDialog::setupFontsTab() 1075void KOPrefsDialog::setupFontsTab()
1069{ 1076{
1070 1077
1071 QFrame *topFrame = addPage(i18n("Fonts"),0,0); 1078 QFrame *topFrame = addPage(i18n("Fonts"),0,0);
1072 // DesktopIcon("fonts",KIcon::SizeMedium)); 1079 // DesktopIcon("fonts",KIcon::SizeMedium));
1073 1080
1074 QGridLayout *topLayout = new QGridLayout(topFrame,7,3); 1081 QGridLayout *topLayout = new QGridLayout(topFrame,7,3);
1075 topLayout->setSpacing(1); 1082 topLayout->setSpacing(1);
1076 topLayout->setMargin(3); 1083 topLayout->setMargin(3);
1077 KPrefsDialogWidFont * tVFont; 1084 KPrefsDialogWidFont * tVFont;
1078 int i = 0; 1085 int i = 0;
1079 KPrefsDialogWidFont *timeLabelsFont = 1086 KPrefsDialogWidFont *timeLabelsFont =
1080 addWidFont(i18n("23"),i18n("DateNavigator:(nr)"), 1087 addWidFont(i18n("23"),i18n("DateNavigator:(nr)"),
1081 &(KOPrefs::instance()->mDateNavigatorFont),topFrame); 1088 &(KOPrefs::instance()->mDateNavigatorFont),topFrame);
1082 topLayout->addWidget(timeLabelsFont->label(),i,0); 1089 topLayout->addWidget(timeLabelsFont->label(),i,0);
1083 topLayout->addWidget(timeLabelsFont->preview(),i,1); 1090 topLayout->addWidget(timeLabelsFont->preview(),i,1);
1084 topLayout->addWidget(timeLabelsFont->button(),i,2); 1091 topLayout->addWidget(timeLabelsFont->button(),i,2);
1085 ++i; 1092 ++i;
1086 1093
1087 1094
1088 timeLabelsFont = 1095 timeLabelsFont =
1089 addWidFont(i18n("Mon 15"),i18n("Date Labels:"), 1096 addWidFont(i18n("Mon 15"),i18n("Date Labels:"),
1090 &(KOPrefs::instance()->mTimeLabelsFont),topFrame); 1097 &(KOPrefs::instance()->mTimeLabelsFont),topFrame);
1091 topLayout->addWidget(timeLabelsFont->label(),i,0); 1098 topLayout->addWidget(timeLabelsFont->label(),i,0);
1092 topLayout->addWidget(timeLabelsFont->preview(),i,1); 1099 topLayout->addWidget(timeLabelsFont->preview(),i,1);
1093 topLayout->addWidget(timeLabelsFont->button(),i,2); 1100 topLayout->addWidget(timeLabelsFont->button(),i,2);
1094 ++i; 1101 ++i;
1095 1102
1096 KPrefsDialogWidFont *timeBarFont = 1103 KPrefsDialogWidFont *timeBarFont =
1097 addWidFont(KGlobal::locale()->formatTime(QTime(12,34)),i18n("Time bar:"), 1104 addWidFont(KGlobal::locale()->formatTime(QTime(12,34)),i18n("Time bar:"),
1098 &(KOPrefs::instance()->mTimeBarFont),topFrame); 1105 &(KOPrefs::instance()->mTimeBarFont),topFrame);
1099 topLayout->addWidget(timeBarFont->label(),i,0); 1106 topLayout->addWidget(timeBarFont->label(),i,0);
1100 topLayout->addWidget(timeBarFont->preview(),i,1); 1107 topLayout->addWidget(timeBarFont->preview(),i,1);
1101 topLayout->addWidget(timeBarFont->button(),i,2); 1108 topLayout->addWidget(timeBarFont->button(),i,2);
1102 ++i; 1109 ++i;
1103 1110
1104 1111
1105 KPrefsDialogWidFont *marcusBainsFont = 1112 KPrefsDialogWidFont *marcusBainsFont =
1106 addWidFont(KGlobal::locale()->formatTime(QTime(12,34,23)),i18n("M. Bains line:"), 1113 addWidFont(KGlobal::locale()->formatTime(QTime(12,34,23)),i18n("M. Bains line:"),
1107 &(KOPrefs::instance()->mMarcusBainsFont),topFrame); 1114 &(KOPrefs::instance()->mMarcusBainsFont),topFrame);
1108 topLayout->addWidget(marcusBainsFont->label(),i,0); 1115 topLayout->addWidget(marcusBainsFont->label(),i,0);
1109 topLayout->addWidget(marcusBainsFont->preview(),i,1); 1116 topLayout->addWidget(marcusBainsFont->preview(),i,1);
1110 topLayout->addWidget(marcusBainsFont->button(),i,2); 1117 topLayout->addWidget(marcusBainsFont->button(),i,2);
1111 ++i; 1118 ++i;
1112 1119
1113 tVFont = 1120 tVFont =
1114 addWidFont(i18n("Summary"),i18n("Event Viewer:"), 1121 addWidFont(i18n("Summary"),i18n("Event Viewer:"),
1115 &(KOPrefs::instance()->mEventViewFont),topFrame); 1122 &(KOPrefs::instance()->mEventViewFont),topFrame);
1116 topLayout->addWidget(tVFont->label(),i,0); 1123 topLayout->addWidget(tVFont->label(),i,0);
1117 topLayout->addWidget(tVFont->preview(),i,1); 1124 topLayout->addWidget(tVFont->preview(),i,1);
1118 topLayout->addWidget(tVFont->button(),i,2); 1125 topLayout->addWidget(tVFont->button(),i,2);
1119 ++i; 1126 ++i;
1120 1127
1121 1128
1122 1129
1123 tVFont = 1130 tVFont =
1124 addWidFont(i18n("Details"),i18n("EditorBox:"), 1131 addWidFont(i18n("Details"),i18n("EditorBox:"),
1125 &(KOPrefs::instance()->mEditBoxFont),topFrame); 1132 &(KOPrefs::instance()->mEditBoxFont),topFrame);
1126 topLayout->addWidget(tVFont->label(),i,0); 1133 topLayout->addWidget(tVFont->label(),i,0);
1127 topLayout->addWidget(tVFont->preview(),i,1); 1134 topLayout->addWidget(tVFont->preview(),i,1);
1128 topLayout->addWidget(tVFont->button(),i,2); 1135 topLayout->addWidget(tVFont->button(),i,2);
1129 ++i; 1136 ++i;
1130 1137
1131 1138
1132 1139
1133 topLayout->setColStretch(1,1); 1140 topLayout->setColStretch(1,1);
1134 topLayout->setRowStretch(4,1); 1141 topLayout->setRowStretch(4,1);
1135 1142
1136 1143
1137 i = 0; 1144 i = 0;
1138 topFrame = addPage(i18n("View Fonts"),0, 1145 topFrame = addPage(i18n("View Fonts"),0,
1139 DesktopIcon("fonts",KIcon::SizeMedium)); 1146 DesktopIcon("fonts",KIcon::SizeMedium));
1140 1147
1141 topLayout = new QGridLayout(topFrame,7,3); 1148 topLayout = new QGridLayout(topFrame,7,3);
1142 topLayout->setSpacing(1); 1149 topLayout->setSpacing(1);
1143 topLayout->setMargin(3); 1150 topLayout->setMargin(3);
1144 1151
1145 tVFont = 1152 tVFont =
1146 addWidFont(i18n("Configure KO"),i18n("What's Next View:"), 1153 addWidFont(i18n("Configure KO"),i18n("What's Next View:"),
1147 &(KOPrefs::instance()->mWhatsNextFont),topFrame); 1154 &(KOPrefs::instance()->mWhatsNextFont),topFrame);
1148 topLayout->addWidget(tVFont->label(),i,0); 1155 topLayout->addWidget(tVFont->label(),i,0);
1149 topLayout->addWidget(tVFont->preview(),i,1); 1156 topLayout->addWidget(tVFont->preview(),i,1);
1150 topLayout->addWidget(tVFont->button(),i,2); 1157 topLayout->addWidget(tVFont->button(),i,2);
1151 ++i; 1158 ++i;
1152 KPrefsDialogWidFont *agendaViewFont = 1159 KPrefsDialogWidFont *agendaViewFont =
1153 addWidFont(i18n("Event text"),i18n("Agenda view:"), 1160 addWidFont(i18n("Event text"),i18n("Agenda view:"),
1154 &(KOPrefs::instance()->mAgendaViewFont),topFrame); 1161 &(KOPrefs::instance()->mAgendaViewFont),topFrame);
1155 topLayout->addWidget(agendaViewFont->label(),i,0); 1162 topLayout->addWidget(agendaViewFont->label(),i,0);
1156 topLayout->addWidget(agendaViewFont->preview(),i,1); 1163 topLayout->addWidget(agendaViewFont->preview(),i,1);
1157 topLayout->addWidget(agendaViewFont->button(),i,2); 1164 topLayout->addWidget(agendaViewFont->button(),i,2);
1158 ++i; 1165 ++i;
1159 1166
1160 1167
1161 KPrefsDialogWidFont *monthViewFont = 1168 KPrefsDialogWidFont *monthViewFont =
1162 addWidFont(KGlobal::locale()->formatTime(QTime(12,34)) + " " + i18n("Event"), 1169 addWidFont(KGlobal::locale()->formatTime(QTime(12,34)) + " " + i18n("Event"),
1163 i18n("Month view:"),&(KOPrefs::instance()->mMonthViewFont),topFrame); 1170 i18n("Month view:"),&(KOPrefs::instance()->mMonthViewFont),topFrame);
1164 topLayout->addWidget(monthViewFont->label(),i,0); 1171 topLayout->addWidget(monthViewFont->label(),i,0);
1165 topLayout->addWidget(monthViewFont->preview(),i,1); 1172 topLayout->addWidget(monthViewFont->preview(),i,1);
1166 topLayout->addWidget(monthViewFont->button(),i,2); 1173 topLayout->addWidget(monthViewFont->button(),i,2);
1167 ++i; 1174 ++i;
1168 1175
1169 1176
1170 KPrefsDialogWidFont *lVFont = 1177 KPrefsDialogWidFont *lVFont =
1171 addWidFont(i18n("Event"),i18n("List View:"), 1178 addWidFont(i18n("Event"),i18n("List View:"),
1172 &(KOPrefs::instance()->mListViewFont),topFrame); 1179 &(KOPrefs::instance()->mListViewFont),topFrame);
1173 topLayout->addWidget(lVFont->label(),i,0); 1180 topLayout->addWidget(lVFont->label(),i,0);
1174 topLayout->addWidget(lVFont->preview(),i,1); 1181 topLayout->addWidget(lVFont->preview(),i,1);
1175 topLayout->addWidget(lVFont->button(),i,2); 1182 topLayout->addWidget(lVFont->button(),i,2);
1176 ++i; 1183 ++i;
1177 1184
1178 1185
1179 tVFont = 1186 tVFont =
1180 addWidFont(i18n("ToDo"),i18n("ToDoView:"), 1187 addWidFont(i18n("ToDo"),i18n("ToDoView:"),
1181 &(KOPrefs::instance()->mTodoViewFont),topFrame); 1188 &(KOPrefs::instance()->mTodoViewFont),topFrame);
1182 topLayout->addWidget(tVFont->label(),i,0); 1189 topLayout->addWidget(tVFont->label(),i,0);
1183 topLayout->addWidget(tVFont->preview(),i,1); 1190 topLayout->addWidget(tVFont->preview(),i,1);
1184 topLayout->addWidget(tVFont->button(),i,2); 1191 topLayout->addWidget(tVFont->button(),i,2);
1185 ++i; 1192 ++i;
1186 1193
1187 1194
1188 tVFont = 1195 tVFont =
1189 addWidFont(i18n("Today"),i18n("JournalView:"), 1196 addWidFont(i18n("Today"),i18n("JournalView:"),
1190 &(KOPrefs::instance()->mJornalViewFont),topFrame); 1197 &(KOPrefs::instance()->mJornalViewFont),topFrame);
1191 topLayout->addWidget(tVFont->label(),i,0); 1198 topLayout->addWidget(tVFont->label(),i,0);
1192 topLayout->addWidget(tVFont->preview(),i,1); 1199 topLayout->addWidget(tVFont->preview(),i,1);
1193 topLayout->addWidget(tVFont->button(),i,2); 1200 topLayout->addWidget(tVFont->button(),i,2);
1194 ++i; 1201 ++i;
1195 1202
1196 1203
1197 1204
1198 1205
1199 topLayout->setColStretch(1,1); 1206 topLayout->setColStretch(1,1);
1200 topLayout->setRowStretch(4,1); 1207 topLayout->setRowStretch(4,1);