1 | /* This file is part of the KDE libraries |
2 | Copyright (C) 2005 Olivier Goffart <ogoffart at kde.org> |
3 | |
4 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Library General Public |
6 | License version 2 as published by the Free Software Foundation. |
7 | |
8 | This library is distributed in the hope that it will be useful, |
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
11 | Library General Public License for more details. |
12 | |
13 | You should have received a copy of the GNU Library General Public License |
14 | along with this library; see the file COPYING.LIB. If not, write to |
15 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
16 | Boston, MA 02110-1301, USA. |
17 | */ |
18 | |
19 | #ifndef KNOTIFYCONFIGWIDGET_H |
20 | #define KNOTIFYCONFIGWIDGET_H |
21 | |
22 | #include <knotifyconfig_export.h> |
23 | #include <QtGui/QWidget> |
24 | #include <QtCore/QString> |
25 | |
26 | class KNotifyConfigElement; |
27 | |
28 | /** |
29 | * Configure the notification for a given application / context |
30 | * |
31 | * You probably will want to use the static function configure |
32 | * |
33 | * If you create the widget yourself, you must call setApplication before showing it |
34 | * |
35 | * @author Olivier Goffart <ogoffart @ kde.org> |
36 | */ |
37 | class KNOTIFYCONFIG_EXPORT KNotifyConfigWidget : public QWidget |
38 | { |
39 | Q_OBJECT |
40 | public: |
41 | KNotifyConfigWidget( QWidget *parent); |
42 | ~KNotifyConfigWidget(); |
43 | |
44 | /** |
45 | * Show a dialog with the widget. |
46 | * @param parent the parent widget of the dialog |
47 | * @param appname the application name, if null, it is autodetected |
48 | * @return the widget itself the topLevelWidget of it is probably a KDialog |
49 | */ |
50 | static KNotifyConfigWidget *configure(QWidget *parent = 0l, const QString &appname=QString()); |
51 | |
52 | /** |
53 | * Change the application and the context |
54 | * |
55 | * @param appname name of the application. if null KGlobal::mainComponent().componentName() is used |
56 | * @param context_name the name of the context, if null , avery context are considered |
57 | * @param context_value the context value |
58 | */ |
59 | void setApplication( const QString & appname = QString() , |
60 | const QString & context_name = QString(), |
61 | const QString & context_value = QString()); |
62 | |
63 | public Q_SLOTS: |
64 | /** |
65 | * save to the config file |
66 | */ |
67 | void save(); |
68 | |
69 | Q_SIGNALS: |
70 | /** |
71 | * Indicate that the state of the modules contents has changed. |
72 | * This signal is emitted whenever the state of the configuration changes. |
73 | * @see KCModule::changed |
74 | */ |
75 | void changed(bool state); |
76 | |
77 | private: |
78 | struct Private; |
79 | Private* const d; |
80 | private Q_SLOTS: |
81 | void slotEventSelected( KNotifyConfigElement *e); |
82 | void slotActionChanged(); |
83 | |
84 | }; |
85 | |
86 | #endif |
87 | |