-rw-r--r-- | korganizer/calendarview.cpp | 8 | ||||
-rw-r--r-- | korganizer/korganizer.pro | 4 | ||||
-rw-r--r-- | korganizer/kotodoview.cpp | 61 | ||||
-rw-r--r-- | korganizer/kotodoview.h | 11 | ||||
-rw-r--r-- | libkcal/dndfactory.cpp | 186 | ||||
-rw-r--r-- | libkcal/dndfactory.h | 56 | ||||
-rw-r--r-- | libkcal/dndfactory_dummy.h | 62 | ||||
-rw-r--r-- | libkcal/libkcal.pro | 2 |
8 files changed, 332 insertions, 58 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 0c39590..74aefb7 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -1406,257 +1406,257 @@ bool CalendarView::importBday() | |||
1406 | if ( ! bar.isVisible() ) | 1406 | if ( ! bar.isVisible() ) |
1407 | return false; | 1407 | return false; |
1408 | bar.setProgress( count++ ); | 1408 | bar.setProgress( count++ ); |
1409 | qApp->processEvents(); | 1409 | qApp->processEvents(); |
1410 | //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() ); | 1410 | //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() ); |
1411 | if ( (*it).birthday().date().isValid() ){ | 1411 | if ( (*it).birthday().date().isValid() ){ |
1412 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; | 1412 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; |
1413 | if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) ) | 1413 | if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) ) |
1414 | ++addCount; | 1414 | ++addCount; |
1415 | } | 1415 | } |
1416 | QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); | 1416 | QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); |
1417 | if ( anni.isValid() ){ | 1417 | if ( anni.isValid() ){ |
1418 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; | 1418 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; |
1419 | if ( addAnniversary( anni, (*it).assembledName(), a, false ) ) | 1419 | if ( addAnniversary( anni, (*it).assembledName(), a, false ) ) |
1420 | ++addCount; | 1420 | ++addCount; |
1421 | } | 1421 | } |
1422 | } | 1422 | } |
1423 | updateView(); | 1423 | updateView(); |
1424 | topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); | 1424 | topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); |
1425 | #else //DESKTOP_VERSION | 1425 | #else //DESKTOP_VERSION |
1426 | 1426 | ||
1427 | ExternalAppHandler::instance()->requestBirthdayListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); | 1427 | ExternalAppHandler::instance()->requestBirthdayListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); |
1428 | // the result should now arrive through method insertBirthdays | 1428 | // the result should now arrive through method insertBirthdays |
1429 | 1429 | ||
1430 | #endif //DESKTOP_VERSION | 1430 | #endif //DESKTOP_VERSION |
1431 | 1431 | ||
1432 | #endif //KORG_NOKABC | 1432 | #endif //KORG_NOKABC |
1433 | 1433 | ||
1434 | 1434 | ||
1435 | return true; | 1435 | return true; |
1436 | } | 1436 | } |
1437 | 1437 | ||
1438 | // This method will be called from Ka/Pi as a response to requestBirthdayListFromKAPI | 1438 | // This method will be called from Ka/Pi as a response to requestBirthdayListFromKAPI |
1439 | void CalendarView::insertBirthdays(const QString& uid, const QStringList& birthdayList, | 1439 | void CalendarView::insertBirthdays(const QString& uid, const QStringList& birthdayList, |
1440 | const QStringList& anniversaryList, const QStringList& realNameList, | 1440 | const QStringList& anniversaryList, const QStringList& realNameList, |
1441 | const QStringList& emailList, const QStringList& assembledNameList, | 1441 | const QStringList& emailList, const QStringList& assembledNameList, |
1442 | const QStringList& uidList) | 1442 | const QStringList& uidList) |
1443 | { | 1443 | { |
1444 | //qDebug("KO::CalendarView::insertBirthdays"); | 1444 | //qDebug("KO::CalendarView::insertBirthdays"); |
1445 | if (uid == this->name()) | 1445 | if (uid == this->name()) |
1446 | { | 1446 | { |
1447 | int count = birthdayList.count(); | 1447 | int count = birthdayList.count(); |
1448 | int addCount = 0; | 1448 | int addCount = 0; |
1449 | KCal::Attendee* a = 0; | 1449 | KCal::Attendee* a = 0; |
1450 | 1450 | ||
1451 | //qDebug("CalView 1 %i", count); | 1451 | //qDebug("CalView 1 %i", count); |
1452 | 1452 | ||
1453 | QProgressBar bar(count,0 ); | 1453 | QProgressBar bar(count,0 ); |
1454 | int w = 300; | 1454 | int w = 300; |
1455 | if ( QApplication::desktop()->width() < 320 ) | 1455 | if ( QApplication::desktop()->width() < 320 ) |
1456 | w = 220; | 1456 | w = 220; |
1457 | int h = bar.sizeHint().height() ; | 1457 | int h = bar.sizeHint().height() ; |
1458 | int dw = QApplication::desktop()->width(); | 1458 | int dw = QApplication::desktop()->width(); |
1459 | int dh = QApplication::desktop()->height(); | 1459 | int dh = QApplication::desktop()->height(); |
1460 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 1460 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
1461 | bar.show(); | 1461 | bar.show(); |
1462 | bar.setCaption (i18n("inserting birthdays - close to abort!") ); | 1462 | bar.setCaption (i18n("inserting birthdays - close to abort!") ); |
1463 | qApp->processEvents(); | 1463 | qApp->processEvents(); |
1464 | 1464 | ||
1465 | QDate birthday; | 1465 | QDate birthday; |
1466 | QDate anniversary; | 1466 | QDate anniversary; |
1467 | QString realName; | 1467 | QString realName; |
1468 | QString email; | 1468 | QString email; |
1469 | QString assembledName; | 1469 | QString assembledName; |
1470 | QString uid; | 1470 | QString uid; |
1471 | bool ok = true; | 1471 | bool ok = true; |
1472 | for ( int i = 0; i < count; i++) | 1472 | for ( int i = 0; i < count; i++) |
1473 | { | 1473 | { |
1474 | if ( ! bar.isVisible() ) | 1474 | if ( ! bar.isVisible() ) |
1475 | return; | 1475 | return; |
1476 | bar.setProgress( i ); | 1476 | bar.setProgress( i ); |
1477 | qApp->processEvents(); | 1477 | qApp->processEvents(); |
1478 | 1478 | ||
1479 | birthday = KGlobal::locale()->readDate(birthdayList[i], KLocale::ISODate, &ok); | 1479 | birthday = KGlobal::locale()->readDate(birthdayList[i], KLocale::ISODate, &ok); |
1480 | if (!ok) { | 1480 | if (!ok) { |
1481 | ;//qDebug("CalendarView::insertBirthdays found invalid birthday: %s",birthdayList[i].latin1()); | 1481 | ;//qDebug("CalendarView::insertBirthdays found invalid birthday: %s",birthdayList[i].latin1()); |
1482 | } | 1482 | } |
1483 | 1483 | ||
1484 | anniversary = KGlobal::locale()->readDate(anniversaryList[i], KLocale::ISODate, &ok); | 1484 | anniversary = KGlobal::locale()->readDate(anniversaryList[i], KLocale::ISODate, &ok); |
1485 | if (!ok) { | 1485 | if (!ok) { |
1486 | ;//qDebug("CalendarView::insertBirthdays found invalid anniversary: %s",anniversaryList[i].latin1()); | 1486 | ;//qDebug("CalendarView::insertBirthdays found invalid anniversary: %s",anniversaryList[i].latin1()); |
1487 | } | 1487 | } |
1488 | realName = realNameList[i]; | 1488 | realName = realNameList[i]; |
1489 | email = emailList[i]; | 1489 | email = emailList[i]; |
1490 | assembledName = assembledNameList[i]; | 1490 | assembledName = assembledNameList[i]; |
1491 | uid = uidList[i]; | 1491 | uid = uidList[i]; |
1492 | //qDebug("insert birthday in KO/Pi: %s,%s,%s,%s: %s, %s", realName.latin1(), email.latin1(), assembledName.latin1(), uid.latin1(), birthdayList[i].latin1(), anniversaryList[i].latin1() ); | 1492 | //qDebug("insert birthday in KO/Pi: %s,%s,%s,%s: %s, %s", realName.latin1(), email.latin1(), assembledName.latin1(), uid.latin1(), birthdayList[i].latin1(), anniversaryList[i].latin1() ); |
1493 | 1493 | ||
1494 | if ( birthday.isValid() ){ | 1494 | if ( birthday.isValid() ){ |
1495 | a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, | 1495 | a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, |
1496 | KCal::Attendee::ReqParticipant,uid) ; | 1496 | KCal::Attendee::ReqParticipant,uid) ; |
1497 | if ( addAnniversary( birthday, assembledName, a, true ) ) | 1497 | if ( addAnniversary( birthday, assembledName, a, true ) ) |
1498 | ++addCount; | 1498 | ++addCount; |
1499 | } | 1499 | } |
1500 | 1500 | ||
1501 | if ( anniversary.isValid() ){ | 1501 | if ( anniversary.isValid() ){ |
1502 | a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, | 1502 | a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, |
1503 | KCal::Attendee::ReqParticipant,uid) ; | 1503 | KCal::Attendee::ReqParticipant,uid) ; |
1504 | if ( addAnniversary( anniversary, assembledName, a, false ) ) | 1504 | if ( addAnniversary( anniversary, assembledName, a, false ) ) |
1505 | ++addCount; | 1505 | ++addCount; |
1506 | } | 1506 | } |
1507 | } | 1507 | } |
1508 | 1508 | ||
1509 | updateView(); | 1509 | updateView(); |
1510 | topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); | 1510 | topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); |
1511 | 1511 | ||
1512 | } | 1512 | } |
1513 | 1513 | ||
1514 | } | 1514 | } |
1515 | 1515 | ||
1516 | 1516 | ||
1517 | 1517 | ||
1518 | bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday) | 1518 | bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday) |
1519 | { | 1519 | { |
1520 | //qDebug("addAnni "); | 1520 | //qDebug("addAnni "); |
1521 | Event * ev = new Event(); | 1521 | Event * ev = new Event(); |
1522 | if ( a ) { | 1522 | if ( a ) { |
1523 | ev->addAttendee( a ); | 1523 | ev->addAttendee( a ); |
1524 | } | 1524 | } |
1525 | QString kind; | 1525 | QString kind; |
1526 | if ( birthday ) { | 1526 | if ( birthday ) { |
1527 | kind = i18n( "Birthday" ); | 1527 | kind = i18n( "Birthday" ); |
1528 | ev->setSummary( name + " (" + QString::number(date.year()) +")"); | 1528 | ev->setSummary( name + " (" + QString::number(date.year()) +")"); |
1529 | } | 1529 | } |
1530 | else { | 1530 | else { |
1531 | kind = i18n( "Anniversary" ); | 1531 | kind = i18n( "Anniversary" ); |
1532 | ev->setSummary( name + " (" + QString::number(date.year()) +") " + kind ); | 1532 | ev->setSummary( name + " (" + QString::number(date.year()) +") " + kind ); |
1533 | } | 1533 | } |
1534 | ev->setOrganizer(a->email()); | 1534 | //ev->setOrganizer(a->email()); |
1535 | ev->setCategories( kind ); | 1535 | ev->setCategories( kind ); |
1536 | ev->setDtStart( QDateTime(date) ); | 1536 | ev->setDtStart( QDateTime(date) ); |
1537 | ev->setDtEnd( QDateTime(date) ); | 1537 | ev->setDtEnd( QDateTime(date) ); |
1538 | ev->setFloats( true ); | 1538 | ev->setFloats( true ); |
1539 | Recurrence * rec = ev->recurrence(); | 1539 | Recurrence * rec = ev->recurrence(); |
1540 | rec->setYearly(Recurrence::rYearlyMonth,1,-1); | 1540 | rec->setYearly(Recurrence::rYearlyMonth,1,-1); |
1541 | rec->addYearlyNum( date.month() ); | 1541 | rec->addYearlyNum( date.month() ); |
1542 | if ( !mCalendar->addAnniversaryNoDup( ev ) ) { | 1542 | if ( !mCalendar->addAnniversaryNoDup( ev ) ) { |
1543 | delete ev; | 1543 | delete ev; |
1544 | return false; | 1544 | return false; |
1545 | } | 1545 | } |
1546 | return true; | 1546 | return true; |
1547 | 1547 | ||
1548 | } | 1548 | } |
1549 | bool CalendarView::importQtopia( const QString &categories, | 1549 | bool CalendarView::importQtopia( const QString &categories, |
1550 | const QString &datebook, | 1550 | const QString &datebook, |
1551 | const QString &todolist ) | 1551 | const QString &todolist ) |
1552 | { | 1552 | { |
1553 | 1553 | ||
1554 | QtopiaFormat qtopiaFormat; | 1554 | QtopiaFormat qtopiaFormat; |
1555 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); | 1555 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); |
1556 | if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories ); | 1556 | if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories ); |
1557 | if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook ); | 1557 | if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook ); |
1558 | if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist ); | 1558 | if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist ); |
1559 | 1559 | ||
1560 | updateView(); | 1560 | updateView(); |
1561 | return true; | 1561 | return true; |
1562 | 1562 | ||
1563 | #if 0 | 1563 | #if 0 |
1564 | mGlobalSyncMode = SYNC_MODE_QTOPIA; | 1564 | mGlobalSyncMode = SYNC_MODE_QTOPIA; |
1565 | mCurrentSyncDevice = "qtopia-XML"; | 1565 | mCurrentSyncDevice = "qtopia-XML"; |
1566 | if ( mSyncManager->mAskForPreferences ) | 1566 | if ( mSyncManager->mAskForPreferences ) |
1567 | edit_sync_options(); | 1567 | edit_sync_options(); |
1568 | qApp->processEvents(); | 1568 | qApp->processEvents(); |
1569 | CalendarLocal* calendar = new CalendarLocal(); | 1569 | CalendarLocal* calendar = new CalendarLocal(); |
1570 | calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 1570 | calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
1571 | bool syncOK = false; | 1571 | bool syncOK = false; |
1572 | QtopiaFormat qtopiaFormat; | 1572 | QtopiaFormat qtopiaFormat; |
1573 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); | 1573 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); |
1574 | bool loadOk = true; | 1574 | bool loadOk = true; |
1575 | if ( !categories.isEmpty() ) | 1575 | if ( !categories.isEmpty() ) |
1576 | loadOk = qtopiaFormat.load( calendar, categories ); | 1576 | loadOk = qtopiaFormat.load( calendar, categories ); |
1577 | if ( loadOk && !datebook.isEmpty() ) | 1577 | if ( loadOk && !datebook.isEmpty() ) |
1578 | loadOk = qtopiaFormat.load( calendar, datebook ); | 1578 | loadOk = qtopiaFormat.load( calendar, datebook ); |
1579 | if ( loadOk && !todolist.isEmpty() ) | 1579 | if ( loadOk && !todolist.isEmpty() ) |
1580 | loadOk = qtopiaFormat.load( calendar, todolist ); | 1580 | loadOk = qtopiaFormat.load( calendar, todolist ); |
1581 | 1581 | ||
1582 | if ( loadOk ) { | 1582 | if ( loadOk ) { |
1583 | getEventViewerDialog()->setSyncMode( true ); | 1583 | getEventViewerDialog()->setSyncMode( true ); |
1584 | syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); | 1584 | syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); |
1585 | getEventViewerDialog()->setSyncMode( false ); | 1585 | getEventViewerDialog()->setSyncMode( false ); |
1586 | qApp->processEvents(); | 1586 | qApp->processEvents(); |
1587 | if ( syncOK ) { | 1587 | if ( syncOK ) { |
1588 | if ( mSyncManager->mWriteBackFile ) | 1588 | if ( mSyncManager->mWriteBackFile ) |
1589 | { | 1589 | { |
1590 | // write back XML file | 1590 | // write back XML file |
1591 | 1591 | ||
1592 | } | 1592 | } |
1593 | setModified( true ); | 1593 | setModified( true ); |
1594 | } | 1594 | } |
1595 | } else { | 1595 | } else { |
1596 | QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ; | 1596 | QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ; |
1597 | QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"), | 1597 | QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"), |
1598 | question, i18n("Ok")) ; | 1598 | question, i18n("Ok")) ; |
1599 | } | 1599 | } |
1600 | delete calendar; | 1600 | delete calendar; |
1601 | updateView(); | 1601 | updateView(); |
1602 | return syncOK; | 1602 | return syncOK; |
1603 | 1603 | ||
1604 | 1604 | ||
1605 | #endif | 1605 | #endif |
1606 | 1606 | ||
1607 | } | 1607 | } |
1608 | 1608 | ||
1609 | void CalendarView::setSyncEventsReadOnly() | 1609 | void CalendarView::setSyncEventsReadOnly() |
1610 | { | 1610 | { |
1611 | Event * ev; | 1611 | Event * ev; |
1612 | QPtrList<Event> eL = mCalendar->rawEvents(); | 1612 | QPtrList<Event> eL = mCalendar->rawEvents(); |
1613 | ev = eL.first(); | 1613 | ev = eL.first(); |
1614 | while ( ev ) { | 1614 | while ( ev ) { |
1615 | if ( ev->uid().left(15) == QString("last-syncEvent-") ) | 1615 | if ( ev->uid().left(15) == QString("last-syncEvent-") ) |
1616 | ev->setReadOnly( true ); | 1616 | ev->setReadOnly( true ); |
1617 | ev = eL.next(); | 1617 | ev = eL.next(); |
1618 | } | 1618 | } |
1619 | } | 1619 | } |
1620 | bool CalendarView::openCalendar(QString filename, bool merge) | 1620 | bool CalendarView::openCalendar(QString filename, bool merge) |
1621 | { | 1621 | { |
1622 | 1622 | ||
1623 | if (filename.isEmpty()) { | 1623 | if (filename.isEmpty()) { |
1624 | return false; | 1624 | return false; |
1625 | } | 1625 | } |
1626 | 1626 | ||
1627 | if (!QFile::exists(filename)) { | 1627 | if (!QFile::exists(filename)) { |
1628 | KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename)); | 1628 | KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename)); |
1629 | return false; | 1629 | return false; |
1630 | } | 1630 | } |
1631 | 1631 | ||
1632 | globalFlagBlockAgenda = 1; | 1632 | globalFlagBlockAgenda = 1; |
1633 | if (!merge) mCalendar->close(); | 1633 | if (!merge) mCalendar->close(); |
1634 | 1634 | ||
1635 | mStorage->setFileName( filename ); | 1635 | mStorage->setFileName( filename ); |
1636 | 1636 | ||
1637 | if ( mStorage->load() ) { | 1637 | if ( mStorage->load() ) { |
1638 | if ( merge ) ;//setModified( true ); | 1638 | if ( merge ) ;//setModified( true ); |
1639 | else { | 1639 | else { |
1640 | //setModified( true ); | 1640 | //setModified( true ); |
1641 | mViewManager->setDocumentId( filename ); | 1641 | mViewManager->setDocumentId( filename ); |
1642 | mDialogManager->setDocumentId( filename ); | 1642 | mDialogManager->setDocumentId( filename ); |
1643 | mTodoList->setDocumentId( filename ); | 1643 | mTodoList->setDocumentId( filename ); |
1644 | } | 1644 | } |
1645 | globalFlagBlockAgenda = 2; | 1645 | globalFlagBlockAgenda = 2; |
1646 | // if ( getLastSyncEvent() ) | 1646 | // if ( getLastSyncEvent() ) |
1647 | // getLastSyncEvent()->setReadOnly( true ); | 1647 | // getLastSyncEvent()->setReadOnly( true ); |
1648 | mCalendar->reInitAlarmSettings(); | 1648 | mCalendar->reInitAlarmSettings(); |
1649 | setSyncEventsReadOnly(); | 1649 | setSyncEventsReadOnly(); |
1650 | updateUnmanagedViews(); | 1650 | updateUnmanagedViews(); |
1651 | updateView(); | 1651 | updateView(); |
1652 | if ( filename != MainWindow::defaultFileName() ) { | 1652 | if ( filename != MainWindow::defaultFileName() ) { |
1653 | saveCalendar( MainWindow::defaultFileName() ); | 1653 | saveCalendar( MainWindow::defaultFileName() ); |
1654 | } else { | 1654 | } else { |
1655 | QFileInfo finf ( MainWindow::defaultFileName()); | 1655 | QFileInfo finf ( MainWindow::defaultFileName()); |
1656 | if ( finf.exists() ) { | 1656 | if ( finf.exists() ) { |
1657 | setLoadedFileVersion( finf.lastModified () ); | 1657 | setLoadedFileVersion( finf.lastModified () ); |
1658 | } | 1658 | } |
1659 | } | 1659 | } |
1660 | return true; | 1660 | return true; |
1661 | } else { | 1661 | } else { |
1662 | // while failing to load, the calendar object could | 1662 | // while failing to load, the calendar object could |
@@ -2089,286 +2089,286 @@ void CalendarView::updateConfig() | |||
2089 | //mViewManager->raiseCurrentView(); | 2089 | //mViewManager->raiseCurrentView(); |
2090 | } | 2090 | } |
2091 | 2091 | ||
2092 | 2092 | ||
2093 | void CalendarView::eventChanged(Event *event) | 2093 | void CalendarView::eventChanged(Event *event) |
2094 | { | 2094 | { |
2095 | changeEventDisplay(event,KOGlobals::EVENTEDITED); | 2095 | changeEventDisplay(event,KOGlobals::EVENTEDITED); |
2096 | //updateUnmanagedViews(); | 2096 | //updateUnmanagedViews(); |
2097 | } | 2097 | } |
2098 | 2098 | ||
2099 | void CalendarView::eventAdded(Event *event) | 2099 | void CalendarView::eventAdded(Event *event) |
2100 | { | 2100 | { |
2101 | changeEventDisplay(event,KOGlobals::EVENTADDED); | 2101 | changeEventDisplay(event,KOGlobals::EVENTADDED); |
2102 | } | 2102 | } |
2103 | 2103 | ||
2104 | void CalendarView::eventToBeDeleted(Event *) | 2104 | void CalendarView::eventToBeDeleted(Event *) |
2105 | { | 2105 | { |
2106 | kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; | 2106 | kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; |
2107 | } | 2107 | } |
2108 | 2108 | ||
2109 | void CalendarView::eventDeleted() | 2109 | void CalendarView::eventDeleted() |
2110 | { | 2110 | { |
2111 | changeEventDisplay(0,KOGlobals::EVENTDELETED); | 2111 | changeEventDisplay(0,KOGlobals::EVENTDELETED); |
2112 | } | 2112 | } |
2113 | void CalendarView::changeTodoDisplay(Todo *which, int action) | 2113 | void CalendarView::changeTodoDisplay(Todo *which, int action) |
2114 | { | 2114 | { |
2115 | changeIncidenceDisplay((Incidence *)which, action); | 2115 | changeIncidenceDisplay((Incidence *)which, action); |
2116 | mDateNavigator->updateView(); //LR | 2116 | mDateNavigator->updateView(); //LR |
2117 | //mDialogManager->updateSearchDialog(); | 2117 | //mDialogManager->updateSearchDialog(); |
2118 | 2118 | ||
2119 | if (which) { | 2119 | if (which) { |
2120 | mViewManager->updateWNview(); | 2120 | mViewManager->updateWNview(); |
2121 | //mTodoList->updateView(); | 2121 | //mTodoList->updateView(); |
2122 | } | 2122 | } |
2123 | 2123 | ||
2124 | } | 2124 | } |
2125 | 2125 | ||
2126 | void CalendarView::changeIncidenceDisplay(Incidence *which, int action) | 2126 | void CalendarView::changeIncidenceDisplay(Incidence *which, int action) |
2127 | { | 2127 | { |
2128 | updateUnmanagedViews(); | 2128 | updateUnmanagedViews(); |
2129 | //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); | 2129 | //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); |
2130 | if ( action == KOGlobals::EVENTDELETED ) { //delete | 2130 | if ( action == KOGlobals::EVENTDELETED ) { //delete |
2131 | mCalendar->checkAlarmForIncidence( 0, true ); | 2131 | mCalendar->checkAlarmForIncidence( 0, true ); |
2132 | if ( mEventViewerDialog ) | 2132 | if ( mEventViewerDialog ) |
2133 | mEventViewerDialog->hide(); | 2133 | mEventViewerDialog->hide(); |
2134 | } | 2134 | } |
2135 | else | 2135 | else |
2136 | mCalendar->checkAlarmForIncidence( which , false ); | 2136 | mCalendar->checkAlarmForIncidence( which , false ); |
2137 | } | 2137 | } |
2138 | 2138 | ||
2139 | // most of the changeEventDisplays() right now just call the view's | 2139 | // most of the changeEventDisplays() right now just call the view's |
2140 | // total update mode, but they SHOULD be recoded to be more refresh-efficient. | 2140 | // total update mode, but they SHOULD be recoded to be more refresh-efficient. |
2141 | void CalendarView::changeEventDisplay(Event *which, int action) | 2141 | void CalendarView::changeEventDisplay(Event *which, int action) |
2142 | { | 2142 | { |
2143 | // kdDebug() << "CalendarView::changeEventDisplay" << endl; | 2143 | // kdDebug() << "CalendarView::changeEventDisplay" << endl; |
2144 | changeIncidenceDisplay((Incidence *)which, action); | 2144 | changeIncidenceDisplay((Incidence *)which, action); |
2145 | mDateNavigator->updateView(); | 2145 | mDateNavigator->updateView(); |
2146 | //mDialogManager->updateSearchDialog(); | 2146 | //mDialogManager->updateSearchDialog(); |
2147 | 2147 | ||
2148 | if (which) { | 2148 | if (which) { |
2149 | // If there is an event view visible update the display | 2149 | // If there is an event view visible update the display |
2150 | mViewManager->currentView()->changeEventDisplay(which,action); | 2150 | mViewManager->currentView()->changeEventDisplay(which,action); |
2151 | // TODO: check, if update needed | 2151 | // TODO: check, if update needed |
2152 | // if (which->getTodoStatus()) { | 2152 | // if (which->getTodoStatus()) { |
2153 | mTodoList->updateView(); | 2153 | mTodoList->updateView(); |
2154 | // } | 2154 | // } |
2155 | } else { | 2155 | } else { |
2156 | mViewManager->currentView()->updateView(); | 2156 | mViewManager->currentView()->updateView(); |
2157 | } | 2157 | } |
2158 | } | 2158 | } |
2159 | 2159 | ||
2160 | 2160 | ||
2161 | void CalendarView::updateTodoViews() | 2161 | void CalendarView::updateTodoViews() |
2162 | { | 2162 | { |
2163 | 2163 | ||
2164 | mTodoList->updateView(); | 2164 | mTodoList->updateView(); |
2165 | mViewManager->currentView()->updateView(); | 2165 | mViewManager->currentView()->updateView(); |
2166 | 2166 | ||
2167 | } | 2167 | } |
2168 | 2168 | ||
2169 | 2169 | ||
2170 | void CalendarView::updateView(const QDate &start, const QDate &end) | 2170 | void CalendarView::updateView(const QDate &start, const QDate &end) |
2171 | { | 2171 | { |
2172 | mTodoList->updateView(); | 2172 | mTodoList->updateView(); |
2173 | mViewManager->updateView(start, end); | 2173 | mViewManager->updateView(start, end); |
2174 | //mDateNavigator->updateView(); | 2174 | //mDateNavigator->updateView(); |
2175 | } | 2175 | } |
2176 | 2176 | ||
2177 | void CalendarView::updateView() | 2177 | void CalendarView::updateView() |
2178 | { | 2178 | { |
2179 | DateList tmpList = mNavigator->selectedDates(); | 2179 | DateList tmpList = mNavigator->selectedDates(); |
2180 | 2180 | ||
2181 | if ( KOPrefs::instance()->mHideNonStartedTodos ) | 2181 | if ( KOPrefs::instance()->mHideNonStartedTodos ) |
2182 | mTodoList->updateView(); | 2182 | mTodoList->updateView(); |
2183 | // We assume that the navigator only selects consecutive days. | 2183 | // We assume that the navigator only selects consecutive days. |
2184 | updateView( tmpList.first(), tmpList.last() ); | 2184 | updateView( tmpList.first(), tmpList.last() ); |
2185 | } | 2185 | } |
2186 | 2186 | ||
2187 | void CalendarView::updateUnmanagedViews() | 2187 | void CalendarView::updateUnmanagedViews() |
2188 | { | 2188 | { |
2189 | mDateNavigator->updateDayMatrix(); | 2189 | mDateNavigator->updateDayMatrix(); |
2190 | } | 2190 | } |
2191 | 2191 | ||
2192 | int CalendarView::msgItemDelete(const QString name) | 2192 | int CalendarView::msgItemDelete(const QString name) |
2193 | { | 2193 | { |
2194 | return KMessageBox::warningContinueCancel(this,name +"\n\n"+ | 2194 | return KMessageBox::warningContinueCancel(this,name +"\n\n"+ |
2195 | i18n("This item will be\npermanently deleted."), | 2195 | i18n("This item will be\npermanently deleted."), |
2196 | i18n("KO/Pi Confirmation"),i18n("Delete")); | 2196 | i18n("KO/Pi Confirmation"),i18n("Delete")); |
2197 | } | 2197 | } |
2198 | 2198 | ||
2199 | 2199 | ||
2200 | void CalendarView::edit_cut() | 2200 | void CalendarView::edit_cut() |
2201 | { | 2201 | { |
2202 | Event *anEvent=0; | 2202 | Event *anEvent=0; |
2203 | 2203 | ||
2204 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2204 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2205 | 2205 | ||
2206 | if (mViewManager->currentView()->isEventView()) { | 2206 | if (mViewManager->currentView()->isEventView()) { |
2207 | if ( incidence && incidence->type() == "Event" ) { | 2207 | if ( incidence && incidence->type() == "Event" ) { |
2208 | anEvent = static_cast<Event *>(incidence); | 2208 | anEvent = static_cast<Event *>(incidence); |
2209 | } | 2209 | } |
2210 | } | 2210 | } |
2211 | 2211 | ||
2212 | if (!anEvent) { | 2212 | if (!anEvent) { |
2213 | KNotifyClient::beep(); | 2213 | KNotifyClient::beep(); |
2214 | return; | 2214 | return; |
2215 | } | 2215 | } |
2216 | DndFactory factory( mCalendar ); | 2216 | DndFactory factory( mCalendar ); |
2217 | factory.cutEvent(anEvent); | 2217 | factory.cutIncidence(anEvent); |
2218 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); | 2218 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); |
2219 | } | 2219 | } |
2220 | 2220 | ||
2221 | void CalendarView::edit_copy() | 2221 | void CalendarView::edit_copy() |
2222 | { | 2222 | { |
2223 | Event *anEvent=0; | 2223 | Event *anEvent=0; |
2224 | 2224 | ||
2225 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2225 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2226 | 2226 | ||
2227 | if (mViewManager->currentView()->isEventView()) { | 2227 | if (mViewManager->currentView()->isEventView()) { |
2228 | if ( incidence && incidence->type() == "Event" ) { | 2228 | if ( incidence && incidence->type() == "Event" ) { |
2229 | anEvent = static_cast<Event *>(incidence); | 2229 | anEvent = static_cast<Event *>(incidence); |
2230 | } | 2230 | } |
2231 | } | 2231 | } |
2232 | 2232 | ||
2233 | if (!anEvent) { | 2233 | if (!anEvent) { |
2234 | KNotifyClient::beep(); | 2234 | KNotifyClient::beep(); |
2235 | return; | 2235 | return; |
2236 | } | 2236 | } |
2237 | DndFactory factory( mCalendar ); | 2237 | DndFactory factory( mCalendar ); |
2238 | factory.copyEvent(anEvent); | 2238 | factory.copyIncidence(anEvent); |
2239 | } | 2239 | } |
2240 | 2240 | ||
2241 | void CalendarView::edit_paste() | 2241 | void CalendarView::edit_paste() |
2242 | { | 2242 | { |
2243 | QDate date = mNavigator->selectedDates().first(); | 2243 | QDate date = mNavigator->selectedDates().first(); |
2244 | 2244 | ||
2245 | DndFactory factory( mCalendar ); | 2245 | DndFactory factory( mCalendar ); |
2246 | Event *pastedEvent = factory.pasteEvent( date ); | 2246 | Event *pastedEvent = (Event *)factory.pasteIncidence( date ); |
2247 | 2247 | ||
2248 | changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); | 2248 | changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); |
2249 | } | 2249 | } |
2250 | 2250 | ||
2251 | void CalendarView::edit_options() | 2251 | void CalendarView::edit_options() |
2252 | { | 2252 | { |
2253 | mDialogManager->showOptionsDialog(); | 2253 | mDialogManager->showOptionsDialog(); |
2254 | //writeSettings(); | 2254 | //writeSettings(); |
2255 | } | 2255 | } |
2256 | 2256 | ||
2257 | 2257 | ||
2258 | void CalendarView::slotSelectPickerDate( QDate d) | 2258 | void CalendarView::slotSelectPickerDate( QDate d) |
2259 | { | 2259 | { |
2260 | mDateFrame->hide(); | 2260 | mDateFrame->hide(); |
2261 | if ( mDatePickerMode == 1 ) { | 2261 | if ( mDatePickerMode == 1 ) { |
2262 | mNavigator->slotDaySelect( d ); | 2262 | mNavigator->slotDaySelect( d ); |
2263 | } else if ( mDatePickerMode == 2 ) { | 2263 | } else if ( mDatePickerMode == 2 ) { |
2264 | if ( mMoveIncidence->type() == "Todo" ) { | 2264 | if ( mMoveIncidence->type() == "Todo" ) { |
2265 | Todo * to = (Todo *) mMoveIncidence; | 2265 | Todo * to = (Todo *) mMoveIncidence; |
2266 | QTime tim; | 2266 | QTime tim; |
2267 | if ( to->hasDueDate() ) | 2267 | if ( to->hasDueDate() ) |
2268 | tim = to->dtDue().time(); | 2268 | tim = to->dtDue().time(); |
2269 | else { | 2269 | else { |
2270 | tim = QTime ( 0,0,0 ); | 2270 | tim = QTime ( 0,0,0 ); |
2271 | to->setFloats( true ); | 2271 | to->setFloats( true ); |
2272 | to->setHasDueDate( true ); | 2272 | to->setHasDueDate( true ); |
2273 | } | 2273 | } |
2274 | QDateTime dt ( d,tim ); | 2274 | QDateTime dt ( d,tim ); |
2275 | to->setDtDue( dt ); | 2275 | to->setDtDue( dt ); |
2276 | todoChanged( to ); | 2276 | todoChanged( to ); |
2277 | } else { | 2277 | } else { |
2278 | if ( mMoveIncidence->doesRecur() ) { | 2278 | if ( mMoveIncidence->doesRecur() ) { |
2279 | #if 0 | 2279 | #if 0 |
2280 | // PENDING implement this | 2280 | // PENDING implement this |
2281 | Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate ); | 2281 | Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate ); |
2282 | mCalendar()->addIncidence( newInc ); | 2282 | mCalendar()->addIncidence( newInc ); |
2283 | if ( mMoveIncidence->type() == "Todo" ) | 2283 | if ( mMoveIncidence->type() == "Todo" ) |
2284 | emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED ); | 2284 | emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED ); |
2285 | else | 2285 | else |
2286 | emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED); | 2286 | emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED); |
2287 | mMoveIncidence = newInc; | 2287 | mMoveIncidence = newInc; |
2288 | 2288 | ||
2289 | #endif | 2289 | #endif |
2290 | } | 2290 | } |
2291 | QTime tim = mMoveIncidence->dtStart().time(); | 2291 | QTime tim = mMoveIncidence->dtStart().time(); |
2292 | int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd()); | 2292 | int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd()); |
2293 | QDateTime dt ( d,tim ); | 2293 | QDateTime dt ( d,tim ); |
2294 | mMoveIncidence->setDtStart( dt ); | 2294 | mMoveIncidence->setDtStart( dt ); |
2295 | ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) ); | 2295 | ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) ); |
2296 | changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED); | 2296 | changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED); |
2297 | } | 2297 | } |
2298 | 2298 | ||
2299 | mMoveIncidence->setRevision( mMoveIncidence->revision()+1 ); | 2299 | mMoveIncidence->setRevision( mMoveIncidence->revision()+1 ); |
2300 | } | 2300 | } |
2301 | } | 2301 | } |
2302 | 2302 | ||
2303 | void CalendarView::removeCategories() | 2303 | void CalendarView::removeCategories() |
2304 | { | 2304 | { |
2305 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); | 2305 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); |
2306 | QStringList catList = KOPrefs::instance()->mCustomCategories; | 2306 | QStringList catList = KOPrefs::instance()->mCustomCategories; |
2307 | QStringList catIncList; | 2307 | QStringList catIncList; |
2308 | QStringList newCatList; | 2308 | QStringList newCatList; |
2309 | Incidence* inc = incList.first(); | 2309 | Incidence* inc = incList.first(); |
2310 | int i; | 2310 | int i; |
2311 | int count = 0; | 2311 | int count = 0; |
2312 | while ( inc ) { | 2312 | while ( inc ) { |
2313 | newCatList.clear(); | 2313 | newCatList.clear(); |
2314 | catIncList = inc->categories() ; | 2314 | catIncList = inc->categories() ; |
2315 | for( i = 0; i< catIncList.count(); ++i ) { | 2315 | for( i = 0; i< catIncList.count(); ++i ) { |
2316 | if ( catList.contains (catIncList[i])) | 2316 | if ( catList.contains (catIncList[i])) |
2317 | newCatList.append( catIncList[i] ); | 2317 | newCatList.append( catIncList[i] ); |
2318 | } | 2318 | } |
2319 | newCatList.sort(); | 2319 | newCatList.sort(); |
2320 | inc->setCategories( newCatList.join(",") ); | 2320 | inc->setCategories( newCatList.join(",") ); |
2321 | inc = incList.next(); | 2321 | inc = incList.next(); |
2322 | } | 2322 | } |
2323 | } | 2323 | } |
2324 | 2324 | ||
2325 | int CalendarView::addCategories() | 2325 | int CalendarView::addCategories() |
2326 | { | 2326 | { |
2327 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); | 2327 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); |
2328 | QStringList catList = KOPrefs::instance()->mCustomCategories; | 2328 | QStringList catList = KOPrefs::instance()->mCustomCategories; |
2329 | QStringList catIncList; | 2329 | QStringList catIncList; |
2330 | Incidence* inc = incList.first(); | 2330 | Incidence* inc = incList.first(); |
2331 | int i; | 2331 | int i; |
2332 | int count = 0; | 2332 | int count = 0; |
2333 | while ( inc ) { | 2333 | while ( inc ) { |
2334 | catIncList = inc->categories() ; | 2334 | catIncList = inc->categories() ; |
2335 | for( i = 0; i< catIncList.count(); ++i ) { | 2335 | for( i = 0; i< catIncList.count(); ++i ) { |
2336 | if ( !catList.contains (catIncList[i])) { | 2336 | if ( !catList.contains (catIncList[i])) { |
2337 | catList.append( catIncList[i] ); | 2337 | catList.append( catIncList[i] ); |
2338 | //qDebug("add cat %s ", catIncList[i].latin1()); | 2338 | //qDebug("add cat %s ", catIncList[i].latin1()); |
2339 | ++count; | 2339 | ++count; |
2340 | } | 2340 | } |
2341 | } | 2341 | } |
2342 | inc = incList.next(); | 2342 | inc = incList.next(); |
2343 | } | 2343 | } |
2344 | catList.sort(); | 2344 | catList.sort(); |
2345 | KOPrefs::instance()->mCustomCategories = catList; | 2345 | KOPrefs::instance()->mCustomCategories = catList; |
2346 | return count; | 2346 | return count; |
2347 | } | 2347 | } |
2348 | 2348 | ||
2349 | void CalendarView::manageCategories() | 2349 | void CalendarView::manageCategories() |
2350 | { | 2350 | { |
2351 | KOCatPrefs* cp = new KOCatPrefs(); | 2351 | KOCatPrefs* cp = new KOCatPrefs(); |
2352 | cp->show(); | 2352 | cp->show(); |
2353 | int w =cp->sizeHint().width() ; | 2353 | int w =cp->sizeHint().width() ; |
2354 | int h = cp->sizeHint().height() ; | 2354 | int h = cp->sizeHint().height() ; |
2355 | int dw = QApplication::desktop()->width(); | 2355 | int dw = QApplication::desktop()->width(); |
2356 | int dh = QApplication::desktop()->height(); | 2356 | int dh = QApplication::desktop()->height(); |
2357 | cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 2357 | cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
2358 | if ( !cp->exec() ) { | 2358 | if ( !cp->exec() ) { |
2359 | delete cp; | 2359 | delete cp; |
2360 | return; | 2360 | return; |
2361 | } | 2361 | } |
2362 | int count = 0; | 2362 | int count = 0; |
2363 | if ( cp->addCat() ) { | 2363 | if ( cp->addCat() ) { |
2364 | count = addCategories(); | 2364 | count = addCategories(); |
2365 | if ( count ) { | 2365 | if ( count ) { |
2366 | topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! ")); | 2366 | topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! ")); |
2367 | writeSettings(); | 2367 | writeSettings(); |
2368 | } else | 2368 | } else |
2369 | topLevelWidget()->setCaption(QString::number( 0 )+ i18n(" Categories added to list! ")); | 2369 | topLevelWidget()->setCaption(QString::number( 0 )+ i18n(" Categories added to list! ")); |
2370 | } else { | 2370 | } else { |
2371 | removeCategories(); | 2371 | removeCategories(); |
2372 | updateView(); | 2372 | updateView(); |
2373 | } | 2373 | } |
2374 | delete cp; | 2374 | delete cp; |
diff --git a/korganizer/korganizer.pro b/korganizer/korganizer.pro index 4d67dca..3c7a1fb 100644 --- a/korganizer/korganizer.pro +++ b/korganizer/korganizer.pro | |||
@@ -1,142 +1,142 @@ | |||
1 | TEMPLATE= app | 1 | TEMPLATE= app |
2 | CONFIG += qt warn_off | 2 | CONFIG += qt warn_off |
3 | TARGET = kopi | 3 | TARGET = kopi |
4 | OBJECTS_DIR = _obj/ | 4 | OBJECTS_DIR = _obj/ |
5 | MOC_DIR = _moc | 5 | MOC_DIR = _moc |
6 | DESTDIR= ../bin | 6 | DESTDIR= ../bin |
7 | 7 | ||
8 | include( ../variables.pri ) | 8 | include( ../variables.pri ) |
9 | 9 | ||
10 | INCLUDEPATH += ../microkde ../ interfaces ../microkde/kdecore ../microkde/kdeui ../microkde/kio/kfile ../microkde/kio/kio ../libkdepim | 10 | INCLUDEPATH += ../microkde ../ interfaces ../microkde/kdecore ../microkde/kdeui ../microkde/kio/kfile ../microkde/kio/kio ../libkdepim |
11 | #../qtcompat | 11 | #../qtcompat |
12 | DEFINES += KORG_NODND KORG_NOPLUGINS KORG_NOARCHIVE KORG_NOMAIL | 12 | DEFINES += KORG_NOPLUGINS KORG_NOARCHIVE KORG_NOMAIL |
13 | DEFINES += KORG_NODCOP KORG_NOKALARMD KORG_NORESOURCEVIEW KORG_NOSPLITTER | 13 | DEFINES += KORG_NODCOP KORG_NOKALARMD KORG_NORESOURCEVIEW KORG_NOSPLITTER |
14 | #KORG_NOPRINTER KORG_NOKABC | 14 | #KORG_NOPRINTER KORG_NOKABC KORG_NODND |
15 | DEFINES += KORG_NOLVALTERNATION | 15 | DEFINES += KORG_NOLVALTERNATION |
16 | DEFINES += DESKTOP_VERSION | 16 | DEFINES += DESKTOP_VERSION |
17 | unix : { | 17 | unix : { |
18 | LIBS += ../bin/libmicrokdepim.so | 18 | LIBS += ../bin/libmicrokdepim.so |
19 | LIBS += ../bin/libmicrokcal.so | 19 | LIBS += ../bin/libmicrokcal.so |
20 | LIBS += ../bin/libmicrokde.so | 20 | LIBS += ../bin/libmicrokde.so |
21 | LIBS += ../bin/libmicrokabc.so | 21 | LIBS += ../bin/libmicrokabc.so |
22 | #LIBS += -lbluetooth | 22 | #LIBS += -lbluetooth |
23 | #LIBS += -lsdp | 23 | #LIBS += -lsdp |
24 | 24 | ||
25 | #LIBS += -lldap | 25 | #LIBS += -lldap |
26 | OBJECTS_DIR = obj/unix | 26 | OBJECTS_DIR = obj/unix |
27 | MOC_DIR = moc/unix | 27 | MOC_DIR = moc/unix |
28 | } | 28 | } |
29 | win32: { | 29 | win32: { |
30 | RC_FILE = winicons.rc | 30 | RC_FILE = winicons.rc |
31 | DEFINES += _WIN32_ | 31 | DEFINES += _WIN32_ |
32 | LIBS += ../bin/microkdepim.lib | 32 | LIBS += ../bin/microkdepim.lib |
33 | LIBS += ../bin/microkcal.lib | 33 | LIBS += ../bin/microkcal.lib |
34 | LIBS += ../bin/microkde.lib | 34 | LIBS += ../bin/microkde.lib |
35 | LIBS += ../bin/microkabc.lib | 35 | LIBS += ../bin/microkabc.lib |
36 | LIBS += ../libical/lib/ical.lib | 36 | LIBS += ../libical/lib/ical.lib |
37 | LIBS += ../libical/lib/icalss.lib | 37 | LIBS += ../libical/lib/icalss.lib |
38 | #LIBS += atls.lib | 38 | #LIBS += atls.lib |
39 | QMAKE_LINK += /NODEFAULTLIB:LIBC | 39 | QMAKE_LINK += /NODEFAULTLIB:LIBC |
40 | #QMAKE_LINK += /NODEFAULTLIB:MSVCRT | 40 | #QMAKE_LINK += /NODEFAULTLIB:MSVCRT |
41 | #QMAKE_LINK += /NODEFAULTLIB:uafxcw.lib | 41 | #QMAKE_LINK += /NODEFAULTLIB:uafxcw.lib |
42 | OBJECTS_DIR = obj/win | 42 | OBJECTS_DIR = obj/win |
43 | MOC_DIR = moc/win | 43 | MOC_DIR = moc/win |
44 | #olimport section | 44 | #olimport section |
45 | #blabla: { | 45 | #blabla: { |
46 | LIBS += mfc71u.lib | 46 | LIBS += mfc71u.lib |
47 | DEFINES += _OL_IMPORT_ | 47 | DEFINES += _OL_IMPORT_ |
48 | 48 | ||
49 | HEADERS += ../outport/msoutl9.h \ | 49 | HEADERS += ../outport/msoutl9.h \ |
50 | koimportoldialog.h | 50 | koimportoldialog.h |
51 | SOURCES += ../outport/msoutl9.cpp \ | 51 | SOURCES += ../outport/msoutl9.cpp \ |
52 | koimportoldialog.cpp | 52 | koimportoldialog.cpp |
53 | #} | 53 | #} |
54 | #olimport section end | 54 | #olimport section end |
55 | 55 | ||
56 | } | 56 | } |
57 | 57 | ||
58 | 58 | ||
59 | INTERFACES = kofilterview_base.ui | 59 | INTERFACES = kofilterview_base.ui |
60 | #filteredit_base.ui | 60 | #filteredit_base.ui |
61 | 61 | ||
62 | # kdateedit.h \ | 62 | # kdateedit.h \ |
63 | 63 | ||
64 | HEADERS += \ | 64 | HEADERS += \ |
65 | filteredit_base.h \ | 65 | filteredit_base.h \ |
66 | alarmclient.h \ | 66 | alarmclient.h \ |
67 | calendarview.h \ | 67 | calendarview.h \ |
68 | customlistviewitem.h \ | 68 | customlistviewitem.h \ |
69 | datenavigator.h \ | 69 | datenavigator.h \ |
70 | docprefs.h \ | 70 | docprefs.h \ |
71 | filtereditdialog.h \ | 71 | filtereditdialog.h \ |
72 | incomingdialog.h \ | 72 | incomingdialog.h \ |
73 | incomingdialog_base.h \ | 73 | incomingdialog_base.h \ |
74 | interfaces/korganizer/baseview.h \ | 74 | interfaces/korganizer/baseview.h \ |
75 | interfaces/korganizer/calendarviewbase.h \ | 75 | interfaces/korganizer/calendarviewbase.h \ |
76 | journalentry.h \ | 76 | journalentry.h \ |
77 | kdatenavigator.h \ | 77 | kdatenavigator.h \ |
78 | koagenda.h \ | 78 | koagenda.h \ |
79 | koagendaitem.h \ | 79 | koagendaitem.h \ |
80 | koagendaview.h \ | 80 | koagendaview.h \ |
81 | kocounterdialog.h \ | 81 | kocounterdialog.h \ |
82 | kodaymatrix.h \ | 82 | kodaymatrix.h \ |
83 | kodialogmanager.h \ | 83 | kodialogmanager.h \ |
84 | koeditordetails.h \ | 84 | koeditordetails.h \ |
85 | koeditorgeneral.h \ | 85 | koeditorgeneral.h \ |
86 | koeditorgeneralevent.h \ | 86 | koeditorgeneralevent.h \ |
87 | koeditorgeneraltodo.h \ | 87 | koeditorgeneraltodo.h \ |
88 | koeditorrecurrence.h \ | 88 | koeditorrecurrence.h \ |
89 | koeventeditor.h \ | 89 | koeventeditor.h \ |
90 | koeventpopupmenu.h \ | 90 | koeventpopupmenu.h \ |
91 | koeventview.h \ | 91 | koeventview.h \ |
92 | koeventviewer.h \ | 92 | koeventviewer.h \ |
93 | koeventviewerdialog.h \ | 93 | koeventviewerdialog.h \ |
94 | kofilterview.h \ | 94 | kofilterview.h \ |
95 | koglobals.h \ | 95 | koglobals.h \ |
96 | koincidenceeditor.h \ | 96 | koincidenceeditor.h \ |
97 | kojournalview.h \ | 97 | kojournalview.h \ |
98 | kolistview.h \ | 98 | kolistview.h \ |
99 | kolocationbox.h \ | 99 | kolocationbox.h \ |
100 | komonthview.h \ | 100 | komonthview.h \ |
101 | koprefs.h \ | 101 | koprefs.h \ |
102 | koprefsdialog.h \ | 102 | koprefsdialog.h \ |
103 | kotimespanview.h \ | 103 | kotimespanview.h \ |
104 | kotodoeditor.h \ | 104 | kotodoeditor.h \ |
105 | kotodoview.h \ | 105 | kotodoview.h \ |
106 | kotodoviewitem.h \ | 106 | kotodoviewitem.h \ |
107 | koviewmanager.h \ | 107 | koviewmanager.h \ |
108 | kowhatsnextview.h \ | 108 | kowhatsnextview.h \ |
109 | ktimeedit.h \ | 109 | ktimeedit.h \ |
110 | lineview.h \ | 110 | lineview.h \ |
111 | mainwindow.h \ | 111 | mainwindow.h \ |
112 | navigatorbar.h \ | 112 | navigatorbar.h \ |
113 | outgoingdialog.h \ | 113 | outgoingdialog.h \ |
114 | outgoingdialog_base.h \ | 114 | outgoingdialog_base.h \ |
115 | publishdialog.h \ | 115 | publishdialog.h \ |
116 | publishdialog_base.h \ | 116 | publishdialog_base.h \ |
117 | savetemplatedialog.h \ | 117 | savetemplatedialog.h \ |
118 | searchdialog.h \ | 118 | searchdialog.h \ |
119 | simplealarmclient.h \ | 119 | simplealarmclient.h \ |
120 | statusdialog.h \ | 120 | statusdialog.h \ |
121 | timeline.h \ | 121 | timeline.h \ |
122 | timespanview.h \ | 122 | timespanview.h \ |
123 | version.h \ | 123 | version.h \ |
124 | ../kalarmd/alarmdialog.h \ | 124 | ../kalarmd/alarmdialog.h \ |
125 | 125 | ||
126 | 126 | ||
127 | SOURCES += \ | 127 | SOURCES += \ |
128 | filteredit_base.cpp \ | 128 | filteredit_base.cpp \ |
129 | calendarview.cpp \ | 129 | calendarview.cpp \ |
130 | datenavigator.cpp \ | 130 | datenavigator.cpp \ |
131 | docprefs.cpp \ | 131 | docprefs.cpp \ |
132 | filtereditdialog.cpp \ | 132 | filtereditdialog.cpp \ |
133 | incomingdialog.cpp \ | 133 | incomingdialog.cpp \ |
134 | incomingdialog_base.cpp \ | 134 | incomingdialog_base.cpp \ |
135 | journalentry.cpp \ | 135 | journalentry.cpp \ |
136 | kdatenavigator.cpp \ | 136 | kdatenavigator.cpp \ |
137 | koagenda.cpp \ | 137 | koagenda.cpp \ |
138 | koagendaitem.cpp \ | 138 | koagendaitem.cpp \ |
139 | koagendaview.cpp \ | 139 | koagendaview.cpp \ |
140 | kocounterdialog.cpp \ | 140 | kocounterdialog.cpp \ |
141 | kodaymatrix.cpp \ | 141 | kodaymatrix.cpp \ |
142 | kodialogmanager.cpp \ | 142 | kodialogmanager.cpp \ |
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index 1fb480d..8c1953d 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp | |||
@@ -14,621 +14,630 @@ | |||
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 <qlayout.h> | 24 | #include <qlayout.h> |
25 | #include <qheader.h> | 25 | #include <qheader.h> |
26 | #include <qcursor.h> | 26 | #include <qcursor.h> |
27 | 27 | ||
28 | #include <qvbox.h> | 28 | #include <qvbox.h> |
29 | #include <kdebug.h> | 29 | #include <kdebug.h> |
30 | #include "koprefs.h" | 30 | #include "koprefs.h" |
31 | #include <klocale.h> | 31 | #include <klocale.h> |
32 | #include <kglobal.h> | 32 | #include <kglobal.h> |
33 | #include <kiconloader.h> | 33 | #include <kiconloader.h> |
34 | #include <kmessagebox.h> | 34 | #include <kmessagebox.h> |
35 | 35 | ||
36 | #include <libkcal/icaldrag.h> | 36 | #include <libkcal/icaldrag.h> |
37 | #include <libkcal/vcaldrag.h> | 37 | #include <libkcal/vcaldrag.h> |
38 | #include <libkcal/calfilter.h> | 38 | #include <libkcal/calfilter.h> |
39 | #include <libkcal/dndfactory.h> | 39 | #include <libkcal/dndfactory.h> |
40 | #include <libkcal/calendarresources.h> | 40 | #include <libkcal/calendarresources.h> |
41 | #include <libkcal/resourcecalendar.h> | 41 | #include <libkcal/resourcecalendar.h> |
42 | #include <kresources/resourceselectdialog.h> | 42 | #include <kresources/resourceselectdialog.h> |
43 | #ifndef DESKTOP_VERSION | 43 | #ifndef DESKTOP_VERSION |
44 | #include <qpe/qpeapplication.h> | 44 | #include <qpe/qpeapplication.h> |
45 | #else | 45 | #else |
46 | #include <qapplication.h> | 46 | #include <qapplication.h> |
47 | #endif | 47 | #endif |
48 | #ifndef KORG_NOPRINTER | 48 | #ifndef KORG_NOPRINTER |
49 | #include "calprinter.h" | 49 | #include "calprinter.h" |
50 | #endif | 50 | #endif |
51 | #include "docprefs.h" | 51 | #include "docprefs.h" |
52 | 52 | ||
53 | #include "kotodoview.h" | 53 | #include "kotodoview.h" |
54 | using namespace KOrg; | 54 | using namespace KOrg; |
55 | 55 | ||
56 | KOTodoListView::KOTodoListView(Calendar *calendar,QWidget *parent, | 56 | KOTodoListView::KOTodoListView(Calendar *calendar,QWidget *parent, |
57 | const char *name) : | 57 | const char *name) : |
58 | KListView(parent,name) | 58 | KListView(parent,name) |
59 | { | 59 | { |
60 | mName = QString ( name ); | 60 | mName = QString ( name ); |
61 | mCalendar = calendar; | 61 | mCalendar = calendar; |
62 | #ifndef DESKTOP_VERSION | 62 | #ifndef DESKTOP_VERSION |
63 | QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); | 63 | QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); |
64 | #endif | 64 | #endif |
65 | mOldCurrent = 0; | 65 | mOldCurrent = 0; |
66 | mMousePressed = false; | 66 | mMousePressed = false; |
67 | 67 | ||
68 | setAcceptDrops(true); | 68 | setAcceptDrops(true); |
69 | viewport()->setAcceptDrops(true); | 69 | viewport()->setAcceptDrops(true); |
70 | int size = 16; | 70 | int size = 16; |
71 | if (qApp->desktop()->width() < 300 ) | 71 | if (qApp->desktop()->width() < 300 ) |
72 | size = 12; | 72 | size = 12; |
73 | setTreeStepSize( size + 6 ); | 73 | setTreeStepSize( size + 6 ); |
74 | 74 | ||
75 | } | 75 | } |
76 | 76 | ||
77 | void KOTodoListView::contentsDragEnterEvent(QDragEnterEvent *e) | 77 | void KOTodoListView::contentsDragEnterEvent(QDragEnterEvent *e) |
78 | { | 78 | { |
79 | #ifndef KORG_NODND | 79 | #ifndef KORG_NODND |
80 | // kdDebug() << "KOTodoListView::contentsDragEnterEvent" << endl; | 80 | // kdDebug() << "KOTodoListView::contentsDragEnterEvent" << endl; |
81 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && | 81 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && |
82 | !QTextDrag::canDecode( e ) ) { | 82 | !QTextDrag::canDecode( e ) ) { |
83 | e->ignore(); | 83 | e->ignore(); |
84 | return; | 84 | return; |
85 | } | 85 | } |
86 | 86 | ||
87 | mOldCurrent = currentItem(); | 87 | mOldCurrent = currentItem(); |
88 | #endif | 88 | #endif |
89 | } | 89 | } |
90 | 90 | ||
91 | 91 | ||
92 | void KOTodoListView::contentsDragMoveEvent(QDragMoveEvent *e) | 92 | void KOTodoListView::contentsDragMoveEvent(QDragMoveEvent *e) |
93 | { | 93 | { |
94 | #ifndef KORG_NODND | 94 | #ifndef KORG_NODND |
95 | // kdDebug() << "KOTodoListView::contentsDragMoveEvent" << endl; | 95 | // kdDebug() << "KOTodoListView::contentsDragMoveEvent" << endl; |
96 | 96 | ||
97 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && | 97 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && |
98 | !QTextDrag::canDecode( e ) ) { | 98 | !QTextDrag::canDecode( e ) ) { |
99 | e->ignore(); | 99 | e->ignore(); |
100 | return; | 100 | return; |
101 | } | 101 | } |
102 | 102 | ||
103 | e->accept(); | 103 | e->accept(); |
104 | #endif | 104 | #endif |
105 | } | 105 | } |
106 | 106 | ||
107 | void KOTodoListView::contentsDragLeaveEvent(QDragLeaveEvent *) | 107 | void KOTodoListView::contentsDragLeaveEvent(QDragLeaveEvent *) |
108 | { | 108 | { |
109 | #ifndef KORG_NODND | 109 | #ifndef KORG_NODND |
110 | // kdDebug() << "KOTodoListView::contentsDragLeaveEvent" << endl; | 110 | // kdDebug() << "KOTodoListView::contentsDragLeaveEvent" << endl; |
111 | 111 | ||
112 | setCurrentItem(mOldCurrent); | 112 | setCurrentItem(mOldCurrent); |
113 | setSelected(mOldCurrent,true); | 113 | setSelected(mOldCurrent,true); |
114 | #endif | 114 | #endif |
115 | } | 115 | } |
116 | 116 | ||
117 | void KOTodoListView::contentsDropEvent(QDropEvent *e) | 117 | void KOTodoListView::contentsDropEvent(QDropEvent *e) |
118 | { | 118 | { |
119 | #ifndef KORG_NODND | 119 | #ifndef KORG_NODND |
120 | // kdDebug() << "KOTodoListView::contentsDropEvent" << endl; | 120 | // kdDebug() << "KOTodoListView::contentsDropEvent" << endl; |
121 | 121 | ||
122 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && | 122 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && |
123 | !QTextDrag::canDecode( e ) ) { | 123 | !QTextDrag::canDecode( e ) ) { |
124 | e->ignore(); | 124 | e->ignore(); |
125 | return; | 125 | return; |
126 | } | 126 | } |
127 | 127 | ||
128 | DndFactory factory( mCalendar ); | 128 | DndFactory factory( mCalendar ); |
129 | Todo *todo = factory.createDropTodo(e); | 129 | Todo *todo = factory.createDropTodo(e); |
130 | 130 | ||
131 | if (todo) { | 131 | if (todo) { |
132 | e->acceptAction(); | 132 | e->acceptAction(); |
133 | 133 | ||
134 | KOTodoViewItem *destination = | 134 | KOTodoViewItem *destination = |
135 | (KOTodoViewItem *)itemAt(contentsToViewport(e->pos())); | 135 | (KOTodoViewItem *)itemAt(contentsToViewport(e->pos())); |
136 | Todo *destinationEvent = 0; | 136 | Todo *destinationEvent = 0; |
137 | if (destination) destinationEvent = destination->todo(); | 137 | if (destination) destinationEvent = destination->todo(); |
138 | 138 | ||
139 | Todo *existingTodo = mCalendar->todo(todo->uid()); | 139 | Todo *existingTodo = mCalendar->todo(todo->uid()); |
140 | 140 | ||
141 | if(existingTodo) { | 141 | if(existingTodo) { |
142 | // kdDebug() << "Drop existing Todo" << endl; | ||
143 | Incidence *to = destinationEvent; | 142 | Incidence *to = destinationEvent; |
144 | while(to) { | 143 | while(to) { |
145 | if (to->uid() == todo->uid()) { | 144 | if (to->uid() == todo->uid()) { |
146 | KMessageBox::sorry(this, | 145 | KMessageBox::sorry(this, |
147 | i18n("Cannot move To-Do to itself or a child of itself"), | 146 | i18n("Cannot move To-Do to itself\nor a child of itself"), |
148 | i18n("Drop To-Do")); | 147 | i18n("Drop To-Do")); |
149 | delete todo; | 148 | delete todo; |
150 | return; | 149 | return; |
151 | } | 150 | } |
152 | to = to->relatedTo(); | 151 | to = to->relatedTo(); |
153 | } | 152 | } |
154 | existingTodo->setRelatedTo(destinationEvent); | 153 | internalDrop = true; |
155 | emit todoDropped(todo); | 154 | if ( destinationEvent ) |
155 | reparentTodoSignal( destinationEvent, existingTodo ); | ||
156 | else | ||
157 | unparentTodoSignal(existingTodo); | ||
156 | delete todo; | 158 | delete todo; |
157 | } else { | 159 | } else { |
158 | // kdDebug() << "Drop new Todo" << endl; | ||
159 | todo->setRelatedTo(destinationEvent); | ||
160 | mCalendar->addTodo(todo); | 160 | mCalendar->addTodo(todo); |
161 | 161 | emit todoDropped(todo, KOGlobals::EVENTADDED); | |
162 | emit todoDropped(todo); | 162 | if ( destinationEvent ) |
163 | reparentTodoSignal( destinationEvent, todo ); | ||
163 | } | 164 | } |
164 | } | 165 | } |
165 | else { | 166 | else { |
166 | QString text; | 167 | QString text; |
167 | if (QTextDrag::decode(e,text)) { | 168 | if (QTextDrag::decode(e,text)) { |
168 | //QListViewItem *qlvi = itemAt( contentsToViewport(e->pos()) ); | 169 | //QListViewItem *qlvi = itemAt( contentsToViewport(e->pos()) ); |
169 | KOTodoViewItem *todoi = static_cast<KOTodoViewItem *>(itemAt( contentsToViewport(e->pos()) )); | 170 | KOTodoViewItem *todoi = static_cast<KOTodoViewItem *>(itemAt( contentsToViewport(e->pos()) )); |
170 | kdDebug() << "Dropped : " << text << endl; | 171 | qDebug("Dropped : " + text); |
171 | QStringList emails = QStringList::split(",",text); | 172 | QStringList emails = QStringList::split(",",text); |
172 | for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) { | 173 | for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) { |
173 | kdDebug() << " Email: " << (*it) << endl; | ||
174 | int pos = (*it).find("<"); | 174 | int pos = (*it).find("<"); |
175 | QString name = (*it).left(pos); | 175 | QString name = (*it).left(pos); |
176 | QString email = (*it).mid(pos); | 176 | QString email = (*it).mid(pos); |
177 | if (!email.isEmpty() && todoi) { | 177 | if (!email.isEmpty() && todoi) { |
178 | todoi->todo()->addAttendee(new Attendee(name,email)); | 178 | todoi->todo()->addAttendee(new Attendee(name,email)); |
179 | } | 179 | } |
180 | } | 180 | } |
181 | } | 181 | } |
182 | else { | 182 | else { |
183 | kdDebug() << "KOTodoListView::contentsDropEvent(): Todo from drop not decodable" << endl; | 183 | qDebug("KOTodoListView::contentsDropEvent(): Todo from drop not decodable "); |
184 | e->ignore(); | 184 | e->ignore(); |
185 | } | 185 | } |
186 | } | 186 | } |
187 | #endif | 187 | #endif |
188 | } | 188 | } |
189 | 189 | ||
190 | void KOTodoListView::contentsMousePressEvent(QMouseEvent* e) | 190 | void KOTodoListView::contentsMousePressEvent(QMouseEvent* e) |
191 | { | 191 | { |
192 | QListView::contentsMousePressEvent(e); | ||
193 | #ifndef KORG_NODND | 192 | #ifndef KORG_NODND |
194 | QPoint p(contentsToViewport(e->pos())); | 193 | QPoint p(contentsToViewport(e->pos())); |
195 | QListViewItem *i = itemAt(p); | 194 | QListViewItem *i = itemAt(p); |
195 | mMousePressed = false; | ||
196 | if (i) { | 196 | if (i) { |
197 | // if the user clicked into the root decoration of the item, don't | 197 | // if the user clicked into the root decoration of the item, don't |
198 | // try to start a drag! | 198 | // try to start a drag! |
199 | if (p.x() > header()->sectionPos(header()->mapToIndex(0)) + | 199 | if (p.x() > header()->sectionPos(header()->mapToIndex(0)) + |
200 | treeStepSize() * (i->depth() + (rootIsDecorated() ? 1 : 0)) + | 200 | treeStepSize() * (i->depth() + (rootIsDecorated() ? 1 : 0)) + |
201 | itemMargin() || | 201 | itemMargin() || |
202 | p.x() < header()->sectionPos(header()->mapToIndex(0))) { | 202 | p.x() < header()->sectionPos(header()->mapToIndex(0))) { |
203 | if (e->button()==Qt::LeftButton) { | 203 | if (e->button()==Qt::LeftButton) { |
204 | mPressPos = e->pos(); | 204 | mPressPos = e->pos(); |
205 | mMousePressed = true; | 205 | mMousePressed = true; |
206 | } | 206 | } |
207 | } | 207 | } |
208 | } | 208 | } |
209 | #endif | 209 | #endif |
210 | QListView::contentsMousePressEvent(e); | ||
210 | } | 211 | } |
211 | 212 | ||
212 | void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e) | 213 | void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e) |
213 | { | 214 | { |
214 | 215 | ||
215 | #ifndef KORG_NODND | 216 | #ifndef KORG_NODND |
216 | // kdDebug() << "KOTodoListView::contentsMouseMoveEvent()" << endl; | ||
217 | QListView::contentsMouseMoveEvent(e); | 217 | QListView::contentsMouseMoveEvent(e); |
218 | if (mMousePressed && (mPressPos - e->pos()).manhattanLength() > | 218 | if (mMousePressed && (mPressPos - e->pos()).manhattanLength() > |
219 | QApplication::startDragDistance()) { | 219 | QApplication::startDragDistance()) { |
220 | mMousePressed = false; | 220 | mMousePressed = false; |
221 | QListViewItem *item = itemAt(contentsToViewport(mPressPos)); | 221 | QListViewItem *item = itemAt(contentsToViewport(mPressPos)); |
222 | if (item) { | 222 | if (item) { |
223 | // kdDebug() << "Start Drag for item " << item->text(0) << endl; | ||
224 | DndFactory factory( mCalendar ); | 223 | DndFactory factory( mCalendar ); |
225 | ICalDrag *vd = factory.createDragTodo( | 224 | ICalDrag *vd = factory.createDrag( |
226 | ((KOTodoViewItem *)item)->todo(),viewport()); | 225 | ((KOTodoViewItem *)item)->todo(),viewport()); |
226 | internalDrop = false; | ||
227 | // we cannot do any senseful here, because the DnD is still broken in Qt | ||
227 | if (vd->drag()) { | 228 | if (vd->drag()) { |
228 | kdDebug() << "KOTodoListView::contentsMouseMoveEvent(): Delete drag source" << endl; | 229 | if ( !internalDrop ) { |
230 | //emit deleteTodo( ((KOTodoViewItem *)item)->todo() ); | ||
231 | qDebug("Dnd: External move: Delete drag source "); | ||
232 | } else | ||
233 | qDebug("Dnd: Internal move "); | ||
234 | |||
235 | } else { | ||
236 | if ( !internalDrop ) { | ||
237 | qDebug("Dnd: External Copy"); | ||
238 | } else | ||
239 | qDebug("DnD: Internal copy: Copy pending"); | ||
229 | } | 240 | } |
230 | /* | ||
231 | QString source = fullPath(item); | ||
232 | if ( QFile::exists(source) ) { | ||
233 | QUriDrag* ud = new QUriDrag(viewport()); | ||
234 | ud->setFilenames( source ); | ||
235 | if ( ud->drag() ) | ||
236 | QMessageBox::information( this, "Drag source", | ||
237 | QString("Delete ")+source, "Not implemented" ); | ||
238 | */ | ||
239 | } | 241 | } |
240 | } | 242 | } |
241 | #endif | 243 | #endif |
242 | } | 244 | } |
243 | void KOTodoListView::keyPressEvent ( QKeyEvent * e ) | 245 | void KOTodoListView::keyPressEvent ( QKeyEvent * e ) |
244 | { | 246 | { |
245 | 247 | ||
246 | QListViewItem* cn; | 248 | QListViewItem* cn; |
247 | if ( e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter ) { | 249 | if ( e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter ) { |
248 | cn = currentItem(); | 250 | cn = currentItem(); |
249 | if ( cn ) { | 251 | if ( cn ) { |
250 | KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); | 252 | KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); |
251 | if ( ci ){ | 253 | if ( ci ){ |
252 | if ( e->state() == ShiftButton ) | 254 | if ( e->state() == ShiftButton ) |
253 | ci->setOn( false ); | 255 | ci->setOn( false ); |
254 | else | 256 | else |
255 | ci->setOn( true ); | 257 | ci->setOn( true ); |
256 | cn = cn->nextSibling(); | 258 | cn = cn->nextSibling(); |
257 | if ( cn ) { | 259 | if ( cn ) { |
258 | setCurrentItem ( cn ); | 260 | setCurrentItem ( cn ); |
259 | ensureItemVisible ( cn ); | 261 | ensureItemVisible ( cn ); |
260 | } | 262 | } |
261 | 263 | ||
262 | } | 264 | } |
263 | } | 265 | } |
264 | 266 | ||
265 | return; | 267 | return; |
266 | } | 268 | } |
267 | 269 | ||
268 | // qDebug("KOTodoListView::keyPressEvent "); | 270 | // qDebug("KOTodoListView::keyPressEvent "); |
269 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) { | 271 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) { |
270 | switch ( e->key() ) { | 272 | switch ( e->key() ) { |
271 | case Qt::Key_Down: | 273 | case Qt::Key_Down: |
272 | case Qt::Key_Up: | 274 | case Qt::Key_Up: |
273 | QListView::keyPressEvent ( e ); | 275 | QListView::keyPressEvent ( e ); |
274 | break; | 276 | break; |
275 | case Qt::Key_Left: | 277 | case Qt::Key_Left: |
276 | case Qt::Key_Right: | 278 | case Qt::Key_Right: |
277 | QListView::keyPressEvent ( e ); | 279 | QListView::keyPressEvent ( e ); |
278 | e->accept(); | 280 | e->accept(); |
279 | return; | 281 | return; |
280 | break; | 282 | break; |
281 | default: | 283 | default: |
282 | e->ignore(); | 284 | e->ignore(); |
283 | break; | 285 | break; |
284 | } | 286 | } |
285 | return; | 287 | return; |
286 | } | 288 | } |
287 | e->ignore(); | 289 | e->ignore(); |
288 | } | 290 | } |
289 | void KOTodoListView::contentsMouseReleaseEvent(QMouseEvent *e) | 291 | void KOTodoListView::contentsMouseReleaseEvent(QMouseEvent *e) |
290 | { | 292 | { |
291 | QListView::contentsMouseReleaseEvent(e); | 293 | QListView::contentsMouseReleaseEvent(e); |
292 | mMousePressed = false; | 294 | mMousePressed = false; |
293 | } | 295 | } |
294 | 296 | ||
295 | void KOTodoListView::contentsMouseDoubleClickEvent(QMouseEvent *e) | 297 | void KOTodoListView::contentsMouseDoubleClickEvent(QMouseEvent *e) |
296 | { | 298 | { |
297 | if (!e) return; | 299 | if (!e) return; |
298 | 300 | ||
299 | QPoint vp = contentsToViewport(e->pos()); | 301 | QPoint vp = contentsToViewport(e->pos()); |
300 | 302 | ||
301 | QListViewItem *item = itemAt(vp); | 303 | QListViewItem *item = itemAt(vp); |
302 | 304 | ||
303 | emit double_Clicked(item); | 305 | emit double_Clicked(item); |
304 | if (!item) return; | 306 | if (!item) return; |
305 | 307 | ||
306 | emit doubleClicked(item,vp,0); | 308 | emit doubleClicked(item,vp,0); |
307 | } | 309 | } |
308 | 310 | ||
309 | ///////////////////////////////////////////////////////////////////////////// | 311 | ///////////////////////////////////////////////////////////////////////////// |
310 | 312 | ||
311 | KOQuickTodo::KOQuickTodo(QWidget *parent) : | 313 | KOQuickTodo::KOQuickTodo(QWidget *parent) : |
312 | QLineEdit(parent) | 314 | QLineEdit(parent) |
313 | { | 315 | { |
314 | setText(i18n("Click to add a new Todo")); | 316 | setText(i18n("Click to add a new Todo")); |
315 | } | 317 | } |
316 | 318 | ||
317 | void KOQuickTodo::focusInEvent(QFocusEvent *ev) | 319 | void KOQuickTodo::focusInEvent(QFocusEvent *ev) |
318 | { | 320 | { |
319 | if ( text()==i18n("Click to add a new Todo") ) | 321 | if ( text()==i18n("Click to add a new Todo") ) |
320 | setText(""); | 322 | setText(""); |
321 | QLineEdit::focusInEvent(ev); | 323 | QLineEdit::focusInEvent(ev); |
322 | } | 324 | } |
323 | 325 | ||
324 | void KOQuickTodo::focusOutEvent(QFocusEvent *ev) | 326 | void KOQuickTodo::focusOutEvent(QFocusEvent *ev) |
325 | { | 327 | { |
326 | setText(i18n("Click to add a new Todo")); | 328 | setText(i18n("Click to add a new Todo")); |
327 | QLineEdit::focusOutEvent(ev); | 329 | QLineEdit::focusOutEvent(ev); |
328 | } | 330 | } |
329 | 331 | ||
330 | ///////////////////////////////////////////////////////////////////////////// | 332 | ///////////////////////////////////////////////////////////////////////////// |
331 | 333 | ||
332 | KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : | 334 | KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : |
333 | KOrg::BaseView(calendar,parent,name) | 335 | KOrg::BaseView(calendar,parent,name) |
334 | { | 336 | { |
335 | mNavigator = 0; | 337 | mNavigator = 0; |
336 | QBoxLayout *topLayout = new QVBoxLayout(this); | 338 | QBoxLayout *topLayout = new QVBoxLayout(this); |
337 | mName = QString ( name ); | 339 | mName = QString ( name ); |
338 | mBlockUpdate = false; | 340 | mBlockUpdate = false; |
339 | mQuickAdd = new KOQuickTodo(this); | 341 | mQuickAdd = new KOQuickTodo(this); |
340 | topLayout->addWidget(mQuickAdd); | 342 | topLayout->addWidget(mQuickAdd); |
341 | 343 | ||
342 | if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickAdd->hide(); | 344 | if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickAdd->hide(); |
343 | 345 | ||
344 | mTodoListView = new KOTodoListView(calendar,this, name ); | 346 | mTodoListView = new KOTodoListView(calendar,this, name ); |
345 | topLayout->addWidget(mTodoListView); | 347 | topLayout->addWidget(mTodoListView); |
346 | //mTodoListView->header()->setMaximumHeight(30); | 348 | //mTodoListView->header()->setMaximumHeight(30); |
347 | mTodoListView->setRootIsDecorated(true); | 349 | mTodoListView->setRootIsDecorated(true); |
348 | mTodoListView->setAllColumnsShowFocus(true); | 350 | mTodoListView->setAllColumnsShowFocus(true); |
349 | 351 | ||
350 | mTodoListView->setShowSortIndicator(true); | 352 | mTodoListView->setShowSortIndicator(true); |
351 | 353 | ||
352 | mTodoListView->addColumn(i18n("Todo")); | 354 | mTodoListView->addColumn(i18n("Todo")); |
353 | mTodoListView->addColumn(i18n("Prio")); | 355 | mTodoListView->addColumn(i18n("Prio")); |
354 | mTodoListView->setColumnAlignment(1,AlignHCenter); | 356 | mTodoListView->setColumnAlignment(1,AlignHCenter); |
355 | mTodoListView->addColumn(i18n("Complete")); | 357 | mTodoListView->addColumn(i18n("Complete")); |
356 | mTodoListView->setColumnAlignment(2,AlignCenter); | 358 | mTodoListView->setColumnAlignment(2,AlignCenter); |
357 | 359 | ||
358 | mTodoListView->addColumn(i18n("Due Date")); | 360 | mTodoListView->addColumn(i18n("Due Date")); |
359 | mTodoListView->setColumnAlignment(3,AlignLeft); | 361 | mTodoListView->setColumnAlignment(3,AlignLeft); |
360 | mTodoListView->addColumn(i18n("Due Time")); | 362 | mTodoListView->addColumn(i18n("Due Time")); |
361 | mTodoListView->setColumnAlignment(4,AlignHCenter); | 363 | mTodoListView->setColumnAlignment(4,AlignHCenter); |
362 | 364 | ||
363 | mTodoListView->addColumn(i18n("Start Date")); | 365 | mTodoListView->addColumn(i18n("Start Date")); |
364 | mTodoListView->setColumnAlignment(5,AlignLeft); | 366 | mTodoListView->setColumnAlignment(5,AlignLeft); |
365 | mTodoListView->addColumn(i18n("Start Time")); | 367 | mTodoListView->addColumn(i18n("Start Time")); |
366 | mTodoListView->setColumnAlignment(6,AlignHCenter); | 368 | mTodoListView->setColumnAlignment(6,AlignHCenter); |
367 | 369 | ||
368 | mTodoListView->addColumn(i18n("Cancelled")); | 370 | mTodoListView->addColumn(i18n("Cancelled")); |
369 | mTodoListView->addColumn(i18n("Categories")); | 371 | mTodoListView->addColumn(i18n("Categories")); |
370 | #if 0 | 372 | #if 0 |
371 | mTodoListView->addColumn(i18n("Sort Id")); | 373 | mTodoListView->addColumn(i18n("Sort Id")); |
372 | mTodoListView->setColumnAlignment(4,AlignHCenter); | 374 | mTodoListView->setColumnAlignment(4,AlignHCenter); |
373 | #endif | 375 | #endif |
374 | 376 | ||
375 | mTodoListView->setMinimumHeight( 60 ); | 377 | mTodoListView->setMinimumHeight( 60 ); |
376 | mTodoListView->setItemsRenameable( true ); | 378 | mTodoListView->setItemsRenameable( true ); |
377 | mTodoListView->setRenameable( 0 ); | 379 | mTodoListView->setRenameable( 0 ); |
378 | mTodoListView->setColumnWidth( 0, 120 ); | 380 | mTodoListView->setColumnWidth( 0, 120 ); |
379 | mTodoListView->setColumnWidthMode(0, QListView::Manual); | 381 | mTodoListView->setColumnWidthMode(0, QListView::Manual); |
380 | mTodoListView->setColumnWidthMode(1, QListView::Manual); | 382 | mTodoListView->setColumnWidthMode(1, QListView::Manual); |
381 | mTodoListView->setColumnWidthMode(2, QListView::Manual); | 383 | mTodoListView->setColumnWidthMode(2, QListView::Manual); |
382 | mTodoListView->setColumnWidthMode(3, QListView::Manual); | 384 | mTodoListView->setColumnWidthMode(3, QListView::Manual); |
383 | mTodoListView->setColumnWidthMode(4, QListView::Manual); | 385 | mTodoListView->setColumnWidthMode(4, QListView::Manual); |
384 | mTodoListView->setColumnWidthMode(5, QListView::Manual); | 386 | mTodoListView->setColumnWidthMode(5, QListView::Manual); |
385 | mTodoListView->setColumnWidthMode(6, QListView::Manual); | 387 | mTodoListView->setColumnWidthMode(6, QListView::Manual); |
386 | mTodoListView->setColumnWidthMode(7, QListView::Manual); | 388 | mTodoListView->setColumnWidthMode(7, QListView::Manual); |
387 | mTodoListView->setColumnWidthMode(8, QListView::Manual); | 389 | mTodoListView->setColumnWidthMode(8, QListView::Manual); |
388 | 390 | ||
389 | 391 | ||
390 | mPriorityPopupMenu = new QPopupMenu(this); | 392 | mPriorityPopupMenu = new QPopupMenu(this); |
391 | for (int i = 1; i <= 5; i++) { | 393 | for (int i = 1; i <= 5; i++) { |
392 | QString label = QString ("%1").arg (i); | 394 | QString label = QString ("%1").arg (i); |
393 | mPriority[mPriorityPopupMenu->insertItem (label)] = i; | 395 | mPriority[mPriorityPopupMenu->insertItem (label)] = i; |
394 | } | 396 | } |
395 | connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int))); | 397 | connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int))); |
396 | 398 | ||
397 | mPercentageCompletedPopupMenu = new QPopupMenu(this); | 399 | mPercentageCompletedPopupMenu = new QPopupMenu(this); |
398 | for (int i = 0; i <= 100; i+=20) { | 400 | for (int i = 0; i <= 100; i+=20) { |
399 | QString label = QString ("%1 %").arg (i); | 401 | QString label = QString ("%1 %").arg (i); |
400 | mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i; | 402 | mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i; |
401 | } | 403 | } |
402 | connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int))); | 404 | connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int))); |
403 | 405 | ||
404 | 406 | ||
405 | 407 | ||
406 | mItemPopupMenu = new QPopupMenu(this); | 408 | mItemPopupMenu = new QPopupMenu(this); |
407 | mItemPopupMenu->insertItem(i18n("Show..."), this, | 409 | mItemPopupMenu->insertItem(i18n("Show..."), this, |
408 | SLOT (showTodo())); | 410 | SLOT (showTodo())); |
409 | mItemPopupMenu->insertItem(i18n("Edit..."), this, | 411 | mItemPopupMenu->insertItem(i18n("Edit..."), this, |
410 | SLOT (editTodo())); | 412 | SLOT (editTodo())); |
411 | mItemPopupMenu->insertItem( i18n("Delete"), this, | 413 | mItemPopupMenu->insertItem( i18n("Delete"), this, |
412 | SLOT (deleteTodo())); | 414 | SLOT (deleteTodo())); |
413 | mItemPopupMenu->insertItem( i18n("Clone..."), this, | 415 | mItemPopupMenu->insertItem( i18n("Clone..."), this, |
414 | SLOT (cloneTodo())); | 416 | SLOT (cloneTodo())); |
415 | mItemPopupMenu->insertItem( i18n("Move..."), this, | 417 | mItemPopupMenu->insertItem( i18n("Move..."), this, |
416 | SLOT (moveTodo())); | 418 | SLOT (moveTodo())); |
417 | mItemPopupMenu->insertItem( i18n("Beam..."), this, | 419 | mItemPopupMenu->insertItem( i18n("Beam..."), this, |
418 | SLOT (beamTodo())); | 420 | SLOT (beamTodo())); |
419 | mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this, | 421 | mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this, |
420 | SLOT (cancelTodo())); | 422 | SLOT (cancelTodo())); |
421 | mItemPopupMenu->insertSeparator(); | 423 | mItemPopupMenu->insertSeparator(); |
422 | 424 | ||
423 | mItemPopupMenu->insertItem( i18n("New Todo..."), this, | 425 | mItemPopupMenu->insertItem( i18n("New Todo..."), this, |
424 | SLOT (newTodo())); | 426 | SLOT (newTodo())); |
425 | mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this, | 427 | mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this, |
426 | SLOT (newSubTodo())); | 428 | SLOT (newSubTodo())); |
427 | mItemPopupMenu->insertItem(i18n("Unparent Todo"), this, | 429 | mItemPopupMenu->insertItem(i18n("Unparent Todo"), this, |
428 | SLOT (unparentTodo()),0,21); | 430 | SLOT (unparentTodo()),0,21); |
429 | mItemPopupMenu->insertItem(i18n("Reparent Todo"), this, | 431 | mItemPopupMenu->insertItem(i18n("Reparent Todo"), this, |
430 | SLOT (reparentTodo()),0,22); | 432 | SLOT (reparentTodo()),0,22); |
431 | mItemPopupMenu->insertSeparator(); | 433 | mItemPopupMenu->insertSeparator(); |
432 | #if 0 | 434 | #if 0 |
433 | mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed"), | 435 | mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed"), |
434 | this, SLOT( purgeCompleted() ) ); | 436 | this, SLOT( purgeCompleted() ) ); |
435 | mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"), | 437 | mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"), |
436 | this, SLOT( toggleCompleted() ),0, 33 ); | 438 | this, SLOT( toggleCompleted() ),0, 33 ); |
437 | mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), | 439 | mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), |
438 | this, SLOT( toggleQuickTodo() ),0, 34 ); | 440 | this, SLOT( toggleQuickTodo() ),0, 34 ); |
439 | mItemPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), | 441 | mItemPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), |
440 | this, SLOT( toggleRunning() ),0, 35 ); | 442 | this, SLOT( toggleRunning() ),0, 35 ); |
441 | 443 | ||
442 | #endif | 444 | #endif |
443 | mPopupMenu = new QPopupMenu(this); | 445 | mPopupMenu = new QPopupMenu(this); |
444 | mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this, | 446 | mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this, |
445 | SLOT (newTodo()),0,1); | 447 | SLOT (newTodo()),0,1); |
446 | mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed"), | 448 | mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed"), |
447 | this, SLOT(purgeCompleted()),0,2); | 449 | this, SLOT(purgeCompleted()),0,2); |
448 | mPopupMenu->insertItem(i18n("Show Completed"), | 450 | mPopupMenu->insertItem(i18n("Show Completed"), |
449 | this, SLOT( toggleCompleted() ),0,3 ); | 451 | this, SLOT( toggleCompleted() ),0,3 ); |
450 | mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), | 452 | mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), |
451 | this, SLOT( toggleQuickTodo() ),0,4 ); | 453 | this, SLOT( toggleQuickTodo() ),0,4 ); |
452 | mPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), | 454 | mPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), |
453 | this, SLOT( toggleRunning() ),0,5 ); | 455 | this, SLOT( toggleRunning() ),0,5 ); |
454 | mPopupMenu->insertItem(i18n(" set all open","Display all opened"), | 456 | mPopupMenu->insertItem(i18n(" set all open","Display all opened"), |
455 | this, SLOT( setAllOpen() ),0,6 ); | 457 | this, SLOT( setAllOpen() ),0,6 ); |
456 | mPopupMenu->insertItem(i18n(" set all close","Display all closed"), | 458 | mPopupMenu->insertItem(i18n(" set all close","Display all closed"), |
457 | this, SLOT( setAllClose() ),0,7 ); | 459 | this, SLOT( setAllClose() ),0,7 ); |
458 | mPopupMenu->insertItem(i18n(" set all flat","Display all flat"), | 460 | mPopupMenu->insertItem(i18n(" set all flat","Display all flat"), |
459 | this, SLOT( setAllFlat() ),0,8 ); | 461 | this, SLOT( setAllFlat() ),0,8 ); |
460 | mDocPrefs = new DocPrefs( name ); | 462 | mDocPrefs = new DocPrefs( name ); |
461 | 463 | ||
462 | mItemPopupMenu->insertItem(i18n("Todo View"),mPopupMenu ); | 464 | mItemPopupMenu->insertItem(i18n("Todo View"),mPopupMenu ); |
463 | mPopupMenu->setCheckable( true ); | 465 | mPopupMenu->setCheckable( true ); |
464 | mItemPopupMenu->setCheckable( true ); | 466 | mItemPopupMenu->setCheckable( true ); |
465 | 467 | ||
466 | 468 | ||
467 | mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); | 469 | mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); |
468 | mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); | 470 | mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); |
469 | 471 | ||
470 | mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); | 472 | mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); |
471 | mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); | 473 | mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); |
472 | 474 | ||
473 | mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); | 475 | mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); |
474 | mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); | 476 | mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); |
475 | 477 | ||
476 | 478 | ||
477 | // Double clicking conflicts with opening/closing the subtree | 479 | // Double clicking conflicts with opening/closing the subtree |
478 | connect( mTodoListView, SIGNAL( doubleClicked( QListViewItem *) ), | 480 | connect( mTodoListView, SIGNAL( doubleClicked( QListViewItem *) ), |
479 | SLOT( editItem( QListViewItem *) ) ); | 481 | SLOT( editItem( QListViewItem *) ) ); |
480 | /* | 482 | /* |
481 | connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *, | 483 | connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *, |
482 | const QPoint &,int ) ), | 484 | const QPoint &,int ) ), |
483 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); | 485 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); |
484 | */ | 486 | */ |
485 | connect( mTodoListView, SIGNAL( contextRequest ( QListViewItem *, | 487 | connect( mTodoListView, SIGNAL( contextRequest ( QListViewItem *, |
486 | const QPoint &,int ) ), | 488 | const QPoint &,int ) ), |
487 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); | 489 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); |
488 | connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ), | 490 | connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ), |
489 | SLOT( itemClicked( QListViewItem * ) ) ); | 491 | SLOT( itemClicked( QListViewItem * ) ) ); |
490 | connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ), | 492 | connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ), |
491 | SLOT( itemDoubleClicked( QListViewItem * ) ) ); | 493 | SLOT( itemDoubleClicked( QListViewItem * ) ) ); |
492 | connect( mTodoListView, SIGNAL( todoDropped( Todo * ) ), | 494 | connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), |
493 | SLOT( updateView() ) ); | 495 | SLOT( updateView() ) ); |
496 | connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), | ||
497 | SLOT( todoModified(Todo *, int) ) ); | ||
494 | connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ), | 498 | connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ), |
495 | SLOT( itemStateChanged( QListViewItem * ) ) ); | 499 | SLOT( itemStateChanged( QListViewItem * ) ) ); |
496 | connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ), | 500 | connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ), |
497 | SLOT( itemStateChanged( QListViewItem * ) ) ); | 501 | SLOT( itemStateChanged( QListViewItem * ) ) ); |
498 | 502 | ||
499 | #if 0 | 503 | #if 0 |
500 | connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)), | 504 | connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)), |
501 | SLOT(selectionChanged(QListViewItem *))); | 505 | SLOT(selectionChanged(QListViewItem *))); |
502 | connect(mTodoListView,SIGNAL(clicked(QListViewItem *)), | 506 | connect(mTodoListView,SIGNAL(clicked(QListViewItem *)), |
503 | SLOT(selectionChanged(QListViewItem *))); | 507 | SLOT(selectionChanged(QListViewItem *))); |
504 | connect(mTodoListView,SIGNAL(pressed(QListViewItem *)), | 508 | connect(mTodoListView,SIGNAL(pressed(QListViewItem *)), |
505 | SLOT(selectionChanged(QListViewItem *))); | 509 | SLOT(selectionChanged(QListViewItem *))); |
506 | #endif | 510 | #endif |
511 | |||
512 | connect( mTodoListView, SIGNAL(reparentTodoSignal( Todo *,Todo * ) ), SIGNAL(reparentTodoSignal( Todo *,Todo * ) )); | ||
513 | connect( mTodoListView, SIGNAL(unparentTodoSignal(Todo *) ), SIGNAL(unparentTodoSignal(Todo *) )); | ||
514 | connect( mTodoListView, SIGNAL( deleteTodo(Todo *) ), SIGNAL(deleteTodoSignal(Todo *) )); | ||
515 | |||
507 | connect( mTodoListView, SIGNAL(selectionChanged() ), | 516 | connect( mTodoListView, SIGNAL(selectionChanged() ), |
508 | SLOT( processSelectionChange() ) ); | 517 | SLOT( processSelectionChange() ) ); |
509 | connect( mQuickAdd, SIGNAL( returnPressed () ), | 518 | connect( mQuickAdd, SIGNAL( returnPressed () ), |
510 | SLOT( addQuickTodo() ) ); | 519 | SLOT( addQuickTodo() ) ); |
511 | 520 | ||
512 | } | 521 | } |
513 | 522 | ||
514 | KOTodoView::~KOTodoView() | 523 | KOTodoView::~KOTodoView() |
515 | { | 524 | { |
516 | delete mDocPrefs; | 525 | delete mDocPrefs; |
517 | } | 526 | } |
518 | 527 | ||
519 | void KOTodoView::jumpToDate () | 528 | void KOTodoView::jumpToDate () |
520 | { | 529 | { |
521 | // if (mActiveItem) { | 530 | // if (mActiveItem) { |
522 | // mActiveItem->todo()); | 531 | // mActiveItem->todo()); |
523 | // if ( mActiveItem->todo()->hasDueDate() ) | 532 | // if ( mActiveItem->todo()->hasDueDate() ) |
524 | // emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() ); | 533 | // emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() ); |
525 | } | 534 | } |
526 | 535 | ||
527 | void KOTodoView::updateView() | 536 | void KOTodoView::updateView() |
528 | { | 537 | { |
529 | pendingSubtodo = 0; | 538 | pendingSubtodo = 0; |
530 | if ( mBlockUpdate ) { | 539 | if ( mBlockUpdate ) { |
531 | //qDebug("blocked "); | 540 | //qDebug("blocked "); |
532 | return; | 541 | return; |
533 | } | 542 | } |
534 | if ( isFlatDisplay ) { | 543 | if ( isFlatDisplay ) { |
535 | setAllFlat(); | 544 | setAllFlat(); |
536 | return; | 545 | return; |
537 | } | 546 | } |
538 | //qDebug("update "); | 547 | //qDebug("update "); |
539 | // kdDebug() << "KOTodoView::updateView()" << endl; | 548 | // kdDebug() << "KOTodoView::updateView()" << endl; |
540 | QFont fo = KOPrefs::instance()->mTodoViewFont; | 549 | QFont fo = KOPrefs::instance()->mTodoViewFont; |
541 | mTodoListView->clear(); | 550 | mTodoListView->clear(); |
542 | if ( mName == "todolistsmall" ) { | 551 | if ( mName == "todolistsmall" ) { |
543 | if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) { | 552 | if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) { |
544 | int ps = fo.pointSize() -2; | 553 | int ps = fo.pointSize() -2; |
545 | if ( ps > 12 ) | 554 | if ( ps > 12 ) |
546 | ps -= 2; | 555 | ps -= 2; |
547 | fo.setPointSize( ps ); | 556 | fo.setPointSize( ps ); |
548 | } | 557 | } |
549 | } | 558 | } |
550 | 559 | ||
551 | mTodoListView->setFont( fo ); | 560 | mTodoListView->setFont( fo ); |
552 | // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont ); | 561 | // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont ); |
553 | //mTodoListView->header()->setMaximumHeight(fm.height()); | 562 | //mTodoListView->header()->setMaximumHeight(fm.height()); |
554 | QPtrList<Todo> todoList = calendar()->todos(); | 563 | QPtrList<Todo> todoList = calendar()->todos(); |
555 | 564 | ||
556 | /* | 565 | /* |
557 | kdDebug() << "KOTodoView::updateView(): Todo List:" << endl; | 566 | kdDebug() << "KOTodoView::updateView(): Todo List:" << endl; |
558 | Event *t; | 567 | Event *t; |
559 | for(t = todoList.first(); t; t = todoList.next()) { | 568 | for(t = todoList.first(); t; t = todoList.next()) { |
560 | kdDebug() << " " << t->getSummary() << endl; | 569 | kdDebug() << " " << t->getSummary() << endl; |
561 | 570 | ||
562 | if (t->getRelatedTo()) { | 571 | if (t->getRelatedTo()) { |
563 | kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl; | 572 | kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl; |
564 | } | 573 | } |
565 | 574 | ||
566 | QPtrList<Event> l = t->getRelations(); | 575 | QPtrList<Event> l = t->getRelations(); |
567 | Event *c; | 576 | Event *c; |
568 | for(c=l.first();c;c=l.next()) { | 577 | for(c=l.first();c;c=l.next()) { |
569 | kdDebug() << " - relation: " << c->getSummary() << endl; | 578 | kdDebug() << " - relation: " << c->getSummary() << endl; |
570 | } | 579 | } |
571 | } | 580 | } |
572 | */ | 581 | */ |
573 | 582 | ||
574 | // Put for each Event a KOTodoViewItem in the list view. Don't rely on a | 583 | // Put for each Event a KOTodoViewItem in the list view. Don't rely on a |
575 | // specific order of events. That means that we have to generate parent items | 584 | // specific order of events. That means that we have to generate parent items |
576 | // recursively for proper hierarchical display of Todos. | 585 | // recursively for proper hierarchical display of Todos. |
577 | mTodoMap.clear(); | 586 | mTodoMap.clear(); |
578 | Todo *todo; | 587 | Todo *todo; |
579 | todo = todoList.first();// todo; todo = todoList.next()) { | 588 | todo = todoList.first();// todo; todo = todoList.next()) { |
580 | while ( todo ) { | 589 | while ( todo ) { |
581 | bool next = true; | 590 | bool next = true; |
582 | // qDebug("todo %s ", todo->summary().latin1()); | 591 | // qDebug("todo %s ", todo->summary().latin1()); |
583 | Incidence *incidence = todo->relatedTo(); | 592 | Incidence *incidence = todo->relatedTo(); |
584 | while ( incidence ) { | 593 | while ( incidence ) { |
585 | if ( incidence->type() == "Todo") { | 594 | if ( incidence->type() == "Todo") { |
586 | //qDebug("related %s ",incidence->summary().latin1() ); | 595 | //qDebug("related %s ",incidence->summary().latin1() ); |
587 | if ( !(todoList.contains ( ((Todo* )incidence ) ) )) { | 596 | if ( !(todoList.contains ( ((Todo* )incidence ) ) )) { |
588 | //qDebug("related not found "); | 597 | //qDebug("related not found "); |
589 | todoList.remove( ); | 598 | todoList.remove( ); |
590 | todo = todoList.current(); | 599 | todo = todoList.current(); |
591 | next = false; | 600 | next = false; |
592 | incidence = 0; | 601 | incidence = 0; |
593 | 602 | ||
594 | } else { | 603 | } else { |
595 | //qDebug("related found "); | 604 | //qDebug("related found "); |
596 | incidence = incidence->relatedTo(); | 605 | incidence = incidence->relatedTo(); |
597 | } | 606 | } |
598 | } else | 607 | } else |
599 | incidence = 0; | 608 | incidence = 0; |
600 | } | 609 | } |
601 | if ( next ) | 610 | if ( next ) |
602 | todo = todoList.next(); | 611 | todo = todoList.next(); |
603 | } | 612 | } |
604 | // qDebug("again .... "); | 613 | // qDebug("again .... "); |
605 | // for(todo = todoList.first(); todo; todo = todoList.next()) { | 614 | // for(todo = todoList.first(); todo; todo = todoList.next()) { |
606 | 615 | ||
607 | // qDebug("yytodo %s ", todo->summary().latin1()); | 616 | // qDebug("yytodo %s ", todo->summary().latin1()); |
608 | // } | 617 | // } |
609 | //qDebug("for "); | 618 | //qDebug("for "); |
610 | for(todo = todoList.first(); todo; todo = todoList.next()) { | 619 | for(todo = todoList.first(); todo; todo = todoList.next()) { |
611 | if (!mTodoMap.contains(todo) && checkTodo( todo ) ) | 620 | if (!mTodoMap.contains(todo) && checkTodo( todo ) ) |
612 | { | 621 | { |
613 | insertTodoItem(todo); | 622 | insertTodoItem(todo); |
614 | } | 623 | } |
615 | } | 624 | } |
616 | //qDebug("for end "); | 625 | //qDebug("for end "); |
617 | // Restore opened/closed state | 626 | // Restore opened/closed state |
618 | mTodoListView->blockSignals( true ); | 627 | mTodoListView->blockSignals( true ); |
619 | if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() ); | 628 | if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() ); |
620 | mTodoListView->blockSignals( false ); | 629 | mTodoListView->blockSignals( false ); |
621 | mTodoListView->setFocus(); | 630 | mTodoListView->setFocus(); |
622 | processSelectionChange(); | 631 | processSelectionChange(); |
623 | } | 632 | } |
624 | 633 | ||
625 | bool KOTodoView::checkTodo( Todo * todo ) | 634 | bool KOTodoView::checkTodo( Todo * todo ) |
626 | { | 635 | { |
627 | 636 | ||
628 | if ( !KOPrefs::instance()->mShowCompletedTodo && todo->isCompleted() ) | 637 | if ( !KOPrefs::instance()->mShowCompletedTodo && todo->isCompleted() ) |
629 | return false; | 638 | return false; |
630 | if ( KOPrefs::instance()->mHideNonStartedTodos && mNavigator ) { | 639 | if ( KOPrefs::instance()->mHideNonStartedTodos && mNavigator ) { |
631 | if ( todo->hasStartDate() ) | 640 | if ( todo->hasStartDate() ) |
632 | if ( mNavigator->selectedDates().last() < todo->dtStart().date() ) | 641 | if ( mNavigator->selectedDates().last() < todo->dtStart().date() ) |
633 | return false; | 642 | return false; |
634 | if ( todo->hasDueDate() ) | 643 | if ( todo->hasDueDate() ) |
diff --git a/korganizer/kotodoview.h b/korganizer/kotodoview.h index f11518d..68e29bb 100644 --- a/korganizer/kotodoview.h +++ b/korganizer/kotodoview.h | |||
@@ -1,244 +1,247 @@ | |||
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 KOTODOVIEW_H | 23 | #ifndef KOTODOVIEW_H |
24 | #define KOTODOVIEW_H | 24 | #define KOTODOVIEW_H |
25 | 25 | ||
26 | #include <qfont.h> | 26 | #include <qfont.h> |
27 | #include <qfontmetrics.h> | 27 | #include <qfontmetrics.h> |
28 | #include <qlineedit.h> | 28 | #include <qlineedit.h> |
29 | #include <qptrlist.h> | 29 | #include <qptrlist.h> |
30 | #include <qstrlist.h> | 30 | #include <qstrlist.h> |
31 | #include <qlistbox.h> | 31 | #include <qlistbox.h> |
32 | #include <qpopupmenu.h> | 32 | #include <qpopupmenu.h> |
33 | #include <qlabel.h> | 33 | #include <qlabel.h> |
34 | #include <qmap.h> | 34 | #include <qmap.h> |
35 | #include <qlistview.h> | 35 | #include <qlistview.h> |
36 | #include <klistview.h> | 36 | #include <klistview.h> |
37 | 37 | ||
38 | #include <libkcal/calendar.h> | 38 | #include <libkcal/calendar.h> |
39 | #include <libkcal/todo.h> | 39 | #include <libkcal/todo.h> |
40 | 40 | ||
41 | #include <korganizer/baseview.h> | 41 | #include <korganizer/baseview.h> |
42 | 42 | ||
43 | #include "kotodoviewitem.h" | 43 | #include "kotodoviewitem.h" |
44 | #include "koprefs.h" | 44 | #include "koprefs.h" |
45 | #include "koglobals.h" | 45 | #include "koglobals.h" |
46 | #include "datenavigator.h" | 46 | #include "datenavigator.h" |
47 | 47 | ||
48 | class QDragEnterEvent; | 48 | class QDragEnterEvent; |
49 | class QDragMoveEvent; | 49 | class QDragMoveEvent; |
50 | class QDragLeaveEvent; | 50 | class QDragLeaveEvent; |
51 | class QDropEvent; | 51 | class QDropEvent; |
52 | 52 | ||
53 | class DocPrefs; | 53 | class DocPrefs; |
54 | 54 | ||
55 | class KOTodoListView : public KListView | 55 | class KOTodoListView : public KListView |
56 | { | 56 | { |
57 | Q_OBJECT | 57 | Q_OBJECT |
58 | public: | 58 | public: |
59 | KOTodoListView(Calendar *,QWidget *parent=0,const char *name=0); | 59 | KOTodoListView(Calendar *,QWidget *parent=0,const char *name=0); |
60 | virtual ~KOTodoListView() {} | 60 | virtual ~KOTodoListView() {} |
61 | 61 | ||
62 | signals: | 62 | signals: |
63 | void todoDropped(Todo *); | 63 | void todoDropped(Todo *, int); |
64 | void double_Clicked(QListViewItem *item); | 64 | void double_Clicked(QListViewItem *item); |
65 | 65 | void reparentTodoSignal( Todo *,Todo * ); | |
66 | void unparentTodoSignal(Todo *); | ||
67 | void deleteTodo( Todo * ); | ||
66 | protected: | 68 | protected: |
67 | void contentsDragEnterEvent(QDragEnterEvent *); | 69 | void contentsDragEnterEvent(QDragEnterEvent *); |
68 | void contentsDragMoveEvent(QDragMoveEvent *); | 70 | void contentsDragMoveEvent(QDragMoveEvent *); |
69 | void contentsDragLeaveEvent(QDragLeaveEvent *); | 71 | void contentsDragLeaveEvent(QDragLeaveEvent *); |
70 | void contentsDropEvent(QDropEvent *); | 72 | void contentsDropEvent(QDropEvent *); |
71 | 73 | ||
72 | void contentsMousePressEvent(QMouseEvent *); | 74 | void contentsMousePressEvent(QMouseEvent *); |
73 | void contentsMouseMoveEvent(QMouseEvent *); | 75 | void contentsMouseMoveEvent(QMouseEvent *); |
74 | void contentsMouseReleaseEvent(QMouseEvent *); | 76 | void contentsMouseReleaseEvent(QMouseEvent *); |
75 | void contentsMouseDoubleClickEvent(QMouseEvent *); | 77 | void contentsMouseDoubleClickEvent(QMouseEvent *); |
76 | 78 | ||
77 | private: | 79 | private: |
80 | bool internalDrop; | ||
78 | QString mName; | 81 | QString mName; |
79 | Calendar *mCalendar; | 82 | Calendar *mCalendar; |
80 | QPoint mPressPos; | 83 | QPoint mPressPos; |
81 | bool mMousePressed; | 84 | bool mMousePressed; |
82 | QListViewItem *mOldCurrent; | 85 | QListViewItem *mOldCurrent; |
83 | void keyPressEvent ( QKeyEvent * ) ; | 86 | void keyPressEvent ( QKeyEvent * ) ; |
84 | }; | 87 | }; |
85 | 88 | ||
86 | 89 | ||
87 | /** | 90 | /** |
88 | This is the line-edit on top of the todoview for fast addition of new todos | 91 | This is the line-edit on top of the todoview for fast addition of new todos |
89 | */ | 92 | */ |
90 | class KOQuickTodo : public QLineEdit | 93 | class KOQuickTodo : public QLineEdit |
91 | { | 94 | { |
92 | public: | 95 | public: |
93 | KOQuickTodo(QWidget *parent=0); | 96 | KOQuickTodo(QWidget *parent=0); |
94 | protected: | 97 | protected: |
95 | void focusInEvent(QFocusEvent *ev); | 98 | void focusInEvent(QFocusEvent *ev); |
96 | void focusOutEvent(QFocusEvent *ev); | 99 | void focusOutEvent(QFocusEvent *ev); |
97 | }; | 100 | }; |
98 | 101 | ||
99 | 102 | ||
100 | /** | 103 | /** |
101 | This class provides a multi-column list view of todo events. | 104 | This class provides a multi-column list view of todo events. |
102 | 105 | ||
103 | @short multi-column list view of todo events. | 106 | @short multi-column list view of todo events. |
104 | @author Cornelius Schumacher <schumacher@kde.org> | 107 | @author Cornelius Schumacher <schumacher@kde.org> |
105 | */ | 108 | */ |
106 | class KOTodoView : public KOrg::BaseView | 109 | class KOTodoView : public KOrg::BaseView |
107 | { | 110 | { |
108 | Q_OBJECT | 111 | Q_OBJECT |
109 | public: | 112 | public: |
110 | KOTodoView(Calendar *, QWidget* parent=0, const char* name=0 ); | 113 | KOTodoView(Calendar *, QWidget* parent=0, const char* name=0 ); |
111 | ~KOTodoView(); | 114 | ~KOTodoView(); |
112 | 115 | ||
113 | QPtrList<Incidence> selectedIncidences(); | 116 | QPtrList<Incidence> selectedIncidences(); |
114 | QPtrList<Todo> selectedTodos(); | 117 | QPtrList<Todo> selectedTodos(); |
115 | 118 | ||
116 | DateList selectedDates() | 119 | DateList selectedDates() |
117 | {DateList q; | 120 | {DateList q; |
118 | return q;} | 121 | return q;} |
119 | 122 | ||
120 | /** Return number of shown dates. TodoView does not show dates, */ | 123 | /** Return number of shown dates. TodoView does not show dates, */ |
121 | int currentDateCount() { return 0; } | 124 | int currentDateCount() { return 0; } |
122 | 125 | ||
123 | void printPreview(CalPrinter *calPrinter, const QDate &fd, const QDate &td); | 126 | void printPreview(CalPrinter *calPrinter, const QDate &fd, const QDate &td); |
124 | 127 | ||
125 | void setDocumentId( const QString & ); | 128 | void setDocumentId( const QString & ); |
126 | 129 | ||
127 | void saveLayout(KConfig *config, const QString &group) const; | 130 | void saveLayout(KConfig *config, const QString &group) const; |
128 | void restoreLayout(KConfig *config, const QString &group); | 131 | void restoreLayout(KConfig *config, const QString &group); |
129 | /** Create a popup menu to set categories */ | 132 | /** Create a popup menu to set categories */ |
130 | QPopupMenu *getCategoryPopupMenu (KOTodoViewItem *todoItem); | 133 | QPopupMenu *getCategoryPopupMenu (KOTodoViewItem *todoItem); |
131 | void setNavigator( DateNavigator* nav ) {mNavigator = nav;} | 134 | void setNavigator( DateNavigator* nav ) {mNavigator = nav;} |
132 | 135 | ||
133 | public slots: | 136 | public slots: |
134 | void updateView(); | 137 | void updateView(); |
135 | void updateConfig(); | 138 | void updateConfig(); |
136 | 139 | ||
137 | void changeEventDisplay(Event *, int); | 140 | void changeEventDisplay(Event *, int); |
138 | 141 | ||
139 | void showDates(const QDate &start, const QDate &end); | 142 | void showDates(const QDate &start, const QDate &end); |
140 | void showEvents(QPtrList<Event> eventList); | 143 | void showEvents(QPtrList<Event> eventList); |
141 | 144 | ||
142 | void clearSelection(); | 145 | void clearSelection(); |
143 | void jumpToDate (); | 146 | void jumpToDate (); |
144 | 147 | ||
145 | void editItem(QListViewItem *item); | 148 | void editItem(QListViewItem *item); |
146 | void showItem(QListViewItem *item,const QPoint &,int); | 149 | void showItem(QListViewItem *item,const QPoint &,int); |
147 | void popupMenu(QListViewItem *item,const QPoint &,int); | 150 | void popupMenu(QListViewItem *item,const QPoint &,int); |
148 | void newTodo(); | 151 | void newTodo(); |
149 | void newSubTodo(); | 152 | void newSubTodo(); |
150 | void unparentTodo(); | 153 | void unparentTodo(); |
151 | void reparentTodo(); | 154 | void reparentTodo(); |
152 | void showTodo(); | 155 | void showTodo(); |
153 | void editTodo(); | 156 | void editTodo(); |
154 | void cloneTodo(); | 157 | void cloneTodo(); |
155 | void cancelTodo(); | 158 | void cancelTodo(); |
156 | void moveTodo(); | 159 | void moveTodo(); |
157 | void beamTodo(); | 160 | void beamTodo(); |
158 | void deleteTodo(); | 161 | void deleteTodo(); |
159 | 162 | ||
160 | void setNewPriority(int); | 163 | void setNewPriority(int); |
161 | void setNewPercentage(int); | 164 | void setNewPercentage(int); |
162 | void changedCategories(int); | 165 | void changedCategories(int); |
163 | 166 | ||
164 | void setAllOpen(); | 167 | void setAllOpen(); |
165 | void setAllClose(); | 168 | void setAllClose(); |
166 | void setAllFlat(); | 169 | void setAllFlat(); |
167 | 170 | ||
168 | void purgeCompleted(); | 171 | void purgeCompleted(); |
169 | void toggleCompleted(); | 172 | void toggleCompleted(); |
170 | void toggleRunning(); | 173 | void toggleRunning(); |
171 | void toggleQuickTodo(); | 174 | void toggleQuickTodo(); |
172 | void updateTodo( Todo *, int ); | 175 | void updateTodo( Todo *, int ); |
173 | 176 | ||
174 | void itemClicked(QListViewItem *); | 177 | void itemClicked(QListViewItem *); |
175 | void itemStateChanged(QListViewItem *); | 178 | void itemStateChanged(QListViewItem *); |
176 | void modified(bool); | 179 | void modified(bool); |
177 | void itemDoubleClicked(QListViewItem *item); | 180 | void itemDoubleClicked(QListViewItem *item); |
178 | 181 | ||
179 | signals: | 182 | signals: |
180 | void newTodoSignal(); | 183 | void newTodoSignal(); |
181 | void newSubTodoSignal(Todo *); | 184 | void newSubTodoSignal(Todo *); |
182 | void unparentTodoSignal(Todo *); | 185 | void unparentTodoSignal(Todo *); |
183 | void reparentTodoSignal( Todo *,Todo * ); | 186 | void reparentTodoSignal( Todo *,Todo * ); |
184 | void showTodoSignal(Todo *); | 187 | void showTodoSignal(Todo *); |
185 | 188 | ||
186 | void editTodoSignal(Todo *); | 189 | void editTodoSignal(Todo *); |
187 | void deleteTodoSignal(Todo *); | 190 | void deleteTodoSignal(Todo *); |
188 | void todoModifiedSignal (Todo *, int); | 191 | void todoModifiedSignal (Todo *, int); |
189 | 192 | ||
190 | void isModified(bool); | 193 | void isModified(bool); |
191 | void cloneTodoSignal( Incidence * ); | 194 | void cloneTodoSignal( Incidence * ); |
192 | void cancelTodoSignal( Incidence * ); | 195 | void cancelTodoSignal( Incidence * ); |
193 | void moveTodoSignal( Incidence * ); | 196 | void moveTodoSignal( Incidence * ); |
194 | void beamTodoSignal( Incidence * ); | 197 | void beamTodoSignal( Incidence * ); |
195 | void purgeCompletedSignal(); | 198 | void purgeCompletedSignal(); |
196 | 199 | ||
197 | protected slots: | 200 | protected slots: |
198 | void processSelectionChange(); | 201 | void processSelectionChange(); |
199 | void addQuickTodo(); | 202 | void addQuickTodo(); |
203 | void setTodoModified( Todo* ); | ||
204 | void todoModified(Todo *, int ); | ||
200 | 205 | ||
201 | private: | 206 | private: |
202 | /* | 207 | /* |
203 | * the TodoEditor approach is rather unscaling in the long | 208 | * the TodoEditor approach is rather unscaling in the long |
204 | * run. | 209 | * run. |
205 | * Korganizer keeps it in memory and we need to update | 210 | * Korganizer keeps it in memory and we need to update |
206 | * 1. make KOTodoViewItem a QObject again? | 211 | * 1. make KOTodoViewItem a QObject again? |
207 | * 2. add a public method for setting one todo modified? | 212 | * 2. add a public method for setting one todo modified? |
208 | * 3. add a private method for setting a todo modified + friend here? | 213 | * 3. add a private method for setting a todo modified + friend here? |
209 | * -- zecke 2002-07-08 | 214 | * -- zecke 2002-07-08 |
210 | */ | 215 | */ |
211 | friend class KOTodoViewItem; | 216 | friend class KOTodoViewItem; |
212 | void setTodoModified( Todo* ); | ||
213 | QMap<Todo *,KOTodoViewItem *>::ConstIterator insertTodoItem(Todo *todo); | 217 | QMap<Todo *,KOTodoViewItem *>::ConstIterator insertTodoItem(Todo *todo); |
214 | void restoreItemState( QListViewItem * ); | 218 | void restoreItemState( QListViewItem * ); |
215 | 219 | ||
216 | bool checkTodo( Todo * ); | 220 | bool checkTodo( Todo * ); |
217 | bool isFlatDisplay; | 221 | bool isFlatDisplay; |
218 | void setOpen( QListViewItem*, bool setOpen); | 222 | void setOpen( QListViewItem*, bool setOpen); |
219 | KOTodoListView *mTodoListView; | 223 | KOTodoListView *mTodoListView; |
220 | QPopupMenu *mItemPopupMenu; | 224 | QPopupMenu *mItemPopupMenu; |
221 | QPopupMenu *mPopupMenu; | 225 | QPopupMenu *mPopupMenu; |
222 | QPopupMenu *mPriorityPopupMenu; | 226 | QPopupMenu *mPriorityPopupMenu; |
223 | QPopupMenu *mPercentageCompletedPopupMenu; | 227 | QPopupMenu *mPercentageCompletedPopupMenu; |
224 | QPopupMenu *mCategoryPopupMenu; | 228 | QPopupMenu *mCategoryPopupMenu; |
225 | 229 | ||
226 | QMap<int, int> mPercentage; | 230 | QMap<int, int> mPercentage; |
227 | QMap<int, int> mPriority; | 231 | QMap<int, int> mPriority; |
228 | QMap<int, QString> mCategory; | 232 | QMap<int, QString> mCategory; |
229 | KOTodoViewItem *mActiveItem; | 233 | KOTodoViewItem *mActiveItem; |
230 | 234 | ||
231 | QMap<Todo *,KOTodoViewItem *> mTodoMap; | 235 | QMap<Todo *,KOTodoViewItem *> mTodoMap; |
232 | QString mName; | 236 | QString mName; |
233 | 237 | ||
234 | DocPrefs *mDocPrefs; | 238 | DocPrefs *mDocPrefs; |
235 | QString mCurrentDoc; | 239 | QString mCurrentDoc; |
236 | KOQuickTodo *mQuickAdd; | 240 | KOQuickTodo *mQuickAdd; |
237 | bool mBlockUpdate; | 241 | bool mBlockUpdate; |
238 | void todoModified(Todo *, int ); | ||
239 | void keyPressEvent ( QKeyEvent * ) ; | 242 | void keyPressEvent ( QKeyEvent * ) ; |
240 | KOTodoViewItem * pendingSubtodo; | 243 | KOTodoViewItem * pendingSubtodo; |
241 | DateNavigator* mNavigator; | 244 | DateNavigator* mNavigator; |
242 | }; | 245 | }; |
243 | 246 | ||
244 | #endif | 247 | #endif |
diff --git a/libkcal/dndfactory.cpp b/libkcal/dndfactory.cpp new file mode 100644 index 0000000..cdcfae4 --- a/dev/null +++ b/libkcal/dndfactory.cpp | |||
@@ -0,0 +1,186 @@ | |||
1 | /* | ||
2 | This file is part of libkcal. | ||
3 | Copyright (c) 1998 Preston Brwon | ||
4 | Copyright (c) 2001,2002 Cornelius Schumacher <schumacher@kde.org> | ||
5 | Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com> | ||
6 | |||
7 | This library is free software; you can redistribute it and/or | ||
8 | modify it under the terms of the GNU Library General Public | ||
9 | License as published by the Free Software Foundation; either | ||
10 | version 2 of the License, or (at your option) any later version. | ||
11 | |||
12 | This library is distributed in the hope that it will be useful, | ||
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
15 | Library General Public License for more details. | ||
16 | |||
17 | You should have received a copy of the GNU Library General Public License | ||
18 | along with this library; see the file COPYING.LIB. If not, write to | ||
19 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
20 | Boston, MA 02111-1307, USA. | ||
21 | */ | ||
22 | |||
23 | #include <qapplication.h> | ||
24 | #include <qclipboard.h> | ||
25 | |||
26 | #include <kiconloader.h> | ||
27 | #include <kdebug.h> | ||
28 | #include <kmessagebox.h> | ||
29 | #include <klocale.h> | ||
30 | |||
31 | #include "vcaldrag.h" | ||
32 | #include "icaldrag.h" | ||
33 | #include "calendar.h" | ||
34 | #include "vcalformat.h" | ||
35 | #include "icalformat.h" | ||
36 | #include "calendarlocal.h" | ||
37 | |||
38 | #include "dndfactory.h" | ||
39 | |||
40 | using namespace KCal; | ||
41 | |||
42 | DndFactory::DndFactory( Calendar *cal ) : | ||
43 | mCalendar( cal ) | ||
44 | { | ||
45 | } | ||
46 | |||
47 | ICalDrag *DndFactory::createDrag( Incidence *incidence, QWidget *owner ) | ||
48 | { | ||
49 | CalendarLocal cal( mCalendar->timeZoneId() ); | ||
50 | Incidence *i = incidence->clone(); | ||
51 | cal.addIncidence( i ); | ||
52 | |||
53 | ICalDrag *icd = new ICalDrag( &cal, owner ); | ||
54 | if ( i->type() == "Event" ) | ||
55 | icd->setPixmap( BarIcon( "appointment" ) ); | ||
56 | else if ( i->type() == "Todo" ) | ||
57 | icd->setPixmap( BarIcon( "todo" ) ); | ||
58 | |||
59 | return icd; | ||
60 | } | ||
61 | |||
62 | Event *DndFactory::createDrop(QDropEvent *de) | ||
63 | { | ||
64 | kdDebug(5800) << "DndFactory::createDrop()" << endl; | ||
65 | |||
66 | CalendarLocal cal( mCalendar->timeZoneId() ); | ||
67 | |||
68 | if ( ICalDrag::decode( de, &cal ) || VCalDrag::decode( de, &cal ) ) { | ||
69 | de->accept(); | ||
70 | |||
71 | QPtrList<Event> events = cal.events(); | ||
72 | if ( !events.isEmpty() ) { | ||
73 | Event *event = new Event( *events.first() ); | ||
74 | return event; | ||
75 | } | ||
76 | } | ||
77 | |||
78 | return 0; | ||
79 | } | ||
80 | |||
81 | Todo *DndFactory::createDropTodo(QDropEvent *de) | ||
82 | { | ||
83 | kdDebug(5800) << "VCalFormat::createDropTodo()" << endl; | ||
84 | |||
85 | CalendarLocal cal( mCalendar->timeZoneId() ); | ||
86 | |||
87 | if ( ICalDrag::decode( de, &cal ) || VCalDrag::decode( de, &cal ) ) { | ||
88 | de->accept(); | ||
89 | |||
90 | QPtrList<Todo> todos = cal.todos(); | ||
91 | if ( !todos.isEmpty() ) { | ||
92 | Todo *todo = new Todo( *todos.first() ); | ||
93 | return todo; | ||
94 | } | ||
95 | } | ||
96 | |||
97 | return 0; | ||
98 | } | ||
99 | |||
100 | |||
101 | void DndFactory::cutIncidence( Incidence *selectedInc ) | ||
102 | { | ||
103 | if ( copyIncidence( selectedInc ) ) { | ||
104 | mCalendar->deleteIncidence( selectedInc ); | ||
105 | } | ||
106 | } | ||
107 | |||
108 | bool DndFactory::copyIncidence( Incidence *selectedInc ) | ||
109 | { | ||
110 | if ( !selectedInc ) | ||
111 | return false; | ||
112 | QClipboard *cb = QApplication::clipboard(); | ||
113 | |||
114 | CalendarLocal cal( mCalendar->timeZoneId() ); | ||
115 | Incidence *inc = selectedInc->clone(); | ||
116 | cal.addIncidence( inc ); | ||
117 | cb->setData( new ICalDrag( &cal ) ); | ||
118 | |||
119 | return true; | ||
120 | } | ||
121 | |||
122 | Incidence *DndFactory::pasteIncidence(const QDate &newDate, const QTime *newTime) | ||
123 | { | ||
124 | // kdDebug(5800) << "DnDFactory::pasteEvent()" << endl; | ||
125 | |||
126 | CalendarLocal cal( mCalendar->timeZoneId() ); | ||
127 | |||
128 | QClipboard *cb = QApplication::clipboard(); | ||
129 | |||
130 | if ( !ICalDrag::decode( cb->data(), &cal ) && | ||
131 | !VCalDrag::decode( cb->data(), &cal ) ) { | ||
132 | kdDebug(5800) << "Can't parse clipboard" << endl; | ||
133 | return 0; | ||
134 | } | ||
135 | |||
136 | QPtrList<Incidence> incList = cal.incidences(); | ||
137 | Incidence *inc = incList.first(); | ||
138 | |||
139 | if ( !incList.isEmpty() && inc ) { | ||
140 | inc = inc->clone(); | ||
141 | |||
142 | inc->recreate(); | ||
143 | |||
144 | if ( inc->type() == "Event" ) { | ||
145 | |||
146 | Event *anEvent = static_cast<Event*>( inc ); | ||
147 | // Calculate length of event | ||
148 | int daysOffset = anEvent->dtStart().date().daysTo( | ||
149 | anEvent->dtEnd().date() ); | ||
150 | // new end date if event starts at the same time on the new day | ||
151 | QDateTime endDate( newDate.addDays(daysOffset), anEvent->dtEnd().time() ); | ||
152 | |||
153 | if ( newTime ) { | ||
154 | // additional offset for new time of day | ||
155 | int addSecsOffset( anEvent->dtStart().time().secsTo( *newTime )); | ||
156 | endDate=endDate.addSecs( addSecsOffset ); | ||
157 | anEvent->setDtStart( QDateTime( newDate, *newTime ) ); | ||
158 | } else { | ||
159 | anEvent->setDtStart( QDateTime( newDate, anEvent->dtStart().time() ) ); | ||
160 | } | ||
161 | anEvent->setDtEnd( endDate ); | ||
162 | |||
163 | } else if ( inc->type() == "Todo" ) { | ||
164 | Todo *anTodo = static_cast<Todo*>( inc ); | ||
165 | if ( newTime ) { | ||
166 | anTodo->setDtDue( QDateTime( newDate, *newTime ) ); | ||
167 | } else { | ||
168 | anTodo->setDtDue( QDateTime( newDate, anTodo->dtDue().time() ) ); | ||
169 | } | ||
170 | } else if ( inc->type() == "Journal" ) { | ||
171 | Journal *anJournal = static_cast<Journal*>( inc ); | ||
172 | if ( newTime ) { | ||
173 | anJournal->setDtStart( QDateTime( newDate, *newTime ) ); | ||
174 | } else { | ||
175 | anJournal->setDtStart( QDateTime( newDate ) ); | ||
176 | } | ||
177 | } else { | ||
178 | kdDebug(5850) << "Trying to paste unknown incidence of type " << inc->type() << endl; | ||
179 | } | ||
180 | |||
181 | return inc; | ||
182 | |||
183 | } | ||
184 | |||
185 | return 0; | ||
186 | } | ||
diff --git a/libkcal/dndfactory.h b/libkcal/dndfactory.h index 6b73f34..7e2ca04 100644 --- a/libkcal/dndfactory.h +++ b/libkcal/dndfactory.h | |||
@@ -1,62 +1,74 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkcal. | 2 | This file is part of libkcal. |
3 | |||
3 | Copyright (c) 1998 Preston Brown | 4 | Copyright (c) 1998 Preston Brown |
4 | Copyright (c) 2001,2002 Cornelius Schumacher <schumacher@kde.org> | 5 | Copyright (c) 2001,2002,2003 Cornelius Schumacher <schumacher@kde.org> |
6 | Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com> | ||
5 | 7 | ||
6 | This library is free software; you can redistribute it and/or | 8 | This library is free software; you can redistribute it and/or |
7 | modify it under the terms of the GNU Library General Public | 9 | modify it under the terms of the GNU Library General Public |
8 | License as published by the Free Software Foundation; either | 10 | License as published by the Free Software Foundation; either |
9 | version 2 of the License, or (at your option) any later version. | 11 | version 2 of the License, or (at your option) any later version. |
10 | 12 | ||
11 | This library is distributed in the hope that it will be useful, | 13 | This library is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | Library General Public License for more details. | 16 | Library General Public License for more details. |
15 | 17 | ||
16 | You should have received a copy of the GNU Library General Public License | 18 | You should have received a copy of the GNU Library General Public License |
17 | along with this library; see the file COPYING.LIB. If not, write to | 19 | along with this library; see the file COPYING.LIB. If not, write to |
18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 20 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
19 | Boston, MA 02111-1307, USA. | 21 | Boston, MA 02111-1307, USA. |
20 | */ | 22 | */ |
21 | 23 | ||
22 | // $Id$ | ||
23 | |||
24 | #ifndef KCAL_DNDFACTORY_H | 24 | #ifndef KCAL_DNDFACTORY_H |
25 | #define KCAL_DNDFACTORY_H | 25 | #define KCAL_DNDFACTORY_H |
26 | 26 | ||
27 | #include "vcalformat.h" | 27 | //#include "libkcal_export.h" |
28 | |||
29 | class QDropEvent; | ||
30 | 28 | ||
31 | namespace KCal { | 29 | namespace KCal { |
32 | 30 | ||
31 | class ICalDrag; | ||
32 | class Event; | ||
33 | class Todo; | ||
34 | class Calendar; | ||
35 | #define LIBKCAL_EXPORT | ||
36 | |||
33 | /** | 37 | /** |
34 | This class implements functions to create Drag and Drop objects used for | 38 | This class implements functions to create Drag and Drop objects used for |
35 | Drag-and-Drop and Copy-and-Paste. | 39 | Drag-and-Drop and Copy-and-Paste. |
36 | 40 | ||
37 | @short vCalendar Drag-and-Drop object factory. | 41 | @short vCalendar/iCalendar Drag-and-Drop object factory. |
38 | */ | 42 | */ |
39 | class DndFactory { | 43 | class LIBKCAL_EXPORT DndFactory |
44 | { | ||
40 | public: | 45 | public: |
41 | DndFactory( Calendar * ) {} | 46 | DndFactory( Calendar * ); |
47 | |||
48 | /** | ||
49 | Create a drag object. | ||
50 | */ | ||
51 | ICalDrag *createDrag( Incidence *incidence, QWidget *owner ); | ||
42 | 52 | ||
43 | /** create an object to be used with the Xdnd Drag And Drop protocol. */ | ||
44 | ICalDrag *createDrag(Event *, QWidget *) { return 0; } | ||
45 | /** create an object to be used with the Xdnd Drag And Drop protocol. */ | ||
46 | ICalDrag *createDragTodo(Todo *, QWidget *) { return 0; } | ||
47 | /** Create Todo object from drop event */ | 53 | /** Create Todo object from drop event */ |
48 | Todo *createDropTodo(QDropEvent *) { return 0; } | 54 | Todo *createDropTodo(QDropEvent *de); |
49 | /** Create Event object from drop event */ | 55 | /** Create Event object from drop event */ |
50 | Event *createDrop(QDropEvent *) { return 0; } | 56 | Event *createDrop(QDropEvent *de); |
51 | 57 | ||
52 | /** cut event to clipboard */ | 58 | /** cut incidence to clipboard */ |
53 | void cutEvent(Event *) {} | 59 | void cutIncidence( Incidence * ); |
54 | /** cut, copy, and paste operations follow. */ | 60 | /** copy the incidence to clipboard */ |
55 | bool copyEvent(Event *) { return false; } | 61 | bool copyIncidence( Incidence * ); |
56 | /** pastes the event and returns a pointer to the new event pasted. */ | 62 | /** pastes the event or todo and returns a pointer to the new incidence pasted. */ |
57 | Event *pasteEvent(const QDate &, const QTime *newTime = 0) { return 0; } | 63 | Incidence *pasteIncidence( const QDate &, const QTime *newTime = 0 ); |
64 | |||
65 | private: | ||
66 | Calendar *mCalendar; | ||
67 | |||
68 | class Private; | ||
69 | Private *d; | ||
58 | }; | 70 | }; |
59 | 71 | ||
60 | } | 72 | } |
61 | 73 | ||
62 | #endif | 74 | #endif |
diff --git a/libkcal/dndfactory_dummy.h b/libkcal/dndfactory_dummy.h new file mode 100644 index 0000000..6b73f34 --- a/dev/null +++ b/libkcal/dndfactory_dummy.h | |||
@@ -0,0 +1,62 @@ | |||
1 | /* | ||
2 | This file is part of libkcal. | ||
3 | Copyright (c) 1998 Preston Brown | ||
4 | Copyright (c) 2001,2002 Cornelius Schumacher <schumacher@kde.org> | ||
5 | |||
6 | This library is free software; you can redistribute it and/or | ||
7 | modify it under the terms of the GNU Library General Public | ||
8 | License as published by the Free Software Foundation; either | ||
9 | version 2 of the License, or (at your option) any later version. | ||
10 | |||
11 | This library is distributed in the hope that it will be useful, | ||
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
14 | Library General Public License for more details. | ||
15 | |||
16 | You should have received a copy of the GNU Library General Public License | ||
17 | along with this library; see the file COPYING.LIB. If not, write to | ||
18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
19 | Boston, MA 02111-1307, USA. | ||
20 | */ | ||
21 | |||
22 | // $Id$ | ||
23 | |||
24 | #ifndef KCAL_DNDFACTORY_H | ||
25 | #define KCAL_DNDFACTORY_H | ||
26 | |||
27 | #include "vcalformat.h" | ||
28 | |||
29 | class QDropEvent; | ||
30 | |||
31 | namespace KCal { | ||
32 | |||
33 | /** | ||
34 | This class implements functions to create Drag and Drop objects used for | ||
35 | Drag-and-Drop and Copy-and-Paste. | ||
36 | |||
37 | @short vCalendar Drag-and-Drop object factory. | ||
38 | */ | ||
39 | class DndFactory { | ||
40 | public: | ||
41 | DndFactory( Calendar * ) {} | ||
42 | |||
43 | /** create an object to be used with the Xdnd Drag And Drop protocol. */ | ||
44 | ICalDrag *createDrag(Event *, QWidget *) { return 0; } | ||
45 | /** create an object to be used with the Xdnd Drag And Drop protocol. */ | ||
46 | ICalDrag *createDragTodo(Todo *, QWidget *) { return 0; } | ||
47 | /** Create Todo object from drop event */ | ||
48 | Todo *createDropTodo(QDropEvent *) { return 0; } | ||
49 | /** Create Event object from drop event */ | ||
50 | Event *createDrop(QDropEvent *) { return 0; } | ||
51 | |||
52 | /** cut event to clipboard */ | ||
53 | void cutEvent(Event *) {} | ||
54 | /** cut, copy, and paste operations follow. */ | ||
55 | bool copyEvent(Event *) { return false; } | ||
56 | /** pastes the event and returns a pointer to the new event pasted. */ | ||
57 | Event *pasteEvent(const QDate &, const QTime *newTime = 0) { return 0; } | ||
58 | }; | ||
59 | |||
60 | } | ||
61 | |||
62 | #endif | ||
diff --git a/libkcal/libkcal.pro b/libkcal/libkcal.pro index 171c726..33c63c3 100644 --- a/libkcal/libkcal.pro +++ b/libkcal/libkcal.pro | |||
@@ -1,106 +1,108 @@ | |||
1 | TEMPLATE= lib | 1 | TEMPLATE= lib |
2 | CONFIG += qt warn_on | 2 | CONFIG += qt warn_on |
3 | TARGET = microkcal | 3 | TARGET = microkcal |
4 | 4 | ||
5 | include( ../variables.pri ) | 5 | include( ../variables.pri ) |
6 | 6 | ||
7 | INCLUDEPATH += ../libkdepim ../microkde versit ../microkde/kdecore | 7 | INCLUDEPATH += ../libkdepim ../microkde versit ../microkde/kdecore |
8 | #../qtcompat | 8 | #../qtcompat |
9 | INCLUDEPATH += ../libical/src/libical | 9 | INCLUDEPATH += ../libical/src/libical |
10 | INCLUDEPATH += ../libical/src/libicalss | 10 | INCLUDEPATH += ../libical/src/libicalss |
11 | DESTDIR = ../bin | 11 | DESTDIR = ../bin |
12 | DEFINES += DESKTOP_VERSION | 12 | DEFINES += DESKTOP_VERSION |
13 | unix: { | 13 | unix: { |
14 | LIBS += ../libical/lib/libical.a | 14 | LIBS += ../libical/lib/libical.a |
15 | LIBS += ../libical/lib/libicalss.a | 15 | LIBS += ../libical/lib/libicalss.a |
16 | OBJECTS_DIR = obj/unix | 16 | OBJECTS_DIR = obj/unix |
17 | MOC_DIR = moc/unix | 17 | MOC_DIR = moc/unix |
18 | } | 18 | } |
19 | win32: { | 19 | win32: { |
20 | DEFINES += _WIN32_ | 20 | DEFINES += _WIN32_ |
21 | 21 | ||
22 | LIBS += ../libical/lib/ical.lib | 22 | LIBS += ../libical/lib/ical.lib |
23 | LIBS += ../libical/lib/icalss.lib | 23 | LIBS += ../libical/lib/icalss.lib |
24 | OBJECTS_DIR = obj/win | 24 | OBJECTS_DIR = obj/win |
25 | MOC_DIR = moc/win | 25 | MOC_DIR = moc/win |
26 | 26 | ||
27 | } | 27 | } |
28 | 28 | ||
29 | INTERFACES = \ | 29 | INTERFACES = \ |
30 | 30 | ||
31 | HEADERS = \ | 31 | HEADERS = \ |
32 | alarm.h \ | 32 | alarm.h \ |
33 | attachment.h \ | 33 | attachment.h \ |
34 | attendee.h \ | 34 | attendee.h \ |
35 | calendar.h \ | 35 | calendar.h \ |
36 | calendarlocal.h \ | 36 | calendarlocal.h \ |
37 | calfilter.h \ | 37 | calfilter.h \ |
38 | calformat.h \ | 38 | calformat.h \ |
39 | calstorage.h \ | 39 | calstorage.h \ |
40 | compat.h \ | 40 | compat.h \ |
41 | customproperties.h \ | 41 | customproperties.h \ |
42 | dummyscheduler.h \ | 42 | dummyscheduler.h \ |
43 | kincidenceformatter.h \ | 43 | kincidenceformatter.h \ |
44 | duration.h \ | 44 | duration.h \ |
45 | event.h \ | 45 | event.h \ |
46 | exceptions.h \ | 46 | exceptions.h \ |
47 | filestorage.h \ | 47 | filestorage.h \ |
48 | freebusy.h \ | 48 | freebusy.h \ |
49 | icaldrag.h \ | 49 | icaldrag.h \ |
50 | icalformat.h \ | 50 | icalformat.h \ |
51 | icalformatimpl.h \ | 51 | icalformatimpl.h \ |
52 | imipscheduler.h \ | 52 | imipscheduler.h \ |
53 | incidence.h \ | 53 | incidence.h \ |
54 | incidencebase.h \ | 54 | incidencebase.h \ |
55 | journal.h \ | 55 | journal.h \ |
56 | period.h \ | 56 | period.h \ |
57 | person.h \ | 57 | person.h \ |
58 | qtopiaformat.h \ | 58 | qtopiaformat.h \ |
59 | recurrence.h \ | 59 | recurrence.h \ |
60 | scheduler.h \ | 60 | scheduler.h \ |
61 | todo.h \ | 61 | todo.h \ |
62 | dndfactory.h \ | ||
62 | vcaldrag.h \ | 63 | vcaldrag.h \ |
63 | vcalformat.h \ | 64 | vcalformat.h \ |
64 | versit/port.h \ | 65 | versit/port.h \ |
65 | versit/vcc.h \ | 66 | versit/vcc.h \ |
66 | versit/vobject.h \ | 67 | versit/vobject.h \ |
67 | phoneformat.h \ | 68 | phoneformat.h \ |
68 | 69 | ||
69 | 70 | ||
70 | 71 | ||
71 | SOURCES = \ | 72 | SOURCES = \ |
72 | alarm.cpp \ | 73 | alarm.cpp \ |
73 | attachment.cpp \ | 74 | attachment.cpp \ |
74 | attendee.cpp \ | 75 | attendee.cpp \ |
75 | calendar.cpp \ | 76 | calendar.cpp \ |
76 | calendarlocal.cpp \ | 77 | calendarlocal.cpp \ |
77 | calfilter.cpp \ | 78 | calfilter.cpp \ |
78 | calformat.cpp \ | 79 | calformat.cpp \ |
79 | compat.cpp \ | 80 | compat.cpp \ |
80 | customproperties.cpp \ | 81 | customproperties.cpp \ |
81 | dummyscheduler.cpp \ | 82 | dummyscheduler.cpp \ |
82 | kincidenceformatter.cpp \ | 83 | kincidenceformatter.cpp \ |
83 | duration.cpp \ | 84 | duration.cpp \ |
84 | event.cpp \ | 85 | event.cpp \ |
85 | exceptions.cpp \ | 86 | exceptions.cpp \ |
86 | filestorage.cpp \ | 87 | filestorage.cpp \ |
87 | freebusy.cpp \ | 88 | freebusy.cpp \ |
88 | icaldrag.cpp \ | 89 | icaldrag.cpp \ |
89 | icalformat.cpp \ | 90 | icalformat.cpp \ |
90 | icalformatimpl.cpp \ | 91 | icalformatimpl.cpp \ |
91 | imipscheduler.cpp \ | 92 | imipscheduler.cpp \ |
92 | incidence.cpp \ | 93 | incidence.cpp \ |
93 | incidencebase.cpp \ | 94 | incidencebase.cpp \ |
94 | journal.cpp \ | 95 | journal.cpp \ |
95 | period.cpp \ | 96 | period.cpp \ |
96 | person.cpp \ | 97 | person.cpp \ |
97 | qtopiaformat.cpp \ | 98 | qtopiaformat.cpp \ |
98 | recurrence.cpp \ | 99 | recurrence.cpp \ |
99 | scheduler.cpp \ | 100 | scheduler.cpp \ |
100 | todo.cpp \ | 101 | todo.cpp \ |
102 | dndfactory.cpp \ | ||
101 | vcaldrag.cpp \ | 103 | vcaldrag.cpp \ |
102 | vcalformat.cpp \ | 104 | vcalformat.cpp \ |
103 | versit/vcc.c \ | 105 | versit/vcc.c \ |
104 | versit/vobject.c \ | 106 | versit/vobject.c \ |
105 | phoneformat.cpp \ | 107 | phoneformat.cpp \ |
106 | 108 | ||