1 | /* |
2 | This file is part of the KDE project |
3 | SPDX-FileCopyrightText: 2000 Waldo Bastian <bastian@kde.org> |
4 | |
5 | SPDX-License-Identifier: LGPL-2.0-only |
6 | */ |
7 | |
8 | #ifndef KBUILD_SERVICE_GROUP_FACTORY_H |
9 | #define KBUILD_SERVICE_GROUP_FACTORY_H |
10 | |
11 | #include <QStringList> |
12 | #include <kservice.h> |
13 | #include <kservicegroupfactory_p.h> |
14 | |
15 | /** |
16 | * Service group factory for building ksycoca |
17 | * @internal |
18 | */ |
19 | class KBuildServiceGroupFactory : public KServiceGroupFactory |
20 | { |
21 | public: |
22 | /** |
23 | * Create factory |
24 | */ |
25 | explicit KBuildServiceGroupFactory(KSycoca *db); |
26 | |
27 | ~KBuildServiceGroupFactory() override; |
28 | |
29 | /** |
30 | * Create new entry. |
31 | */ |
32 | KServiceGroup *createEntry(const QString &) const override; |
33 | |
34 | KServiceGroup *createEntry(int) const override |
35 | { |
36 | assert(0); |
37 | return nullptr; |
38 | } |
39 | |
40 | /** |
41 | * Adds the entry @p newEntry to the menu @p menuName |
42 | */ |
43 | void addNewEntryTo(const QString &, const KService::Ptr &newEntry); |
44 | |
45 | /** |
46 | * Adds the entry @p newEntry to the "parent group" @p parent, creating |
47 | * the group if necessary. |
48 | * A "parent group" is a group of services that all have the same |
49 | * "X-KDE-ParentApp". |
50 | */ |
51 | void addNewChild(const QString &parent, const KSycocaEntry::Ptr &newEntry); |
52 | |
53 | /** |
54 | * Add new menu @p menuName defined by @p file |
55 | * When @p entry is non-null it is re-used, otherwise a new group is created. |
56 | * A pointer to the group is returned. |
57 | */ |
58 | KServiceGroup::Ptr addNew(const QString &, const QString &file, KServiceGroup::Ptr entry, bool isDeleted); |
59 | |
60 | /** |
61 | * Find a group ( by desktop path, e.g. "Applications/Editors") |
62 | */ |
63 | KServiceGroup::Ptr findGroupByDesktopPath(const QString &_name, bool deep = true) override; |
64 | |
65 | /** |
66 | * Add a new menu entry |
67 | */ |
68 | void addEntry(const KSycocaEntry::Ptr &newEntry) override; |
69 | |
70 | /** |
71 | * Write out servicegroup specific index files. |
72 | */ |
73 | void save(QDataStream &str) override; |
74 | |
75 | /** |
76 | * Write out header information |
77 | */ |
78 | void (QDataStream &str) override; |
79 | }; |
80 | |
81 | #endif |
82 | |