File indexing completed on 2024-12-08 03:41:39

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 <QList>
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, QMetaType::Type t) const;
0060 
0061     QStringList categories;
0062     QString menuId;
0063     QString m_strType;
0064     QString m_strName;
0065     QString m_strExec;
0066     QString m_strIcon;
0067     QString m_strTerminalOptions;
0068     QString m_strWorkingDirectory;
0069     QString m_strComment;
0070     QString m_strLibrary;
0071 
0072     int m_initialPreference = 1; // deprecated
0073     // the initial preference is per-servicetype now.
0074     QList<KService::ServiceTypeAndPreference> m_serviceTypes;
0075 
0076     QString m_strDesktopEntryName;
0077     QMap<QString, QVariant> m_mapProps;
0078     QStringList m_lstFormFactors;
0079     QStringList m_lstKeywords;
0080     QString m_strGenName;
0081     QString m_untranslatedGenericName;
0082     QString m_untranslatedName;
0083     QList<KServiceAction> m_actions;
0084     bool m_bAllowAsDefault : 1;
0085     bool m_bTerminal : 1;
0086     bool m_bValid : 1;
0087 };
0088 #endif