summaryrefslogtreecommitdiffabout
path: root/korganizer/kotodoview.cpp
Side-by-side diff
Diffstat (limited to 'korganizer/kotodoview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kotodoview.cpp61
1 files changed, 35 insertions, 26 deletions
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index 1fb480d..8c1953d 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -141,3 +141,2 @@ void KOTodoListView::contentsDropEvent(QDropEvent *e)
if(existingTodo) {
-// kdDebug() << "Drop existing Todo" << endl;
Incidence *to = destinationEvent;
@@ -146,3 +145,3 @@ void KOTodoListView::contentsDropEvent(QDropEvent *e)
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"));
@@ -153,11 +152,13 @@ void KOTodoListView::contentsDropEvent(QDropEvent *e)
}
- 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 );
}
@@ -169,6 +170,5 @@ void KOTodoListView::contentsDropEvent(QDropEvent *e)
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("<");
@@ -182,3 +182,3 @@ 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();
@@ -191,3 +191,2 @@ void KOTodoListView::contentsMousePressEvent(QMouseEvent* e)
{
- QListView::contentsMousePressEvent(e);
#ifndef KORG_NODND
@@ -195,2 +194,3 @@ void KOTodoListView::contentsMousePressEvent(QMouseEvent* e)
QListViewItem *i = itemAt(p);
+ mMousePressed = false;
if (i) {
@@ -209,2 +209,3 @@ void KOTodoListView::contentsMousePressEvent(QMouseEvent* e)
#endif
+ QListView::contentsMousePressEvent(e);
}
@@ -215,3 +216,2 @@ void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e)
#ifndef KORG_NODND
-// kdDebug() << "KOTodoListView::contentsMouseMoveEvent()" << endl;
QListView::contentsMouseMoveEvent(e);
@@ -222,18 +222,20 @@ void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e)
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" );
-*/
}
@@ -491,4 +493,6 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
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 * ) ),
@@ -506,2 +510,7 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
#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() ),