File indexing completed on 2024-04-28 05:27:03
0001 /* This file is part of the KDE project 0002 SPDX-FileCopyrightText: 2000, 2007 David Faure <faure@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only 0005 */ 0006 0007 #ifndef FILETYPEDETAILS_H 0008 #define FILETYPEDETAILS_H 0009 0010 #include <QTabWidget> 0011 0012 class KIconButton; 0013 class MimeTypeData; 0014 class TypesListItem; 0015 class QLabel; 0016 class QListWidget; 0017 class QGroupBox; 0018 class QButtonGroup; 0019 class QCheckBox; 0020 class QRadioButton; 0021 class KLineEdit; 0022 class QPushButton; 0023 class KServiceListWidget; 0024 0025 /** 0026 * This widget contains the right part of the file type configuration 0027 * dialog, that shows the details for a file type. 0028 * It is implemented as a separate class so that it can be used by 0029 * the keditfiletype program to show the details of a single mimetype. 0030 */ 0031 class FileTypeDetails : public QWidget 0032 { 0033 Q_OBJECT 0034 public: 0035 explicit FileTypeDetails(QWidget *parent = nullptr); 0036 0037 /** 0038 * Set a non-gui "mimetype data" to work on, 0039 * and optionally a gui "treeview item", to update its icon if set. 0040 */ 0041 void setMimeTypeData(MimeTypeData *mimeTypeData, TypesListItem *item = nullptr); 0042 0043 /** 0044 * Called when ksycoca has changed 0045 */ 0046 void refresh(); 0047 0048 void allowMultiApply(bool allow); 0049 0050 protected: 0051 void updateRemoveButton(); 0052 void updateAskSave(); 0053 0054 Q_SIGNALS: 0055 void embedMajor(const QString &major, bool &embed); // To adjust whether major type is being embedded 0056 void changed(bool); 0057 void multiApply(int kind); 0058 0059 protected Q_SLOTS: 0060 void updateIcon(const QString &icon); 0061 void updateDescription(const QString &desc); 0062 void addExtension(); 0063 void removeExtension(); 0064 void enableExtButtons(); 0065 void slotAutoEmbedClicked(int button); 0066 void slotAskSaveToggled(bool); 0067 0068 private: 0069 MimeTypeData *m_mimeTypeData; 0070 TypesListItem *m_item; // can be 0, in keditfiletype! 0071 0072 QLabel *m_mimeTypeLabel; 0073 0074 QTabWidget *m_tabWidget; 0075 0076 // First tab - General 0077 KIconButton *iconButton; 0078 QLabel *iconLabel; // if icon cannot be changed 0079 0080 QListWidget *extensionLB; 0081 QPushButton *addExtButton, *removeExtButton; 0082 KLineEdit *description; 0083 KServiceListWidget *serviceListWidget; 0084 0085 // Second tab - Embedding 0086 QGroupBox *m_autoEmbedBox; 0087 QButtonGroup *m_autoEmbedGroup; 0088 KServiceListWidget *embedServiceListWidget; 0089 QRadioButton *m_rbOpenSeparate; 0090 QCheckBox *m_chkAskSave; 0091 QRadioButton *m_rbGroupSettings; 0092 }; 0093 0094 #endif