summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opieui/okeyconfigwidget.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/libopie2/opieui/okeyconfigwidget.h b/libopie2/opieui/okeyconfigwidget.h
index 3d2260c..cc1ea44 100644
--- a/libopie2/opieui/okeyconfigwidget.h
+++ b/libopie2/opieui/okeyconfigwidget.h
@@ -1,141 +1,142 @@
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#include <qdialog.h>
13 14
14 15
15class QKeyEvent; 16class QKeyEvent;
16class QLabel; 17class QLabel;
17class QPushButton; 18class QPushButton;
18class QListViewItem; 19class QListViewItem;
19class QRadioButton; 20class QRadioButton;
20class QTimer; 21class QTimer;
21 22
22namespace Opie { 23namespace Opie {
23namespace Ui { 24namespace Ui {
24namespace Internal { 25namespace Internal {
25 class OKeyConfigWidgetPrivate; 26 class OKeyConfigWidgetPrivate;
26 typedef QValueList<OKeyConfigWidgetPrivate> OKeyConfigWidgetPrivateList; 27 typedef QValueList<OKeyConfigWidgetPrivate> OKeyConfigWidgetPrivateList;
27 class OKeyListViewItem; 28 class OKeyListViewItem;
28} 29}
29 class OListViewItem; 30 class OListViewItem;
30 class OListView; 31 class OListView;
31 32
32 33
33/** 34/**
34 * With this Widget you can let the Keyboard Shortcuts 35 * With this Widget you can let the Keyboard Shortcuts
35 * be configured by the user. 36 * be configured by the user.
36 * There are two ways you can use this widget. Either in a tab were 37 * 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 38 * 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 39 * were you ask for saving. Save won't write the data but only set
39 * it to the OKeyConfigManager. 40 * it to the OKeyConfigManager.
40 * 41 *
41 * Normally subclassing this widget does not make much sense as the widget content 42 * 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 * 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). 44 * functions do make sense with virtual on it (zecke@handhelds.org).
44 * 45 *
45 * @since 1.2 46 * @since 1.2
46 */ 47 */
47class OKeyConfigWidget : public QWidget { 48class OKeyConfigWidget : public QWidget {
48 Q_OBJECT 49 Q_OBJECT
49 50
50public: 51public:
51 /** 52 /**
52 * Immediate Apply the change directly to the underlying OKeyConfigManager 53 * Immediate Apply the change directly to the underlying OKeyConfigManager
53 * Queue Save all items and then apply when you save() 54 * Queue Save all items and then apply when you save()
54 */ 55 */
55 enum ChangeMode { Imediate, Queue }; 56 enum ChangeMode { Imediate, Queue };
56 OKeyConfigWidget( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); 57 OKeyConfigWidget( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
57 virtual ~OKeyConfigWidget(); 58 virtual ~OKeyConfigWidget();
58 59
59 void setChangeMode( enum ChangeMode ); 60 void setChangeMode( enum ChangeMode );
60 ChangeMode changeMode()const; 61 ChangeMode changeMode()const;
61 62
62 void insert( const QString& name, Opie::Core::OKeyConfigManager* ); 63 void insert( const QString& name, Opie::Core::OKeyConfigManager* );
63 64
64 void load(); 65 void load();
65 void save(); 66 void save();
66 67
67protected slots: 68protected slots:
68 void slotListViewItem( QListViewItem* ); 69 void slotListViewItem( QListViewItem* );
69 void slotNoKey(); 70 void slotNoKey();
70 void slotDefaultKey(); 71 void slotDefaultKey();
71 void slotCustomKey(); 72 void slotCustomKey();
72 void slotConfigure(); 73 void slotConfigure();
73 74
74private: 75private:
75 static bool sanityCheck( Opie::Ui::Internal::OKeyListViewItem* man, 76 static bool sanityCheck( Opie::Ui::Internal::OKeyListViewItem* man,
76 const Opie::Core::OKeyPair& newItem ); 77 const Opie::Core::OKeyPair& newItem );
77 void updateItem( Opie::Ui::Internal::OKeyListViewItem* man, 78 void updateItem( Opie::Ui::Internal::OKeyListViewItem* man,
78 const Opie::Core::OKeyPair& newItem); 79 const Opie::Core::OKeyPair& newItem);
79 void initUi(); 80 void initUi();
80 Opie::Ui::OListView *m_view; 81 Opie::Ui::OListView *m_view;
81 Opie::Ui::Internal::OKeyConfigWidgetPrivateList m_list; 82 Opie::Ui::Internal::OKeyConfigWidgetPrivateList m_list;
82 QLabel *m_lbl; 83 QLabel *m_lbl;
83 QPushButton *m_btn; 84 QPushButton *m_btn;
84 QRadioButton *m_def, *m_cus, *m_none; 85 QRadioButton *m_def, *m_cus, *m_none;
85 QWidget* m_box; 86 QWidget* m_box;
86 ChangeMode m_mode; 87 ChangeMode m_mode;
87 class Private; 88 class Private;
88 Private *d; 89 Private *d;
89}; 90};
90 91
91 92
92/** 93/**
93 * This is a small dialog that allows you to 94 * This is a small dialog that allows you to
94 * capture a key sequence. 95 * capture a key sequence.
95 * If you want it to close after a key was captured you 96 * If you want it to close after a key was captured you
96 * can use this code snippet. 97 * can use this code snippet.
97 * 98 *
98 * \code 99 * \code
99 * OKeyChooserConfigDialog diag(0,0,true); 100 * OKeyChooserConfigDialog diag(0,0,true);
100 * connect(&diag,SIGNAL(keyCaptured()), 101 * connect(&diag,SIGNAL(keyCaptured()),
101 * this,SLOT(accept())); 102 * this,SLOT(accept()));
102 * if( QPEApplication::execDialog(&diag) == QDialog::Accept ){ 103 * if( QPEApplication::execDialog(&diag) == QDialog::Accept ){
103 * take_the_key_and_do_something 104 * take_the_key_and_do_something
104 * } 105 * }
105 * 106 *
106 * \endcode 107 * \endcode
107 * 108 *
108 */ 109 */
109class OKeyChooserConfigDialog : public QDialog { 110class OKeyChooserConfigDialog : public QDialog {
110 Q_OBJECT 111 Q_OBJECT
111public: 112public:
112 OKeyChooserConfigDialog( QWidget* parent = 0, const char* name = 0, bool modal = false, WFlags fl = 0 ); 113 OKeyChooserConfigDialog( QWidget* parent = 0, const char* name = 0, bool modal = false, WFlags fl = 0 );
113 ~OKeyChooserConfigDialog(); 114 ~OKeyChooserConfigDialog();
114 115
115 Opie::Core::OKeyPair keyPair()const; 116 Opie::Core::OKeyPair keyPair()const;
116 117
117protected: 118protected:
118 void keyPressEvent( QKeyEvent* ); 119 void keyPressEvent( QKeyEvent* );
119 void keyReleaseEvent( QKeyEvent* ); 120 void keyReleaseEvent( QKeyEvent* );
120 121
121signals: 122signals:
122 void keyCaptured(); 123 void keyCaptured();
123 124
124private slots: 125private slots:
125 void slotTimeUp(); 126 void slotTimeUp();
126 127
127private: 128private:
128 QTimer *m_timer; 129 QTimer *m_timer;
129 QLabel *m_lbl; 130 QLabel *m_lbl;
130 bool m_virtKey : 1; 131 bool m_virtKey : 1;
131 Opie::Core::OKeyPair m_keyPair; 132 Opie::Core::OKeyPair m_keyPair;
132 int m_key, m_mod; 133 int m_key, m_mod;
133 class Private; 134 class Private;
134 Private *d; 135 Private *d;
135}; 136};
136 137
137} 138}
138} 139}
139 140
140 141
141#endif 142#endif