File indexing completed on 2024-04-28 16:44:25

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 protected:
0049     void updateRemoveButton();
0050     void updateAskSave();
0051 
0052 Q_SIGNALS:
0053     void embedMajor(const QString &major, bool &embed); // To adjust whether major type is being embedded
0054     void changed(bool);
0055 
0056 protected Q_SLOTS:
0057     void updateIcon(const QString &icon);
0058     void updateDescription(const QString &desc);
0059     void addExtension();
0060     void removeExtension();
0061     void enableExtButtons();
0062     void slotAutoEmbedClicked(int button);
0063     void slotAskSaveToggled(bool);
0064 
0065 private:
0066     MimeTypeData *m_mimeTypeData;
0067     TypesListItem *m_item; // can be 0, in keditfiletype!
0068 
0069     QLabel *m_mimeTypeLabel;
0070 
0071     QTabWidget *m_tabWidget;
0072 
0073     // First tab - General
0074     KIconButton *iconButton;
0075     QLabel *iconLabel; // if icon cannot be changed
0076 
0077     QListWidget *extensionLB;
0078     QPushButton *addExtButton, *removeExtButton;
0079     KLineEdit *description;
0080     KServiceListWidget *serviceListWidget;
0081 
0082     // Second tab - Embedding
0083     QGroupBox *m_autoEmbedBox;
0084     QButtonGroup *m_autoEmbedGroup;
0085     KServiceListWidget *embedServiceListWidget;
0086     QRadioButton *m_rbOpenSeparate;
0087     QCheckBox *m_chkAskSave;
0088     QRadioButton *m_rbGroupSettings;
0089 };
0090 
0091 #endif