1 | /* This file is part of the KDE project |
2 | Copyright (C) 2003 Waldo Bastian <bastian@kde.org> |
3 | Copyright (C) 2003 David Faure <faure@kde.org> |
4 | Copyright (C) 2002 Daniel Molkentin <molkentin@kde.org> |
5 | |
6 | This program is free software; you can redistribute it and/or |
7 | modify it under the terms of the GNU General Public |
8 | License version 2 or at your option version 3 as published |
9 | by the Free Software Foundation. |
10 | |
11 | This program is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | General Public License for more details. |
15 | |
16 | You should have received a copy of the GNU General Public License |
17 | along with this program; see the file COPYING. If not, write to |
18 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
19 | Boston, MA 02110-1301, USA. |
20 | */ |
21 | |
22 | #ifndef _KSERVICELISTWIDGET_H |
23 | #define _KSERVICELISTWIDGET_H |
24 | |
25 | #include <QGroupBox> |
26 | #include <QListWidget> |
27 | #include <kservice.h> |
28 | class MimeTypeData; |
29 | class KPushButton; |
30 | class KService; |
31 | |
32 | class KServiceListItem : public QListWidgetItem |
33 | { |
34 | public: |
35 | KServiceListItem( const KService::Ptr& pService, int kind ); |
36 | bool isImmutable() const; |
37 | QString storageId; |
38 | QString desktopPath; |
39 | QString localPath; |
40 | }; |
41 | |
42 | /** |
43 | * This widget holds a list of services, with 5 buttons to manage it. |
44 | * It's a separate class so that it can be used by both tabs of the |
45 | * module, once for applications and once for services. |
46 | * The "kind" is determined by the argument given to the constructor. |
47 | */ |
48 | class KServiceListWidget : public QGroupBox |
49 | { |
50 | Q_OBJECT |
51 | public: |
52 | enum { SERVICELIST_APPLICATIONS, SERVICELIST_SERVICES }; |
53 | explicit KServiceListWidget(int kind, QWidget *parent = 0); |
54 | |
55 | void setMimeTypeData( MimeTypeData * item ); |
56 | |
57 | Q_SIGNALS: |
58 | void changed(bool); |
59 | |
60 | protected Q_SLOTS: |
61 | void promoteService(); |
62 | void demoteService(); |
63 | void addService(); |
64 | void editService(); |
65 | void removeService(); |
66 | void enableMoveButtons(); |
67 | |
68 | protected: |
69 | void updatePreferredServices(); |
70 | |
71 | private: |
72 | int m_kind; |
73 | QListWidget *servicesLB; |
74 | KPushButton *servUpButton, *servDownButton; |
75 | KPushButton *servNewButton, *servEditButton, *servRemoveButton; |
76 | MimeTypeData *m_mimeTypeData; |
77 | }; |
78 | |
79 | #endif |
80 | |