parent
01db509f97
commit
770e9ab7ef
5 changed files with 81 additions and 14 deletions
@ -0,0 +1,24 @@ |
||||
// SPDX-FileCopyrightText: 2021 Carl Schwan <carlschwan@kde.org>
|
||||
// SPDX-Licence-Identifier: SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
|
||||
|
||||
#include "applicationintegration.h" |
||||
#include <KIO/ApplicationLauncherJob> |
||||
|
||||
ApplicationIntegration::ApplicationIntegration(QObject *parent) |
||||
: QObject(parent) |
||||
, m_korganizerService(KService::serviceByDesktopName(QStringLiteral("org.kde.korganizer"))) |
||||
{ |
||||
} |
||||
|
||||
bool ApplicationIntegration::korganizerInstalled() const |
||||
{ |
||||
return m_korganizerService != nullptr; |
||||
} |
||||
|
||||
void ApplicationIntegration::launchKorganizer() const |
||||
{ |
||||
Q_ASSERT(m_korganizerService); |
||||
|
||||
auto job = new KIO::ApplicationLauncherJob(m_korganizerService); |
||||
job->start(); |
||||
} |
||||
@ -0,0 +1,22 @@ |
||||
// SPDX-FileCopyrightText: 2021 Carl Schwan <carlschwan@kde.org>
|
||||
// SPDX-Licence-Identifier: SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
|
||||
|
||||
#pragma once |
||||
#include <KService> |
||||
#include <QObject> |
||||
|
||||
class ApplicationIntegration : public QObject |
||||
{ |
||||
Q_OBJECT |
||||
Q_PROPERTY(bool korganizerInstalled READ korganizerInstalled CONSTANT) |
||||
|
||||
public: |
||||
explicit ApplicationIntegration(QObject *parent = nullptr); |
||||
~ApplicationIntegration() = default; |
||||
|
||||
bool korganizerInstalled() const; |
||||
Q_INVOKABLE void launchKorganizer() const; |
||||
|
||||
private: |
||||
KService::Ptr m_korganizerService; |
||||
}; |
||||
Loading…
Reference in new issue