[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE
From: Allen Winter <winter () kde ! org>
Date: 2010-09-26 20:21:55
Message-ID: 20100926202155.56091AC857 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1180039 by winterz:
QSharedPointer<ScheduleMessage> usage
CCMAIL: alvaro.manera@nokia.com
M +1 -3 kdepim/calendarsupport/groupware.cpp
M +1 -2 kdepim/calendarsupport/invitationhandler.cpp
M +1 -1 kdepim/plugins/messageviewer/bodypartformatter/text_calendar.cpp
M +1 -1 kdepim/runtime/agents/invitations/invitationsagent.cpp
M +8 -7 kdepimlibs/kcalcore/icalformat.cpp
M +1 -1 kdepimlibs/kcalcore/icalformat.h
M +5 -0 kdepimlibs/kcalcore/schedulemessage.h
M +7 -7 kdepimlibs/kcalutils/incidenceformatter.cpp
--- trunk/KDE/kdepim/calendarsupport/groupware.cpp #1180038:1180039
@@ -78,7 +78,7 @@
const QString action = type;
CalendarAdaptor::Ptr adaptor( new CalendarAdaptor( mCalendar, 0 ) );
- KCalCore::ScheduleMessage *message = mFormat.parseScheduleMessage( adaptor, iCal );
+ KCalCore::ScheduleMessage::Ptr message = mFormat.parseScheduleMessage( adaptor, iCal );
if ( !message ) {
QString errorMessage;
if ( mFormat.exception() ) {
@@ -97,7 +97,6 @@
KCalCore::ScheduleMessage::Status status = message->status();
KCalCore::Incidence::Ptr incidence = message->event().staticCast<KCalCore::Incidence>();
if ( !incidence ) {
- delete message;
return false;
}
MailScheduler scheduler( mCalendar );
@@ -151,7 +150,6 @@
item.setPayload( KCalCore::Incidence::Ptr( incidence->clone() ) );
mDelegate->requestIncidenceEditor( item );
}
- delete message;
return true;
}
--- trunk/KDE/kdepim/calendarsupport/invitationhandler.cpp #1180038:1180039
@@ -196,8 +196,7 @@
KCalCore::ICalFormat mFormat;
CalendarAdaptor::Ptr adaptor( new CalendarAdaptor( d->mCalendar, d->mParent ) );
- QScopedPointer<KCalCore::ScheduleMessage> message(
- mFormat.parseScheduleMessage( adaptor, iCal ) );
+ KCalCore::ScheduleMessage::Ptr message = mFormat.parseScheduleMessage( adaptor, iCal );
if ( !message ) {
QString errorMessage = i18n( "Unknown error while parsing iCal invitation" );
--- trunk/KDE/kdepim/plugins/messageviewer/bodypartformatter/text_calendar.cpp #1180038:1180039
@@ -269,7 +269,7 @@
{
MemoryCalendar::Ptr calendar( new MemoryCalendar( KSystemTimeZones::local() ) ) ;
ICalFormat format;
- ScheduleMessage *message = format.parseScheduleMessage( calendar, iCal );
+ ScheduleMessage::Ptr message = format.parseScheduleMessage( calendar, iCal );
if ( !message ) {
//TODO: Error message?
return Incidence::Ptr();
--- trunk/KDE/kdepim/runtime/agents/invitations/invitationsagent.cpp #1180038:1180039
@@ -462,7 +462,7 @@
const Item &item )
{
KCalCore::ICalFormat format;
- KCalCore::ScheduleMessage *message = format.parseScheduleMessage( calendar, vcal );
+ KCalCore::ScheduleMessage::Ptr message = format.parseScheduleMessage( calendar, vcal );
if ( !message ) {
kWarning() << "Invalid invitation:" << vcal;
return Item();
--- trunk/KDE/kdepimlibs/kcalcore/icalformat.cpp #1180038:1180039
@@ -416,7 +416,7 @@
return freeBusy;
}
-ScheduleMessage *ICalFormat::parseScheduleMessage( const Calendar::Ptr &cal,
+ScheduleMessage::Ptr ICalFormat::parseScheduleMessage( const Calendar::Ptr &cal,
const QString &messageText )
{
setTimeSpec( cal->timeSpec() );
@@ -425,7 +425,7 @@
if ( messageText.isEmpty() ) {
setException(
new Exception( Exception::ParseErrorEmptyMessage ) );
- return 0;
+ return ScheduleMessage::Ptr();
}
icalcomponent *message;
@@ -435,7 +435,7 @@
setException(
new Exception( Exception::ParseErrorUnableToParse ) );
- return 0;
+ return ScheduleMessage::Ptr();
}
icalproperty *m =
@@ -444,7 +444,7 @@
setException(
new Exception( Exception::ParseErrorMethodProperty ) );
- return 0;
+ return ScheduleMessage::Ptr();
}
// Populate the message's time zone collection with all VTIMEZONE components
@@ -485,7 +485,7 @@
kDebug() << "object is not a freebusy, event, todo or journal";
setException( new Exception( Exception::ParseErrorNotIncidence ) );
- return 0;
+ return ScheduleMessage::Ptr();
}
icalproperty_method icalmethod = icalproperty_get_method( m );
@@ -549,7 +549,8 @@
}
} else {
icalcomponent_free( message );
- return new ScheduleMessage( incidence, method, ScheduleMessage::Unknown );
+ return ScheduleMessage::Ptr( new ScheduleMessage( incidence, method,
+ ScheduleMessage::Unknown ) );
}
icalproperty_xlicclass result =
@@ -582,7 +583,7 @@
icalcomponent_free( message );
icalcomponent_free( calendarComponent );
- return new ScheduleMessage( incidence, method, status );
+ return ScheduleMessage::Ptr( new ScheduleMessage( incidence, method, status ) );
}
void ICalFormat::setTimeSpec( const KDateTime::Spec &timeSpec )
--- trunk/KDE/kdepimlibs/kcalcore/icalformat.h #1180038:1180039
@@ -170,7 +170,7 @@
@return a pointer to a ScheduleMessage object if successful; 0 otherwise.
The calling routine may later free the return memory.
*/
- ScheduleMessage *parseScheduleMessage( const Calendar::Ptr &calendar,
+ ScheduleMessage::Ptr parseScheduleMessage( const Calendar::Ptr &calendar,
const QString &string );
/**
--- trunk/KDE/kdepimlibs/kcalcore/schedulemessage.h #1180038:1180039
@@ -67,6 +67,11 @@
};
/**
+ A shared pointer to a ScheduleMessage.
+ */
+ typedef QSharedPointer<ScheduleMessage> Ptr;
+
+ /**
Creates a scheduling message with method as defined in iTIPMethod and a status.
@param incidence a pointer to a valid Incidence to be associated with this message.
@param method an iTIPMethod.
--- trunk/KDE/kdepimlibs/kcalutils/incidenceformatter.cpp #1180038:1180039
@@ -1775,7 +1775,7 @@
static QString invitationHeaderEvent( const Event::Ptr &event,
const Incidence::Ptr &existingIncidence,
- ScheduleMessage *msg, const QString &sender )
+ ScheduleMessage::Ptr msg, const QString &sender )
{
if ( !msg || !event ) {
return QString();
@@ -1916,7 +1916,7 @@
static QString invitationHeaderTodo( const Todo::Ptr &todo,
const Incidence::Ptr &existingIncidence,
- ScheduleMessage *msg, const QString &sender )
+ ScheduleMessage::Ptr msg, const QString &sender )
{
if ( !msg || !todo ) {
return QString();
@@ -2066,7 +2066,7 @@
}
static QString invitationHeaderJournal( const Journal::Ptr &journal,
- ScheduleMessage *msg )
+ ScheduleMessage::Ptr msg )
{
if ( !msg || !journal ) {
return QString();
@@ -2132,7 +2132,7 @@
}
static QString invitationHeaderFreeBusy( const FreeBusy::Ptr &fb,
- ScheduleMessage *msg )
+ ScheduleMessage::Ptr msg )
{
if ( !msg || !fb ) {
return QString();
@@ -2249,7 +2249,7 @@
ScheduleMessageVisitor() : mMessage( 0 ) { mResult = ""; }
bool act( const IncidenceBase::Ptr &incidence,
const Incidence::Ptr &existingIncidence,
- ScheduleMessage *msg, const QString &sender )
+ ScheduleMessage::Ptr msg, const QString &sender )
{
mExistingIncidence = existingIncidence;
mMessage = msg;
@@ -2261,7 +2261,7 @@
protected:
QString mResult;
Incidence::Ptr mExistingIncidence;
- ScheduleMessage *mMessage;
+ ScheduleMessage::Ptr mMessage;
QString mSender;
};
@@ -2661,7 +2661,7 @@
ICalFormat format;
// parseScheduleMessage takes the tz from the calendar,
// no need to set it manually here for the format!
- ScheduleMessage *msg = format.parseScheduleMessage( mCalendar, invitation );
+ ScheduleMessage::Ptr msg = format.parseScheduleMessage( mCalendar, invitation );
if( !msg ) {
kDebug() << "Failed to parse the scheduling message";
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic