-rw-r--r-- | libopie2/opieui/okeyconfigwidget.h | 10 | ||||
-rw-r--r-- | libopie2/opieui/otaskbarapplet.h | 1 |
2 files changed, 8 insertions, 3 deletions
diff --git a/libopie2/opieui/okeyconfigwidget.h b/libopie2/opieui/okeyconfigwidget.h index d11054c..3d2260c 100644 --- a/libopie2/opieui/okeyconfigwidget.h +++ b/libopie2/opieui/okeyconfigwidget.h | |||
@@ -1,137 +1,141 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2004 | 2 | * Copyright (C) 2004 |
3 | * LGPL v2 zecke@handhelds.org | 3 | * LGPL v2 zecke@handhelds.org |
4 | */ | 4 | */ |
5 | 5 | ||
6 | 6 | ||
7 | #ifndef ODP_KEY_CONFIG_WIDGET_H | 7 | #ifndef ODP_KEY_CONFIG_WIDGET_H |
8 | #define ODP_KEY_CONFIG_WIDGET_H | 8 | #define ODP_KEY_CONFIG_WIDGET_H |
9 | 9 | ||
10 | #include <opie2/okeyconfigmanager.h> | 10 | #include <opie2/okeyconfigmanager.h> |
11 | 11 | ||
12 | #include <qhbox.h> | 12 | #include <qhbox.h> |
13 | 13 | ||
14 | 14 | ||
15 | class QKeyEvent; | 15 | class QKeyEvent; |
16 | class QLabel; | 16 | class QLabel; |
17 | class QPushButton; | 17 | class QPushButton; |
18 | class QListViewItem; | 18 | class QListViewItem; |
19 | class QRadioButton; | 19 | class QRadioButton; |
20 | class QTimer; | 20 | class QTimer; |
21 | 21 | ||
22 | namespace Opie { | 22 | namespace Opie { |
23 | namespace Ui { | 23 | namespace Ui { |
24 | namespace Internal { | 24 | namespace Internal { |
25 | class OKeyConfigWidgetPrivate; | 25 | class OKeyConfigWidgetPrivate; |
26 | typedef QValueList<OKeyConfigWidgetPrivate> OKeyConfigWidgetPrivateList; | 26 | typedef QValueList<OKeyConfigWidgetPrivate> OKeyConfigWidgetPrivateList; |
27 | class OKeyListViewItem; | 27 | class OKeyListViewItem; |
28 | } | 28 | } |
29 | class OListViewItem; | 29 | class OListViewItem; |
30 | class OListView; | 30 | class OListView; |
31 | 31 | ||
32 | 32 | ||
33 | /** | 33 | /** |
34 | * With this Widget you can let the Keyboard Shortcuts | 34 | * With this Widget you can let the Keyboard Shortcuts |
35 | * be configured by the user. | 35 | * be configured by the user. |
36 | * There are two ways you can use this widget. Either in a tab were | 36 | * There are two ways you can use this widget. Either in a tab were |
37 | * all changes are immediately getting into effect or in a queue | 37 | * all changes are immediately getting into effect or in a queue |
38 | * were you ask for saving. Save won't write the data but only set | 38 | * were you ask for saving. Save won't write the data but only set |
39 | * it to the OKeyConfigManager | 39 | * it to the OKeyConfigManager. |
40 | * | ||
41 | * Normally subclassing this widget does not make much sense as the widget content | ||
42 | * as such is immutable. If I'm wrong I'm willing to learn and you could mail me which | ||
43 | * functions do make sense with virtual on it (zecke@handhelds.org). | ||
40 | * | 44 | * |
41 | * @since 1.2 | 45 | * @since 1.2 |
42 | */ | 46 | */ |
43 | class OKeyConfigWidget : public QWidget { | 47 | class OKeyConfigWidget : public QWidget { |
44 | Q_OBJECT | 48 | Q_OBJECT |
45 | 49 | ||
46 | public: | 50 | public: |
47 | /** | 51 | /** |
48 | * Immediate Apply the change directly to the underlying OKeyConfigManager | 52 | * Immediate Apply the change directly to the underlying OKeyConfigManager |
49 | * Queue Save all items and then apply when you save() | 53 | * Queue Save all items and then apply when you save() |
50 | */ | 54 | */ |
51 | enum ChangeMode { Imediate, Queue }; | 55 | enum ChangeMode { Imediate, Queue }; |
52 | OKeyConfigWidget( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | 56 | OKeyConfigWidget( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); |
53 | ~OKeyConfigWidget(); | 57 | virtual ~OKeyConfigWidget(); |
54 | 58 | ||
55 | void setChangeMode( enum ChangeMode ); | 59 | void setChangeMode( enum ChangeMode ); |
56 | ChangeMode changeMode()const; | 60 | ChangeMode changeMode()const; |
57 | 61 | ||
58 | void insert( const QString& name, Opie::Core::OKeyConfigManager* ); | 62 | void insert( const QString& name, Opie::Core::OKeyConfigManager* ); |
59 | 63 | ||
60 | void load(); | 64 | void load(); |
61 | void save(); | 65 | void save(); |
62 | 66 | ||
63 | private slots: | 67 | protected slots: |
64 | void slotListViewItem( QListViewItem* ); | 68 | void slotListViewItem( QListViewItem* ); |
65 | void slotNoKey(); | 69 | void slotNoKey(); |
66 | void slotDefaultKey(); | 70 | void slotDefaultKey(); |
67 | void slotCustomKey(); | 71 | void slotCustomKey(); |
68 | void slotConfigure(); | 72 | void slotConfigure(); |
69 | 73 | ||
70 | private: | 74 | private: |
71 | static bool sanityCheck( Opie::Ui::Internal::OKeyListViewItem* man, | 75 | static bool sanityCheck( Opie::Ui::Internal::OKeyListViewItem* man, |
72 | const Opie::Core::OKeyPair& newItem ); | 76 | const Opie::Core::OKeyPair& newItem ); |
73 | void updateItem( Opie::Ui::Internal::OKeyListViewItem* man, | 77 | void updateItem( Opie::Ui::Internal::OKeyListViewItem* man, |
74 | const Opie::Core::OKeyPair& newItem); | 78 | const Opie::Core::OKeyPair& newItem); |
75 | void initUi(); | 79 | void initUi(); |
76 | Opie::Ui::OListView *m_view; | 80 | Opie::Ui::OListView *m_view; |
77 | Opie::Ui::Internal::OKeyConfigWidgetPrivateList m_list; | 81 | Opie::Ui::Internal::OKeyConfigWidgetPrivateList m_list; |
78 | QLabel *m_lbl; | 82 | QLabel *m_lbl; |
79 | QPushButton *m_btn; | 83 | QPushButton *m_btn; |
80 | QRadioButton *m_def, *m_cus, *m_none; | 84 | QRadioButton *m_def, *m_cus, *m_none; |
81 | QWidget* m_box; | 85 | QWidget* m_box; |
82 | ChangeMode m_mode; | 86 | ChangeMode m_mode; |
83 | class Private; | 87 | class Private; |
84 | Private *d; | 88 | Private *d; |
85 | }; | 89 | }; |
86 | 90 | ||
87 | 91 | ||
88 | /** | 92 | /** |
89 | * This is a small dialog that allows you to | 93 | * This is a small dialog that allows you to |
90 | * capture a key sequence. | 94 | * capture a key sequence. |
91 | * If you want it to close after a key was captured you | 95 | * If you want it to close after a key was captured you |
92 | * can use this code snippet. | 96 | * can use this code snippet. |
93 | * | 97 | * |
94 | * \code | 98 | * \code |
95 | * OKeyChooserConfigDialog diag(0,0,true); | 99 | * OKeyChooserConfigDialog diag(0,0,true); |
96 | * connect(&diag,SIGNAL(keyCaptured()), | 100 | * connect(&diag,SIGNAL(keyCaptured()), |
97 | * this,SLOT(accept())); | 101 | * this,SLOT(accept())); |
98 | * if( QPEApplication::execDialog(&diag) == QDialog::Accept ){ | 102 | * if( QPEApplication::execDialog(&diag) == QDialog::Accept ){ |
99 | * take_the_key_and_do_something | 103 | * take_the_key_and_do_something |
100 | * } | 104 | * } |
101 | * | 105 | * |
102 | * \endcode | 106 | * \endcode |
103 | * | 107 | * |
104 | */ | 108 | */ |
105 | class OKeyChooserConfigDialog : public QDialog { | 109 | class OKeyChooserConfigDialog : public QDialog { |
106 | Q_OBJECT | 110 | Q_OBJECT |
107 | public: | 111 | public: |
108 | OKeyChooserConfigDialog( QWidget* parent = 0, const char* name = 0, bool modal = false, WFlags fl = 0 ); | 112 | OKeyChooserConfigDialog( QWidget* parent = 0, const char* name = 0, bool modal = false, WFlags fl = 0 ); |
109 | ~OKeyChooserConfigDialog(); | 113 | ~OKeyChooserConfigDialog(); |
110 | 114 | ||
111 | Opie::Core::OKeyPair keyPair()const; | 115 | Opie::Core::OKeyPair keyPair()const; |
112 | 116 | ||
113 | protected: | 117 | protected: |
114 | void keyPressEvent( QKeyEvent* ); | 118 | void keyPressEvent( QKeyEvent* ); |
115 | void keyReleaseEvent( QKeyEvent* ); | 119 | void keyReleaseEvent( QKeyEvent* ); |
116 | 120 | ||
117 | signals: | 121 | signals: |
118 | void keyCaptured(); | 122 | void keyCaptured(); |
119 | 123 | ||
120 | private slots: | 124 | private slots: |
121 | void slotTimeUp(); | 125 | void slotTimeUp(); |
122 | 126 | ||
123 | private: | 127 | private: |
124 | QTimer *m_timer; | 128 | QTimer *m_timer; |
125 | QLabel *m_lbl; | 129 | QLabel *m_lbl; |
126 | bool m_virtKey : 1; | 130 | bool m_virtKey : 1; |
127 | Opie::Core::OKeyPair m_keyPair; | 131 | Opie::Core::OKeyPair m_keyPair; |
128 | int m_key, m_mod; | 132 | int m_key, m_mod; |
129 | class Private; | 133 | class Private; |
130 | Private *d; | 134 | Private *d; |
131 | }; | 135 | }; |
132 | 136 | ||
133 | } | 137 | } |
134 | } | 138 | } |
135 | 139 | ||
136 | 140 | ||
137 | #endif | 141 | #endif |
diff --git a/libopie2/opieui/otaskbarapplet.h b/libopie2/opieui/otaskbarapplet.h index ec7b9c4..77cc461 100644 --- a/libopie2/opieui/otaskbarapplet.h +++ b/libopie2/opieui/otaskbarapplet.h | |||
@@ -18,112 +18,113 @@ | |||
18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
20 | ..}^=.= = ; Library General Public License for more | 20 | ..}^=.= = ; Library General Public License for more |
21 | ++= -. .` .: details. | 21 | ++= -. .` .: details. |
22 | : = ...= . :.=- | 22 | : = ...= . :.=- |
23 | -. .:....=;==+<; You should have received a copy of the GNU | 23 | -. .:....=;==+<; You should have received a copy of the GNU |
24 | -_. . . )=. = Library General Public License along with | 24 | -_. . . )=. = Library General Public License along with |
25 | -- :-=` this library; see the file COPYING.LIB. | 25 | -- :-=` this library; see the file COPYING.LIB. |
26 | If not, write to the Free Software Foundation, | 26 | If not, write to the Free Software Foundation, |
27 | Inc., 59 Temple Place - Suite 330, | 27 | Inc., 59 Temple Place - Suite 330, |
28 | Boston, MA 02111-1307, USA. | 28 | Boston, MA 02111-1307, USA. |
29 | 29 | ||
30 | */ | 30 | */ |
31 | 31 | ||
32 | #ifndef OTASKBARAPPLET_H | 32 | #ifndef OTASKBARAPPLET_H |
33 | #define OTASKBARAPPLET_H | 33 | #define OTASKBARAPPLET_H |
34 | 34 | ||
35 | #include <qpe/taskbarappletinterface.h> | 35 | #include <qpe/taskbarappletinterface.h> |
36 | #include <qpe/qcom.h> | 36 | #include <qpe/qcom.h> |
37 | 37 | ||
38 | #include <qwidget.h> | 38 | #include <qwidget.h> |
39 | 39 | ||
40 | class QMouseEvent; | 40 | class QMouseEvent; |
41 | 41 | ||
42 | namespace Opie { | 42 | namespace Opie { |
43 | namespace Ui { | 43 | namespace Ui { |
44 | namespace Internal { | 44 | namespace Internal { |
45 | /*====================================================================================== | 45 | /*====================================================================================== |
46 | * OTaskbarAppletWrapper | 46 | * OTaskbarAppletWrapper |
47 | *======================================================================================*/ | 47 | *======================================================================================*/ |
48 | 48 | ||
49 | class OTaskbarAppletWrapperPrivate; | 49 | class OTaskbarAppletWrapperPrivate; |
50 | template<class T> class OTaskbarAppletWrapper : public TaskbarAppletInterface | 50 | template<class T> class OTaskbarAppletWrapper : public TaskbarAppletInterface |
51 | { | 51 | { |
52 | public: | 52 | public: |
53 | OTaskbarAppletWrapper():_applet( 0 ) | 53 | OTaskbarAppletWrapper():_applet( 0 ) |
54 | { | 54 | { |
55 | } | 55 | } |
56 | 56 | ||
57 | virtual ~OTaskbarAppletWrapper() | 57 | virtual ~OTaskbarAppletWrapper() |
58 | { | 58 | { |
59 | delete _applet; | 59 | delete _applet; |
60 | } | 60 | } |
61 | 61 | ||
62 | QRESULT queryInterface( const QUuid& uuid, QUnknownInterface** iface ) | 62 | QRESULT queryInterface( const QUuid& uuid, QUnknownInterface** iface ) |
63 | { | 63 | { |
64 | qDebug( "OTaskbarAppletWrapper::queryInterface()" ); | 64 | qDebug( "OTaskbarAppletWrapper::queryInterface()" ); |
65 | *iface = 0; | 65 | *iface = 0; |
66 | if ( uuid == IID_QUnknown ) | 66 | if ( uuid == IID_QUnknown ) |
67 | *iface = this; | 67 | *iface = this; |
68 | else if ( uuid == IID_TaskbarApplet ) | 68 | else if ( uuid == IID_TaskbarApplet ) |
69 | *iface = this; | 69 | *iface = this; |
70 | else | 70 | else |
71 | return QS_FALSE; | 71 | return QS_FALSE; |
72 | 72 | ||
73 | if ( *iface ) (*iface)->addRef(); | 73 | if ( *iface ) (*iface)->addRef(); |
74 | return QS_OK; | 74 | return QS_OK; |
75 | } | 75 | } |
76 | 76 | ||
77 | Q_REFCOUNT | 77 | Q_REFCOUNT |
78 | 78 | ||
79 | virtual T* applet( QWidget* parent ) | 79 | virtual T* applet( QWidget* parent ) |
80 | { | 80 | { |
81 | if ( !_applet ) _applet = new T( parent ); | 81 | if ( !_applet ) _applet = new T( parent ); |
82 | return _applet; | 82 | return _applet; |
83 | } | 83 | } |
84 | 84 | ||
85 | virtual int position() const | 85 | virtual int position() const |
86 | { | 86 | { |
87 | return T::position(); | 87 | return T::position(); |
88 | } | 88 | } |
89 | 89 | ||
90 | private: | 90 | private: |
91 | T* _applet; | 91 | T* _applet; |
92 | OTaskbarAppletWrapperPrivate *d; | 92 | OTaskbarAppletWrapperPrivate *d; |
93 | }; | 93 | }; |
94 | 94 | ||
95 | } | 95 | } |
96 | /*====================================================================================== | 96 | /*====================================================================================== |
97 | * OTaskbarApplet | 97 | * OTaskbarApplet |
98 | *======================================================================================*/ | 98 | *======================================================================================*/ |
99 | 99 | ||
100 | // Must be inline until after we shipped Opie 1.0 | 100 | // Must be inline until after we shipped Opie 1.0 |
101 | 101 | ||
102 | // Having OTaskBarApplet reside in libopieui2 is not possible | 102 | // Having OTaskBarApplet reside in libopieui2 is not possible |
103 | // until we link the launcher binary against libopieui2 - | 103 | // until we link the launcher binary against libopieui2 - |
104 | // otherwise the necessary symbols are not present, when | 104 | // otherwise the necessary symbols are not present, when |
105 | // the dynamic loader [dlopen] tries to resolve an applet which | 105 | // the dynamic loader [dlopen] tries to resolve an applet which |
106 | // inherits OTaskbarApplet | 106 | // inherits OTaskbarApplet |
107 | 107 | ||
108 | class OTaskbarApplet : public QWidget | 108 | class OTaskbarApplet : public QWidget |
109 | { | 109 | { |
110 | public: | 110 | public: |
111 | OTaskbarApplet( QWidget* parent, const char* name = 0 ); | 111 | OTaskbarApplet( QWidget* parent, const char* name = 0 ); |
112 | virtual ~OTaskbarApplet(); | 112 | virtual ~OTaskbarApplet(); |
113 | 113 | ||
114 | |||
114 | protected: | 115 | protected: |
115 | virtual void popup( QWidget* widget ); | 116 | virtual void popup( QWidget* widget ); |
116 | private: | 117 | private: |
117 | class Private; | 118 | class Private; |
118 | Private *d; | 119 | Private *d; |
119 | }; | 120 | }; |
120 | } | 121 | } |
121 | } | 122 | } |
122 | 123 | ||
123 | #define EXPORT_OPIE_APPLET_v1( AppLet ) \ | 124 | #define EXPORT_OPIE_APPLET_v1( AppLet ) \ |
124 | Q_EXPORT_INTERFACE() { \ | 125 | Q_EXPORT_INTERFACE() { \ |
125 | Q_CREATE_INSTANCE( Opie::Ui::Internal::OTaskbarAppletWrapper<AppLet> ) \ | 126 | Q_CREATE_INSTANCE( Opie::Ui::Internal::OTaskbarAppletWrapper<AppLet> ) \ |
126 | } | 127 | } |
127 | 128 | ||
128 | #endif | 129 | #endif |
129 | 130 | ||