summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-01-29 23:23:11 (UTC)
committer zautrix <zautrix>2005-01-29 23:23:11 (UTC)
commitd94b52aa95cc52aa1bef7c9cd99f43c725ed8042 (patch) (side-by-side diff)
tree9443dfbc790a76e5d707ce762e075cdb21096f50 /korganizer
parent74c808f288bf81bc68c92a377ce64953603c2d40 (diff)
downloadkdepimpi-d94b52aa95cc52aa1bef7c9cd99f43c725ed8042.zip
kdepimpi-d94b52aa95cc52aa1bef7c9cd99f43c725ed8042.tar.gz
kdepimpi-d94b52aa95cc52aa1bef7c9cd99f43c725ed8042.tar.bz2
todo dnd
Diffstat (limited to 'korganizer') (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
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
@@ -1533,3 +1533,3 @@ bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a
}
- ev->setOrganizer(a->email());
+ //ev->setOrganizer(a->email());
ev->setCategories( kind );
@@ -2216,3 +2216,3 @@ void CalendarView::edit_cut()
DndFactory factory( mCalendar );
- factory.cutEvent(anEvent);
+ factory.cutIncidence(anEvent);
changeEventDisplay(anEvent, KOGlobals::EVENTDELETED);
@@ -2237,3 +2237,3 @@ void CalendarView::edit_copy()
DndFactory factory( mCalendar );
- factory.copyEvent(anEvent);
+ factory.copyIncidence(anEvent);
}
@@ -2245,3 +2245,3 @@ void CalendarView::edit_paste()
DndFactory factory( mCalendar );
- Event *pastedEvent = factory.pasteEvent( date );
+ Event *pastedEvent = (Event *)factory.pasteIncidence( date );
diff --git a/korganizer/korganizer.pro b/korganizer/korganizer.pro
index 4d67dca..3c7a1fb 100644
--- a/korganizer/korganizer.pro
+++ b/korganizer/korganizer.pro
@@ -11,5 +11,5 @@ INCLUDEPATH += ../microkde ../ interfaces ../microkde/kdecore ../microkde/kdeui
#../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
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() ),
diff --git a/korganizer/kotodoview.h b/korganizer/kotodoview.h
index f11518d..68e29bb 100644
--- a/korganizer/kotodoview.h
+++ b/korganizer/kotodoview.h
@@ -62,5 +62,7 @@ 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:
@@ -77,2 +79,3 @@ class KOTodoListView : public KListView
private:
+ bool internalDrop;
QString mName;
@@ -199,2 +202,4 @@ class KOTodoView : public KOrg::BaseView
void addQuickTodo();
+ void setTodoModified( Todo* );
+ void todoModified(Todo *, int );
@@ -211,3 +216,2 @@ class KOTodoView : public KOrg::BaseView
friend class KOTodoViewItem;
- void setTodoModified( Todo* );
QMap<Todo *,KOTodoViewItem *>::ConstIterator insertTodoItem(Todo *todo);
@@ -237,3 +241,2 @@ class KOTodoView : public KOrg::BaseView
bool mBlockUpdate;
- void todoModified(Todo *, int );
void keyPressEvent ( QKeyEvent * ) ;