author | hash <hash> | 2002-10-24 17:56:48 (UTC) |
---|---|---|
committer | hash <hash> | 2002-10-24 17:56:48 (UTC) |
commit | 3773cd825129f1cc6fa7a4ecb4129634f5189984 (patch) (unidiff) | |
tree | d10cc2c4e45e2b47eddcae5534f59ce8f90092b1 | |
parent | b01703c4b1de7006c88aa814ca00472b966b2464 (diff) | |
download | opie-3773cd825129f1cc6fa7a4ecb4129634f5189984.zip opie-3773cd825129f1cc6fa7a4ecb4129634f5189984.tar.gz opie-3773cd825129f1cc6fa7a4ecb4129634f5189984.tar.bz2 |
closing a session returns keyboard to default better now
-rw-r--r-- | noncore/apps/opie-console/function_keyboard.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/noncore/apps/opie-console/function_keyboard.cpp b/noncore/apps/opie-console/function_keyboard.cpp index ce65052..5f3b5ec 100644 --- a/noncore/apps/opie-console/function_keyboard.cpp +++ b/noncore/apps/opie-console/function_keyboard.cpp | |||
@@ -4,28 +4,31 @@ | |||
4 | #include <qpe/qpeapplication.h> | 4 | #include <qpe/qpeapplication.h> |
5 | #include <qsizepolicy.h> | 5 | #include <qsizepolicy.h> |
6 | #include <qevent.h> | 6 | #include <qevent.h> |
7 | #include <qwindowsystem_qws.h> | 7 | #include <qwindowsystem_qws.h> |
8 | #include <qapplication.h> | 8 | #include <qapplication.h> |
9 | #include <qlayout.h> | 9 | #include <qlayout.h> |
10 | #include <qspinbox.h> | 10 | #include <qspinbox.h> |
11 | #include <qlistbox.h> | 11 | #include <qlistbox.h> |
12 | #include <qlabel.h> | 12 | #include <qlabel.h> |
13 | #include <qcombobox.h> | 13 | #include <qcombobox.h> |
14 | #include <qdir.h> | 14 | #include <qdir.h> |
15 | 15 | ||
16 | #define DEFAULT_ROWS 2 | ||
17 | #define DEFAULT_COLS 11 | ||
18 | |||
16 | /* FunctionKeyboard {{{1 */ | 19 | /* FunctionKeyboard {{{1 */ |
17 | 20 | ||
18 | FunctionKeyboard::FunctionKeyboard(QWidget *parent) : | 21 | FunctionKeyboard::FunctionKeyboard(QWidget *parent) : |
19 | QFrame(parent), numRows(2), numCols(11), | 22 | QFrame(parent), numRows(DEFAULT_ROWS), numCols(DEFAULT_COLS), |
20 | pressedRow(0), pressedCol(0) { | 23 | pressedRow(0), pressedCol(0) { |
21 | 24 | ||
22 | setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed)); | 25 | setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed)); |
23 | 26 | ||
24 | /* | 27 | /* |
25 | * all the saving/loading is now done in a profile. downside is that you cant modify | 28 | * all the saving/loading is now done in a profile. downside is that you cant modify |
26 | * the keyboard for all profiles, but must do it on a profile-basis | 29 | * the keyboard for all profiles, but must do it on a profile-basis |
27 | * | 30 | * |
28 | 31 | ||
29 | Config conf("opie-console-keys"); | 32 | Config conf("opie-console-keys"); |
30 | conf.setGroup("keys"); | 33 | conf.setGroup("keys"); |
31 | for (uint r = 0; r < numRows; r++) | 34 | for (uint r = 0; r < numRows; r++) |
@@ -214,24 +217,28 @@ void FunctionKeyboard::resizeEvent(QResizeEvent*) { | |||
214 | keyHeight = fm.lineSpacing() + 2; | 217 | keyHeight = fm.lineSpacing() + 2; |
215 | keyWidth = (double)width()/numCols; | 218 | keyWidth = (double)width()/numCols; |
216 | 219 | ||
217 | } | 220 | } |
218 | 221 | ||
219 | QSize FunctionKeyboard::sizeHint() const { | 222 | QSize FunctionKeyboard::sizeHint() const { |
220 | 223 | ||
221 | return QSize(width(), keyHeight * numRows + 1); | 224 | return QSize(width(), keyHeight * numRows + 1); |
222 | } | 225 | } |
223 | 226 | ||
224 | void FunctionKeyboard::loadDefaults() { | 227 | void FunctionKeyboard::loadDefaults() { |
225 | 228 | ||
229 | numRows = DEFAULT_ROWS; | ||
230 | numCols = DEFAULT_COLS; | ||
231 | keyWidth = (double)width()/numCols; // have to reset this thing too | ||
232 | |||
226 | keys.insert( "r0c0", FKey ("Enter", "enter", Qt::Key_Enter, 0)); | 233 | keys.insert( "r0c0", FKey ("Enter", "enter", Qt::Key_Enter, 0)); |
227 | keys.insert( "r0c1", FKey ("Space", "space", Qt::Key_Space, Qt::Key_Space)); | 234 | keys.insert( "r0c1", FKey ("Space", "space", Qt::Key_Space, Qt::Key_Space)); |
228 | keys.insert( "r0c2", FKey ("Tab", "tab", Qt::Key_Tab, 0)); | 235 | keys.insert( "r0c2", FKey ("Tab", "tab", Qt::Key_Tab, 0)); |
229 | keys.insert( "r0c3", FKey ("Up", "up", Qt::Key_Up, 0)); | 236 | keys.insert( "r0c3", FKey ("Up", "up", Qt::Key_Up, 0)); |
230 | keys.insert( "r0c4", FKey ("Down", "down", Qt::Key_Down, 0)); | 237 | keys.insert( "r0c4", FKey ("Down", "down", Qt::Key_Down, 0)); |
231 | 238 | ||
232 | keys.insert( "r0c7", FKey ("Ho", 0, 4112, 0)); | 239 | keys.insert( "r0c7", FKey ("Ho", 0, 4112, 0)); |
233 | keys.insert( "r0c8", FKey ("End", 0, 4113, 0)); | 240 | keys.insert( "r0c8", FKey ("End", 0, 4113, 0)); |
234 | keys.insert( "r0c9", FKey ("PU", 0, 4118, 0)); | 241 | keys.insert( "r0c9", FKey ("PU", 0, 4118, 0)); |
235 | keys.insert( "r0c10", FKey ("PD", 0, 4119, 0)); | 242 | keys.insert( "r0c10", FKey ("PD", 0, 4119, 0)); |
236 | 243 | ||
237 | keys.insert( "r1c0", FKey ("F1", 0, 4144, 0)); | 244 | keys.insert( "r1c0", FKey ("F1", 0, 4144, 0)); |