1 | /* This file is part of the KDE project |
2 | Copyright (C) 2000, 2007 David Faure <faure@kde.org> |
3 | |
4 | This program is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU General Public |
6 | License version 2 or at your option version 3 as published by |
7 | the Free Software Foundation. |
8 | |
9 | This program is distributed in the hope that it will be useful, |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 | General Public License for more details. |
13 | |
14 | You should have received a copy of the GNU General Public License |
15 | along with this program; see the file COPYING. If not, write to |
16 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
17 | Boston, MA 02110-1301, USA. |
18 | */ |
19 | |
20 | #ifndef FILETYPEDETAILS_H |
21 | #define FILETYPEDETAILS_H |
22 | |
23 | #include <QTabWidget> |
24 | |
25 | class KIconButton; |
26 | class MimeTypeData; |
27 | class TypesListItem; |
28 | class QLabel; |
29 | class QListWidget; |
30 | class QGroupBox; |
31 | class QButtonGroup; |
32 | class QCheckBox; |
33 | class QRadioButton; |
34 | class KLineEdit; |
35 | class KPushButton; |
36 | class KServiceListWidget; |
37 | |
38 | /** |
39 | * This widget contains the right part of the file type configuration |
40 | * dialog, that shows the details for a file type. |
41 | * It is implemented as a separate class so that it can be used by |
42 | * the keditfiletype program to show the details of a single mimetype. |
43 | */ |
44 | class FileTypeDetails : public QWidget |
45 | { |
46 | Q_OBJECT |
47 | public: |
48 | FileTypeDetails(QWidget *parent = 0); |
49 | |
50 | /** |
51 | * Set a non-gui "mimetype data" to work on, |
52 | * and optionally a gui "treeview item", to update its icon if set. |
53 | */ |
54 | void setMimeTypeData( MimeTypeData * mimeTypeData, TypesListItem* item = 0 ); |
55 | |
56 | /** |
57 | * Called when ksycoca has changed |
58 | */ |
59 | void refresh(); |
60 | |
61 | protected: |
62 | void updateRemoveButton(); |
63 | void updateAskSave(); |
64 | |
65 | Q_SIGNALS: |
66 | void embedMajor(const QString &major, bool &embed); // To adjust whether major type is being embedded |
67 | void changed(bool); |
68 | |
69 | protected Q_SLOTS: |
70 | void updateIcon(const QString &icon); |
71 | void updateDescription(const QString &desc); |
72 | void addExtension(); |
73 | void removeExtension(); |
74 | void enableExtButtons(); |
75 | void slotAutoEmbedClicked(int button); |
76 | void slotAskSaveToggled(bool); |
77 | |
78 | private: |
79 | MimeTypeData* m_mimeTypeData; |
80 | TypesListItem* m_item; // can be 0, in keditfiletype! |
81 | |
82 | QLabel* m_mimeTypeLabel; |
83 | |
84 | QTabWidget* m_tabWidget; |
85 | |
86 | // First tab - General |
87 | KIconButton* iconButton; |
88 | QLabel* iconLabel; // if icon cannot be changed |
89 | |
90 | QListWidget *extensionLB; |
91 | KPushButton *addExtButton, *removeExtButton; |
92 | KLineEdit *description; |
93 | KServiceListWidget *serviceListWidget; |
94 | |
95 | // Second tab - Embedding |
96 | QGroupBox *m_autoEmbedBox; |
97 | QButtonGroup *m_autoEmbedGroup; |
98 | KServiceListWidget *embedServiceListWidget; |
99 | QRadioButton *m_rbOpenSeparate; |
100 | QCheckBox *m_chkAskSave; |
101 | QRadioButton *m_rbGroupSettings; |
102 | }; |
103 | |
104 | #endif |
105 | |