summaryrefslogtreecommitdiffabout
path: root/korganizer/kotodoview.cpp
Side-by-side diff
Diffstat (limited to 'korganizer/kotodoview.cpp') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/kotodoview.cpp1
1 files changed, 0 insertions, 1 deletions
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index 0708a69..d9e0a03 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -1,151 +1,150 @@
/*
This file is part of KOrganizer.
Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include <qlayout.h>
#include <qheader.h>
#include <qcursor.h>
#include <qvbox.h>
#include <kdebug.h>
#include "koprefs.h"
#include <klocale.h>
#include <kglobal.h>
#include <kiconloader.h>
#include <kmessagebox.h>
#include <libkcal/icaldrag.h>
#include <libkcal/vcaldrag.h>
#include <libkcal/calfilter.h>
#include <libkcal/dndfactory.h>
#include <libkcal/calendarresources.h>
#include <libkcal/resourcecalendar.h>
#include <kresources/resourceselectdialog.h>
#ifndef DESKTOP_VERSION
#include <qpe/qpeapplication.h>
#else
#include <qapplication.h>
#endif
#ifndef KORG_NOPRINTER
#include "calprinter.h"
#endif
#include "docprefs.h"
#include "kotodoview.h"
using namespace KOrg;
-#include "kotodoview.moc"
KOTodoListView::KOTodoListView(Calendar *calendar,QWidget *parent,
const char *name) :
KListView(parent,name)
{
mCalendar = calendar;
#ifndef DESKTOP_VERSION
QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold );
#endif
mOldCurrent = 0;
mMousePressed = false;
setAcceptDrops(true);
viewport()->setAcceptDrops(true);
int size = 16;
if (qApp->desktop()->width() < 300 )
size = 12;
setTreeStepSize( size + 6 );
}
void KOTodoListView::contentsDragEnterEvent(QDragEnterEvent *e)
{
#ifndef KORG_NODND
// kdDebug() << "KOTodoListView::contentsDragEnterEvent" << endl;
if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) &&
!QTextDrag::canDecode( e ) ) {
e->ignore();
return;
}
mOldCurrent = currentItem();
#endif
}
void KOTodoListView::contentsDragMoveEvent(QDragMoveEvent *e)
{
#ifndef KORG_NODND
// kdDebug() << "KOTodoListView::contentsDragMoveEvent" << endl;
if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) &&
!QTextDrag::canDecode( e ) ) {
e->ignore();
return;
}
e->accept();
#endif
}
void KOTodoListView::contentsDragLeaveEvent(QDragLeaveEvent *)
{
#ifndef KORG_NODND
// kdDebug() << "KOTodoListView::contentsDragLeaveEvent" << endl;
setCurrentItem(mOldCurrent);
setSelected(mOldCurrent,true);
#endif
}
void KOTodoListView::contentsDropEvent(QDropEvent *e)
{
#ifndef KORG_NODND
// kdDebug() << "KOTodoListView::contentsDropEvent" << endl;
if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) &&
!QTextDrag::canDecode( e ) ) {
e->ignore();
return;
}
DndFactory factory( mCalendar );
Todo *todo = factory.createDropTodo(e);
if (todo) {
e->acceptAction();
KOTodoViewItem *destination =
(KOTodoViewItem *)itemAt(contentsToViewport(e->pos()));
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("Drop To-Do"));
delete todo;
return;
}