Commit 86df0d2c authored by Sergio Martins's avatar Sergio Martins
Browse files

Fix incidences being duplicated when importing a calendar.

The ETMCalendar already detects new items, so don't insert them
when the ItemCreateJob finishes.

BUG: 316312
parent 1009b0b1
......@@ -49,6 +49,7 @@ static QString itemToString(const Akonadi::Item &item)
CalendarBasePrivate::CalendarBasePrivate( CalendarBase *qq ) : QObject()
, mIncidenceChanger( new IncidenceChanger() )
, mBatchInsertionCancelled( false )
, mListensForNewItems( false )
, q( qq )
{
connect( mIncidenceChanger,
......@@ -217,7 +218,7 @@ void CalendarBasePrivate::slotCreateFinished( int changeId,
{
Q_UNUSED( changeId );
Q_UNUSED( item );
if ( resultCode == IncidenceChanger::ResultCodeSuccess ) {
if ( resultCode == IncidenceChanger::ResultCodeSuccess && !mListensForNewItems) {
Q_ASSERT( item.isValid() );
Q_ASSERT( item.hasPayload<KCalCore::Incidence::Ptr>() );
internalInsert( item );
......
......@@ -68,6 +68,7 @@ public:
QWeakPointer<CalendarBase> mWeakPointer;
Akonadi::Collection mCollectionForBatchInsertion;
bool mBatchInsertionCancelled;
bool mListensForNewItems; // does this model detect new item creations ?
private:
CalendarBase *const q;
......
......@@ -55,6 +55,7 @@ ETMCalendarPrivate::ETMCalendarPrivate( ETMCalendar *qq ) : CalendarBasePrivate(
, mCollectionFilteringEnabled( true )
, q( qq )
{
mListensForNewItems = true;
}
void ETMCalendarPrivate::init()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment