summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp8
-rw-r--r--korganizer/korganizer.pro4
-rw-r--r--korganizer/kotodoview.cpp61
-rw-r--r--korganizer/kotodoview.h11
-rw-r--r--libkcal/dndfactory.cpp186
-rw-r--r--libkcal/dndfactory.h56
-rw-r--r--libkcal/dndfactory_dummy.h62
-rw-r--r--libkcal/libkcal.pro2
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
@@ -1510,49 +1510,49 @@ void CalendarView::insertBirthdays(const QString& uid, const QStringList& birthd
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
1518bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday) 1518bool 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}
1549bool CalendarView::importQtopia( const QString &categories, 1549bool 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 );
@@ -2193,78 +2193,78 @@ 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
2200void CalendarView::edit_cut() 2200void 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
2221void CalendarView::edit_copy() 2221void 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
2241void CalendarView::edit_paste() 2241void 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
2251void CalendarView::edit_options() 2251void CalendarView::edit_options()
2252{ 2252{
2253 mDialogManager->showOptionsDialog(); 2253 mDialogManager->showOptionsDialog();
2254 //writeSettings(); 2254 //writeSettings();
2255} 2255}
2256 2256
2257 2257
2258void CalendarView::slotSelectPickerDate( QDate d) 2258void 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 );
diff --git a/korganizer/korganizer.pro b/korganizer/korganizer.pro
index 4d67dca..3c7a1fb 100644
--- a/korganizer/korganizer.pro
+++ b/korganizer/korganizer.pro
@@ -1,38 +1,38 @@
1 TEMPLATE= app 1 TEMPLATE= app
2 CONFIG += qt warn_off 2 CONFIG += qt warn_off
3 TARGET = kopi 3 TARGET = kopi
4OBJECTS_DIR = _obj/ 4OBJECTS_DIR = _obj/
5MOC_DIR = _moc 5MOC_DIR = _moc
6DESTDIR= ../bin 6DESTDIR= ../bin
7 7
8include( ../variables.pri ) 8include( ../variables.pri )
9 9
10INCLUDEPATH += ../microkde ../ interfaces ../microkde/kdecore ../microkde/kdeui ../microkde/kio/kfile ../microkde/kio/kio ../libkdepim 10INCLUDEPATH += ../microkde ../ interfaces ../microkde/kdecore ../microkde/kdeui ../microkde/kio/kfile ../microkde/kio/kio ../libkdepim
11#../qtcompat 11#../qtcompat
12DEFINES += KORG_NODND KORG_NOPLUGINS KORG_NOARCHIVE KORG_NOMAIL 12DEFINES += KORG_NOPLUGINS KORG_NOARCHIVE KORG_NOMAIL
13DEFINES += KORG_NODCOP KORG_NOKALARMD KORG_NORESOURCEVIEW KORG_NOSPLITTER 13DEFINES += KORG_NODCOP KORG_NOKALARMD KORG_NORESOURCEVIEW KORG_NOSPLITTER
14#KORG_NOPRINTER KORG_NOKABC 14#KORG_NOPRINTER KORG_NOKABC KORG_NODND
15DEFINES += KORG_NOLVALTERNATION 15DEFINES += KORG_NOLVALTERNATION
16DEFINES += DESKTOP_VERSION 16DEFINES += DESKTOP_VERSION
17unix : { 17unix : {
18LIBS += ../bin/libmicrokdepim.so 18LIBS += ../bin/libmicrokdepim.so
19LIBS += ../bin/libmicrokcal.so 19LIBS += ../bin/libmicrokcal.so
20LIBS += ../bin/libmicrokde.so 20LIBS += ../bin/libmicrokde.so
21LIBS += ../bin/libmicrokabc.so 21LIBS += ../bin/libmicrokabc.so
22#LIBS += -lbluetooth 22#LIBS += -lbluetooth
23#LIBS += -lsdp 23#LIBS += -lsdp
24 24
25#LIBS += -lldap 25#LIBS += -lldap
26OBJECTS_DIR = obj/unix 26OBJECTS_DIR = obj/unix
27MOC_DIR = moc/unix 27MOC_DIR = moc/unix
28} 28}
29win32: { 29win32: {
30RC_FILE = winicons.rc 30RC_FILE = winicons.rc
31DEFINES += _WIN32_ 31DEFINES += _WIN32_
32LIBS += ../bin/microkdepim.lib 32LIBS += ../bin/microkdepim.lib
33LIBS += ../bin/microkcal.lib 33LIBS += ../bin/microkcal.lib
34LIBS += ../bin/microkde.lib 34LIBS += ../bin/microkde.lib
35LIBS += ../bin/microkabc.lib 35LIBS += ../bin/microkabc.lib
36LIBS += ../libical/lib/ical.lib 36LIBS += ../libical/lib/ical.lib
37LIBS += ../libical/lib/icalss.lib 37LIBS += ../libical/lib/icalss.lib
38#LIBS += atls.lib 38#LIBS += atls.lib
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index 1fb480d..8c1953d 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -118,145 +118,147 @@ 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
190void KOTodoListView::contentsMousePressEvent(QMouseEvent* e) 190void 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
212void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e) 213void 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}
243void KOTodoListView::keyPressEvent ( QKeyEvent * e ) 245void 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 }
@@ -468,63 +470,70 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
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
514KOTodoView::~KOTodoView() 523KOTodoView::~KOTodoView()
515{ 524{
516 delete mDocPrefs; 525 delete mDocPrefs;
517} 526}
518 527
519void KOTodoView::jumpToDate () 528void 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
527void KOTodoView::updateView() 536void KOTodoView::updateView()
528{ 537{
529 pendingSubtodo = 0; 538 pendingSubtodo = 0;
530 if ( mBlockUpdate ) { 539 if ( mBlockUpdate ) {
diff --git a/korganizer/kotodoview.h b/korganizer/kotodoview.h
index f11518d..68e29bb 100644
--- a/korganizer/kotodoview.h
+++ b/korganizer/kotodoview.h
@@ -39,63 +39,66 @@
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
48class QDragEnterEvent; 48class QDragEnterEvent;
49class QDragMoveEvent; 49class QDragMoveEvent;
50class QDragLeaveEvent; 50class QDragLeaveEvent;
51class QDropEvent; 51class QDropEvent;
52 52
53class DocPrefs; 53class DocPrefs;
54 54
55class KOTodoListView : public KListView 55class 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*/
90class KOQuickTodo : public QLineEdit 93class 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.
@@ -176,69 +179,69 @@ class KOTodoView : public KOrg::BaseView
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
40using namespace KCal;
41
42DndFactory::DndFactory( Calendar *cal ) :
43 mCalendar( cal )
44{
45}
46
47ICalDrag *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
62Event *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
81Todo *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
101void DndFactory::cutIncidence( Incidence *selectedInc )
102{
103 if ( copyIncidence( selectedInc ) ) {
104 mCalendar->deleteIncidence( selectedInc );
105 }
106}
107
108bool 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
122Incidence *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
29class QDropEvent;
30 28
31namespace KCal { 29namespace KCal {
32 30
31class ICalDrag;
32class Event;
33class Todo;
34class 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*/
39class DndFactory { 43class 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
29class QDropEvent;
30
31namespace 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*/
39class 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
@@ -38,69 +38,71 @@ HEADERS = \
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 \
43kincidenceformatter.h \ 43kincidenceformatter.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 \
62dndfactory.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
71SOURCES = \ 72SOURCES = \
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 \
102dndfactory.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