-rw-r--r-- | noncore/apps/opie-console/default.cpp | 8 | ||||
-rw-r--r-- | noncore/apps/opie-console/default.h | 1 | ||||
-rw-r--r-- | noncore/apps/opie-console/function_keyboard.cpp | 33 | ||||
-rw-r--r-- | noncore/apps/opie-console/function_keyboard.h | 16 | ||||
-rw-r--r-- | noncore/apps/opie-console/metafactory.cpp | 20 | ||||
-rw-r--r-- | noncore/apps/opie-console/metafactory.h | 5 | ||||
-rw-r--r-- | noncore/apps/opie-console/profiledialogwidget.cpp | 11 | ||||
-rw-r--r-- | noncore/apps/opie-console/profiledialogwidget.h | 11 | ||||
-rw-r--r-- | noncore/apps/opie-console/profileeditordialog.cpp | 20 | ||||
-rw-r--r-- | noncore/apps/opie-console/profileeditordialog.h | 7 |
10 files changed, 123 insertions, 9 deletions
diff --git a/noncore/apps/opie-console/default.cpp b/noncore/apps/opie-console/default.cpp index 8b905e1..0160b56 100644 --- a/noncore/apps/opie-console/default.cpp +++ b/noncore/apps/opie-console/default.cpp | |||
@@ -6,12 +6,13 @@ | |||
6 | #include "filereceive.h" | 6 | #include "filereceive.h" |
7 | #include "serialconfigwidget.h" | 7 | #include "serialconfigwidget.h" |
8 | #include "irdaconfigwidget.h" | 8 | #include "irdaconfigwidget.h" |
9 | #include "btconfigwidget.h" | 9 | #include "btconfigwidget.h" |
10 | #include "modemconfigwidget.h" | 10 | #include "modemconfigwidget.h" |
11 | #include "terminalwidget.h" | 11 | #include "terminalwidget.h" |
12 | #include "function_keyboard.h" | ||
12 | #include "MyPty.h" | 13 | #include "MyPty.h" |
13 | 14 | ||
14 | #include "default.h" | 15 | #include "default.h" |
15 | 16 | ||
16 | extern "C" { | 17 | extern "C" { |
17 | // FILE Transfer Stuff | 18 | // FILE Transfer Stuff |
@@ -73,12 +74,17 @@ extern "C" { | |||
73 | 74 | ||
74 | // Terminal Widget(s) | 75 | // Terminal Widget(s) |
75 | ProfileDialogWidget* newTerminalWidget(const QString& na, QWidget* wid) { | 76 | ProfileDialogWidget* newTerminalWidget(const QString& na, QWidget* wid) { |
76 | return new TerminalWidget(na, wid,0 ); | 77 | return new TerminalWidget(na, wid,0 ); |
77 | } | 78 | } |
78 | 79 | ||
80 | // Function Keyboard Widget | ||
81 | ProfileDialogWidget* newKeyboardWidget(const QString& na, QWidget *wid) { | ||
82 | return new FunctionKeyboardConfig(na, wid); | ||
83 | } | ||
84 | |||
79 | /* // VT Emulations | 85 | /* // VT Emulations |
80 | EmulationLayer* newVT102( WidgetLayer* wid ) { | 86 | EmulationLayer* newVT102( WidgetLayer* wid ) { |
81 | return new Vt102Emulation( wid ); | 87 | return new Vt102Emulation( wid ); |
82 | } | 88 | } |
83 | */ | 89 | */ |
84 | }; | 90 | }; |
@@ -102,12 +108,14 @@ Default::Default( MetaFactory* fact ) { | |||
102 | fact->addConnectionWidgetFactory( "irda", QObject::tr("Infrared"), newIrDaWidget ); | 108 | fact->addConnectionWidgetFactory( "irda", QObject::tr("Infrared"), newIrDaWidget ); |
103 | fact->addConnectionWidgetFactory( "modem", QObject::tr("Modem"), newModemWidget ); | 109 | fact->addConnectionWidgetFactory( "modem", QObject::tr("Modem"), newModemWidget ); |
104 | fact->addConnectionWidgetFactory( "bt", QObject::tr("Bluetooth"), newBTWidget ); | 110 | fact->addConnectionWidgetFactory( "bt", QObject::tr("Bluetooth"), newBTWidget ); |
105 | fact->addConnectionWidgetFactory( "console", QObject::tr("Console"), newConsoleWid ); | 111 | fact->addConnectionWidgetFactory( "console", QObject::tr("Console"), newConsoleWid ); |
106 | 112 | ||
107 | fact->addTerminalWidgetFactory( "default", QObject::tr("Default Terminal"), newTerminalWidget ); | 113 | fact->addTerminalWidgetFactory( "default", QObject::tr("Default Terminal"), newTerminalWidget ); |
114 | fact->addKeyboardWidgetFactory( "defaultKeys", QObject::tr("Default Keyboard"), | ||
115 | newKeyboardWidget ); | ||
108 | 116 | ||
109 | // fact->addEmulationLayer( "default", QObject::tr("Default Terminal"), newVT102 ); | 117 | // fact->addEmulationLayer( "default", QObject::tr("Default Terminal"), newVT102 ); |
110 | } | 118 | } |
111 | Default::~Default() { | 119 | Default::~Default() { |
112 | 120 | ||
113 | } | 121 | } |
diff --git a/noncore/apps/opie-console/default.h b/noncore/apps/opie-console/default.h index b8cda03..5b542f5 100644 --- a/noncore/apps/opie-console/default.h +++ b/noncore/apps/opie-console/default.h | |||
@@ -22,12 +22,13 @@ extern "C" { | |||
22 | ProfileDialogWidget* newSerialWidget(const QString&, QWidget* ); | 22 | ProfileDialogWidget* newSerialWidget(const QString&, QWidget* ); |
23 | ProfileDialogWidget* newIrDaWidget (const QString&, QWidget* ); | 23 | ProfileDialogWidget* newIrDaWidget (const QString&, QWidget* ); |
24 | ProfileDialogWidget* newBTWidget (const QString&, QWidget* ); | 24 | ProfileDialogWidget* newBTWidget (const QString&, QWidget* ); |
25 | ProfileDialogWidget* newConsoleWid (const QString&, QWidget* ); | 25 | ProfileDialogWidget* newConsoleWid (const QString&, QWidget* ); |
26 | 26 | ||
27 | ProfileDialogWidget* newTerminalWidget(const QString&, QWidget* ); | 27 | ProfileDialogWidget* newTerminalWidget(const QString&, QWidget* ); |
28 | ProfileDialogWidget* newKeyboardWidget(const QString&, QWidget* ); | ||
28 | 29 | ||
29 | // EmulationLayer* newVT102( WidgetLayer* ); | 30 | // EmulationLayer* newVT102( WidgetLayer* ); |
30 | }; | 31 | }; |
31 | 32 | ||
32 | class MetaFactory; | 33 | class MetaFactory; |
33 | struct Default { | 34 | struct Default { |
diff --git a/noncore/apps/opie-console/function_keyboard.cpp b/noncore/apps/opie-console/function_keyboard.cpp index 4119ad4..fd20e99 100644 --- a/noncore/apps/opie-console/function_keyboard.cpp +++ b/noncore/apps/opie-console/function_keyboard.cpp | |||
@@ -1,22 +1,23 @@ | |||
1 | #include "function_keyboard.h" | 1 | #include "function_keyboard.h" |
2 | #include <qsizepolicy.h> | 2 | #include <qsizepolicy.h> |
3 | #include <qevent.h> | 3 | #include <qevent.h> |
4 | #include <qwindowsystem_qws.h> | 4 | #include <qwindowsystem_qws.h> |
5 | #include <qapplication.h> | 5 | #include <qapplication.h> |
6 | #include <qlayout.h> | ||
6 | 7 | ||
7 | FunctionKeyboard::FunctionKeyboard(QWidget *parent) : | 8 | FunctionKeyboard::FunctionKeyboard(QWidget *parent) : |
8 | QFrame(parent), numRows(2), numCols(11), | 9 | QFrame(parent), numRows(2), numCols(11), |
9 | pressedRow(0), pressedCol(0) { | 10 | pressedRow(0), pressedCol(0) { |
10 | 11 | ||
11 | setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed)); | 12 | setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed)); |
12 | 13 | ||
13 | Config conf("opie-console-keys"); | 14 | Config conf("opie-console-keys"); |
14 | conf.setGroup("keys"); | 15 | conf.setGroup("keys"); |
15 | for (int r = 0; r < numRows; r++) | 16 | for (uint r = 0; r < numRows; r++) |
16 | for (int c = 0; c < numCols; c++) { | 17 | for (uint c = 0; c < numCols; c++) { |
17 | 18 | ||
18 | QString handle = "r" + QString::number(r) + "c" + QString::number(c); | 19 | QString handle = "r" + QString::number(r) + "c" + QString::number(c); |
19 | QStringList value_list = conf.readListEntry( handle, '|'); | 20 | QStringList value_list = conf.readListEntry( handle, '|'); |
20 | 21 | ||
21 | if (value_list.isEmpty()) continue; | 22 | if (value_list.isEmpty()) continue; |
22 | 23 | ||
@@ -56,14 +57,14 @@ void FunctionKeyboard::paintEvent(QPaintEvent *e) { | |||
56 | 57 | ||
57 | for (int i = 0; i <= height(); i += keyHeight) { | 58 | for (int i = 0; i <= height(); i += keyHeight) { |
58 | 59 | ||
59 | p.drawLine(0, i, width(), i); | 60 | p.drawLine(0, i, width(), i); |
60 | } | 61 | } |
61 | 62 | ||
62 | for (int r = 0; r < numRows; r++) { | 63 | for (uint r = 0; r < numRows; r++) { |
63 | for (int c = 0; c < numCols; c++) { | 64 | for (uint c = 0; c < numCols; c++) { |
64 | 65 | ||
65 | QString handle = "r" + QString::number(r) + "c" + QString::number(c); | 66 | QString handle = "r" + QString::number(r) + "c" + QString::number(c); |
66 | if (keys.contains(handle)) { | 67 | if (keys.contains(handle)) { |
67 | 68 | ||
68 | p.drawText( | 69 | p.drawText( |
69 | c * keyWidth + 1, r * keyHeight + 1, | 70 | c * keyWidth + 1, r * keyHeight + 1, |
@@ -152,6 +153,30 @@ void FunctionKeyboard::loadDefaults() { | |||
152 | keys.insert( "r1c7", FKey ("Ho", 4112, 0)); | 153 | keys.insert( "r1c7", FKey ("Ho", 4112, 0)); |
153 | keys.insert( "r1c8", FKey ("End", 4113, 0)); | 154 | keys.insert( "r1c8", FKey ("End", 4113, 0)); |
154 | keys.insert( "r1c9", FKey ("PU", 4118, 0)); | 155 | keys.insert( "r1c9", FKey ("PU", 4118, 0)); |
155 | keys.insert( "r1c10", FKey ("PD", 4119, 0)); | 156 | keys.insert( "r1c10", FKey ("PD", 4119, 0)); |
156 | 157 | ||
157 | } | 158 | } |
159 | |||
160 | |||
161 | FunctionKeyboardConfig::FunctionKeyboardConfig(const QString& name, QWidget* parent) : | ||
162 | ProfileDialogKeyWidget(name, parent) { | ||
163 | |||
164 | |||
165 | FunctionKeyboard *kb = new FunctionKeyboard(this); | ||
166 | QGroupBox *dimentions = new QGroupBox(2, Qt::Horizontal, tr("Dimentions"), this); | ||
167 | QGroupBox *editKey = new QGroupBox(2, Qt::Horizontal, tr("Edit"), this); | ||
168 | |||
169 | QVBoxLayout *root = new QVBoxLayout(this, 2); | ||
170 | root->addWidget(kb); | ||
171 | root->addWidget(dimentions); | ||
172 | root->addWidget(editKey); | ||
173 | } | ||
174 | FunctionKeyboardConfig::~FunctionKeyboardConfig() { | ||
175 | |||
176 | } | ||
177 | void FunctionKeyboardConfig::load (const Profile& prof) { | ||
178 | |||
179 | } | ||
180 | void FunctionKeyboardConfig::save (Profile& prof) { | ||
181 | |||
182 | } | ||
diff --git a/noncore/apps/opie-console/function_keyboard.h b/noncore/apps/opie-console/function_keyboard.h index 8d05e2b..2be74b4 100644 --- a/noncore/apps/opie-console/function_keyboard.h +++ b/noncore/apps/opie-console/function_keyboard.h | |||
@@ -1,13 +1,16 @@ | |||
1 | #ifndef OPIE_FUNCTION_KEYBOARD_H | 1 | #ifndef OPIE_FUNCTION_KEYBOARD_H |
2 | #define OPIE_FUNCTION_KEYBOARD_H | 2 | #define OPIE_FUNCTION_KEYBOARD_H |
3 | 3 | ||
4 | #include <qpe/config.h> | 4 | #include <qpe/config.h> |
5 | #include <qframe.h> | 5 | #include <qframe.h> |
6 | #include <qpainter.h> | 6 | #include <qpainter.h> |
7 | #include <qvbox.h> | ||
8 | #include <qgroupbox.h> | ||
7 | #include <qmap.h> | 9 | #include <qmap.h> |
10 | #include "profiledialogwidget.h" | ||
8 | 11 | ||
9 | class FKey { | 12 | class FKey { |
10 | 13 | ||
11 | public: | 14 | public: |
12 | 15 | ||
13 | FKey(): qcode(0), unicode(0) {}; | 16 | FKey(): qcode(0), unicode(0) {}; |
@@ -61,7 +64,20 @@ private: | |||
61 | int pressedRow, pressedCol; | 64 | int pressedRow, pressedCol; |
62 | 65 | ||
63 | QObject *parent; | 66 | QObject *parent; |
64 | 67 | ||
65 | }; | 68 | }; |
66 | 69 | ||
70 | class FunctionKeyboardConfig : public ProfileDialogKeyWidget { | ||
71 | Q_OBJECT | ||
72 | public: | ||
73 | FunctionKeyboardConfig(const QString& name, QWidget *wid); | ||
74 | ~FunctionKeyboardConfig(); | ||
75 | |||
76 | void load(const Profile&); | ||
77 | void save(Profile&); | ||
78 | |||
79 | private: | ||
80 | |||
81 | }; | ||
82 | |||
67 | #endif | 83 | #endif |
diff --git a/noncore/apps/opie-console/metafactory.cpp b/noncore/apps/opie-console/metafactory.cpp index 04a5dfa..0b43e17 100644 --- a/noncore/apps/opie-console/metafactory.cpp +++ b/noncore/apps/opie-console/metafactory.cpp | |||
@@ -15,12 +15,19 @@ void MetaFactory::addConnectionWidgetFactory( const QCString& name, | |||
15 | void MetaFactory::addTerminalWidgetFactory( const QCString& name, | 15 | void MetaFactory::addTerminalWidgetFactory( const QCString& name, |
16 | const QString& str, | 16 | const QString& str, |
17 | configWidget wid ) { | 17 | configWidget wid ) { |
18 | m_strings.insert( str, name ); | 18 | m_strings.insert( str, name ); |
19 | m_termFact.insert( str, wid ); | 19 | m_termFact.insert( str, wid ); |
20 | } | 20 | } |
21 | void MetaFactory::addKeyboardWidgetFactory( const QCString& name, | ||
22 | const QString & str, | ||
23 | configWidget wid) { | ||
24 | m_strings.insert( str, name ); | ||
25 | m_keyFact.insert( str, wid ); | ||
26 | |||
27 | } | ||
21 | void MetaFactory::addIOLayerFactory( const QCString& name, | 28 | void MetaFactory::addIOLayerFactory( const QCString& name, |
22 | const QString& str, | 29 | const QString& str, |
23 | iolayer lay) { | 30 | iolayer lay) { |
24 | m_strings.insert( str, name ); | 31 | m_strings.insert( str, name ); |
25 | m_layerFact.insert( str, lay ); | 32 | m_layerFact.insert( str, lay ); |
26 | } | 33 | } |
@@ -125,12 +132,25 @@ ProfileDialogWidget *MetaFactory::newTerminalPlugin( const QString& str, QWidget | |||
125 | it = m_termFact.find( str ); | 132 | it = m_termFact.find( str ); |
126 | if ( it != m_termFact.end() ) { | 133 | if ( it != m_termFact.end() ) { |
127 | wid = (*(it.data() ) )(str,parent); | 134 | wid = (*(it.data() ) )(str,parent); |
128 | } | 135 | } |
129 | return wid; | 136 | return wid; |
130 | } | 137 | } |
138 | ProfileDialogWidget *MetaFactory::newKeyboardPlugin( const QString& str, QWidget *parent) { | ||
139 | |||
140 | if (str.isEmpty() ) | ||
141 | return 0l; | ||
142 | ProfileDialogWidget* wid = 0l; | ||
143 | |||
144 | QMap<QString, configWidget>::Iterator it; | ||
145 | it = m_keyFact.find( str ); | ||
146 | if ( it != m_keyFact.end() ) { | ||
147 | wid = (*(it.data() ) )(str,parent); | ||
148 | } | ||
149 | return wid; | ||
150 | } | ||
131 | EmulationLayer* MetaFactory::newEmulationLayer( const QString& str, WidgetLayer* wid) { | 151 | EmulationLayer* MetaFactory::newEmulationLayer( const QString& str, WidgetLayer* wid) { |
132 | EmulationLayer* lay = 0l; | 152 | EmulationLayer* lay = 0l; |
133 | 153 | ||
134 | QMap<QString, emulationLayer>::Iterator it; | 154 | QMap<QString, emulationLayer>::Iterator it; |
135 | it = m_emu.find( str ); | 155 | it = m_emu.find( str ); |
136 | if ( it != m_emu.end() ) { | 156 | if ( it != m_emu.end() ) { |
diff --git a/noncore/apps/opie-console/metafactory.h b/noncore/apps/opie-console/metafactory.h index d6aa5e2..f89136c 100644 --- a/noncore/apps/opie-console/metafactory.h +++ b/noncore/apps/opie-console/metafactory.h | |||
@@ -37,12 +37,15 @@ public: | |||
37 | void addConnectionWidgetFactory( const QCString& internalName, | 37 | void addConnectionWidgetFactory( const QCString& internalName, |
38 | const QString& uiString, | 38 | const QString& uiString, |
39 | configWidget ); | 39 | configWidget ); |
40 | void addTerminalWidgetFactory ( const QCString& internalName, | 40 | void addTerminalWidgetFactory ( const QCString& internalName, |
41 | const QString& name, | 41 | const QString& name, |
42 | configWidget ); | 42 | configWidget ); |
43 | void addKeyboardWidgetFactory ( const QCString& internalName, | ||
44 | const QString& name, | ||
45 | configWidget ); | ||
43 | 46 | ||
44 | /** | 47 | /** |
45 | * adds an IOLayer factory | 48 | * adds an IOLayer factory |
46 | */ | 49 | */ |
47 | void addIOLayerFactory( const QCString&, | 50 | void addIOLayerFactory( const QCString&, |
48 | const QString&, | 51 | const QString&, |
@@ -80,12 +83,13 @@ public: | |||
80 | /** | 83 | /** |
81 | * the generation... | 84 | * the generation... |
82 | */ | 85 | */ |
83 | IOLayer* newIOLayer( const QString&,const Profile& ); | 86 | IOLayer* newIOLayer( const QString&,const Profile& ); |
84 | ProfileDialogWidget *newConnectionPlugin ( const QString&, QWidget* ); | 87 | ProfileDialogWidget *newConnectionPlugin ( const QString&, QWidget* ); |
85 | ProfileDialogWidget* newTerminalPlugin( const QString&, QWidget* ); | 88 | ProfileDialogWidget* newTerminalPlugin( const QString&, QWidget* ); |
89 | ProfileDialogWidget* newKeyboardPlugin( const QString&, QWidget* ); | ||
86 | EmulationLayer* newEmulationLayer(const QString&, WidgetLayer* ); | 90 | EmulationLayer* newEmulationLayer(const QString&, WidgetLayer* ); |
87 | FileTransferLayer* newFileTransfer(const QString&, IOLayer* ); | 91 | FileTransferLayer* newFileTransfer(const QString&, IOLayer* ); |
88 | ReceiveLayer* newReceive(const QString&, IOLayer* ); | 92 | ReceiveLayer* newReceive(const QString&, IOLayer* ); |
89 | 93 | ||
90 | /* | 94 | /* |
91 | * internal takes the maybe translated | 95 | * internal takes the maybe translated |
@@ -102,12 +106,13 @@ public: | |||
102 | 106 | ||
103 | 107 | ||
104 | private: | 108 | private: |
105 | QMap<QString, QCString> m_strings; | 109 | QMap<QString, QCString> m_strings; |
106 | QMap<QString, configWidget> m_conFact; | 110 | QMap<QString, configWidget> m_conFact; |
107 | QMap<QString, configWidget> m_termFact; | 111 | QMap<QString, configWidget> m_termFact; |
112 | QMap<QString, configWidget> m_keyFact; | ||
108 | QMap<QString, iolayer> m_layerFact; | 113 | QMap<QString, iolayer> m_layerFact; |
109 | QMap<QString, filelayer> m_fileFact; | 114 | QMap<QString, filelayer> m_fileFact; |
110 | QMap<QString, receivelayer> m_receiveFact; | 115 | QMap<QString, receivelayer> m_receiveFact; |
111 | QMap<QString, emulationLayer> m_emu; | 116 | QMap<QString, emulationLayer> m_emu; |
112 | }; | 117 | }; |
113 | 118 | ||
diff --git a/noncore/apps/opie-console/profiledialogwidget.cpp b/noncore/apps/opie-console/profiledialogwidget.cpp index 24d59bf..caad998 100644 --- a/noncore/apps/opie-console/profiledialogwidget.cpp +++ b/noncore/apps/opie-console/profiledialogwidget.cpp | |||
@@ -27,6 +27,17 @@ ProfileDialogConnectionWidget::ProfileDialogConnectionWidget( const QString& na, | |||
27 | } | 27 | } |
28 | ProfileDialogConnectionWidget::~ProfileDialogConnectionWidget() { | 28 | ProfileDialogConnectionWidget::~ProfileDialogConnectionWidget() { |
29 | } | 29 | } |
30 | ProfileDialogWidget::Type ProfileDialogConnectionWidget::type()const { | 30 | ProfileDialogWidget::Type ProfileDialogConnectionWidget::type()const { |
31 | return Connection; | 31 | return Connection; |
32 | } | 32 | } |
33 | ProfileDialogKeyWidget::ProfileDialogKeyWidget( const QString &na, | ||
34 | QWidget *parent, | ||
35 | const char *name) | ||
36 | : ProfileDialogWidget(na, parent, name ) | ||
37 | { | ||
38 | } | ||
39 | ProfileDialogKeyWidget::~ProfileDialogKeyWidget() { | ||
40 | } | ||
41 | ProfileDialogWidget::Type ProfileDialogKeyWidget::type() const{ | ||
42 | return Keyboard; | ||
43 | } | ||
diff --git a/noncore/apps/opie-console/profiledialogwidget.h b/noncore/apps/opie-console/profiledialogwidget.h index 5d279e6..9d2d5ec 100644 --- a/noncore/apps/opie-console/profiledialogwidget.h +++ b/noncore/apps/opie-console/profiledialogwidget.h | |||
@@ -7,13 +7,14 @@ | |||
7 | 7 | ||
8 | class ProfileDialogWidget : public QWidget { | 8 | class ProfileDialogWidget : public QWidget { |
9 | Q_OBJECT | 9 | Q_OBJECT |
10 | public: | 10 | public: |
11 | enum Type { | 11 | enum Type { |
12 | Connection, | 12 | Connection, |
13 | Terminal | 13 | Terminal, |
14 | Keyboard | ||
14 | }; | 15 | }; |
15 | ProfileDialogWidget( const QString& name, QWidget* parent, const char* name = 0l); | 16 | ProfileDialogWidget( const QString& name, QWidget* parent, const char* name = 0l); |
16 | ~ProfileDialogWidget(); | 17 | ~ProfileDialogWidget(); |
17 | 18 | ||
18 | /* | 19 | /* |
19 | * load data from a Profile into | 20 | * load data from a Profile into |
@@ -43,8 +44,16 @@ public: | |||
43 | ProfileDialogConnectionWidget( const QString& name, QWidget* parent, | 44 | ProfileDialogConnectionWidget( const QString& name, QWidget* parent, |
44 | const char* name =0l); | 45 | const char* name =0l); |
45 | ~ProfileDialogConnectionWidget(); | 46 | ~ProfileDialogConnectionWidget(); |
46 | Type type() const; | 47 | Type type() const; |
47 | 48 | ||
48 | }; | 49 | }; |
50 | class ProfileDialogKeyWidget : public ProfileDialogWidget { | ||
51 | Q_OBJECT | ||
52 | public: | ||
53 | ProfileDialogKeyWidget( const QString &name, QWidget* parent, | ||
54 | const char *name =0l); | ||
55 | ~ProfileDialogKeyWidget(); | ||
56 | Type type() const; | ||
57 | }; | ||
49 | 58 | ||
50 | #endif | 59 | #endif |
diff --git a/noncore/apps/opie-console/profileeditordialog.cpp b/noncore/apps/opie-console/profileeditordialog.cpp index d124067..2dfc0fd 100644 --- a/noncore/apps/opie-console/profileeditordialog.cpp +++ b/noncore/apps/opie-console/profileeditordialog.cpp | |||
@@ -50,27 +50,29 @@ Profile ProfileEditorDialog::profile() const | |||
50 | { | 50 | { |
51 | return m_prof; | 51 | return m_prof; |
52 | } | 52 | } |
53 | 53 | ||
54 | void ProfileEditorDialog::initUI() | 54 | void ProfileEditorDialog::initUI() |
55 | { | 55 | { |
56 | m_con = m_term = 0l; | 56 | m_con = m_term = m_key = 0l; |
57 | 57 | ||
58 | QVBoxLayout *mainLayout = new QVBoxLayout( this ); | 58 | QVBoxLayout *mainLayout = new QVBoxLayout( this ); |
59 | tabWidget = new OTabWidget( this ); | 59 | tabWidget = new OTabWidget( this ); |
60 | tabWidget->setTabStyle(OTabWidget::TextTab); | 60 | tabWidget->setTabStyle(OTabWidget::TextTab); |
61 | mainLayout->add(tabWidget); | 61 | mainLayout->add(tabWidget); |
62 | 62 | ||
63 | /* base tabs */ | 63 | /* base tabs */ |
64 | tabprof = new QWidget(this); | 64 | tabprof = new QWidget(this); |
65 | m_tabTerm = new QWidget(this); | 65 | m_tabTerm = new QWidget(this); |
66 | m_tabCon = new QWidget(this); | 66 | m_tabCon = new QWidget(this); |
67 | m_tabKey = new QWidget(this); | ||
67 | 68 | ||
68 | /* base layout for tabs */ | 69 | /* base layout for tabs */ |
69 | m_layCon = new QHBoxLayout( m_tabCon , 2 ); | 70 | m_layCon = new QHBoxLayout( m_tabCon , 2 ); |
70 | m_layTerm = new QHBoxLayout( m_tabTerm, 2 ); | 71 | m_layTerm = new QHBoxLayout( m_tabTerm, 2 ); |
72 | m_layKey = new QHBoxLayout( m_tabKey, 2 ); | ||
71 | 73 | ||
72 | // profile tab | 74 | // profile tab |
73 | 75 | ||
74 | QLabel *name = new QLabel(QObject::tr("Profile name"), tabprof); | 76 | QLabel *name = new QLabel(QObject::tr("Profile name"), tabprof); |
75 | m_name = new QLineEdit(tabprof); | 77 | m_name = new QLineEdit(tabprof); |
76 | QLabel *con = new QLabel(tr("Connection"), tabprof ); | 78 | QLabel *con = new QLabel(tr("Connection"), tabprof ); |
@@ -91,12 +93,13 @@ void ProfileEditorDialog::initUI() | |||
91 | vbox3->addStretch(1); | 93 | vbox3->addStretch(1); |
92 | 94 | ||
93 | m_showconntab = 0; | 95 | m_showconntab = 0; |
94 | tabWidget->addTab(tabprof, "", QObject::tr("Profile")); | 96 | tabWidget->addTab(tabprof, "", QObject::tr("Profile")); |
95 | //tabWidget->addTab(m_tabCon, "", QObject::tr("Connection")); | 97 | //tabWidget->addTab(m_tabCon, "", QObject::tr("Connection")); |
96 | tabWidget->addTab(m_tabTerm, "", QObject::tr("Terminal")); | 98 | tabWidget->addTab(m_tabTerm, "", QObject::tr("Terminal")); |
99 | tabWidget->addTab(m_tabKey, "", QObject::tr("Special Keys")); | ||
97 | tabWidget->setCurrentTab( tabprof ); | 100 | tabWidget->setCurrentTab( tabprof ); |
98 | 101 | ||
99 | 102 | ||
100 | // fill the comboboxes | 103 | // fill the comboboxes |
101 | QStringList list = m_fact->connectionWidgets(); | 104 | QStringList list = m_fact->connectionWidgets(); |
102 | QStringList::Iterator it; | 105 | QStringList::Iterator it; |
@@ -109,12 +112,13 @@ void ProfileEditorDialog::initUI() | |||
109 | } | 112 | } |
110 | 113 | ||
111 | // load profile values | 114 | // load profile values |
112 | m_name->setText(m_prof.name()); | 115 | m_name->setText(m_prof.name()); |
113 | slotConActivated( m_fact->external(m_prof.ioLayerName() ) ); | 116 | slotConActivated( m_fact->external(m_prof.ioLayerName() ) ); |
114 | slotTermActivated( m_fact->external(m_prof.terminalName() ) ); | 117 | slotTermActivated( m_fact->external(m_prof.terminalName() ) ); |
118 | slotKeyActivated( "Default Keyboard" ); | ||
115 | setCurrent( m_fact->external(m_prof.ioLayerName() ), m_conCmb ); | 119 | setCurrent( m_fact->external(m_prof.ioLayerName() ), m_conCmb ); |
116 | setCurrent( m_fact->external(m_prof.terminalName() ), m_termCmb ); | 120 | setCurrent( m_fact->external(m_prof.terminalName() ), m_termCmb ); |
117 | m_autoConnect->setChecked(m_prof.autoConnect()); | 121 | m_autoConnect->setChecked(m_prof.autoConnect()); |
118 | 122 | ||
119 | 123 | ||
120 | // signal and slots | 124 | // signal and slots |
@@ -147,12 +151,14 @@ void ProfileEditorDialog::accept() | |||
147 | m_prof.setAutoConnect( m_autoConnect->isChecked() ); | 151 | m_prof.setAutoConnect( m_autoConnect->isChecked() ); |
148 | 152 | ||
149 | if (m_con ) | 153 | if (m_con ) |
150 | m_con->save( m_prof ); | 154 | m_con->save( m_prof ); |
151 | if (m_term ) | 155 | if (m_term ) |
152 | m_term->save( m_prof ); | 156 | m_term->save( m_prof ); |
157 | if (m_key) | ||
158 | m_key->save( m_prof ); | ||
153 | 159 | ||
154 | QDialog::accept(); | 160 | QDialog::accept(); |
155 | } | 161 | } |
156 | 162 | ||
157 | 163 | ||
158 | QString ProfileEditorDialog::profName()const | 164 | QString ProfileEditorDialog::profName()const |
@@ -175,12 +181,13 @@ void ProfileEditorDialog::slotConActivated( const QString& str ) { | |||
175 | delete m_con; | 181 | delete m_con; |
176 | m_con = m_fact->newConnectionPlugin( str, m_tabCon ); | 182 | m_con = m_fact->newConnectionPlugin( str, m_tabCon ); |
177 | 183 | ||
178 | if ( m_con ) { | 184 | if ( m_con ) { |
179 | m_con->load( m_prof ); | 185 | m_con->load( m_prof ); |
180 | m_layCon->addWidget( m_con ); | 186 | m_layCon->addWidget( m_con ); |
187 | |||
181 | if(!m_showconntab) | 188 | if(!m_showconntab) |
182 | { | 189 | { |
183 | tabWidget->addTab( m_tabCon, "", QObject::tr("Connection") ); | 190 | tabWidget->addTab( m_tabCon, "", QObject::tr("Connection") ); |
184 | tabWidget->setCurrentTab( tabprof ); | 191 | tabWidget->setCurrentTab( tabprof ); |
185 | m_showconntab = 1; | 192 | m_showconntab = 1; |
186 | } | 193 | } |
@@ -199,6 +206,17 @@ void ProfileEditorDialog::slotTermActivated( const QString& str ) { | |||
199 | if (m_term) { | 206 | if (m_term) { |
200 | m_term->load(m_prof ); | 207 | m_term->load(m_prof ); |
201 | m_layTerm->addWidget( m_term ); | 208 | m_layTerm->addWidget( m_term ); |
202 | } | 209 | } |
203 | } | 210 | } |
204 | 211 | ||
212 | void ProfileEditorDialog::slotKeyActivated(const QString &str) { | ||
213 | delete m_key; | ||
214 | m_key = m_fact->newKeyboardPlugin( str, m_tabKey ); | ||
215 | |||
216 | if (m_key) { | ||
217 | |||
218 | m_key->load(m_prof); | ||
219 | m_layKey->addWidget(m_key); | ||
220 | } | ||
221 | |||
222 | } | ||
diff --git a/noncore/apps/opie-console/profileeditordialog.h b/noncore/apps/opie-console/profileeditordialog.h index cbda689..6216660 100644 --- a/noncore/apps/opie-console/profileeditordialog.h +++ b/noncore/apps/opie-console/profileeditordialog.h | |||
@@ -30,12 +30,13 @@ public: | |||
30 | public slots: | 30 | public slots: |
31 | void accept(); | 31 | void accept(); |
32 | 32 | ||
33 | private slots: | 33 | private slots: |
34 | void slotConActivated(const QString& ); | 34 | void slotConActivated(const QString& ); |
35 | void slotTermActivated( const QString& ); | 35 | void slotTermActivated( const QString& ); |
36 | void slotKeyActivated(const QString&); | ||
36 | private: | 37 | private: |
37 | void initUI(); | 38 | void initUI(); |
38 | QString profName()const; | 39 | QString profName()const; |
39 | QCString profType()const; | 40 | QCString profType()const; |
40 | 41 | ||
41 | MetaFactory* m_fact; | 42 | MetaFactory* m_fact; |
@@ -43,15 +44,15 @@ private: | |||
43 | Profile m_prof; | 44 | Profile m_prof; |
44 | 45 | ||
45 | QLineEdit *m_name; | 46 | QLineEdit *m_name; |
46 | QComboBox *m_conCmb, *m_termCmb; | 47 | QComboBox *m_conCmb, *m_termCmb; |
47 | QCheckBox *m_autoConnect; | 48 | QCheckBox *m_autoConnect; |
48 | 49 | ||
49 | QWidget *m_tabCon, *m_tabTerm; | 50 | QWidget *m_tabCon, *m_tabTerm, *m_tabKey; |
50 | ProfileDialogWidget* m_con, *m_term; | 51 | ProfileDialogWidget* m_con, *m_term, *m_key; |
51 | QHBoxLayout *m_layCon, *m_layTerm; | 52 | QHBoxLayout *m_layCon, *m_layTerm, *m_layKey; |
52 | OTabWidget *tabWidget; | 53 | OTabWidget *tabWidget; |
53 | QWidget *tabprof; | 54 | QWidget *tabprof; |
54 | int m_showconntab; | 55 | int m_showconntab; |
55 | }; | 56 | }; |
56 | 57 | ||
57 | #endif | 58 | #endif |