summaryrefslogtreecommitdiffabout
path: root/korganizer/kolistview.cpp
Side-by-side diff
Diffstat (limited to 'korganizer/kolistview.cpp') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/kolistview.cpp1
1 files changed, 0 insertions, 1 deletions
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index b6061d0..9a3ba73 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -1,158 +1,157 @@
/*
This file is part of KOrganizer.
Copyright (c) 1999 Preston Brown
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 <qlistview.h>
#include <qlayout.h>
#include <qlabel.h>
#include <qpopupmenu.h>
#include <qprogressbar.h>
#include <qfileinfo.h>
#include <qmessagebox.h>
#include <qdialog.h>
#include <qtextstream.h>
#include <qdir.h>
#include <klocale.h>
#include <kdebug.h>
#include <kiconloader.h>
#include <kglobal.h>
#include <libkcal/calendar.h>
#include <libkcal/calendarlocal.h>
#include <libkcal/icalformat.h>
#include <libkcal/vcalformat.h>
#include <libkcal/recurrence.h>
#include <libkcal/filestorage.h>
#include <libkdepim/categoryselectdialog.h>
#ifndef DESKTOP_VERSION
#include <qpe/qpeapplication.h>
#else
#include <qapplication.h>
#endif
#ifndef KORG_NOPRINTER
#include "calprinter.h"
#endif
#include "koglobals.h"
#include "koprefs.h"
#include "kfiledialog.h"
#include "kolistview.h"
-#include "kolistview.moc"
ListItemVisitor::ListItemVisitor(KOListViewItem *item, QDate date )
{
mItem = item;
mDate = date;
}
ListItemVisitor::~ListItemVisitor()
{
}
bool ListItemVisitor::visit(Event *e)
{
bool ok = false;
QString start, end;
if ( e->doesRecur() ) {
QDate d = e->getNextOccurence( QDateTime( mDate, QTime(0,0,0)), &ok ).date();
if ( ok ) {
int days = e->dtStart().date().daysTo(e->dtEnd().date() );
start = KGlobal::locale()->formatDate(d,true);
end = KGlobal::locale()->formatDate(d.addDays( days),true);
}
}
if ( ! ok ) {
start =e->dtStartDateStr();
end = e->dtEndDateStr();
}
mItem->setText(0,e->summary());
mItem->setText(1,start);
mItem->setText(2,e->dtStartTimeStr());
mItem->setText(3,end);
mItem->setText(4,e->dtEndTimeStr());
mItem->setText(5,e->isAlarmEnabled() ? i18n("Yes") : i18n("No"));
mItem->setText(6, e->recurrence()->recurrenceText());
mItem->setText(7,"---");
mItem->setText(8,"---");
mItem->setText(9, e->cancelled() ? i18n("Yes") : i18n("No"));
mItem->setText(10,e->categoriesStr());
QString key;
QDate d = e->dtStart().date();
QTime t = e->doesFloat() ? QTime(0,0) : e->dtStart().time();
key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),t.hour(),t.minute());
mItem->setSortKey(1,key);
d = e->dtEnd().date();
t = e->doesFloat() ? QTime(0,0) : e->dtEnd().time();
key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),t.hour(),t.minute());
mItem->setSortKey(3,key);
return true;
}
bool ListItemVisitor::visit(Todo *t)
{
mItem->setText(0,i18n("To-Do: %1").arg(t->summary()));
if (t->hasStartDate()) {
mItem->setText(1,t->dtStartDateStr());
if (t->doesFloat()) {
mItem->setText(2,"---");
} else {
mItem->setText(2,t->dtStartTimeStr());
}
} else {
mItem->setText(1,"---");
mItem->setText(2,"---");
}
mItem->setText(3,"---");
mItem->setText(4,"---");
mItem->setText(5,"---");
mItem->setText(6,"---");
if (t->hasDueDate()) {
mItem->setText(7,t->dtDueDateStr());
if (t->doesFloat()) {
mItem->setText(8,"---");
} else {
mItem->setText(8,t->dtDueTimeStr());
}
} else {
mItem->setText(7,"---");
mItem->setText(8,"---");
}
mItem->setText(9, t->cancelled() ? i18n("Yes") : i18n("No"));
mItem->setText(10,t->categoriesStr());
QString key;
QDate d;
if (t->hasDueDate()) {
d = t->dtDue().date();
QTime tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time();
key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute());
mItem->setSortKey(7,key);
}
if ( t->hasStartDate() ) {