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
@@ -1528,13 +1528,13 @@ bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a
ev->setSummary( name + " (" + QString::number(date.year()) +")");
}
else {
kind = i18n( "Anniversary" );
ev->setSummary( name + " (" + QString::number(date.year()) +") " + kind );
}
- ev->setOrganizer(a->email());
+ //ev->setOrganizer(a->email());
ev->setCategories( kind );
ev->setDtStart( QDateTime(date) );
ev->setDtEnd( QDateTime(date) );
ev->setFloats( true );
Recurrence * rec = ev->recurrence();
rec->setYearly(Recurrence::rYearlyMonth,1,-1);
@@ -2211,13 +2211,13 @@ void CalendarView::edit_cut()
if (!anEvent) {
KNotifyClient::beep();
return;
}
DndFactory factory( mCalendar );
- factory.cutEvent(anEvent);
+ factory.cutIncidence(anEvent);
changeEventDisplay(anEvent, KOGlobals::EVENTDELETED);
}
void CalendarView::edit_copy()
{
Event *anEvent=0;
@@ -2232,21 +2232,21 @@ void CalendarView::edit_copy()
if (!anEvent) {
KNotifyClient::beep();
return;
}
DndFactory factory( mCalendar );
- factory.copyEvent(anEvent);
+ factory.copyIncidence(anEvent);
}
void CalendarView::edit_paste()
{
QDate date = mNavigator->selectedDates().first();
DndFactory factory( mCalendar );
- Event *pastedEvent = factory.pasteEvent( date );
+ Event *pastedEvent = (Event *)factory.pasteIncidence( date );
changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED );
}
void CalendarView::edit_options()
{
diff --git a/korganizer/korganizer.pro b/korganizer/korganizer.pro
index 4d67dca..3c7a1fb 100644
--- a/korganizer/korganizer.pro
+++ b/korganizer/korganizer.pro
@@ -6,15 +6,15 @@ MOC_DIR = _moc
DESTDIR= ../bin
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
unix : {
LIBS += ../bin/libmicrokdepim.so
LIBS += ../bin/libmicrokcal.so
LIBS += ../bin/libmicrokde.so
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index 1fb480d..8c1953d 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -136,66 +136,66 @@ void KOTodoListView::contentsDropEvent(QDropEvent *e)
Todo *destinationEvent = 0;
if (destination) destinationEvent = destination->todo();
Todo *existingTodo = mCalendar->todo(todo->uid());
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;
return;
}
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 );
}
}
else {
QString text;
if (QTextDrag::decode(e,text)) {
//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);
QString email = (*it).mid(pos);
if (!email.isEmpty() && todoi) {
todoi->todo()->addAttendee(new Attendee(name,email));
}
}
}
else {
- kdDebug() << "KOTodoListView::contentsDropEvent(): Todo from drop not decodable" << endl;
+ qDebug("KOTodoListView::contentsDropEvent(): Todo from drop not decodable ");
e->ignore();
}
}
#endif
}
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
// try to start a drag!
if (p.x() > header()->sectionPos(header()->mapToIndex(0)) +
treeStepSize() * (i->depth() + (rootIsDecorated() ? 1 : 0)) +
itemMargin() ||
@@ -204,41 +204,43 @@ void KOTodoListView::contentsMousePressEvent(QMouseEvent* e)
mPressPos = e->pos();
mMousePressed = true;
}
}
}
#endif
+ QListView::contentsMousePressEvent(e);
}
void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e)
{
#ifndef KORG_NODND
-// kdDebug() << "KOTodoListView::contentsMouseMoveEvent()" << endl;
QListView::contentsMouseMoveEvent(e);
if (mMousePressed && (mPressPos - e->pos()).manhattanLength() >
QApplication::startDragDistance()) {
mMousePressed = false;
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" );
-*/
}
}
#endif
}
void KOTodoListView::keyPressEvent ( QKeyEvent * e )
{
@@ -486,14 +488,16 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
const QPoint &,int ) ),
SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) );
connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ),
SLOT( itemClicked( QListViewItem * ) ) );
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 * ) ) );
connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ),
SLOT( itemStateChanged( QListViewItem * ) ) );
#if 0
@@ -501,12 +505,17 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
SLOT(selectionChanged(QListViewItem *)));
connect(mTodoListView,SIGNAL(clicked(QListViewItem *)),
SLOT(selectionChanged(QListViewItem *)));
connect(mTodoListView,SIGNAL(pressed(QListViewItem *)),
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() ) );
connect( mQuickAdd, SIGNAL( returnPressed () ),
SLOT( addQuickTodo() ) );
}
diff --git a/korganizer/kotodoview.h b/korganizer/kotodoview.h
index f11518d..68e29bb 100644
--- a/korganizer/kotodoview.h
+++ b/korganizer/kotodoview.h
@@ -57,27 +57,30 @@ class KOTodoListView : public KListView
Q_OBJECT
public:
KOTodoListView(Calendar *,QWidget *parent=0,const char *name=0);
virtual ~KOTodoListView() {}
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 *);
void contentsDragMoveEvent(QDragMoveEvent *);
void contentsDragLeaveEvent(QDragLeaveEvent *);
void contentsDropEvent(QDropEvent *);
void contentsMousePressEvent(QMouseEvent *);
void contentsMouseMoveEvent(QMouseEvent *);
void contentsMouseReleaseEvent(QMouseEvent *);
void contentsMouseDoubleClickEvent(QMouseEvent *);
private:
+ bool internalDrop;
QString mName;
Calendar *mCalendar;
QPoint mPressPos;
bool mMousePressed;
QListViewItem *mOldCurrent;
void keyPressEvent ( QKeyEvent * ) ;
@@ -194,25 +197,26 @@ class KOTodoView : public KOrg::BaseView
void beamTodoSignal( Incidence * );
void purgeCompletedSignal();
protected slots:
void processSelectionChange();
void addQuickTodo();
+ void setTodoModified( Todo* );
+ void todoModified(Todo *, int );
private:
/*
* the TodoEditor approach is rather unscaling in the long
* run.
* Korganizer keeps it in memory and we need to update
* 1. make KOTodoViewItem a QObject again?
* 2. add a public method for setting one todo modified?
* 3. add a private method for setting a todo modified + friend here?
* -- zecke 2002-07-08
*/
friend class KOTodoViewItem;
- void setTodoModified( Todo* );
QMap<Todo *,KOTodoViewItem *>::ConstIterator insertTodoItem(Todo *todo);
void restoreItemState( QListViewItem * );
bool checkTodo( Todo * );
bool isFlatDisplay;
void setOpen( QListViewItem*, bool setOpen);
@@ -232,13 +236,12 @@ class KOTodoView : public KOrg::BaseView
QString mName;
DocPrefs *mDocPrefs;
QString mCurrentDoc;
KOQuickTodo *mQuickAdd;
bool mBlockUpdate;
- void todoModified(Todo *, int );
void keyPressEvent ( QKeyEvent * ) ;
KOTodoViewItem * pendingSubtodo;
DateNavigator* mNavigator;
};
#endif