KontactInterface

pimuniqueapplication.h
1/* This file is part of the KDE project
2
3 SPDX-FileCopyrightText: 2008 David Faure <faure@kde.org>
4
5 SPDX-License-Identifier: LGPL-2.0-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
6*/
7#pragma once
8
9#include "kontactinterface_export.h"
10
11#include <QApplication>
12#include <memory>
13
14class KAboutData;
16
17namespace KontactInterface
18{
19/**
20 * KDEPIM applications which can be integrated into kontact should use
21 * PimUniqueApplication instead of QApplication + Dbus unique.
22 * This makes command-line handling work, i.e. you can launch "korganizer"
23 * and if kontact is already running, it will load the korganizer part and
24 * switch to it.
25 */
26class KONTACTINTERFACE_EXPORT PimUniqueApplication : public QApplication
27{
28 Q_OBJECT
29 Q_CLASSINFO("D-Bus Interface", "org.kde.PIMUniqueApplication")
30
31public:
32 explicit PimUniqueApplication(int &argc, char **argv[]);
33 ~PimUniqueApplication() override;
34
35 void setAboutData(KAboutData &aboutData);
36
37 /**
38 * Register this process as a unique application, if not already running.
39 * Typically called in main().
40 * @param arguments should start with the appname, as QCoreApplication::arguments() does.
41 */
42 static bool start(const QStringList &arguments);
43
44 [[nodiscard]] QCommandLineParser *cmdArgs() const;
45
46public Q_SLOTS:
47 Q_SCRIPTABLE int newInstance();
48 Q_SCRIPTABLE virtual int newInstance(const QByteArray &startupId, const QStringList &arguments, const QString &workingDirectory);
49
50protected:
51 virtual int activate(const QStringList &arguments, const QString &workingDirectory);
52
53private:
54 //@cond PRIVATE
55 class PimUniqueApplicationPrivate;
56 std::unique_ptr<PimUniqueApplicationPrivate> const d;
57 //@endcond
58};
59
60}
KDEPIM applications which can be integrated into kontact should use PimUniqueApplication instead of Q...
Q_SCRIPTABLE Q_NOREPLY void start()
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:58:55 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.