author | zautrix <zautrix> | 2005-01-29 23:23:11 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-01-29 23:23:11 (UTC) |
commit | d94b52aa95cc52aa1bef7c9cd99f43c725ed8042 (patch) (side-by-side diff) | |
tree | 9443dfbc790a76e5d707ce762e075cdb21096f50 /korganizer | |
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 |
4 files changed, 48 insertions, 36 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 0c39590..74aefb7 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -1532,5 +1532,5 @@ bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a ev->setSummary( name + " (" + QString::number(date.year()) +") " + kind ); } - ev->setOrganizer(a->email()); + //ev->setOrganizer(a->email()); ev->setCategories( kind ); ev->setDtStart( QDateTime(date) ); @@ -2215,5 +2215,5 @@ void CalendarView::edit_cut() } DndFactory factory( mCalendar ); - factory.cutEvent(anEvent); + factory.cutIncidence(anEvent); changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); } @@ -2236,5 +2236,5 @@ void CalendarView::edit_copy() } DndFactory factory( mCalendar ); - factory.copyEvent(anEvent); + factory.copyIncidence(anEvent); } @@ -2244,5 +2244,5 @@ void CalendarView::edit_paste() DndFactory factory( mCalendar ); - Event *pastedEvent = factory.pasteEvent( date ); + Event *pastedEvent = (Event *)factory.pasteIncidence( date ); changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); diff --git a/korganizer/korganizer.pro b/korganizer/korganizer.pro index 4d67dca..3c7a1fb 100644 --- a/korganizer/korganizer.pro +++ b/korganizer/korganizer.pro @@ -10,7 +10,7 @@ include( ../variables.pri ) INCLUDEPATH += ../microkde ../ interfaces ../microkde/kdecore ../microkde/kdeui ../microkde/kio/kfile ../microkde/kio/kio ../libkdepim #../qtcompat -DEFINES += KORG_NODND KORG_NOPLUGINS KORG_NOARCHIVE KORG_NOMAIL +DEFINES += KORG_NOPLUGINS KORG_NOARCHIVE KORG_NOMAIL DEFINES += KORG_NODCOP KORG_NOKALARMD KORG_NORESOURCEVIEW KORG_NOSPLITTER -#KORG_NOPRINTER KORG_NOKABC +#KORG_NOPRINTER KORG_NOKABC KORG_NODND DEFINES += KORG_NOLVALTERNATION DEFINES += DESKTOP_VERSION diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index 1fb480d..8c1953d 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp @@ -140,10 +140,9 @@ void KOTodoListView::contentsDropEvent(QDropEvent *e) if(existingTodo) { -// kdDebug() << "Drop existing Todo" << endl; Incidence *to = destinationEvent; while(to) { if (to->uid() == todo->uid()) { KMessageBox::sorry(this, - i18n("Cannot move To-Do to itself or a child of itself"), + i18n("Cannot move To-Do to itself\nor a child of itself"), i18n("Drop To-Do")); delete todo; @@ -152,13 +151,15 @@ void KOTodoListView::contentsDropEvent(QDropEvent *e) to = to->relatedTo(); } - existingTodo->setRelatedTo(destinationEvent); - emit todoDropped(todo); + internalDrop = true; + if ( destinationEvent ) + reparentTodoSignal( destinationEvent, existingTodo ); + else + unparentTodoSignal(existingTodo); delete todo; } else { -// kdDebug() << "Drop new Todo" << endl; - todo->setRelatedTo(destinationEvent); mCalendar->addTodo(todo); - - emit todoDropped(todo); + emit todoDropped(todo, KOGlobals::EVENTADDED); + if ( destinationEvent ) + reparentTodoSignal( destinationEvent, todo ); } } @@ -168,8 +169,7 @@ void KOTodoListView::contentsDropEvent(QDropEvent *e) //QListViewItem *qlvi = itemAt( contentsToViewport(e->pos()) ); KOTodoViewItem *todoi = static_cast<KOTodoViewItem *>(itemAt( contentsToViewport(e->pos()) )); - kdDebug() << "Dropped : " << text << endl; + qDebug("Dropped : " + text); QStringList emails = QStringList::split(",",text); for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) { - kdDebug() << " Email: " << (*it) << endl; int pos = (*it).find("<"); QString name = (*it).left(pos); @@ -181,5 +181,5 @@ void KOTodoListView::contentsDropEvent(QDropEvent *e) } else { - kdDebug() << "KOTodoListView::contentsDropEvent(): Todo from drop not decodable" << endl; + qDebug("KOTodoListView::contentsDropEvent(): Todo from drop not decodable "); e->ignore(); } @@ -190,8 +190,8 @@ void KOTodoListView::contentsDropEvent(QDropEvent *e) void KOTodoListView::contentsMousePressEvent(QMouseEvent* e) { - QListView::contentsMousePressEvent(e); #ifndef KORG_NODND QPoint p(contentsToViewport(e->pos())); QListViewItem *i = itemAt(p); + mMousePressed = false; if (i) { // if the user clicked into the root decoration of the item, don't @@ -208,4 +208,5 @@ void KOTodoListView::contentsMousePressEvent(QMouseEvent* e) } #endif + QListView::contentsMousePressEvent(e); } @@ -214,5 +215,4 @@ void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e) #ifndef KORG_NODND -// kdDebug() << "KOTodoListView::contentsMouseMoveEvent()" << endl; QListView::contentsMouseMoveEvent(e); if (mMousePressed && (mPressPos - e->pos()).manhattanLength() > @@ -221,20 +221,22 @@ void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e) QListViewItem *item = itemAt(contentsToViewport(mPressPos)); if (item) { -// kdDebug() << "Start Drag for item " << item->text(0) << endl; DndFactory factory( mCalendar ); - ICalDrag *vd = factory.createDragTodo( + ICalDrag *vd = factory.createDrag( ((KOTodoViewItem *)item)->todo(),viewport()); + internalDrop = false; + // we cannot do any senseful here, because the DnD is still broken in Qt if (vd->drag()) { - kdDebug() << "KOTodoListView::contentsMouseMoveEvent(): Delete drag source" << endl; + if ( !internalDrop ) { + //emit deleteTodo( ((KOTodoViewItem *)item)->todo() ); + qDebug("Dnd: External move: Delete drag source "); + } else + qDebug("Dnd: Internal move "); + + } else { + if ( !internalDrop ) { + qDebug("Dnd: External Copy"); + } else + qDebug("DnD: Internal copy: Copy pending"); } -/* - QString source = fullPath(item); - if ( QFile::exists(source) ) { - QUriDrag* ud = new QUriDrag(viewport()); - ud->setFilenames( source ); - if ( ud->drag() ) - QMessageBox::information( this, "Drag source", - QString("Delete ")+source, "Not implemented" ); -*/ } } @@ -490,6 +492,8 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ), SLOT( itemDoubleClicked( QListViewItem * ) ) ); - connect( mTodoListView, SIGNAL( todoDropped( Todo * ) ), + connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), SLOT( updateView() ) ); + connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), + SLOT( todoModified(Todo *, int) ) ); connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ), SLOT( itemStateChanged( QListViewItem * ) ) ); @@ -505,4 +509,9 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : SLOT(selectionChanged(QListViewItem *))); #endif + + connect( mTodoListView, SIGNAL(reparentTodoSignal( Todo *,Todo * ) ), SIGNAL(reparentTodoSignal( Todo *,Todo * ) )); + connect( mTodoListView, SIGNAL(unparentTodoSignal(Todo *) ), SIGNAL(unparentTodoSignal(Todo *) )); + connect( mTodoListView, SIGNAL( deleteTodo(Todo *) ), SIGNAL(deleteTodoSignal(Todo *) )); + connect( mTodoListView, SIGNAL(selectionChanged() ), SLOT( processSelectionChange() ) ); diff --git a/korganizer/kotodoview.h b/korganizer/kotodoview.h index f11518d..68e29bb 100644 --- a/korganizer/kotodoview.h +++ b/korganizer/kotodoview.h @@ -61,7 +61,9 @@ class KOTodoListView : public KListView signals: - void todoDropped(Todo *); + void todoDropped(Todo *, int); void double_Clicked(QListViewItem *item); - + void reparentTodoSignal( Todo *,Todo * ); + void unparentTodoSignal(Todo *); + void deleteTodo( Todo * ); protected: void contentsDragEnterEvent(QDragEnterEvent *); @@ -76,4 +78,5 @@ class KOTodoListView : public KListView private: + bool internalDrop; QString mName; Calendar *mCalendar; @@ -198,4 +201,6 @@ class KOTodoView : public KOrg::BaseView void processSelectionChange(); void addQuickTodo(); + void setTodoModified( Todo* ); + void todoModified(Todo *, int ); private: @@ -210,5 +215,4 @@ class KOTodoView : public KOrg::BaseView */ friend class KOTodoViewItem; - void setTodoModified( Todo* ); QMap<Todo *,KOTodoViewItem *>::ConstIterator insertTodoItem(Todo *todo); void restoreItemState( QListViewItem * ); @@ -236,5 +240,4 @@ class KOTodoView : public KOrg::BaseView KOQuickTodo *mQuickAdd; bool mBlockUpdate; - void todoModified(Todo *, int ); void keyPressEvent ( QKeyEvent * ) ; KOTodoViewItem * pendingSubtodo; |