-rw-r--r-- | libopie2/qt3/opieui/ocombobox.h | 4 | ||||
-rw-r--r-- | libopie2/qt3/opieui/olineedit.h | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/libopie2/qt3/opieui/ocombobox.h b/libopie2/qt3/opieui/ocombobox.h index 4e35b61..3f60f54 100644 --- a/libopie2/qt3/opieui/ocombobox.h +++ b/libopie2/qt3/opieui/ocombobox.h | |||
@@ -1,164 +1,164 @@ | |||
1 | /* | 1 | /* |
2 | This file Copyright (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> | 2 | This file Copyright (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> |
3 | is part of the Copyright (C) 2000 Carsten Pfeiffer <pfeiffer@kde.org> | 3 | is part of the Copyright (C) 2000 Carsten Pfeiffer <pfeiffer@kde.org> |
4 | Opie Project Copyright (C) 2000 Dawit Alemayehu <adawit@kde.org> | 4 | Opie Project Copyright (C) 2000 Dawit Alemayehu <adawit@kde.org> |
5 | 5 | ||
6 | =. Originally part of the KDE projects | 6 | =. Originally part of the KDE projects |
7 | .=l. | 7 | .=l. |
8 | .>+-= | 8 | .>+-= |
9 | _;:, .> :=|. This program is free software; you can | 9 | _;:, .> :=|. This program is free software; you can |
10 | .> <`_, > . <= redistribute it and/or modify it under | 10 | .> <`_, > . <= redistribute it and/or modify it under |
11 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 11 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
12 | .="- .-=="i, .._ License as published by the Free Software | 12 | .="- .-=="i, .._ License as published by the Free Software |
13 | - . .-<_> .<> Foundation; either version 2 of the License, | 13 | - . .-<_> .<> Foundation; either version 2 of the License, |
14 | ._= =} : or (at your option) any later version. | 14 | ._= =} : or (at your option) any later version. |
15 | .%`+i> _;_. | 15 | .%`+i> _;_. |
16 | .i_,=:_. -<s. This program is distributed in the hope that | 16 | .i_,=:_. -<s. This program is distributed in the hope that |
17 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 17 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
18 | : .. .:, . . . without even the implied warranty of | 18 | : .. .:, . . . without even the implied warranty of |
19 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 19 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
20 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 20 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
21 | ..}^=.= = ; Library General Public License for more | 21 | ..}^=.= = ; Library General Public License for more |
22 | ++= -. .` .: details. | 22 | ++= -. .` .: details. |
23 | : = ...= . :.=- | 23 | : = ...= . :.=- |
24 | -. .:....=;==+<; You should have received a copy of the GNU | 24 | -. .:....=;==+<; You should have received a copy of the GNU |
25 | -_. . . )=. = Library General Public License along with | 25 | -_. . . )=. = Library General Public License along with |
26 | -- :-=` this library; see the file COPYING.LIB. | 26 | -- :-=` this library; see the file COPYING.LIB. |
27 | If not, write to the Free Software Foundation, | 27 | If not, write to the Free Software Foundation, |
28 | Inc., 59 Temple Place - Suite 330, | 28 | Inc., 59 Temple Place - Suite 330, |
29 | Boston, MA 02111-1307, USA. | 29 | Boston, MA 02111-1307, USA. |
30 | 30 | ||
31 | */ | 31 | */ |
32 | 32 | ||
33 | #ifndef OCOMBOBOX_H | 33 | #ifndef OCOMBOBOX_H |
34 | #define OCOMBOBOX_H | 34 | #define OCOMBOBOX_H |
35 | 35 | ||
36 | /* QT */ | 36 | /* QT */ |
37 | 37 | ||
38 | #include <qcombobox.h> | 38 | #include <qcombobox.h> |
39 | 39 | ||
40 | /* OPIE */ | 40 | /* OPIE */ |
41 | 41 | ||
42 | #include <opie2/olineedit.h> | 42 | #include <opie2/olineedit.h> |
43 | #include <opie2/ocompletion.h> | 43 | #include <opie2/ocompletion.h> |
44 | #include <opie2/ocompletionbase.h> | 44 | #include <opie2/ocompletionbase.h> |
45 | 45 | ||
46 | /* FORWARDS */ | 46 | /* FORWARDS */ |
47 | 47 | ||
48 | class QListBoxItem; | 48 | class QListBoxItem; |
49 | class QPopupMenu; | 49 | class QPopupMenu; |
50 | class OCompletionBox; | 50 | class OCompletionBox; |
51 | typedef QString OURL; | 51 | typedef QString OURL; |
52 | 52 | ||
53 | /** | 53 | /** |
54 | * A combined button, line-edit and a popup list widget. | 54 | * A combined button, line-edit and a popup list widget. |
55 | * | 55 | * |
56 | * @sect Detail | 56 | * @par Detail |
57 | * | 57 | * |
58 | * This widget inherits from @ref QComboBox and implements | 58 | * This widget inherits from @ref QComboBox and implements |
59 | * the following additional functionalities: a completion | 59 | * the following additional functionalities: a completion |
60 | * object that provides both automatic and manual text | 60 | * object that provides both automatic and manual text |
61 | * completion as well as text rotation features, configurable | 61 | * completion as well as text rotation features, configurable |
62 | * key-bindings to activate these features, and a popup-menu | 62 | * key-bindings to activate these features, and a popup-menu |
63 | * item that can be used to allow the user to set text completion | 63 | * item that can be used to allow the user to set text completion |
64 | * modes on the fly based on their preference. | 64 | * modes on the fly based on their preference. |
65 | * | 65 | * |
66 | * To support these new features OComboBox also emits a few | 66 | * To support these new features OComboBox also emits a few |
67 | * more additional signals as well. The main ones are the | 67 | * more additional signals as well. The main ones are the |
68 | * @ref completion( const QString& ) and @ref textRotation( KeyBindingType ) | 68 | * @ref completion( const QString& ) and @ref textRotation( KeyBindingType ) |
69 | * signals. The completion signal is intended to be connected to a slot | 69 | * signals. The completion signal is intended to be connected to a slot |
70 | * that will assist the user in filling out the remaining text while | 70 | * that will assist the user in filling out the remaining text while |
71 | * the rotation signals is intended to be used to traverse through all | 71 | * the rotation signals is intended to be used to traverse through all |
72 | * possible matches whenever text completion results in multiple matches. | 72 | * possible matches whenever text completion results in multiple matches. |
73 | * The @ref returnPressed() and @ref returnPressed( const QString& ) | 73 | * The @ref returnPressed() and @ref returnPressed( const QString& ) |
74 | * signal is emitted when the user presses the Enter/Return key. | 74 | * signal is emitted when the user presses the Enter/Return key. |
75 | * | 75 | * |
76 | * This widget by default creates a completion object when you invoke | 76 | * This widget by default creates a completion object when you invoke |
77 | * the @ref completionObject( bool ) member function for the first time | 77 | * the @ref completionObject( bool ) member function for the first time |
78 | * or use @ref setCompletionObject( OCompletion*, bool ) to assign your | 78 | * or use @ref setCompletionObject( OCompletion*, bool ) to assign your |
79 | * own completion object. Additionally, to make this widget more functional, | 79 | * own completion object. Additionally, to make this widget more functional, |
80 | * OComboBox will by default handle the text rotation and completion | 80 | * OComboBox will by default handle the text rotation and completion |
81 | * events internally whenever a completion object is created through either | 81 | * events internally whenever a completion object is created through either |
82 | * one of the methods mentioned above. If you do not need this functionality, | 82 | * one of the methods mentioned above. If you do not need this functionality, |
83 | * simply use @ref OCompletionBase::setHandleSignals( bool ) or alternatively | 83 | * simply use @ref OCompletionBase::setHandleSignals( bool ) or alternatively |
84 | * set the boolean parameter in the above methods to FALSE. | 84 | * set the boolean parameter in the above methods to FALSE. |
85 | * | 85 | * |
86 | * The default key-bindings for completion and rotation is determined | 86 | * The default key-bindings for completion and rotation is determined |
87 | * from the global settings in @ref OStdAccel. These values, however, | 87 | * from the global settings in @ref OStdAccel. These values, however, |
88 | * can be overriden locally by invoking @ref OCompletionBase::setKeyBinding(). | 88 | * can be overriden locally by invoking @ref OCompletionBase::setKeyBinding(). |
89 | * The values can easily be reverted back to the default setting, by simply | 89 | * The values can easily be reverted back to the default setting, by simply |
90 | * calling @ref useGlobalSettings(). An alternate method would be to default | 90 | * calling @ref useGlobalSettings(). An alternate method would be to default |
91 | * individual key-bindings by usning @ref setKeyBinding() with the default | 91 | * individual key-bindings by usning @ref setKeyBinding() with the default |
92 | * second argument. | 92 | * second argument. |
93 | * | 93 | * |
94 | * Note that if this widget is not editable ( i.e. select-only ), then only | 94 | * Note that if this widget is not editable ( i.e. select-only ), then only |
95 | * one completion mode, @p CompletionAuto, will work. All the other modes are | 95 | * one completion mode, @p CompletionAuto, will work. All the other modes are |
96 | * simply ignored. The @p CompletionAuto mode in this case allows you to | 96 | * simply ignored. The @p CompletionAuto mode in this case allows you to |
97 | * automatically select an item from the list by trying to match the pressed | 97 | * automatically select an item from the list by trying to match the pressed |
98 | * keycode with the first letter of the enteries in the combo box. | 98 | * keycode with the first letter of the enteries in the combo box. |
99 | * | 99 | * |
100 | * @sect Useage | 100 | * @par Usage |
101 | * | 101 | * |
102 | * To enable the basic completion feature: | 102 | * To enable the basic completion feature: |
103 | * | 103 | * |
104 | * <pre> | 104 | * <pre> |
105 | * OComboBox *combo = new OComboBox( true, this, "mywidget" ); | 105 | * OComboBox *combo = new OComboBox( true, this, "mywidget" ); |
106 | * OCompletion *comp = combo->completionObject(); | 106 | * OCompletion *comp = combo->completionObject(); |
107 | * // Connect to the return pressed signal - optional | 107 | * // Connect to the return pressed signal - optional |
108 | * connect(combo,SIGNAL(returnPressed(const QString&)),comp,SLOT(addItem(const QString&)); | 108 | * connect(combo,SIGNAL(returnPressed(const QString&)),comp,SLOT(addItem(const QString&)); |
109 | * </pre> | 109 | * </pre> |
110 | * | 110 | * |
111 | * To use your own completion object: | 111 | * To use your own completion object: |
112 | * | 112 | * |
113 | * <pre> | 113 | * <pre> |
114 | * OComboBox *combo = new OComboBox( this,"mywidget" ); | 114 | * OComboBox *combo = new OComboBox( this,"mywidget" ); |
115 | * OURLCompletion *comp = new OURLCompletion(); | 115 | * OURLCompletion *comp = new OURLCompletion(); |
116 | * combo->setCompletionObject( comp ); | 116 | * combo->setCompletionObject( comp ); |
117 | * // Connect to the return pressed signal - optional | 117 | * // Connect to the return pressed signal - optional |
118 | * connect(combo,SIGNAL(returnPressed(const QString&)),comp,SLOT(addItem(const QString&)); | 118 | * connect(combo,SIGNAL(returnPressed(const QString&)),comp,SLOT(addItem(const QString&)); |
119 | * </pre> | 119 | * </pre> |
120 | * | 120 | * |
121 | * Note that you have to either delete the allocated completion object | 121 | * Note that you have to either delete the allocated completion object |
122 | * when you don't need it anymore, or call | 122 | * when you don't need it anymore, or call |
123 | * setAutoDeleteCompletionObject( true ); | 123 | * setAutoDeleteCompletionObject( true ); |
124 | * | 124 | * |
125 | * Miscellaneous function calls: | 125 | * Miscellaneous function calls: |
126 | * | 126 | * |
127 | * <pre> | 127 | * <pre> |
128 | * // Tell the widget not to handle completion and rotation | 128 | * // Tell the widget not to handle completion and rotation |
129 | * combo->setHandleSignals( false ); | 129 | * combo->setHandleSignals( false ); |
130 | * // Set your own completion key for manual completions. | 130 | * // Set your own completion key for manual completions. |
131 | * combo->setKeyBinding( OCompletionBase::TextCompletion, Qt::End ); | 131 | * combo->setKeyBinding( OCompletionBase::TextCompletion, Qt::End ); |
132 | * // Hide the context (popup) menu | 132 | * // Hide the context (popup) menu |
133 | * combo->setContextMenuEnabled( false ); | 133 | * combo->setContextMenuEnabled( false ); |
134 | * // Temporarly disable signal emition | 134 | * // Temporarly disable signal emition |
135 | * combo->disableSignals(); | 135 | * combo->disableSignals(); |
136 | * // Default the all key-bindings to their system-wide settings. | 136 | * // Default the all key-bindings to their system-wide settings. |
137 | * combo->useGlobalKeyBindings(); | 137 | * combo->useGlobalKeyBindings(); |
138 | * </pre> | 138 | * </pre> |
139 | * | 139 | * |
140 | * @short An enhanced combo box. | 140 | * @short An enhanced combo box. |
141 | * @author Dawit Alemayehu <adawit@kde.org> | 141 | * @author Dawit Alemayehu <adawit@kde.org> |
142 | */ | 142 | */ |
143 | class OComboBox : public QComboBox, public OCompletionBase | 143 | class OComboBox : public QComboBox, public OCompletionBase |
144 | { | 144 | { |
145 | Q_OBJECT | 145 | Q_OBJECT |
146 | 146 | ||
147 | //Q_PROPERTY( bool autoCompletion READ autoCompletion WRITE setAutoCompletion ) | 147 | //Q_PROPERTY( bool autoCompletion READ autoCompletion WRITE setAutoCompletion ) |
148 | //Q_PROPERTY( bool contextMenuEnabled READ isContextMenuEnabled WRITE setContextMenuEnabled ) | 148 | //Q_PROPERTY( bool contextMenuEnabled READ isContextMenuEnabled WRITE setContextMenuEnabled ) |
149 | //Q_PROPERTY( bool urlDropsEnabled READ isURLDropsEnabled WRITE setURLDropsEnabled ) | 149 | //Q_PROPERTY( bool urlDropsEnabled READ isURLDropsEnabled WRITE setURLDropsEnabled ) |
150 | 150 | ||
151 | public: | 151 | public: |
152 | 152 | ||
153 | /** | 153 | /** |
154 | * Constructs a read-only or rather select-only combo box with a | 154 | * Constructs a read-only or rather select-only combo box with a |
155 | * parent object and a name. | 155 | * parent object and a name. |
156 | * | 156 | * |
157 | * @param parent The parent object of this widget | 157 | * @param parent The parent object of this widget |
158 | * @param name The name of this widget | 158 | * @param name The name of this widget |
159 | */ | 159 | */ |
160 | OComboBox( QWidget *parent=0, const char *name=0 ); | 160 | OComboBox( QWidget *parent=0, const char *name=0 ); |
161 | 161 | ||
162 | /** | 162 | /** |
163 | * Constructs a "read-write" or "read-only" combo box depending on | 163 | * Constructs a "read-write" or "read-only" combo box depending on |
164 | * the value of the first argument( @p rw ) with a parent, a | 164 | * the value of the first argument( @p rw ) with a parent, a |
diff --git a/libopie2/qt3/opieui/olineedit.h b/libopie2/qt3/opieui/olineedit.h index ecfca27..db3d7ef 100644 --- a/libopie2/qt3/opieui/olineedit.h +++ b/libopie2/qt3/opieui/olineedit.h | |||
@@ -1,192 +1,192 @@ | |||
1 | /* | 1 | /* |
2 | This file Copyright (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> | 2 | This file Copyright (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> |
3 | is part of the Copyright (C) 2001 Carsten Pfeiffer <pfeiffer@kde.org>, Dawit Alemayehu <adawit@kde.org> | 3 | is part of the Copyright (C) 2001 Carsten Pfeiffer <pfeiffer@kde.org>, Dawit Alemayehu <adawit@kde.org> |
4 | Opie Project Copyright (C) 1999 Preston Brown <pbrown@kde.org>, Patrick Ward <PAT_WARD@HP-USA-om5.om.hp.com> | 4 | Opie Project Copyright (C) 1999 Preston Brown <pbrown@kde.org>, Patrick Ward <PAT_WARD@HP-USA-om5.om.hp.com> |
5 | Copyright (C) 1997 Sven Radej (sven.radej@iname.com) | 5 | Copyright (C) 1997 Sven Radej (sven.radej@iname.com) |
6 | =. | 6 | =. |
7 | .=l. | 7 | .=l. |
8 | .>+-= | 8 | .>+-= |
9 | _;:, .> :=|. This program is free software; you can | 9 | _;:, .> :=|. This program is free software; you can |
10 | .> <`_, > . <= redistribute it and/or modify it under | 10 | .> <`_, > . <= redistribute it and/or modify it under |
11 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 11 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
12 | .="- .-=="i, .._ License as published by the Free Software | 12 | .="- .-=="i, .._ License as published by the Free Software |
13 | - . .-<_> .<> Foundation; either version 2 of the License, | 13 | - . .-<_> .<> Foundation; either version 2 of the License, |
14 | ._= =} : or (at your option) any later version. | 14 | ._= =} : or (at your option) any later version. |
15 | .%`+i> _;_. | 15 | .%`+i> _;_. |
16 | .i_,=:_. -<s. This program is distributed in the hope that | 16 | .i_,=:_. -<s. This program is distributed in the hope that |
17 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 17 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
18 | : .. .:, . . . without even the implied warranty of | 18 | : .. .:, . . . without even the implied warranty of |
19 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 19 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
20 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 20 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
21 | ..}^=.= = ; Library General Public License for more | 21 | ..}^=.= = ; Library General Public License for more |
22 | ++= -. .` .: details. | 22 | ++= -. .` .: details. |
23 | : = ...= . :.=- | 23 | : = ...= . :.=- |
24 | -. .:....=;==+<; You should have received a copy of the GNU | 24 | -. .:....=;==+<; You should have received a copy of the GNU |
25 | -_. . . )=. = Library General Public License along with | 25 | -_. . . )=. = Library General Public License along with |
26 | -- :-=` this library; see the file COPYING.LIB. | 26 | -- :-=` this library; see the file COPYING.LIB. |
27 | If not, write to the Free Software Foundation, | 27 | If not, write to the Free Software Foundation, |
28 | Inc., 59 Temple Place - Suite 330, | 28 | Inc., 59 Temple Place - Suite 330, |
29 | Boston, MA 02111-1307, USA. | 29 | Boston, MA 02111-1307, USA. |
30 | 30 | ||
31 | */ | 31 | */ |
32 | 32 | ||
33 | #ifndef OLINEEDIT_H | 33 | #ifndef OLINEEDIT_H |
34 | #define OLINEEDIT_H | 34 | #define OLINEEDIT_H |
35 | 35 | ||
36 | /* QT */ | 36 | /* QT */ |
37 | 37 | ||
38 | #include <qlineedit.h> | 38 | #include <qlineedit.h> |
39 | 39 | ||
40 | /* OPIE */ | 40 | /* OPIE */ |
41 | 41 | ||
42 | #include <opie2/ocompletion.h> | 42 | #include <opie2/ocompletion.h> |
43 | #include <opie2/ocompletionbase.h> | 43 | #include <opie2/ocompletionbase.h> |
44 | 44 | ||
45 | class QPopupMenu; | 45 | class QPopupMenu; |
46 | 46 | ||
47 | class OCompletionBox; | 47 | class OCompletionBox; |
48 | typedef QString KURL; //class KURL; | 48 | typedef QString KURL; //class KURL; |
49 | 49 | ||
50 | /** | 50 | /** |
51 | * An enhanced QLineEdit widget for inputting text. | 51 | * An enhanced QLineEdit widget for inputting text. |
52 | * | 52 | * |
53 | * @sect Detail | 53 | * @par Detail |
54 | * | 54 | * |
55 | * This widget inherits from @ref QLineEdit and implements the following | 55 | * This widget inherits from @ref QLineEdit and implements the following |
56 | * additional functionalities: q completion object that provides both | 56 | * additional functionalities: q completion object that provides both |
57 | * automatic and manual text completion as well as multiple match iteration | 57 | * automatic and manual text completion as well as multiple match iteration |
58 | * features, configurable key-bindings to activate these features and a | 58 | * features, configurable key-bindings to activate these features and a |
59 | * popup-menu item that can be used to allow the user to set text completion | 59 | * popup-menu item that can be used to allow the user to set text completion |
60 | * modes on the fly based on their preference. | 60 | * modes on the fly based on their preference. |
61 | * | 61 | * |
62 | * To support these new features OLineEdit also emits a few more | 62 | * To support these new features OLineEdit also emits a few more |
63 | * additional signals. These are: @ref completion( const QString& ), | 63 | * additional signals. These are: @ref completion( const QString& ), |
64 | * textRotation( KeyBindingType ), and @ref returnPressed( const QString& ). | 64 | * textRotation( KeyBindingType ), and @ref returnPressed( const QString& ). |
65 | * The completion signal can be connected to a slot that will assist the | 65 | * The completion signal can be connected to a slot that will assist the |
66 | * user in filling out the remaining text. The text rotation signal is | 66 | * user in filling out the remaining text. The text rotation signal is |
67 | * intended to be used to iterate through the list of all possible matches | 67 | * intended to be used to iterate through the list of all possible matches |
68 | * whenever there is more than one match for the entered text. The | 68 | * whenever there is more than one match for the entered text. The |
69 | * @p returnPressed( const QString& ) signals are the same as QLineEdit's | 69 | * @p returnPressed( const QString& ) signals are the same as QLineEdit's |
70 | * except it provides the current text in the widget as its argument whenever | 70 | * except it provides the current text in the widget as its argument whenever |
71 | * appropriate. | 71 | * appropriate. |
72 | * | 72 | * |
73 | * This widget by default creates a completion object when you invoke | 73 | * This widget by default creates a completion object when you invoke |
74 | * the @ref completionObject( bool ) member function for the first time or | 74 | * the @ref completionObject( bool ) member function for the first time or |
75 | * use @ref setCompletionObject( OCompletion*, bool ) to assign your own | 75 | * use @ref setCompletionObject( OCompletion*, bool ) to assign your own |
76 | * completion object. Additionally, to make this widget more functional, | 76 | * completion object. Additionally, to make this widget more functional, |
77 | * OLineEdit will by default handle the text rotation and completion | 77 | * OLineEdit will by default handle the text rotation and completion |
78 | * events internally when a completion object is created through either one | 78 | * events internally when a completion object is created through either one |
79 | * of the methods mentioned above. If you do not need this functionality, | 79 | * of the methods mentioned above. If you do not need this functionality, |
80 | * simply use @ref OCompletionBase::setHandleSignals( bool ) or set the | 80 | * simply use @ref OCompletionBase::setHandleSignals( bool ) or set the |
81 | * boolean parameter in the above functions to FALSE. | 81 | * boolean parameter in the above functions to FALSE. |
82 | * | 82 | * |
83 | * The default key-bindings for completion and rotation is determined | 83 | * The default key-bindings for completion and rotation is determined |
84 | * from the global settings in @ref OStdAccel. These values, however, | 84 | * from the global settings in @ref OStdAccel. These values, however, |
85 | * can be overriden locally by invoking @ref OCompletionBase::setKeyBinding(). | 85 | * can be overriden locally by invoking @ref OCompletionBase::setKeyBinding(). |
86 | * The values can easily be reverted back to the default setting, by simply | 86 | * The values can easily be reverted back to the default setting, by simply |
87 | * calling @ref useGlobalSettings(). An alternate method would be to default | 87 | * calling @ref useGlobalSettings(). An alternate method would be to default |
88 | * individual key-bindings by usning @ref setKeyBinding() with the default | 88 | * individual key-bindings by usning @ref setKeyBinding() with the default |
89 | * second argument. | 89 | * second argument. |
90 | * | 90 | * |
91 | * NOTE that if the @p EchoMode for this widget is set to something other | 91 | * NOTE that if the @p EchoMode for this widget is set to something other |
92 | * than @p QLineEdit::Normal, the completion mode will always be defaulted | 92 | * than @p QLineEdit::Normal, the completion mode will always be defaulted |
93 | * to @ref PGlobalSettings::CompletionNone. This is done purposefully to guard | 93 | * to @ref PGlobalSettings::CompletionNone. This is done purposefully to guard |
94 | * against protected entries such as passwords being cached in @ref OCompletion's | 94 | * against protected entries such as passwords being cached in @ref OCompletion's |
95 | * list. Hence, if the @p EchoMode is not @ref QLineEdit::Normal, the completion | 95 | * list. Hence, if the @p EchoMode is not @ref QLineEdit::Normal, the completion |
96 | * mode is automatically disabled. | 96 | * mode is automatically disabled. |
97 | * | 97 | * |
98 | * @sect Useage | 98 | * @par Usage |
99 | * | 99 | * |
100 | * To enable the basic completion feature : | 100 | * To enable the basic completion feature : |
101 | * | 101 | * |
102 | * <pre> | 102 | * <pre> |
103 | * OLineEdit *edit = new OLineEdit( this, "mywidget" ); | 103 | * OLineEdit *edit = new OLineEdit( this, "mywidget" ); |
104 | * OCompletion *comp = edit->completionObject(); | 104 | * OCompletion *comp = edit->completionObject(); |
105 | * // Fill the completion object with a list of possible matches | 105 | * // Fill the completion object with a list of possible matches |
106 | * QStringList list; | 106 | * QStringList list; |
107 | * list << "mickeyl@handhelds.org" << "mickey@tm.informatik.uni-frankfurt.de>" << "mickey@Vanille.de"; | 107 | * list << "mickeyl@handhelds.org" << "mickey@tm.informatik.uni-frankfurt.de>" << "mickey@Vanille.de"; |
108 | * comp->setItems( list ); | 108 | * comp->setItems( list ); |
109 | * // Connect to the return pressed signal (optional) | 109 | * // Connect to the return pressed signal (optional) |
110 | * connect(edit,SIGNAL(returnPressed(const QString&)),comp,SLOT(addItem(const QString&)); | 110 | * connect(edit,SIGNAL(returnPressed(const QString&)),comp,SLOT(addItem(const QString&)); |
111 | * </pre> | 111 | * </pre> |
112 | * | 112 | * |
113 | * To use a customized completion objects or your | 113 | * To use a customized completion objects or your |
114 | * own completion object : | 114 | * own completion object : |
115 | * | 115 | * |
116 | * <pre> | 116 | * <pre> |
117 | * OLineEdit *edit = new OLineEdit( this,"mywidget" ); | 117 | * OLineEdit *edit = new OLineEdit( this,"mywidget" ); |
118 | * KURLCompletion *comp = new KURLCompletion(); | 118 | * KURLCompletion *comp = new KURLCompletion(); |
119 | * edit->setCompletionObject( comp ); | 119 | * edit->setCompletionObject( comp ); |
120 | * // Connect to the return pressed signal - optional | 120 | * // Connect to the return pressed signal - optional |
121 | * connect(edit,SIGNAL(returnPressed(const QString&)),comp,SLOT(addItem(const QString&)); | 121 | * connect(edit,SIGNAL(returnPressed(const QString&)),comp,SLOT(addItem(const QString&)); |
122 | * </pre> | 122 | * </pre> |
123 | * | 123 | * |
124 | * Note that you have to either delete the allocated completion object | 124 | * Note that you have to either delete the allocated completion object |
125 | * when you don't need it anymore, or call | 125 | * when you don't need it anymore, or call |
126 | * setAutoDeleteCompletionObject( true ); | 126 | * setAutoDeleteCompletionObject( true ); |
127 | * | 127 | * |
128 | * @sect Miscellaneous function calls : | 128 | * @par Miscellaneous function calls : |
129 | * | 129 | * |
130 | * <pre> | 130 | * <pre> |
131 | * // Tell the widget not to handle completion and | 131 | * // Tell the widget not to handle completion and |
132 | * // iteration internally. | 132 | * // iteration internally. |
133 | * edit->setHandleSignals( false ); | 133 | * edit->setHandleSignals( false ); |
134 | * // Set your own completion key for manual completions. | 134 | * // Set your own completion key for manual completions. |
135 | * edit->setKeyBinding( OCompletionBase::TextCompletion, Qt::End ); | 135 | * edit->setKeyBinding( OCompletionBase::TextCompletion, Qt::End ); |
136 | * // Hide the context (popup) menu | 136 | * // Hide the context (popup) menu |
137 | * edit->setContextMenuEnabled( false ); | 137 | * edit->setContextMenuEnabled( false ); |
138 | * // Temporarly disable signal emitions | 138 | * // Temporarly disable signal emitions |
139 | * // (both completion & iteration signals) | 139 | * // (both completion & iteration signals) |
140 | * edit->disableSignals(); | 140 | * edit->disableSignals(); |
141 | * // Default the key-bindings to system settings. | 141 | * // Default the key-bindings to system settings. |
142 | * edit->useGlobalKeyBindings(); | 142 | * edit->useGlobalKeyBindings(); |
143 | * </pre> | 143 | * </pre> |
144 | * | 144 | * |
145 | * @short An enhanced single line input widget. | 145 | * @short An enhanced single line input widget. |
146 | * @author Dawit Alemayehu <adawit@kde.org> | 146 | * @author Dawit Alemayehu <adawit@kde.org> |
147 | * @author Opie adaption by Michael Lauer <mickey@tm.informatik.uni-frankfurt.de> | 147 | * @author Opie adaption by Michael Lauer <mickey@tm.informatik.uni-frankfurt.de> |
148 | */ | 148 | */ |
149 | 149 | ||
150 | class OLineEdit : public QLineEdit, public OCompletionBase | 150 | class OLineEdit : public QLineEdit, public OCompletionBase |
151 | { | 151 | { |
152 | friend class OComboBox; | 152 | friend class OComboBox; |
153 | 153 | ||
154 | Q_OBJECT | 154 | Q_OBJECT |
155 | Q_PROPERTY( bool contextMenuEnabled READ isContextMenuEnabled WRITE setContextMenuEnabled ) | 155 | Q_PROPERTY( bool contextMenuEnabled READ isContextMenuEnabled WRITE setContextMenuEnabled ) |
156 | Q_PROPERTY( bool urlDropsEnabled READ isURLDropsEnabled WRITE setURLDropsEnabled ) | 156 | Q_PROPERTY( bool urlDropsEnabled READ isURLDropsEnabled WRITE setURLDropsEnabled ) |
157 | 157 | ||
158 | public: | 158 | public: |
159 | 159 | ||
160 | /** | 160 | /** |
161 | * Constructs a OLineEdit object with a default text, a parent, | 161 | * Constructs a OLineEdit object with a default text, a parent, |
162 | * and a name. | 162 | * and a name. |
163 | * | 163 | * |
164 | * @param string Text to be shown in the edit widget. | 164 | * @param string Text to be shown in the edit widget. |
165 | * @param parent The parent object of this widget. | 165 | * @param parent The parent object of this widget. |
166 | * @param name the name of this widget | 166 | * @param name the name of this widget |
167 | */ | 167 | */ |
168 | OLineEdit( const QString &string, QWidget *parent, const char *name = 0 ); | 168 | OLineEdit( const QString &string, QWidget *parent, const char *name = 0 ); |
169 | 169 | ||
170 | /** | 170 | /** |
171 | * Constructs a OLineEdit object with a parent and a name. | 171 | * Constructs a OLineEdit object with a parent and a name. |
172 | * | 172 | * |
173 | * @param string Text to be shown in the edit widget. | 173 | * @param string Text to be shown in the edit widget. |
174 | * @param parent The parent object of this widget. | 174 | * @param parent The parent object of this widget. |
175 | * @param name The name of this widget. | 175 | * @param name The name of this widget. |
176 | */ | 176 | */ |
177 | OLineEdit ( QWidget *parent=0, const char *name=0 ); | 177 | OLineEdit ( QWidget *parent=0, const char *name=0 ); |
178 | 178 | ||
179 | /** | 179 | /** |
180 | * Destructor. | 180 | * Destructor. |
181 | */ | 181 | */ |
182 | virtual ~OLineEdit (); | 182 | virtual ~OLineEdit (); |
183 | 183 | ||
184 | /** | 184 | /** |
185 | * Sets @p url into the lineedit. It uses @ref KURL::prettyURL() so | 185 | * Sets @p url into the lineedit. It uses @ref KURL::prettyURL() so |
186 | * that the url is properly decoded for displaying. | 186 | * that the url is properly decoded for displaying. |
187 | */ | 187 | */ |
188 | void setURL( const KURL& url ); | 188 | void setURL( const KURL& url ); |
189 | 189 | ||
190 | /** | 190 | /** |
191 | * Puts the text cursor at the end of the string. | 191 | * Puts the text cursor at the end of the string. |
192 | * | 192 | * |