1 /* This file is part of the KDE project
2    SPDX-FileCopyrightText: 2000, 2007 David Faure <faure@kde.org>
3 
4    SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
5 */
6 
7 #ifndef FILETYPEDETAILS_H
8 #define FILETYPEDETAILS_H
9 
10 #include <QTabWidget>
11 
12 class KIconButton;
13 class MimeTypeData;
14 class TypesListItem;
15 class QLabel;
16 class QListWidget;
17 class QGroupBox;
18 class QButtonGroup;
19 class QCheckBox;
20 class QRadioButton;
21 class KLineEdit;
22 class QPushButton;
23 class KServiceListWidget;
24 
25 /**
26  * This widget contains the right part of the file type configuration
27  * dialog, that shows the details for a file type.
28  * It is implemented as a separate class so that it can be used by
29  * the keditfiletype program to show the details of a single mimetype.
30  */
31 class FileTypeDetails : public QWidget
32 {
33     Q_OBJECT
34 public:
35     explicit FileTypeDetails(QWidget *parent = nullptr);
36 
37     /**
38      * Set a non-gui "mimetype data" to work on,
39      * and optionally a gui "treeview item", to update its icon if set.
40      */
41     void setMimeTypeData(MimeTypeData *mimeTypeData, TypesListItem *item = nullptr);
42 
43     /**
44      * Called when ksycoca has changed
45      */
46     void refresh();
47 
48 protected:
49     void updateRemoveButton();
50     void updateAskSave();
51 
52 Q_SIGNALS:
53     void embedMajor(const QString &major, bool &embed); // To adjust whether major type is being embedded
54     void changed(bool);
55 
56 protected Q_SLOTS:
57     void updateIcon(const QString &icon);
58     void updateDescription(const QString &desc);
59     void addExtension();
60     void removeExtension();
61     void enableExtButtons();
62     void slotAutoEmbedClicked(int button);
63     void slotAskSaveToggled(bool);
64 
65 private:
66     MimeTypeData *m_mimeTypeData;
67     TypesListItem *m_item; // can be 0, in keditfiletype!
68 
69     QLabel *m_mimeTypeLabel;
70 
71     QTabWidget *m_tabWidget;
72 
73     // First tab - General
74     KIconButton *iconButton;
75     QLabel *iconLabel; // if icon cannot be changed
76 
77     QListWidget *extensionLB;
78     QPushButton *addExtButton, *removeExtButton;
79     KLineEdit *description;
80     KServiceListWidget *serviceListWidget;
81 
82     // Second tab - Embedding
83     QGroupBox *m_autoEmbedBox;
84     QButtonGroup *m_autoEmbedGroup;
85     KServiceListWidget *embedServiceListWidget;
86     QRadioButton *m_rbOpenSeparate;
87     QCheckBox *m_chkAskSave;
88     QRadioButton *m_rbGroupSettings;
89 };
90 
91 #endif
92