File indexing completed on 2023-12-03 10:58:57

0001 /*
0002     This file is part of the KDE project
0003     SPDX-FileCopyrightText: 1998, 1999 Torben Weis <weis@kde.org>
0004     SPDX-FileCopyrightText: 1999-2006 David Faure <faure@kde.org>
0005 
0006     SPDX-License-Identifier: LGPL-2.0-or-later
0007 */
0008 
0009 #ifndef KSERVICEPRIVATE_H
0010 #define KSERVICEPRIVATE_H
0011 
0012 #include "kservice.h"
0013 #include <QVector>
0014 
0015 #include <ksycocaentry_p.h>
0016 
0017 class KServicePrivate : public KSycocaEntryPrivate
0018 {
0019 public:
0020     K_SYCOCATYPE(KST_KService, KSycocaEntryPrivate)
0021 
0022     explicit KServicePrivate(const QString &path)
0023         : KSycocaEntryPrivate(path)
0024         , m_bValid(true)
0025     {
0026     }
0027     KServicePrivate(QDataStream &_str, int _offset)
0028         : KSycocaEntryPrivate(_str, _offset)
0029         , m_bValid(true)
0030     {
0031         load(_str);
0032     }
0033     KServicePrivate(const KServicePrivate &other) = default;
0034 
0035     void init(const KDesktopFile *config, KService *q);
0036 
0037     void parseActions(const KDesktopFile *config, KService *q);
0038     void load(QDataStream &);
0039     void save(QDataStream &) override;
0040 
0041     QString name() const override
0042     {
0043         return m_strName;
0044     }
0045 
0046     QString storageId() const override
0047     {
0048         if (!menuId.isEmpty()) {
0049             return menuId;
0050         }
0051         return path;
0052     }
0053 
0054     bool isValid() const override
0055     {
0056         return m_bValid;
0057     }
0058 
0059     QVariant property(const QString &name) const;
0060 
0061     QStringList propertyNames() const override;
0062 
0063     QVariant property(const QString &_name, QMetaType::Type t) const;
0064 
0065     static QMetaType::Type typeForProperty(const QString &name);
0066 
0067     QStringList categories;
0068     QString menuId;
0069     QString m_strType;
0070     QString m_strName;
0071     QString m_strExec;
0072     QString m_strIcon;
0073     QString m_strTerminalOptions;
0074     QString m_strWorkingDirectory;
0075     QString m_strComment;
0076     QString m_strLibrary;
0077 
0078     int m_initialPreference; // deprecated
0079     // the initial preference is per-servicetype now.
0080     QVector<KService::ServiceTypeAndPreference> m_serviceTypes;
0081 
0082     QString m_strDesktopEntryName;
0083     QMap<QString, QVariant> m_mapProps;
0084     QStringList m_lstFormFactors;
0085     QStringList m_lstKeywords;
0086     QString m_strGenName;
0087     QString m_untranslatedGenericName;
0088     QString m_untranslatedName;
0089     QList<KServiceAction> m_actions;
0090     bool m_bAllowAsDefault : 1;
0091     bool m_bTerminal : 1;
0092     bool m_bValid : 1;
0093 };
0094 #endif