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
001f1fb0
Commit
001f1fb0
authored
Aug 12, 2020
by
Shashwat Jolly
Browse files
Add journal cache updation timestamp
parent
d1a6a649
Changes
2
Hide whitespace changes
Inline
Side-by-side
resources/etesync/etesyncresource.cpp
View file @
001f1fb0
...
...
@@ -113,10 +113,6 @@ void EteSyncResource::configure(WId windowId)
void
EteSyncResource
::
retrieveCollections
()
{
if
(
!
mSyncing
)
{
mCollectionsToSync
=
0
;
}
mSyncing
=
true
;
setCollectionStreamingEnabled
(
true
);
// Set up root collection for resource
mResourceCollection
=
Collection
();
...
...
@@ -159,7 +155,6 @@ void EteSyncResource::slotCollectionsRetrieved(KJob *job)
Collection
collection
;
collection
.
setParentCollection
(
mResourceCollection
);
setupCollection
(
collection
,
*
iter
);
mCollectionsToSync
++
;
list
<<
collection
;
}
free
(
journals
);
...
...
@@ -217,7 +212,8 @@ void EteSyncResource::setupCollection(Collection &collection, EteSyncJournal *jo
collection
.
setName
(
displayName
);
collection
.
setContentMimeTypes
(
mimeTypes
);
mJournals
[
journalUid
]
=
EteSyncJournalPtr
(
journal
);
mJournalsCache
[
journalUid
]
=
EteSyncJournalPtr
(
journal
);
mJournalsCacheUpdateTime
=
QDateTime
::
currentDateTime
();
}
BaseHandler
*
EteSyncResource
::
fetchHandlerForMimeType
(
const
QString
&
mimeType
)
...
...
@@ -250,11 +246,8 @@ BaseHandler *EteSyncResource::fetchHandlerForCollection(const Akonadi::Collectio
void
EteSyncResource
::
retrieveItems
(
const
Akonadi
::
Collection
&
collection
)
{
if
(
mSyncing
)
{
mCollectionsToSync
--
;
if
(
mCollectionsToSync
==
0
)
{
mSyncing
=
false
;
}
int
timeSinceLastCacheUpdate
=
mJournalsCacheUpdateTime
.
secsTo
(
QDateTime
::
currentDateTime
());
if
(
timeSinceLastCacheUpdate
<=
30
)
{
QString
journalUid
=
collection
.
remoteId
();
const
EteSyncJournalPtr
&
journal
=
getJournal
(
journalUid
);
QString
lastEntryUid
=
QStringFromCharPtr
(
CharPtr
(
etesync_journal_get_last_uid
(
journal
.
get
())));
...
...
resources/etesync/etesyncresource.h
View file @
001f1fb0
...
...
@@ -78,7 +78,7 @@ protected:
const
EteSyncJournalPtr
&
getJournal
(
QString
journalUid
)
{
return
mJournals
[
journalUid
];
return
mJournals
Cache
[
journalUid
];
}
private
Q_SLOTS
:
...
...
@@ -91,9 +91,8 @@ private:
Akonadi
::
Collection
mResourceCollection
;
EteSyncClientState
*
mClientState
=
nullptr
;
std
::
vector
<
BaseHandler
::
Ptr
>
mHandlers
;
std
::
map
<
QString
,
EteSyncJournalPtr
>
mJournals
;
int
mCollectionsToSync
=
0
;
bool
mSyncing
;
std
::
map
<
QString
,
EteSyncJournalPtr
>
mJournalsCache
;
QDateTime
mJournalsCacheUpdateTime
;
ContactHandler
::
Ptr
mContactHandler
=
nullptr
;
CalendarHandler
::
Ptr
mCalendarHandler
=
nullptr
;
...
...
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