Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
KDE PIM Runtime
Commits
f3b1329d
Commit
f3b1329d
authored
Aug 16, 2020
by
Shashwat Jolly
Browse files
Fix bug related to changing item after addition
parent
2af86bd0
Changes
3
Hide whitespace changes
Inline
Side-by-side
resources/etesync/calendartaskbasehandler.cpp
View file @
f3b1329d
...
...
@@ -132,7 +132,8 @@ void CalendarTaskBaseHandler::itemAdded(const Akonadi::Item &item,
const
Akonadi
::
Collection
&
collection
)
{
KCalendarCore
::
Calendar
::
Ptr
calendar
(
new
MemoryCalendar
(
QTimeZone
::
utc
()));
calendar
->
addIncidence
(
item
.
payload
<
Incidence
::
Ptr
>
());
const
auto
incidence
=
item
.
payload
<
Incidence
::
Ptr
>
();
calendar
->
addIncidence
(
incidence
);
KCalendarCore
::
ICalFormat
format
;
const
QString
journalUid
=
collection
.
remoteId
();
...
...
@@ -146,7 +147,10 @@ void CalendarTaskBaseHandler::itemAdded(const Akonadi::Item &item,
return
;
}
mResource
->
changeCommitted
(
item
);
Item
newItem
(
item
);
newItem
.
setRemoteId
(
incidence
->
uid
());
newItem
.
setPayload
<
Incidence
::
Ptr
>
(
incidence
);
mResource
->
changeCommitted
(
newItem
);
updateLocalCalendar
(
item
.
payload
<
Incidence
::
Ptr
>
());
}
...
...
@@ -157,7 +161,8 @@ void CalendarTaskBaseHandler::itemChanged(const Akonadi::Item &item,
Collection
collection
=
item
.
parentCollection
();
KCalendarCore
::
Calendar
::
Ptr
calendar
(
new
MemoryCalendar
(
QTimeZone
::
utc
()));
calendar
->
addIncidence
(
item
.
payload
<
Incidence
::
Ptr
>
());
const
auto
incidence
=
item
.
payload
<
Incidence
::
Ptr
>
();
calendar
->
addIncidence
(
incidence
);
KCalendarCore
::
ICalFormat
format
;
const
QString
journalUid
=
collection
.
remoteId
();
...
...
@@ -171,7 +176,9 @@ void CalendarTaskBaseHandler::itemChanged(const Akonadi::Item &item,
return
;
}
mResource
->
changeCommitted
(
item
);
Item
newItem
(
item
);
newItem
.
setPayload
<
Incidence
::
Ptr
>
(
incidence
);
mResource
->
changeCommitted
(
newItem
);
updateLocalCalendar
(
item
.
payload
<
Incidence
::
Ptr
>
());
}
...
...
@@ -244,7 +251,9 @@ void CalendarTaskBaseHandler::collectionChanged(const Akonadi::Collection &colle
return
;
}
mResource
->
changeCommitted
(
collection
);
Collection
newCollection
(
collection
);
mResource
->
setupCollection
(
newCollection
,
journal
.
get
());
mResource
->
changeCommitted
(
newCollection
);
}
void
CalendarTaskBaseHandler
::
collectionRemoved
(
const
Akonadi
::
Collection
&
collection
)
...
...
resources/etesync/contacthandler.cpp
View file @
f3b1329d
...
...
@@ -141,7 +141,8 @@ void ContactHandler::itemAdded(const Akonadi::Item &item,
EteSyncCryptoManagerPtr
cryptoManager
=
etesync_journal_get_crypto_manager
(
journal
.
get
(),
mClientState
->
derived
(),
mClientState
->
keypair
());
KContacts
::
VCardConverter
converter
;
QByteArray
content
=
converter
.
createVCard
(
item
.
payload
<
KContacts
::
Addressee
>
());
const
auto
contact
=
item
.
payload
<
KContacts
::
Addressee
>
();
QByteArray
content
=
converter
.
createVCard
(
contact
);
EteSyncSyncEntryPtr
syncEntry
=
etesync_sync_entry_new
(
QStringLiteral
(
ETESYNC_SYNC_ENTRY_ACTION_ADD
),
QString
::
fromUtf8
(
content
));
...
...
@@ -149,7 +150,10 @@ void ContactHandler::itemAdded(const Akonadi::Item &item,
return
;
}
mResource
->
changeCommitted
(
item
);
Item
newItem
(
item
);
newItem
.
setRemoteId
(
contact
.
uid
());
newItem
.
setPayload
<
KContacts
::
Addressee
>
(
contact
);
mResource
->
changeCommitted
(
newItem
);
updateLocalContact
(
item
.
payload
<
KContacts
::
Addressee
>
());
}
...
...
@@ -165,7 +169,8 @@ void ContactHandler::itemChanged(const Akonadi::Item &item,
EteSyncCryptoManagerPtr
cryptoManager
=
etesync_journal_get_crypto_manager
(
journal
.
get
(),
mClientState
->
derived
(),
mClientState
->
keypair
());
KContacts
::
VCardConverter
converter
;
QByteArray
content
=
converter
.
createVCard
(
item
.
payload
<
KContacts
::
Addressee
>
());
const
auto
contact
=
item
.
payload
<
KContacts
::
Addressee
>
();
QByteArray
content
=
converter
.
createVCard
(
contact
);
EteSyncSyncEntryPtr
syncEntry
=
etesync_sync_entry_new
(
QStringLiteral
(
ETESYNC_SYNC_ENTRY_ACTION_CHANGE
),
QString
::
fromUtf8
(
content
));
...
...
@@ -173,7 +178,9 @@ void ContactHandler::itemChanged(const Akonadi::Item &item,
return
;
}
mResource
->
changeCommitted
(
item
);
Item
newItem
(
item
);
newItem
.
setPayload
<
KContacts
::
Addressee
>
(
contact
);
mResource
->
changeCommitted
(
newItem
);
updateLocalContact
(
item
.
payload
<
KContacts
::
Addressee
>
());
}
...
...
@@ -237,7 +244,9 @@ void ContactHandler::collectionChanged(const Akonadi::Collection &collection)
return
;
}
mResource
->
changeCommitted
(
collection
);
Collection
newCollection
(
collection
);
mResource
->
setupCollection
(
newCollection
,
journal
.
get
());
mResource
->
changeCommitted
(
newCollection
);
}
void
ContactHandler
::
collectionRemoved
(
const
Akonadi
::
Collection
&
collection
)
...
...
resources/etesync/etesyncresource.cpp
View file @
f3b1329d
...
...
@@ -213,6 +213,7 @@ void EteSyncResource::setupCollection(Collection &collection, EteSyncJournal *jo
if
(
etesync_journal_is_read_only
(
journal
))
{
collection
.
setRights
(
Collection
::
ReadOnly
);
}
collection
.
setRemoteId
(
journalUid
);
collection
.
setName
(
displayName
);
collection
.
setContentMimeTypes
(
mimeTypes
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment