File: typeslistitem.h

package info (click to toggle)
kde-cli-tools 4%3A6.3.4-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 7,396 kB
  • sloc: cpp: 4,368; sh: 42; makefile: 7
file content (60 lines) | stat: -rw-r--r-- 1,301 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/* This file is part of the KDE project
   SPDX-FileCopyrightText: 2003 Waldo Bastian <bastian@kde.org>
   SPDX-FileCopyrightText: 2003 David Faure <faure@kde.org>

   SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
*/

#ifndef TYPESLISTITEM_H
#define TYPESLISTITEM_H

#include "mimetypedata.h"
#include "typeslistitembase.h"

#include <QMimeType>

// TODO different subclasses for mimetypes and groups?
class TypesListItem : public TypesListItemBase
{
public:
    /**
     * Create a filetype group
     */
    TypesListItem(QTreeWidget *parent, const QString &major);

    /**
     * Create a filetype item inside a group, for an existing mimetype
     */
    TypesListItem(TypesListItem *parent, QMimeType mimetype);

    /**
     * Create a filetype item inside a group, for a new mimetype
     */
    TypesListItem(TypesListItem *parent, const QString &newMimetype);

    ~TypesListItem() override;

    void setIcon(const QString &icon);

    QString name() const
    {
        return m_mimetypeData.name();
    }

    const MimeTypeData &mimeTypeData() const
    {
        return m_mimetypeData;
    }

    MimeTypeData &mimeTypeData()
    {
        return m_mimetypeData;
    }

    void loadIcon(bool forceReload = false) override;

private:
    MimeTypeData m_mimetypeData;
};

#endif