File indexing completed on 2024-05-19 05:14:33

0001 /*
0002   This file is part of KAddressBook Kontact Plugin.
0003 
0004   SPDX-FileCopyrightText: 2009-2024 Laurent Montel <montel@kde.org>
0005 
0006   SPDX-License-Identifier: GPL-2.0-or-later
0007 */
0008 
0009 #pragma once
0010 
0011 #include <KontactInterface/UniqueAppHandler>
0012 
0013 namespace KontactInterface
0014 {
0015 class Plugin;
0016 }
0017 
0018 class KAddressBookUniqueAppHandler : public KontactInterface::UniqueAppHandler
0019 {
0020     Q_OBJECT
0021 public:
0022     explicit KAddressBookUniqueAppHandler(KontactInterface::Plugin *plugin)
0023         : KontactInterface::UniqueAppHandler(plugin)
0024     {
0025     }
0026 
0027     void loadCommandLineOptions(QCommandLineParser *parser) override;
0028     int activate(const QStringList &args, const QString &workingDir) override;
0029 };
0030 
0031 class KAddressBookPlugin : public KontactInterface::Plugin
0032 {
0033     Q_OBJECT
0034 
0035 public:
0036     explicit KAddressBookPlugin(KontactInterface::Core *core, const KPluginMetaData &data, const QVariantList &);
0037     ~KAddressBookPlugin() override;
0038 
0039     [[nodiscard]] bool isRunningStandalone() const override;
0040     [[nodiscard]] int weight() const override;
0041 
0042     [[nodiscard]] QStringList invisibleToolbarActions() const override;
0043     void shortcutChanged() override;
0044 
0045 protected:
0046     KParts::Part *createPart() override;
0047 
0048 private:
0049     void slotNewContact();
0050     void slotNewContactGroup();
0051 
0052     KontactInterface::UniqueAppWatcher *mUniqueAppWatcher = nullptr;
0053 };