summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/komonthview.cpp6
-rw-r--r--libkcal/calendarlocal.cpp1
-rw-r--r--libkcal/icalformat.cpp17
-rw-r--r--libkcal/icalformat.h3
-rw-r--r--libkcal/todo.cpp7
5 files changed, 24 insertions, 10 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index eea9a4d..4aeb20c 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -1100,25 +1100,29 @@ void MonthViewCell::cellClicked( QListBoxItem *item )
void MonthViewCell::contextMenu( QListBoxItem *item )
{
mMonthView->setPopupCell( this );
if ( !item ) {
mMonthView->showContextMenu( 0 );
return;
}
//selection( item );
//qApp->processEvents();
MonthViewItem *eventItem = static_cast<MonthViewItem *>( item );
Incidence *incidence = eventItem->incidence();
- if ( incidence ) mMonthView->showContextMenu( incidence );
+ if ( incidence ) {
+ mMonthView->showContextMenu( incidence );
+ selection( item );
+ doHighLight( incidence );
+ }
}
void MonthViewCell::selection( QListBoxItem *item )
{
if ( !item ) {
emit highlightIncidence( 0 , this, 0 );
return;
}
MonthViewItem * it = (static_cast<MonthViewItem *>( item ));
emit highlightIncidence( it->incidence(), this, it->multiDay() );
mMonthView->setSelectedCell( this );
}
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp
index e37a7ad..eef8327 100644
--- a/libkcal/calendarlocal.cpp
+++ b/libkcal/calendarlocal.cpp
@@ -56,24 +56,25 @@ CalendarLocal::CalendarLocal(const QString &timeZoneId)
{
init();
}
void CalendarLocal::init()
{
mNextAlarmIncidence = 0;
}
CalendarLocal::~CalendarLocal()
{
+ registerObserver( 0 );
if ( mDeleteIncidencesOnClose )
close();
}
bool CalendarLocal::mergeCalendarFile( QString name )
{
CalendarLocal calendar( timeZoneId() );
calendar.setDefaultCalendar( 1 );
if ( calendar.load( name ) ) {
mergeCalendar( &calendar );
return true;
}
return false;
diff --git a/libkcal/icalformat.cpp b/libkcal/icalformat.cpp
index 5877406..6f3a799 100644
--- a/libkcal/icalformat.cpp
+++ b/libkcal/icalformat.cpp
@@ -41,26 +41,27 @@ extern "C" {
#include "calendar.h"
#include "calendarlocal.h"
#include "journal.h"
#include "icalformat.h"
#include "icalformatimpl.h"
#define _ICAL_VERSION "2.0"
using namespace KCal;
-ICalFormat::ICalFormat( )
+ICalFormat::ICalFormat( bool pe )
{
+ mProcessEvents = pe;
mImpl = new ICalFormatImpl( this );
tzOffsetMin = 0;
//qDebug("new ICalFormat() ");
}
ICalFormat::~ICalFormat()
{
delete mImpl;
//qDebug("delete ICalFormat ");
}
bool ICalFormat::load( Calendar *calendar, const QString &fileName)
@@ -180,49 +181,55 @@ QString ICalFormat::toString( Calendar *cal )
icalcomponent *calendar = mImpl->createCalendarComponent(cal);
icalcomponent *component;
// todos
QPtrList<Todo> todoList = cal->rawTodos();
QPtrListIterator<Todo> qlt(todoList);
for (; qlt.current(); ++qlt) {
component = mImpl->writeTodo(qlt.current());
icalcomponent_add_component(calendar,component);
//qDebug(" todos ");
- qApp->processEvents();
+ if ( mProcessEvents ) {
+ //qDebug("mProcessEvents ");
+ qApp->processEvents();
+ }
}
// events
QPtrList<Event> events = cal->rawEvents();
Event *ev;
for(ev=events.first();ev;ev=events.next()) {
component = mImpl->writeEvent(ev);
icalcomponent_add_component(calendar,component);
//qDebug("events ");
- qApp->processEvents();
+ if ( mProcessEvents )
+ qApp->processEvents();
}
// journals
QPtrList<Journal> journals = cal->journals();
Journal *j;
for(j=journals.first();j;j=journals.next()) {
component = mImpl->writeJournal(j);
icalcomponent_add_component(calendar,component);
//qDebug("journals ");
- qApp->processEvents();
+ if ( mProcessEvents )
+ qApp->processEvents();
}
const char *text;
QString ret ="";
text = icalcomponent_as_ical_string( calendar );
- qApp->processEvents();
+ if ( mProcessEvents )
+ qApp->processEvents();
// text = "BEGIN:VCALENDAR\nPRODID\n :-//K Desktop Environment//NONSGML libkcal 3.1//EN\nVERSION\n :2.0\nBEGIN:VEVENT\nDTSTAMP\n :20031231T213514Z\nORGANIZER\n :MAILTO:lutz@putz.de\nCREATED\n :20031231T213513Z\nUID\n :libkcal-1295166342.120\nSEQUENCE\n :0\nLAST-MODIFIED\n :20031231T213513Z\nSUMMARY\n :test1\nCLASS\n :PUBLIC\nPRIORITY\n :3\nDTSTART\n :20040101T090000Z\nDTEND\n :20040101T110000Z\nTRANSP\n :OPAQUE\nEND:VEVENT\nEND:VCALENDAR\n";
if ( text ) {
ret = QString ( text );
}
icalcomponent_free( calendar );
if (!text) {
setException(new ErrorFormat(ErrorFormat::SaveError,
i18n("libical error")));
diff --git a/libkcal/icalformat.h b/libkcal/icalformat.h
index 485ab6e..a770dbb 100644
--- a/libkcal/icalformat.h
+++ b/libkcal/icalformat.h
@@ -31,25 +31,25 @@ namespace KCal {
class ICalFormatImpl;
/**
This class implements the iCalendar format. It provides methods for
loading/saving/converting iCalendar format data into the internal KOrganizer
representation as Calendar and Events.
@short iCalendar format implementation
*/
class ICalFormat : public CalFormat {
public:
/** Create new iCalendar format. */
- ICalFormat( );
+ ICalFormat( bool pe = true);
virtual ~ICalFormat();
/**
Loads a calendar on disk in iCalendar format into calendar.
Returns true if successful, else returns false. Provides more error
information by exception().
@param calendar Calendar object to be filled.
@param fileName The name of the calendar file on disk.
*/
bool load( Calendar *, const QString &fileName );
/**
Writes out the calendar to disk in iCalendar format. Returns true if
@@ -94,22 +94,23 @@ class ICalFormat : public CalFormat {
QString createScheduleMessage(IncidenceBase *e,Scheduler::Method m);
/** Parse scheduling message provided as string \s */
ScheduleMessage *parseScheduleMessage( Calendar *, const QString &s);
/** Set id of used time zone and whether this time zone is UTC or not. */
void setTimeZone( const QString &id, bool utc );
QString timeZoneId() const;
int timeOffset();
const char * tzString();
bool utc() const;
private:
+ bool mProcessEvents;
ICalFormatImpl *mImpl;
QString mTimeZoneId;
QCString mTzString;
int tzOffsetMin;
bool mUtc;
};
}
#endif
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp
index 4ada2d8..7bf756a 100644
--- a/libkcal/todo.cpp
+++ b/libkcal/todo.cpp
@@ -57,25 +57,26 @@ Todo::Todo(const Todo &t) : QObject(),Incidence(t)
Todo::~Todo()
{
setRunning( false );
//qDebug("Todo::~Todo() ");
}
void Todo::setRunningFalse( QString s )
{
if ( ! mRunning )
return;
mRunning = false;
- mRunSaveTimer->stop();
+ if ( mRunSaveTimer )
+ mRunSaveTimer->stop();
saveRunningInfoToFile( s );
}
void Todo::stopRunning()
{
if ( !mRunning )
return;
if ( mRunSaveTimer )
mRunSaveTimer->stop();
mRunning = false;
}
void Todo::setRunning( bool run )
{
@@ -130,25 +131,25 @@ void Todo::saveRunningInfoToFile( QString comment )
to->setHasStartDate( true );
to->setDtDue( mRunEnd );
to->setHasDueDate( true );
to->setUid( file );
if ( !comment.isEmpty() ) {
QString des = to->description();
if ( des.isEmpty () )
to->setDescription( "TT-Note: " + comment );
else
to->setDescription( "TT-Note: " + comment +"\n" + des );
}
cal.addIncidence( to );
- ICalFormat format;
+ ICalFormat format( false );
file = dir +"/" +file +".ics";
format.save( &cal, file );
saveParents();
}
void Todo::saveParents()
{
if (!relatedTo() )
return;
Incidence * inc = relatedTo();
if ( inc->typeID() != todoID )
return;
@@ -158,25 +159,25 @@ void Todo::saveParents()
QFileInfo fi ( file );
if ( fi.exists() ) {
if ( fi.lastModified () < to->lastModified ())
saveTodo = true;
} else {
saveTodo = true;
}
if ( saveTodo ) {
CalendarLocal cal;
cal.setLocalTime();
Todo * par = (Todo *) to->clone();
cal.addIncidence( par );
- ICalFormat format;
+ ICalFormat format( false );
format.save( &cal, file );
}
to->saveParents();
}
int Todo::runTime()
{
if ( !mRunning )
return 0;
return mRunStart.secsTo( QDateTime::currentDateTime() );
}
bool Todo::hasRunningSub()