Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Unmaintained
KDE Pim
Commits
0a45ce1d
Commit
0a45ce1d
authored
Jan 03, 2015
by
Laurent Montel
😁
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use imapresourcemanager
parent
2d8cec9b
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
7 deletions
+23
-7
kmail/kmkernel.cpp
kmail/kmkernel.cpp
+7
-0
kmail/kmkernel.h
kmail/kmkernel.h
+3
-0
pimcommon/util/imapresourcemanager.cpp
pimcommon/util/imapresourcemanager.cpp
+13
-7
No files found.
kmail/kmkernel.cpp
View file @
0a45ce1d
...
...
@@ -114,6 +114,7 @@ using KMail::MailServiceImpl;
#include "foldercollectionmonitor.h"
#include "imapresourcesettings.h"
#include "util.h"
#include "pimcommon/util/imapresourcemanager.h"
#include "mailcommon/kernel/mailkernel.h"
#include "searchdialog/searchdescriptionattribute.h"
...
...
@@ -143,6 +144,7 @@ KMKernel::KMKernel (QObject *parent) :
KMail
::
Util
::
migrateFromKMail1
();
kDebug
()
<<
"Starting up..."
;
mImapResourceManager
=
new
PimCommon
::
ImapResourceManager
(
this
);
mySelf
=
this
;
the_firstInstance
=
true
;
...
...
@@ -2082,6 +2084,11 @@ PimCommon::StorageServiceManager *KMKernel::storageServiceManager() const
return
mStorageManager
;
}
PimCommon
::
ImapResourceManager
*
KMKernel
::
imapResourceManager
()
const
{
return
mImapResourceManager
;
}
bool
KMKernel
::
allowToDebugBalooSupport
()
const
{
return
mDebugBaloo
;
...
...
kmail/kmkernel.h
View file @
0a45ce1d
...
...
@@ -44,6 +44,7 @@ class MessageSender;
namespace
PimCommon
{
class
AutoCorrection
;
class
StorageServiceManager
;
class
ImapResourceManager
;
}
/** The KMail namespace contains classes used for KMail.
...
...
@@ -426,6 +427,7 @@ public:
void
toggleSystemTray
();
FolderArchiveManager
*
folderArchiveManager
()
const
;
PimCommon
::
StorageServiceManager
*
storageServiceManager
()
const
;
PimCommon
::
ImapResourceManager
*
imapResourceManager
()
const
;
bool
allowToDebugBalooSupport
()
const
;
...
...
@@ -533,6 +535,7 @@ private:
PimCommon
::
AutoCorrection
*
mAutoCorrection
;
FolderArchiveManager
*
mFolderArchiveManager
;
PimCommon
::
StorageServiceManager
*
mStorageManager
;
PimCommon
::
ImapResourceManager
*
mImapResourceManager
;
bool
mDebugBaloo
;
};
...
...
pimcommon/util/imapresourcemanager.cpp
View file @
0a45ce1d
...
...
@@ -38,26 +38,31 @@ ImapResourceManager::~ImapResourceManager()
void
ImapResourceManager
::
slotInstanceAdded
(
const
Akonadi
::
AgentInstance
&
instance
)
{
searchCapabilities
(
instance
.
type
().
identifier
());
searchCapabilities
(
instance
.
identifier
());
}
void
ImapResourceManager
::
slotInstanceRemoved
(
const
Akonadi
::
AgentInstance
&
instance
)
{
mImapResource
.
remove
(
instance
.
type
().
identifier
());
mImapResource
.
remove
(
instance
.
identifier
());
}
void
ImapResourceManager
::
searchCapabilities
(
const
QString
&
identifier
)
{
qDebug
()
<<
" void ImapResourceManager::searchCapabilities(const QString &identifier)"
<<
identifier
;
//By default makes it as true.
mImapResource
.
insert
(
identifier
,
true
);
QDBusInterface
iface
(
QLatin1String
(
"org.freedesktop.Akonadi.Resource."
)
+
identifier
,
QLatin1String
(
"/"
),
QLatin1String
(
"org.kde.Akonadi.ImapResourceBase"
),
Akonadi
::
DBusConnectionPool
::
threadConnection
(),
this
);
if
(
iface
.
isValid
())
{
QDBusPendingCall
call
=
iface
.
asyncCall
(
QLatin1String
(
"serverCapabilities"
)
);
QDBusPendingCallWatcher
*
watcher
=
new
QDBusPendingCallWatcher
(
call
,
this
);
watcher
->
setProperty
(
"identifier"
,
identifier
);
connect
(
watcher
,
SIGNAL
(
finished
(
QDBusPendingCallWatcher
*
)),
this
,
SLOT
(
slotCapabilities
(
QDBusPendingCallWatcher
*
)));
}
else
{
qDebug
()
<<
"interface not valid"
;
}
}
void
ImapResourceManager
::
slotCapabilities
(
QDBusPendingCallWatcher
*
watcher
)
...
...
@@ -66,6 +71,7 @@ void ImapResourceManager::slotCapabilities(QDBusPendingCallWatcher* watcher)
if
(
reply
.
isValid
()
)
{
if
(
watcher
->
property
(
"identifier"
).
isValid
())
{
const
QStringList
capabilities
=
reply
.
value
();
qDebug
()
<<
" capabilities"
<<
capabilities
<<
" for identifier"
<<
watcher
->
property
(
"identifier"
).
toString
();
mImapResource
.
insert
(
watcher
->
property
(
"identifier"
).
toString
(),
capabilities
.
contains
(
QLatin1String
(
"ANNOTATEMORE"
)));
}
}
...
...
@@ -76,7 +82,7 @@ void ImapResourceManager::slotCapabilities(QDBusPendingCallWatcher* watcher)
void
ImapResourceManager
::
init
()
{
Q_FOREACH
(
const
Akonadi
::
AgentInstance
&
instance
,
Akonadi
::
AgentManager
::
self
()
->
instances
()
)
{
const
QString
identifier
=
instance
.
type
().
identifier
();
const
QString
identifier
=
instance
.
identifier
();
if
(
PimCommon
::
Util
::
isImapResource
(
identifier
))
{
searchCapabilities
(
identifier
);
}
...
...
Write
Preview
Markdown
is supported
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