File indexing completed on 2024-06-23 05:06:49
0001 /* 0002 SPDX-FileCopyrightText: 2008 Volker Krause <vkrause@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include <QObject> 0010 #include <QStringList> 0011 #include <QVariant> 0012 0013 class KConfig; 0014 class KJob; 0015 struct QMetaObject; 0016 0017 namespace Akonadi 0018 { 0019 /** 0020 Takes care of setting up default resource agents when running Akonadi for the first time. 0021 0022 <h4>Defining your own default agent setups</h4> 0023 0024 To add an additional agent to the default Akonadi setup, add a file with the 0025 agent setup description into <QStandardPaths::GenericDataLocation>/akonadi/firstrun. 0026 0027 Such a file looks as follows: 0028 0029 @verbatim 0030 [Agent] 0031 Id=defaultaddressbook 0032 Type=akonadi_vcard_resource 0033 Name=My Addressbook 0034 0035 [Settings] 0036 Path[$e]=~/.kde/share/apps/kabc/std.ics 0037 AutosaveInterval=1 0038 @endverbatim 0039 0040 The keys in the [Agent] group are mandatory: 0041 <ul> 0042 <li>Id: A unique identifier of the setup description, should never change to avoid the agent 0043 being set up twice.</li> 0044 <li>Type: The agent type</li> 0045 <li>Name: The user visible name for this agent (only used for resource agents currently)</li> 0046 </ul> 0047 0048 The [Settings] group is optional and contains agent-dependent settings. 0049 For those settings to be applied, the agent needs to export its settings 0050 via D-Bus using the KConfigXT <-> D-Bus bridge. 0051 */ 0052 class Firstrun : public QObject 0053 { 0054 Q_OBJECT 0055 public: 0056 explicit Firstrun(QObject *parent = nullptr); 0057 ~Firstrun() override; 0058 0059 private: 0060 void findPendingDefaults(); 0061 void setupNext(); 0062 static QMetaType::Type argumentType(const QMetaObject *mo, const QString &method); 0063 0064 private Q_SLOTS: 0065 void instanceCreated(KJob *job); 0066 0067 private: 0068 QStringList mPendingDefaults; 0069 KConfig *const mConfig; 0070 KConfig *mCurrentDefault = nullptr; 0071 }; 0072 0073 }