File indexing completed on 2024-07-21 03:42:34

0001 /*
0002     This file is part of the KDE project
0003     SPDX-FileCopyrightText: 2000 Waldo Bastian <bastian@kde.org>
0004 
0005     SPDX-License-Identifier: LGPL-2.0-only
0006 */
0007 
0008 #ifndef KSERVICEGROUPPRIVATE_H
0009 #define KSERVICEGROUPPRIVATE_H
0010 
0011 #include "kservicegroup.h"
0012 #include <ksycocaentry_p.h>
0013 
0014 #include <QStringList>
0015 
0016 class KServiceGroupPrivate : public KSycocaEntryPrivate
0017 {
0018 public:
0019     K_SYCOCATYPE(KST_KServiceGroup, KSycocaEntryPrivate)
0020 
0021     explicit KServiceGroupPrivate(const QString &path)
0022         : KSycocaEntryPrivate(path)
0023         , m_bNoDisplay(false)
0024         , m_bShowEmptyMenu(false)
0025         , m_bShowInlineHeader(false)
0026         , m_bInlineAlias(false)
0027         , m_bAllowInline(false)
0028         , m_inlineValue(4)
0029         , m_bDeep(false)
0030         , m_childCount(-1)
0031     {
0032     }
0033 
0034     KServiceGroupPrivate(QDataStream &str, int offset)
0035         : KSycocaEntryPrivate(str, offset)
0036         , m_bNoDisplay(false)
0037         , m_bShowEmptyMenu(false)
0038         , m_bShowInlineHeader(false)
0039         , m_bInlineAlias(false)
0040         , m_bAllowInline(false)
0041         , m_inlineValue(4)
0042         , m_bDeep(false)
0043         , m_childCount(-1)
0044 
0045     {
0046     }
0047 
0048     void save(QDataStream &s) override;
0049 
0050     QString name() const override
0051     {
0052         return path;
0053     }
0054 
0055     void load(const QString &cfg);
0056     void load(QDataStream &s);
0057 
0058     int childCount() const;
0059 
0060     KServiceGroup::List entries(KServiceGroup *group, bool sort, bool excludeNoDisplay, bool allowSeparators, bool sortByGenericName);
0061     /**
0062      * This function parse attributes into menu
0063      */
0064     void parseAttribute(const QString &item, bool &showEmptyMenu, bool &showInline, bool &showInlineHeader, bool &showInlineAlias, int &inlineValue);
0065 
0066     bool m_bNoDisplay : 1;
0067     bool m_bShowEmptyMenu : 1;
0068     bool m_bShowInlineHeader : 1;
0069     bool m_bInlineAlias : 1;
0070     bool m_bAllowInline : 1;
0071     int m_inlineValue;
0072     QStringList suppressGenericNames;
0073     QString directoryEntryPath;
0074     QStringList sortOrder;
0075     QString m_strCaption;
0076     QString m_strIcon;
0077     QString m_strComment;
0078 
0079     KServiceGroup::List m_serviceList;
0080     bool m_bDeep;
0081     QString m_strBaseGroupName;
0082     mutable int m_childCount;
0083 };
0084 
0085 class KServiceSeparator : public KSycocaEntry // krazy:exclude=dpointer (dummy class)
0086 {
0087 public:
0088     typedef QExplicitlySharedDataPointer<KServiceSeparator> Ptr;
0089 
0090 public:
0091     /**
0092      * Construct a service separator
0093      */
0094     KServiceSeparator();
0095     ~KServiceSeparator() override;
0096 };
0097 
0098 #endif