author | zautrix <zautrix> | 2005-01-29 23:23:11 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-01-29 23:23:11 (UTC) |
commit | d94b52aa95cc52aa1bef7c9cd99f43c725ed8042 (patch) (unidiff) | |
tree | 9443dfbc790a76e5d707ce762e075cdb21096f50 | |
parent | 74c808f288bf81bc68c92a377ce64953603c2d40 (diff) | |
download | kdepimpi-d94b52aa95cc52aa1bef7c9cd99f43c725ed8042.zip kdepimpi-d94b52aa95cc52aa1bef7c9cd99f43c725ed8042.tar.gz kdepimpi-d94b52aa95cc52aa1bef7c9cd99f43c725ed8042.tar.bz2 |
todo dnd
-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 | |||
@@ -1470,129 +1470,129 @@ void CalendarView::insertBirthdays(const QString& uid, const QStringList& birthd | |||
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")) ; |
@@ -2153,158 +2153,158 @@ void CalendarView::changeEventDisplay(Event *which, int action) | |||
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; |
diff --git a/korganizer/korganizer.pro b/korganizer/korganizer.pro index 4d67dca..3c7a1fb 100644 --- a/korganizer/korganizer.pro +++ b/korganizer/korganizer.pro | |||
@@ -1,78 +1,78 @@ | |||
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 \ |
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index 1fb480d..8c1953d 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp | |||
@@ -78,225 +78,227 @@ 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 | ||
@@ -428,143 +430,150 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : | |||
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 | } |
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 | ||