File: filetypedetails.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 (94 lines) | stat: -rw-r--r-- 2,392 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/* This file is part of the KDE project
   SPDX-FileCopyrightText: 2000, 2007 David Faure <faure@kde.org>

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

#ifndef FILETYPEDETAILS_H
#define FILETYPEDETAILS_H

#include <QTabWidget>

class KIconButton;
class MimeTypeData;
class TypesListItem;
class QLabel;
class QListWidget;
class QGroupBox;
class QButtonGroup;
class QCheckBox;
class QRadioButton;
class KLineEdit;
class QPushButton;
class KServiceListWidget;

/**
 * This widget contains the right part of the file type configuration
 * dialog, that shows the details for a file type.
 * It is implemented as a separate class so that it can be used by
 * the keditfiletype program to show the details of a single mimetype.
 */
class FileTypeDetails : public QWidget
{
    Q_OBJECT
public:
    explicit FileTypeDetails(QWidget *parent = nullptr);

    /**
     * Set a non-gui "mimetype data" to work on,
     * and optionally a gui "treeview item", to update its icon if set.
     */
    void setMimeTypeData(MimeTypeData *mimeTypeData, TypesListItem *item = nullptr);

    /**
     * Called when ksycoca has changed
     */
    void refresh();

    void allowMultiApply(bool allow);

protected:
    void updateRemoveButton();
    void updateAskSave();

Q_SIGNALS:
    void embedMajor(const QString &major, bool &embed); // To adjust whether major type is being embedded
    void changed(bool);
    void multiApply(int kind);

protected Q_SLOTS:
    void updateIcon(const QString &icon);
    void updateDescription(const QString &desc);
    void addExtension();
    void removeExtension();
    void enableExtButtons();
    void slotAutoEmbedClicked(int button);
    void slotAskSaveToggled(bool);

private:
    MimeTypeData *m_mimeTypeData;
    TypesListItem *m_item; // can be 0, in keditfiletype!

    QLabel *m_mimeTypeLabel;

    QTabWidget *m_tabWidget;

    // First tab - General
    KIconButton *iconButton;
    QLabel *iconLabel; // if icon cannot be changed

    QListWidget *extensionLB;
    QPushButton *addExtButton, *removeExtButton;
    KLineEdit *description;
    KServiceListWidget *serviceListWidget;

    // Second tab - Embedding
    QGroupBox *m_autoEmbedBox;
    QButtonGroup *m_autoEmbedGroup;
    KServiceListWidget *embedServiceListWidget;
    QRadioButton *m_rbOpenSeparate;
    QCheckBox *m_chkAskSave;
    QRadioButton *m_rbGroupSettings;
};

#endif