Akonadi Mime

util.cpp
1/*
2 SPDX-FileCopyrightText: 2010 Klarälvdalens Datakonsult AB, a KDAB Group company, <info@kdab.com>
3 SPDX-FileCopyrightText: 2010 Andras Mantia <andras@kdab.com>
4
5 SPDX-License-Identifier: LGPL-2.1-or-later
6*/
7
8#include "imapsettings.h"
9#include "util_p.h"
10
11#include <Akonadi/ServerManager>
12#include <QDBusConnection>
13
14#include "akonadi_mime_debug.h"
15#include <KIO/Job>
16#include <KJobUiDelegate>
17#include <cassert>
18
19namespace Util
20{
21/// Helper to sanely show an error message for a job
22void showJobError(KJob *job)
23{
24 assert(job);
25 // we can be called from the KJob::kill, where we are no longer a KIO::Job
26 // so better safe than sorry
27 auto kiojob = qobject_cast<KIO::Job *>(job);
28 if (kiojob && kiojob->uiDelegate()) {
29 kiojob->uiDelegate()->showErrorMessage();
30 } else {
31 qCWarning(AKONADIMIME_LOG) << "Job: " << job << "There is no GUI delegate set for a kjob, and it failed with error:" << job->errorString();
32 }
33}
34
35OrgKdeAkonadiImapSettingsInterface *createImapSettingsInterface(const QString &ident)
36{
37 // NOTE(Andras): from kmail/util.cpp
38 return new OrgKdeAkonadiImapSettingsInterface(Akonadi::ServerManager::agentServiceName(Akonadi::ServerManager::Resource, ident),
39 QStringLiteral("/Settings"),
41}
42}
static QString agentServiceName(ServiceAgentType agentType, const QString &identifier)
virtual QString errorString() const
QDBusConnection sessionBus()
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:19:28 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.