summaryrefslogtreecommitdiff
authorzecke <zecke>2002-10-21 22:15:31 (UTC)
committer zecke <zecke>2002-10-21 22:15:31 (UTC)
commit151729eb3e4e4cfbb69db1f027e74188cf55c328 (patch) (unidiff)
tree73705a6ca967933780062a95756dc18ae7bd8167
parent5bcd4ccebd86f912c693de16675da44d21e11d94 (diff)
downloadopie-151729eb3e4e4cfbb69db1f027e74188cf55c328.zip
opie-151729eb3e4e4cfbb69db1f027e74188cf55c328.tar.gz
opie-151729eb3e4e4cfbb69db1f027e74188cf55c328.tar.bz2
Fix the addPage bug... and avoid some compiler warnings. REMEMBER WARNINGS ARE BUGS
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/btconfigwidget.cpp4
-rw-r--r--noncore/apps/opie-console/default.cpp2
-rw-r--r--noncore/apps/opie-console/dialer.cpp4
-rw-r--r--noncore/apps/opie-console/dialer.h2
-rw-r--r--noncore/apps/opie-console/function_keyboard.cpp64
-rw-r--r--noncore/apps/opie-console/io_modem.cpp2
-rw-r--r--noncore/apps/opie-console/iolayerbase.cpp4
-rw-r--r--noncore/apps/opie-console/irdaconfigwidget.cpp4
-rw-r--r--noncore/apps/opie-console/main.cpp1
-rw-r--r--noncore/apps/opie-console/modemconfigwidget.cpp3
-rw-r--r--noncore/apps/opie-console/procctl.cpp1
-rw-r--r--noncore/apps/opie-console/profileeditordialog.cpp3
-rw-r--r--noncore/apps/opie-console/serialconfigwidget.cpp2
-rw-r--r--noncore/apps/opie-console/transferdialog.cpp8
14 files changed, 57 insertions, 47 deletions
diff --git a/noncore/apps/opie-console/btconfigwidget.cpp b/noncore/apps/opie-console/btconfigwidget.cpp
index 6246f92..64046d8 100644
--- a/noncore/apps/opie-console/btconfigwidget.cpp
+++ b/noncore/apps/opie-console/btconfigwidget.cpp
@@ -1,46 +1,46 @@
1#include <qlabel.h> 1#include <qlabel.h>
2#include <qlayout.h> 2#include <qlayout.h>
3#include <qlineedit.h> 3#include <qlineedit.h>
4#include <qcombobox.h> 4#include <qcombobox.h>
5#include <qhbox.h> 5#include <qhbox.h>
6#include <qradiobutton.h> 6#include <qradiobutton.h>
7 7
8#include "iolayerbase.h" 8#include "iolayerbase.h"
9#include "btconfigwidget.h" 9#include "btconfigwidget.h"
10 10
11namespace { 11namespace {
12 void setCurrent( const QString& str, QComboBox* bo ) { 12 void setCurrent( const QString& str, QComboBox* bo ) {
13 uint b = bo->count(); 13 uint b = bo->count();
14 for (uint i = 0; i < bo->count(); i++ ) { 14 for (int i = 0; i < bo->count(); i++ ) {
15 if ( bo->text(i) == str ) { 15 if ( bo->text(i) == str ) {
16 bo->setCurrentItem( i ); 16 bo->setCurrentItem( i );
17 return; 17 return;
18 } 18 }
19 } 19 }
20 bo->insertItem( str ); 20 bo->insertItem( str );
21 bo->setCurrentItem( b ); 21 bo->setCurrentItem( b );
22 } 22 }
23} 23}
24 24
25BTConfigWidget::BTConfigWidget( const QString& name, 25BTConfigWidget::BTConfigWidget( const QString& name,
26 QWidget* parent, 26 QWidget* parent,
27 const char* na ) 27 const char* na )
28 : ProfileDialogConnectionWidget( name, parent, na ) { 28 : ProfileDialogConnectionWidget( name, parent, na ) {
29 29
30 m_lay = new QVBoxLayout( this ); 30 m_lay = new QVBoxLayout( this );
31 31
32 m_device = new QLabel( tr( "Device" ), this ); 32 m_device = new QLabel( tr( "Device" ), this );
33 QHBox *deviceBox = new QHBox( this ); 33 QHBox *deviceBox = new QHBox( this );
34 m_devRadio = new QRadioButton( deviceBox ); 34 m_devRadio = new QRadioButton( deviceBox );
35 connect( m_devRadio, SIGNAL( toggled( bool ) ), this, SLOT( slotDevRadio( bool ) ) ); 35 connect( m_devRadio, SIGNAL( toggled( bool ) ), this, SLOT( slotDevRadio( bool ) ) );
36 m_deviceCmb = new QComboBox( deviceBox ); 36 m_deviceCmb = new QComboBox( deviceBox );
37 m_deviceCmb->setEditable( TRUE ); 37 m_deviceCmb->setEditable( TRUE );
38 38
39 QLabel *macLabel = new QLabel( this ); 39 QLabel *macLabel = new QLabel( this );
40 macLabel->setText( tr( "Or peer mac address" ) ); 40 macLabel->setText( tr( "Or peer mac address" ) );
41 QHBox *macBox = new QHBox( this ); 41 QHBox *macBox = new QHBox( this );
42 m_macRadio = new QRadioButton( macBox ); 42 m_macRadio = new QRadioButton( macBox );
43 connect( m_macRadio, SIGNAL( toggled( bool ) ), this, SLOT( slotMacRadio( bool ) ) ); 43 connect( m_macRadio, SIGNAL( toggled( bool ) ), this, SLOT( slotMacRadio( bool ) ) );
44 m_mac = new QLineEdit( macBox ); 44 m_mac = new QLineEdit( macBox );
45 45
46 m_base = new IOLayerBase(this, "base"); 46 m_base = new IOLayerBase(this, "base");
@@ -87,102 +87,104 @@ void BTConfigWidget::load( const Profile& prof ) {
87 } 87 }
88 88
89 switch( speed ) { 89 switch( speed ) {
90 case 115200: 90 case 115200:
91 m_base->setSpeed(IOLayerBase::Baud_115200 ); 91 m_base->setSpeed(IOLayerBase::Baud_115200 );
92 break; 92 break;
93 case 57600: 93 case 57600:
94 m_base->setSpeed( IOLayerBase::Baud_57600 ); 94 m_base->setSpeed( IOLayerBase::Baud_57600 );
95 break; 95 break;
96 case 38400: 96 case 38400:
97 m_base->setSpeed(IOLayerBase::Baud_38400 ); 97 m_base->setSpeed(IOLayerBase::Baud_38400 );
98 break; 98 break;
99 case 19200: 99 case 19200:
100 m_base->setSpeed( IOLayerBase::Baud_19200 ); 100 m_base->setSpeed( IOLayerBase::Baud_19200 );
101 break; 101 break;
102 case 9600: 102 case 9600:
103 default: 103 default:
104 m_base->setSpeed(IOLayerBase::Baud_9600 ); 104 m_base->setSpeed(IOLayerBase::Baud_9600 );
105 break; 105 break;
106 } 106 }
107 107
108 if ( prof.readEntry("Device").isEmpty() ) return; 108 if ( prof.readEntry("Device").isEmpty() ) return;
109 setCurrent( prof.readEntry("Device"), m_deviceCmb ); 109 setCurrent( prof.readEntry("Device"), m_deviceCmb );
110 110
111} 111}
112/* 112/*
113 * save speed, 113 * save speed,
114 * flow, 114 * flow,
115 * parity 115 * parity
116 */ 116 */
117void BTConfigWidget::save( Profile& prof ) { 117void BTConfigWidget::save( Profile& prof ) {
118 int flow, parity, speed; 118 int flow, parity, speed;
119 flow = parity = speed = 0;
119 prof.writeEntry("Device", m_deviceCmb->currentText() ); 120 prof.writeEntry("Device", m_deviceCmb->currentText() );
120 121
121 122
122 switch( m_base->flow() ) { 123 switch( m_base->flow() ) {
123 case IOLayerBase::None: 124 case IOLayerBase::None:
124 flow = 0; 125 flow = 0;
125 break; 126 break;
126 case IOLayerBase::Software: 127 case IOLayerBase::Software:
127 flow = 2; 128 flow = 2;
128 break; 129 break;
129 case IOLayerBase::Hardware: 130 case IOLayerBase::Hardware:
130 flow = 1; 131 flow = 1;
131 break; 132 break;
132 } 133 }
133 134
134 switch( m_base->parity() ) { 135 switch( m_base->parity() ) {
135 case IOLayerBase::Odd: 136 case IOLayerBase::Odd:
136 parity = 2; 137 parity = 2;
137 break; 138 break;
138 case IOLayerBase::Even: 139 case IOLayerBase::Even:
139 parity = 1; 140 parity = 1;
140 break; 141 break;
141 case IOLayerBase::NonePar: 142 case IOLayerBase::NonePar:
142 parity = 0; 143 parity = 0;
143 break; 144 break;
144 } 145 }
145 146
146 switch( m_base->speed() ) { 147 switch( m_base->speed() ) {
147 case IOLayerBase::Baud_115200: 148 case IOLayerBase::Baud_115200:
148 speed = 115200; 149 speed = 115200;
149 break; 150 break;
150 case IOLayerBase::Baud_57600: 151 case IOLayerBase::Baud_57600:
151 speed = 57600; 152 speed = 57600;
152 break; 153 break;
153 case IOLayerBase::Baud_38400: 154 case IOLayerBase::Baud_38400:
154 speed = 38400; 155 speed = 38400;
155 break; 156 break;
156 case IOLayerBase::Baud_19200: 157 case IOLayerBase::Baud_19200:
157 speed = 19200; 158 speed = 19200;
158 break; 159 break;
160 default:
159 case IOLayerBase::Baud_9600: 161 case IOLayerBase::Baud_9600:
160 speed = 9600; 162 speed = 9600;
161 break; 163 break;
162 } 164 }
163 165
164 prof.writeEntry("Flow", flow); 166 prof.writeEntry("Flow", flow);
165 prof.writeEntry("Parity", parity); 167 prof.writeEntry("Parity", parity);
166 prof.writeEntry("Speed", speed); 168 prof.writeEntry("Speed", speed);
167 prof.writeEntry("Mac", m_mac->text() ); 169 prof.writeEntry("Mac", m_mac->text() );
168} 170}
169 171
170void BTConfigWidget::slotMacRadio( bool on ) { 172void BTConfigWidget::slotMacRadio( bool on ) {
171 if ( on ) { 173 if ( on ) {
172 m_devRadio->setChecked( false ); 174 m_devRadio->setChecked( false );
173 m_deviceCmb->setEnabled( false ); 175 m_deviceCmb->setEnabled( false );
174 m_mac->setEnabled( true ); 176 m_mac->setEnabled( true );
175 } else { 177 } else {
176 m_devRadio->setChecked( true ); 178 m_devRadio->setChecked( true );
177 } 179 }
178} 180}
179 181
180void BTConfigWidget::slotDevRadio( bool on ) { 182void BTConfigWidget::slotDevRadio( bool on ) {
181 if ( on ) { 183 if ( on ) {
182 m_macRadio->setChecked( false ); 184 m_macRadio->setChecked( false );
183 m_deviceCmb->setEnabled( true ); 185 m_deviceCmb->setEnabled( true );
184 m_mac->setEnabled( false ); 186 m_mac->setEnabled( false );
185 } else { 187 } else {
186 m_macRadio->setChecked( true ); 188 m_macRadio->setChecked( true );
187 } 189 }
188} 190}
diff --git a/noncore/apps/opie-console/default.cpp b/noncore/apps/opie-console/default.cpp
index 0160b56..19640d8 100644
--- a/noncore/apps/opie-console/default.cpp
+++ b/noncore/apps/opie-console/default.cpp
@@ -38,65 +38,65 @@ extern "C" {
38 } 38 }
39 39
40 // Layer stuff 40 // Layer stuff
41 IOLayer* newSerialLayer( const Profile& prof) { 41 IOLayer* newSerialLayer( const Profile& prof) {
42 return new IOSerial( prof ); 42 return new IOSerial( prof );
43 } 43 }
44 IOLayer* newBTLayer( const Profile& prof ) { 44 IOLayer* newBTLayer( const Profile& prof ) {
45 return new IOBt( prof ); 45 return new IOBt( prof );
46 } 46 }
47 IOLayer* newIrDaLayer( const Profile& prof ) { 47 IOLayer* newIrDaLayer( const Profile& prof ) {
48 return new IOIrda( prof ); 48 return new IOIrda( prof );
49 } 49 }
50 IOLayer* newModemLayer( const Profile& prof ) { 50 IOLayer* newModemLayer( const Profile& prof ) {
51 return new IOModem( prof ); 51 return new IOModem( prof );
52 } 52 }
53 IOLayer* newConsole( const Profile& prof ) { 53 IOLayer* newConsole( const Profile& prof ) {
54 return new MyPty( prof ); 54 return new MyPty( prof );
55 } 55 }
56 56
57 // Connection Widgets 57 // Connection Widgets
58 ProfileDialogWidget* newSerialWidget( const QString& str, QWidget* wid ) { 58 ProfileDialogWidget* newSerialWidget( const QString& str, QWidget* wid ) {
59 return new SerialConfigWidget( str, wid ); 59 return new SerialConfigWidget( str, wid );
60 } 60 }
61 ProfileDialogWidget* newIrDaWidget( const QString& str, QWidget* wid ) { 61 ProfileDialogWidget* newIrDaWidget( const QString& str, QWidget* wid ) {
62 return new IrdaConfigWidget( str, wid ); 62 return new IrdaConfigWidget( str, wid );
63 } 63 }
64 ProfileDialogWidget* newModemWidget( const QString& str, QWidget* wid ) { 64 ProfileDialogWidget* newModemWidget( const QString& str, QWidget* wid ) {
65 return new ModemConfigWidget(str, wid ); 65 return new ModemConfigWidget(str, wid );
66 } 66 }
67 ProfileDialogWidget* newBTWidget( const QString& str, QWidget* wid ) { 67 ProfileDialogWidget* newBTWidget( const QString& str, QWidget* wid ) {
68 return new BTConfigWidget(str, wid ); 68 return new BTConfigWidget(str, wid );
69 } 69 }
70 ProfileDialogWidget* newConsoleWid( const QString& str, QWidget* wid ) { 70 ProfileDialogWidget* newConsoleWid( const QString& , QWidget* ) {
71 return 0l; 71 return 0l;
72 } 72 }
73 73
74 74
75 // Terminal Widget(s) 75 // Terminal Widget(s)
76 ProfileDialogWidget* newTerminalWidget(const QString& na, QWidget* wid) { 76 ProfileDialogWidget* newTerminalWidget(const QString& na, QWidget* wid) {
77 return new TerminalWidget(na, wid,0 ); 77 return new TerminalWidget(na, wid,0 );
78 } 78 }
79 79
80 // Function Keyboard Widget 80 // Function Keyboard Widget
81 ProfileDialogWidget* newKeyboardWidget(const QString& na, QWidget *wid) { 81 ProfileDialogWidget* newKeyboardWidget(const QString& na, QWidget *wid) {
82 return new FunctionKeyboardConfig(na, wid); 82 return new FunctionKeyboardConfig(na, wid);
83 } 83 }
84 84
85/* // VT Emulations 85/* // VT Emulations
86 EmulationLayer* newVT102( WidgetLayer* wid ) { 86 EmulationLayer* newVT102( WidgetLayer* wid ) {
87 return new Vt102Emulation( wid ); 87 return new Vt102Emulation( wid );
88 } 88 }
89*/ 89*/
90}; 90};
91 91
92Default::Default( MetaFactory* fact ) { 92Default::Default( MetaFactory* fact ) {
93 fact->addFileTransferLayer( "SZ", QObject::tr("Z-Modem"), newSZTransfer ); 93 fact->addFileTransferLayer( "SZ", QObject::tr("Z-Modem"), newSZTransfer );
94 fact->addFileTransferLayer( "SY", QObject::tr("Y-Modem"), newSYTransfer ); 94 fact->addFileTransferLayer( "SY", QObject::tr("Y-Modem"), newSYTransfer );
95 fact->addFileTransferLayer( "SX", QObject::tr("X-Modem"), newSXTransfer ); 95 fact->addFileTransferLayer( "SX", QObject::tr("X-Modem"), newSXTransfer );
96 96
97 fact->addReceiveLayer( "SZ", QObject::tr("Z-Modem"), newSZReceive ); 97 fact->addReceiveLayer( "SZ", QObject::tr("Z-Modem"), newSZReceive );
98 fact->addReceiveLayer( "SY", QObject::tr("Y-Modem"), newSYReceive ); 98 fact->addReceiveLayer( "SY", QObject::tr("Y-Modem"), newSYReceive );
99 fact->addReceiveLayer( "SX", QObject::tr("X-Modem"), newSXReceive ); 99 fact->addReceiveLayer( "SX", QObject::tr("X-Modem"), newSXReceive );
100 100
101 fact->addIOLayerFactory( "serial", QObject::tr("Serial"), newSerialLayer ); 101 fact->addIOLayerFactory( "serial", QObject::tr("Serial"), newSerialLayer );
102 fact->addIOLayerFactory( "irda", QObject::tr("Infrared"), newIrDaLayer ); 102 fact->addIOLayerFactory( "irda", QObject::tr("Infrared"), newIrDaLayer );
diff --git a/noncore/apps/opie-console/dialer.cpp b/noncore/apps/opie-console/dialer.cpp
index d37e406..5056040 100644
--- a/noncore/apps/opie-console/dialer.cpp
+++ b/noncore/apps/opie-console/dialer.cpp
@@ -163,98 +163,98 @@ void Dialer::trydial(const QString& number)
163 } 163 }
164 164
165 if(state != state_cancel) 165 if(state != state_cancel)
166 { 166 {
167 switchState(state_dialtone); 167 switchState(state_dialtone);
168 168
169 send("ATX1"); 169 send("ATX1");
170 QString response4 = receive(); 170 QString response4 = receive();
171 if(!response4.contains("\nOK\r")) 171 if(!response4.contains("\nOK\r"))
172 reset(); 172 reset();
173 } 173 }
174 174
175 if(state != state_cancel) 175 if(state != state_cancel)
176 { 176 {
177 switchState(state_dialing); 177 switchState(state_dialing);
178 178
179 //send(QString("ATDT %1").arg(number)); 179 //send(QString("ATDT %1").arg(number));
180 send(QString("%1 %2").arg(m_profile.readEntry("DialPrefix1")).arg(number)); 180 send(QString("%1 %2").arg(m_profile.readEntry("DialPrefix1")).arg(number));
181 QString response5 = receive(); 181 QString response5 = receive();
182 if(!response5.contains("\n" + m_profile.readEntry("DefaultConnect"))) 182 if(!response5.contains("\n" + m_profile.readEntry("DefaultConnect")))
183 { 183 {
184 if(response5.contains("BUSY")) 184 if(response5.contains("BUSY"))
185 switchState(state_dialing); 185 switchState(state_dialing);
186 else 186 else
187 { 187 {
188 QMessageBox::warning(this, 188 QMessageBox::warning(this,
189 QObject::tr("Failure"), 189 QObject::tr("Failure"),
190 QObject::tr("Dialing the number failed.")); 190 QObject::tr("Dialing the number failed."));
191 slotCancel(); 191 slotCancel();
192 } 192 }
193 } 193 }
194 } 194 }
195 195
196 if(state != state_cancel) 196 if(state != state_cancel)
197 { 197 {
198 switchState(state_online); 198 switchState(state_online);
199 } 199 }
200} 200}
201 201
202void Dialer::send(const QString& msg) 202void Dialer::send(const QString& msg)
203{ 203{
204 QString m = msg; 204 QString m = msg;
205 int bytes; 205 int bytes;
206 QString termination; 206 QString termination;
207 207
208 //qWarning("Sending: '%s'", m.latin1()); 208 //qWarning("Sending: '%s'", m.latin1());
209 209
210 termination = "\r"; 210 termination = "\r";
211 //termination = m_profile.readEntry("Termination"); 211 //termination = m_profile.readEntry("Termination");
212 if(termination == "\n") m = m + "\n"; 212 if(termination == "\n") m = m + "\n";
213 else if(termination == "\r") m = m + "\r"; 213 else if(termination == "\r") m = m + "\r";
214 else m = m + "\r\n"; 214 else m = m + "\r\n";
215 215
216 bytes = ::write(m_fd, m.local8Bit(), strlen(m.local8Bit())); 216 bytes = ::write(m_fd, m.local8Bit(), strlen(m.local8Bit()));
217 if(bytes < 0) 217 if(bytes < 0)
218 { 218 {
219 reset(); 219 reset();
220 } 220 }
221} 221}
222 222
223QString Dialer::receive() 223QString Dialer::receive()
224{ 224{
225 QString buf; 225 QString buf;
226 char buffer[1024]; 226 char buffer[1024];
227 int ret; 227 int ret;
228 int counter; 228 int counter = 0;
229 229
230 while(1) 230 while(1)
231 { 231 {
232 ret = ::read(m_fd, buffer, sizeof(buffer)); 232 ret = ::read(m_fd, buffer, sizeof(buffer));
233 233
234 if(ret > 0) 234 if(ret > 0)
235 { 235 {
236 for(int i = 0; i < ret; i++) 236 for(int i = 0; i < ret; i++)
237 buffer[i] = buffer[i] & 0x7F; 237 buffer[i] = buffer[i] & 0x7F;
238 buffer[ret] = 0; 238 buffer[ret] = 0;
239 //qWarning("Got: '%s'", buffer); 239 //qWarning("Got: '%s'", buffer);
240 buf.append(QString(buffer)); 240 buf.append(QString(buffer));
241 if(buf.contains("OK") || buf.contains("ERROR") || buf.contains("CONNECT") || (buf.contains("BUSY"))) 241 if(buf.contains("OK") || buf.contains("ERROR") || buf.contains("CONNECT") || (buf.contains("BUSY")))
242 { 242 {
243 //qWarning("Receiving: '%s'", buf.latin1()); 243 //qWarning("Receiving: '%s'", buf.latin1());
244 cleanshutdown = 1; 244 cleanshutdown = 1;
245 return buf; 245 return buf;
246 } 246 }
247 } 247 }
248 else if(ret < 0) 248 else if(ret < 0)
249 { 249 {
250 if(errno != EAGAIN) reset(); 250 if(errno != EAGAIN) reset();
251 else if(!(counter++ % 100)) qApp->processEvents(); 251 else if(!(counter++ % 100)) qApp->processEvents();
252 } 252 }
253 else if(!(counter++ % 100)) qApp->processEvents(); 253 else if(!(counter++ % 100)) qApp->processEvents();
254 254
255 if(usercancel) return QString::null; 255 if(usercancel) return QString::null;
256 } 256 }
257 257
258 cleanshutdown = 1; 258 cleanshutdown = 1;
259 return QString::null; 259 return QString::null;
260} 260}
diff --git a/noncore/apps/opie-console/dialer.h b/noncore/apps/opie-console/dialer.h
index 28303f3..88681a3 100644
--- a/noncore/apps/opie-console/dialer.h
+++ b/noncore/apps/opie-console/dialer.h
@@ -16,39 +16,39 @@ class Dialer : public QDialog
16 ~Dialer(); 16 ~Dialer();
17 void setHangupOnly(); 17 void setHangupOnly();
18 18
19 public slots: 19 public slots:
20 void slotCancel(); 20 void slotCancel();
21 void slotAutostart(); 21 void slotAutostart();
22 22
23 private: 23 private:
24 void switchState(int newstate); 24 void switchState(int newstate);
25 void reset(); 25 void reset();
26 void dial(const QString& number); 26 void dial(const QString& number);
27 void trydial(const QString& number); 27 void trydial(const QString& number);
28 28
29 void send(const QString& msg); 29 void send(const QString& msg);
30 QString receive(); 30 QString receive();
31 31
32 enum States 32 enum States
33 { 33 {
34 state_cancel, 34 state_cancel,
35 state_preinit, 35 state_preinit,
36 state_init, 36 state_init,
37 state_options, 37 state_options,
38 state_dialtone, 38 state_dialtone,
39 state_dialing, 39 state_dialing,
40 state_online 40 state_online
41 }; 41 };
42 42
43 QLabel *status; 43 QLabel *status;
44 QProgressBar *progress; 44 QProgressBar *progress;
45 QPushButton *cancel; 45 QPushButton *cancel;
46 int state; 46 int state;
47 int usercancel; 47 int usercancel;
48 int m_fd;
48 const Profile& m_profile; 49 const Profile& m_profile;
49 int m_fd;
50 int cleanshutdown; 50 int cleanshutdown;
51}; 51};
52 52
53#endif 53#endif
54 54
diff --git a/noncore/apps/opie-console/function_keyboard.cpp b/noncore/apps/opie-console/function_keyboard.cpp
index fd20e99..100fdfc 100644
--- a/noncore/apps/opie-console/function_keyboard.cpp
+++ b/noncore/apps/opie-console/function_keyboard.cpp
@@ -1,182 +1,182 @@
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#include <qlayout.h>
7 7
8FunctionKeyboard::FunctionKeyboard(QWidget *parent) : 8FunctionKeyboard::FunctionKeyboard(QWidget *parent) :
9 QFrame(parent), numRows(2), numCols(11), 9 QFrame(parent), numRows(2), numCols(11),
10 pressedRow(0), pressedCol(0) { 10 pressedRow(0), pressedCol(0) {
11 11
12 setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed)); 12 setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed));
13 13
14 Config conf("opie-console-keys"); 14 Config conf("opie-console-keys");
15 conf.setGroup("keys"); 15 conf.setGroup("keys");
16 for (uint r = 0; r < numRows; r++) 16 for (uint r = 0; r < numRows; r++)
17 for (uint c = 0; c < numCols; c++) { 17 for (uint c = 0; c < numCols; c++) {
18 18
19 QString handle = "r" + QString::number(r) + "c" + QString::number(c); 19 QString handle = "r" + QString::number(r) + "c" + QString::number(c);
20 QStringList value_list = conf.readListEntry( handle, '|'); 20 QStringList value_list = conf.readListEntry( handle, '|');
21 21
22 if (value_list.isEmpty()) continue; 22 if (value_list.isEmpty()) continue;
23 23
24 keys.insert( 24 keys.insert(
25 25
26 handle, 26 handle,
27 FKey (value_list[0], value_list[1].toUShort(), value_list[2].toUShort()) 27 FKey (value_list[0], value_list[1].toUShort(), value_list[2].toUShort())
28 ); 28 );
29 } 29 }
30 //qWarning("loaded %d keys", keys.count()); 30 //qWarning("loaded %d keys", keys.count());
31 if (keys.isEmpty()) loadDefaults(); 31 if (keys.isEmpty()) loadDefaults();
32 32
33 33
34 34
35} 35}
36 36
37FunctionKeyboard::~FunctionKeyboard() { 37FunctionKeyboard::~FunctionKeyboard() {
38 38
39} 39}
40 40
41void FunctionKeyboard::paintEvent(QPaintEvent *e) { 41void FunctionKeyboard::paintEvent(QPaintEvent *e) {
42 42
43 QPainter p(this); 43 QPainter p(this);
44 p.setClipRect(e->rect()); 44 p.setClipRect(e->rect());
45 p.fillRect(0, 0, width(), height(), QColor(255,255,255)); 45 p.fillRect(0, 0, width(), height(), QColor(255,255,255));
46 46
47 p.setPen(QColor(0,0,0)); 47 p.setPen(QColor(0,0,0));
48 48
49 /* those decimals do count! becomes short if use plain int */ 49 /* those decimals do count! becomes short if use plain int */
50 for (double i = 0; i <= width(); i += keyWidth) { 50 for (double i = 0; i <= width(); i += keyWidth) {
51 51
52 p.drawLine((int)i, 0, (int)i, height()); 52 p.drawLine((int)i, 0, (int)i, height());
53 } 53 }
54 54
55 // sometimes the last line doesnt get drawn 55 // sometimes the last line doesnt get drawn
56 p.drawLine(width() -1, 0, width() -1, height()); 56 p.drawLine(width() -1, 0, width() -1, height());
57 57
58 for (int i = 0; i <= height(); i += keyHeight) { 58 for (int i = 0; i <= height(); i += keyHeight) {
59 59
60 p.drawLine(0, i, width(), i); 60 p.drawLine(0, i, width(), i);
61 } 61 }
62 62
63 for (uint r = 0; r < numRows; r++) { 63 for (uint r = 0; r < numRows; r++) {
64 for (uint c = 0; c < numCols; c++) { 64 for (uint c = 0; c < numCols; c++) {
65 65
66 QString handle = "r" + QString::number(r) + "c" + QString::number(c); 66 QString handle = "r" + QString::number(r) + "c" + QString::number(c);
67 if (keys.contains(handle)) { 67 if (keys.contains(handle)) {
68 68
69 p.drawText( 69 p.drawText(
70 c * keyWidth + 1, r * keyHeight + 1, 70 c * keyWidth + 1, r * keyHeight + 1,
71 keyWidth, keyHeight, 71 keyWidth, keyHeight,
72 Qt::AlignHCenter | Qt::AlignVCenter, 72 Qt::AlignHCenter | Qt::AlignVCenter,
73 keys[handle].getL() 73 keys[handle].getL()
74 ); 74 );
75 } 75 }
76 } 76 }
77 } 77 }
78} 78}
79 79
80void FunctionKeyboard::paintKey(int row, int col) { 80void FunctionKeyboard::paintKey(int row, int col) {
81 81
82 QPainter p(this); 82 QPainter p(this);
83 83
84 p.fillRect(QRect(QPoint(col * keyWidth + 1, row * keyHeight + 1), 84 p.fillRect(QRect(QPoint(col * keyWidth + 1, row * keyHeight + 1),
85 QPoint((col + 1) * keyWidth - 1, row * keyHeight + keyHeight- 1)), 85 QPoint((col + 1) * keyWidth - 1, row * keyHeight + keyHeight- 1)),
86 (pressedRow != -1 && pressedCol != -1 ) ? QColor(97,119,155) : QColor(255,255,255)); 86 (pressedRow != -1 && pressedCol != -1 ) ? QColor(97,119,155) : QColor(255,255,255));
87 p.drawText( 87 p.drawText(
88 col * keyWidth + 1, row * keyHeight + 1, 88 col * keyWidth + 1, row * keyHeight + 1,
89 keyWidth, keyHeight, 89 keyWidth, keyHeight,
90 Qt::AlignHCenter | Qt::AlignVCenter, 90 Qt::AlignHCenter | Qt::AlignVCenter,
91 keys["r" + QString::number(row) + "c" + QString::number(col)].getL() 91 keys["r" + QString::number(row) + "c" + QString::number(col)].getL()
92 ); 92 );
93 93
94} 94}
95 95
96void FunctionKeyboard::mousePressEvent(QMouseEvent *e) { 96void FunctionKeyboard::mousePressEvent(QMouseEvent *e) {
97 97
98 pressedRow = e->y() / keyHeight; 98 pressedRow = e->y() / keyHeight;
99 pressedCol = (int) (e->x() / keyWidth); 99 pressedCol = (int) (e->x() / keyWidth);
100 100
101 paintKey(pressedRow, pressedCol); 101 paintKey(pressedRow, pressedCol);
102 102
103 // emit that sucker! 103 // emit that sucker!
104 FKey k = keys["r" + QString::number(pressedRow) + "c" + QString::number(pressedCol)]; 104 FKey k = keys["r" + QString::number(pressedRow) + "c" + QString::number(pressedCol)];
105 emit keyPressed(k.getU(), k.getQ(), 0, 1, 0); 105 emit keyPressed(k.getU(), k.getQ(), 0, 1, 0);
106 106
107} 107}
108 108
109void FunctionKeyboard::mouseReleaseEvent(QMouseEvent *) { 109void FunctionKeyboard::mouseReleaseEvent(QMouseEvent *) {
110 110
111 if (pressedRow != -1 && pressedRow != -1) { 111 if (pressedRow != -1 && pressedRow != -1) {
112 112
113 int row = pressedRow; pressedRow = -1; 113 int row = pressedRow; pressedRow = -1;
114 int col = pressedCol; pressedCol = -1; 114 int col = pressedCol; pressedCol = -1;
115 paintKey(row, col); 115 paintKey(row, col);
116 116
117 FKey k = keys["r" + QString::number(row) + "c" + QString::number(col)]; 117 FKey k = keys["r" + QString::number(row) + "c" + QString::number(col)];
118 emit keyPressed(k.getU(), k.getQ(), 0, 0, 0); 118 emit keyPressed(k.getU(), k.getQ(), 0, 0, 0);
119 } 119 }
120 120
121} 121}
122 122
123 123
124void FunctionKeyboard::resizeEvent(QResizeEvent*) { 124void FunctionKeyboard::resizeEvent(QResizeEvent*) {
125 125
126 /* set he default font height/width */ 126 /* set he default font height/width */
127 QFontMetrics fm=fontMetrics(); 127 QFontMetrics fm=fontMetrics();
128 keyHeight = fm.lineSpacing() + 2; 128 keyHeight = fm.lineSpacing() + 2;
129 keyWidth = (double)width()/numCols; 129 keyWidth = (double)width()/numCols;
130 130
131} 131}
132 132
133QSize FunctionKeyboard::sizeHint() const { 133QSize FunctionKeyboard::sizeHint() const {
134 134
135 return QSize(width(), keyHeight * numRows + 1); 135 return QSize(width(), keyHeight * numRows + 1);
136} 136}
137 137
138void FunctionKeyboard::loadDefaults() { 138void FunctionKeyboard::loadDefaults() {
139 139
140 /* what keys should be default? */ 140 /* what keys should be default? */
141 keys.insert( "r0c0", FKey ("F1", 4144, 0)); 141 keys.insert( "r0c0", FKey ("F1", 4144, 0));
142 keys.insert( "r0c1", FKey ("F2", 4145, 0)); 142 keys.insert( "r0c1", FKey ("F2", 4145, 0));
143 keys.insert( "r0c2", FKey ("F3", 4145, 0)); 143 keys.insert( "r0c2", FKey ("F3", 4145, 0));
144 keys.insert( "r0c3", FKey ("F4", 4146, 0)); 144 keys.insert( "r0c3", FKey ("F4", 4146, 0));
145 keys.insert( "r0c4", FKey ("F5", 4147, 0)); 145 keys.insert( "r0c4", FKey ("F5", 4147, 0));
146 keys.insert( "r0c5", FKey ("F6", 4148, 0)); 146 keys.insert( "r0c5", FKey ("F6", 4148, 0));
147 keys.insert( "r0c6", FKey ("F7", 4149, 0)); 147 keys.insert( "r0c6", FKey ("F7", 4149, 0));
148 keys.insert( "r0c7", FKey ("F8", 4150, 0)); 148 keys.insert( "r0c7", FKey ("F8", 4150, 0));
149 keys.insert( "r0c8", FKey ("F9", 4151, 0)); 149 keys.insert( "r0c8", FKey ("F9", 4151, 0));
150 keys.insert( "r0c9", FKey ("F10", 4152, 0)); 150 keys.insert( "r0c9", FKey ("F10", 4152, 0));
151 keys.insert( "r0c10", FKey ("F11", 4153, 0)); 151 keys.insert( "r0c10", FKey ("F11", 4153, 0));
152 152
153 keys.insert( "r1c7", FKey ("Ho", 4112, 0)); 153 keys.insert( "r1c7", FKey ("Ho", 4112, 0));
154 keys.insert( "r1c8", FKey ("End", 4113, 0)); 154 keys.insert( "r1c8", FKey ("End", 4113, 0));
155 keys.insert( "r1c9", FKey ("PU", 4118, 0)); 155 keys.insert( "r1c9", FKey ("PU", 4118, 0));
156 keys.insert( "r1c10", FKey ("PD", 4119, 0)); 156 keys.insert( "r1c10", FKey ("PD", 4119, 0));
157 157
158} 158}
159 159
160 160
161FunctionKeyboardConfig::FunctionKeyboardConfig(const QString& name, QWidget* parent) : 161FunctionKeyboardConfig::FunctionKeyboardConfig(const QString& name, QWidget* parent) :
162 ProfileDialogKeyWidget(name, parent) { 162 ProfileDialogKeyWidget(name, parent) {
163 163
164 164
165 FunctionKeyboard *kb = new FunctionKeyboard(this); 165 FunctionKeyboard *kb = new FunctionKeyboard(this);
166 QGroupBox *dimentions = new QGroupBox(2, Qt::Horizontal, tr("Dimentions"), this); 166 QGroupBox *dimentions = new QGroupBox(2, Qt::Horizontal, tr("Dimentions"), this);
167 QGroupBox *editKey = new QGroupBox(2, Qt::Horizontal, tr("Edit"), this); 167 QGroupBox *editKey = new QGroupBox(2, Qt::Horizontal, tr("Edit"), this);
168 168
169 QVBoxLayout *root = new QVBoxLayout(this, 2); 169 QVBoxLayout *root = new QVBoxLayout(this, 2);
170 root->addWidget(kb); 170 root->addWidget(kb);
171 root->addWidget(dimentions); 171 root->addWidget(dimentions);
172 root->addWidget(editKey); 172 root->addWidget(editKey);
173} 173}
174FunctionKeyboardConfig::~FunctionKeyboardConfig() { 174FunctionKeyboardConfig::~FunctionKeyboardConfig() {
175 175
176} 176}
177void FunctionKeyboardConfig::load (const Profile& prof) { 177void FunctionKeyboardConfig::load (const Profile& ) {
178 178
179} 179}
180void FunctionKeyboardConfig::save (Profile& prof) { 180void FunctionKeyboardConfig::save (Profile& ) {
181 181
182} 182}
diff --git a/noncore/apps/opie-console/io_modem.cpp b/noncore/apps/opie-console/io_modem.cpp
index f246d81..d4ea0b2 100644
--- a/noncore/apps/opie-console/io_modem.cpp
+++ b/noncore/apps/opie-console/io_modem.cpp
@@ -56,34 +56,36 @@ void IOModem::reload( const Profile &config ) {
56 56
57 m_initString = config.readEntry("InitString", MODEM_DEFAULT_INIT_STRING ); 57 m_initString = config.readEntry("InitString", MODEM_DEFAULT_INIT_STRING );
58 m_resetString = config.readEntry("ResetString", MODEM_DEFAULT_RESET_STRING ); 58 m_resetString = config.readEntry("ResetString", MODEM_DEFAULT_RESET_STRING );
59 m_dialPref1 = config.readEntry("DialPrefix1", MODEM_DEFAULT_DIAL_PREFIX1 ); 59 m_dialPref1 = config.readEntry("DialPrefix1", MODEM_DEFAULT_DIAL_PREFIX1 );
60 m_dialSuf1 = config.readEntry("DialSuffix1", MODEM_DEFAULT_DIAL_SUFFIX1 ); 60 m_dialSuf1 = config.readEntry("DialSuffix1", MODEM_DEFAULT_DIAL_SUFFIX1 );
61 m_dialPref2 = config.readEntry("DialPrefix2", MODEM_DEFAULT_DIAL_PREFIX1 ); 61 m_dialPref2 = config.readEntry("DialPrefix2", MODEM_DEFAULT_DIAL_PREFIX1 );
62 m_dialSuf2 = config.readEntry("DialSuffix2", MODEM_DEFAULT_DIAL_SUFFIX1 ); 62 m_dialSuf2 = config.readEntry("DialSuffix2", MODEM_DEFAULT_DIAL_SUFFIX1 );
63 m_dialPref3 = config.readEntry("DialPrefix3", MODEM_DEFAULT_DIAL_PREFIX1 ); 63 m_dialPref3 = config.readEntry("DialPrefix3", MODEM_DEFAULT_DIAL_PREFIX1 );
64 m_dialSuf3 = config.readEntry("DialSuffix3", MODEM_DEFAULT_DIAL_SUFFIX1 ); 64 m_dialSuf3 = config.readEntry("DialSuffix3", MODEM_DEFAULT_DIAL_SUFFIX1 );
65 m_connect = config.readEntry("DefaultConnect" MODEM_DEFAULT_CONNECT_STRING ); 65 m_connect = config.readEntry("DefaultConnect" MODEM_DEFAULT_CONNECT_STRING );
66 m_hangup = config.readEntry("HangupString", MODEM_DEFAULT_HANGUP_STRING ); 66 m_hangup = config.readEntry("HangupString", MODEM_DEFAULT_HANGUP_STRING );
67 m_cancel = config.readEntry("CancelString", MODEM_DEFAULT_CANCEL_STRING ); 67 m_cancel = config.readEntry("CancelString", MODEM_DEFAULT_CANCEL_STRING );
68 m_dialTime = config.readNumEntry("DialTime", MODEM_DEFAULT_DIAL_TIME ); 68 m_dialTime = config.readNumEntry("DialTime", MODEM_DEFAULT_DIAL_TIME );
69 m_delayRedial = config.readNumEntry("DelayRedial", MODEM_DEFAULT_DELAY_REDIAL ); 69 m_delayRedial = config.readNumEntry("DelayRedial", MODEM_DEFAULT_DELAY_REDIAL );
70 m_numberTries = config.readNumEntry("NumberTries", MODEM_DEFAULT_NUMBER_TRIES ); 70 m_numberTries = config.readNumEntry("NumberTries", MODEM_DEFAULT_NUMBER_TRIES );
71 m_dtrDropTime = config.readNumEntry("DTRDRopTime", MODEM_DEFAULT_DTR_DROP_TIME ); 71 m_dtrDropTime = config.readNumEntry("DTRDRopTime", MODEM_DEFAULT_DTR_DROP_TIME );
72 m_bpsDetect = config.readBoolEntry("BPSDetect", MODEM_DEFAULT_BPS_DETECT ); 72 m_bpsDetect = config.readBoolEntry("BPSDetect", MODEM_DEFAULT_BPS_DETECT );
73 m_dcdLines = config.readBoolEntry("DCDLines", MODEM_DEFAULT_DCD_LINES ); 73 m_dcdLines = config.readBoolEntry("DCDLines", MODEM_DEFAULT_DCD_LINES );
74 m_multiLineUntag = config.readBoolEntry("MultiLineUntag", MODEM_DEFAULT_MULTI_LINE_UNTAG ); 74 m_multiLineUntag = config.readBoolEntry("MultiLineUntag", MODEM_DEFAULT_MULTI_LINE_UNTAG );
75} 75}
76 76
77 77
78QString IOModem::identifier() const { 78QString IOModem::identifier() const {
79 return "modem"; 79 return "modem";
80} 80}
81 81
82QString IOModem::name() const { 82QString IOModem::name() const {
83 return "Modem IO Layer"; 83 return "Modem IO Layer";
84} 84}
85 85
86void IOModem::slotExited(OProcess* proc ){ 86void IOModem::slotExited(OProcess* proc ){
87 close(); 87 close();
88 /* delete it afterwards */
89 delete proc;
88} 90}
89 91
diff --git a/noncore/apps/opie-console/iolayerbase.cpp b/noncore/apps/opie-console/iolayerbase.cpp
index b0df02d..47f9e76 100644
--- a/noncore/apps/opie-console/iolayerbase.cpp
+++ b/noncore/apps/opie-console/iolayerbase.cpp
@@ -78,90 +78,92 @@ IOLayerBase::IOLayerBase( QWidget* par, const char* name )
78}; 78};
79IOLayerBase::~IOLayerBase() { 79IOLayerBase::~IOLayerBase() {
80 80
81} 81}
82void IOLayerBase::setFlow( Flow flo ) { 82void IOLayerBase::setFlow( Flow flo ) {
83 switch ( flo ) { 83 switch ( flo ) {
84 case Software: 84 case Software:
85 m_flowSw->setChecked( true ); 85 m_flowSw->setChecked( true );
86 break; 86 break;
87 case Hardware: 87 case Hardware:
88 m_flowHw->setChecked( true ); 88 m_flowHw->setChecked( true );
89 break; 89 break;
90 case None: 90 case None:
91 m_flowNone->setChecked( true ); 91 m_flowNone->setChecked( true );
92 break; 92 break;
93 } 93 }
94} 94}
95 95
96void IOLayerBase::setParity( Parity par ) { 96void IOLayerBase::setParity( Parity par ) {
97 switch( par ) { 97 switch( par ) {
98 case NonePar: 98 case NonePar:
99 m_parityNone->setChecked( true ); 99 m_parityNone->setChecked( true );
100 break; 100 break;
101 case Odd: 101 case Odd:
102 m_parityOdd->setChecked( true ); 102 m_parityOdd->setChecked( true );
103 break; 103 break;
104 case Even: 104 case Even:
105 m_parityEven->setChecked( true ); 105 m_parityEven->setChecked( true );
106 break; 106 break;
107 } 107 }
108} 108}
109void IOLayerBase::setSpeed( Speed sp ) { 109void IOLayerBase::setSpeed( Speed sp ) {
110 int index; 110 int index = -1;
111 switch( sp ) { 111 switch( sp ) {
112 case Baud_115200: 112 case Baud_115200:
113 index = id_baud_115200; 113 index = id_baud_115200;
114 break; 114 break;
115 case Baud_57600: 115 case Baud_57600:
116 index = id_baud_57600; 116 index = id_baud_57600;
117 break; 117 break;
118 case Baud_38400: 118 case Baud_38400:
119 index = id_baud_38400; 119 index = id_baud_38400;
120 break; 120 break;
121 case Baud_19200: 121 case Baud_19200:
122 index = id_baud_19200; 122 index = id_baud_19200;
123 break; 123 break;
124 default:
124 case Baud_9600: 125 case Baud_9600:
125 index = id_baud_9600; 126 index = id_baud_9600;
126 break; 127 break;
127 } 128 }
128 m_speedBox->setCurrentItem(index ); 129 m_speedBox->setCurrentItem(index );
129} 130}
130IOLayerBase::Flow IOLayerBase::flow()const { 131IOLayerBase::Flow IOLayerBase::flow()const {
131 if (m_flowHw->isChecked() ) { 132 if (m_flowHw->isChecked() ) {
132 return Hardware; 133 return Hardware;
133 }else if( m_flowSw->isChecked() ) { 134 }else if( m_flowSw->isChecked() ) {
134 return Software; 135 return Software;
135 } else { 136 } else {
136 return None; 137 return None;
137 } 138 }
138} 139}
139IOLayerBase::Parity IOLayerBase::parity()const { 140IOLayerBase::Parity IOLayerBase::parity()const {
140 if ( m_parityOdd->isChecked() ) { 141 if ( m_parityOdd->isChecked() ) {
141 return Odd; 142 return Odd;
142 } else if ( m_parityEven->isChecked() ) { 143 } else if ( m_parityEven->isChecked() ) {
143 return Even; 144 return Even;
144 } else { 145 } else {
145 return NonePar; 146 return NonePar;
146 } 147 }
147 148
148} 149}
149IOLayerBase::Speed IOLayerBase::speed()const{ 150IOLayerBase::Speed IOLayerBase::speed()const{
150 switch( m_speedBox->currentItem() ) { 151 switch( m_speedBox->currentItem() ) {
151 case id_baud_115200: 152 case id_baud_115200:
152 return Baud_115200; 153 return Baud_115200;
153 break; 154 break;
154 case id_baud_57600: 155 case id_baud_57600:
155 return Baud_57600; 156 return Baud_57600;
156 break; 157 break;
157 case id_baud_38400: 158 case id_baud_38400:
158 return Baud_38400; 159 return Baud_38400;
159 break; 160 break;
160 case id_baud_19200: 161 case id_baud_19200:
161 return Baud_19200; 162 return Baud_19200;
162 break; 163 break;
164 default:
163 case id_baud_9600: 165 case id_baud_9600:
164 return Baud_9600; 166 return Baud_9600;
165 break; 167 break;
166 } 168 }
167} 169}
diff --git a/noncore/apps/opie-console/irdaconfigwidget.cpp b/noncore/apps/opie-console/irdaconfigwidget.cpp
index 72e99a1..059530d 100644
--- a/noncore/apps/opie-console/irdaconfigwidget.cpp
+++ b/noncore/apps/opie-console/irdaconfigwidget.cpp
@@ -1,43 +1,43 @@
1#include <qlabel.h> 1#include <qlabel.h>
2#include <qlayout.h> 2#include <qlayout.h>
3#include <qcombobox.h> 3#include <qcombobox.h>
4 4
5#include "iolayerbase.h" 5#include "iolayerbase.h"
6#include "irdaconfigwidget.h" 6#include "irdaconfigwidget.h"
7 7
8namespace { 8namespace {
9 void setCurrent( const QString& str, QComboBox* bo ) { 9 void setCurrent( const QString& str, QComboBox* bo ) {
10 uint b = bo->count(); 10 uint b = bo->count();
11 for (uint i = 0; i < bo->count(); i++ ) { 11 for (int i = 0; i < bo->count(); i++ ) {
12 if ( bo->text(i) == str ) { 12 if ( bo->text(i) == str ) {
13 bo->setCurrentItem( i ); 13 bo->setCurrentItem( i );
14 return; 14 return;
15 } 15 }
16 } 16 }
17 bo->insertItem( str ); 17 bo->insertItem( str );
18 bo->setCurrentItem( b ); 18 bo->setCurrentItem( b );
19 } 19 }
20 20
21 21
22} 22}
23 23
24IrdaConfigWidget::IrdaConfigWidget( const QString& name, 24IrdaConfigWidget::IrdaConfigWidget( const QString& name,
25 QWidget* parent, 25 QWidget* parent,
26 const char* na ) 26 const char* na )
27 : ProfileDialogConnectionWidget( name, parent, na ) { 27 : ProfileDialogConnectionWidget( name, parent, na ) {
28 28
29 m_lay = new QVBoxLayout(this ); 29 m_lay = new QVBoxLayout(this );
30 m_device = new QLabel(tr("Device"), this ); 30 m_device = new QLabel(tr("Device"), this );
31 m_deviceCmb = new QComboBox(this ); 31 m_deviceCmb = new QComboBox(this );
32 m_deviceCmb->setEditable( TRUE ); 32 m_deviceCmb->setEditable( TRUE );
33 33
34 m_base = new IOLayerBase(this, "base"); 34 m_base = new IOLayerBase(this, "base");
35 35
36 m_lay->addWidget( m_device ); 36 m_lay->addWidget( m_device );
37 m_lay->addWidget( m_deviceCmb ); 37 m_lay->addWidget( m_deviceCmb );
38 m_lay->addWidget( m_base ); 38 m_lay->addWidget( m_base );
39 39
40 m_deviceCmb->insertItem( "/dev/ircomm0" ); 40 m_deviceCmb->insertItem( "/dev/ircomm0" );
41 m_deviceCmb->insertItem( "/dev/ircomm1" ); 41 m_deviceCmb->insertItem( "/dev/ircomm1" );
42} 42}
43 43
@@ -66,81 +66,83 @@ void IrdaConfigWidget::load( const Profile& prof ) {
66 } 66 }
67 67
68 switch( speed ) { 68 switch( speed ) {
69 case 115200: 69 case 115200:
70 m_base->setSpeed(IOLayerBase::Baud_115200 ); 70 m_base->setSpeed(IOLayerBase::Baud_115200 );
71 break; 71 break;
72 case 57600: 72 case 57600:
73 m_base->setSpeed( IOLayerBase::Baud_57600 ); 73 m_base->setSpeed( IOLayerBase::Baud_57600 );
74 break; 74 break;
75 case 38400: 75 case 38400:
76 m_base->setSpeed(IOLayerBase::Baud_38400 ); 76 m_base->setSpeed(IOLayerBase::Baud_38400 );
77 break; 77 break;
78 case 19200: 78 case 19200:
79 m_base->setSpeed( IOLayerBase::Baud_19200 ); 79 m_base->setSpeed( IOLayerBase::Baud_19200 );
80 break; 80 break;
81 case 9600: 81 case 9600:
82 default: 82 default:
83 m_base->setSpeed(IOLayerBase::Baud_9600 ); 83 m_base->setSpeed(IOLayerBase::Baud_9600 );
84 break; 84 break;
85 } 85 }
86 86
87 if ( prof.readEntry("Device").isEmpty() ) return; 87 if ( prof.readEntry("Device").isEmpty() ) return;
88 setCurrent( prof.readEntry("Device"), m_deviceCmb ); 88 setCurrent( prof.readEntry("Device"), m_deviceCmb );
89 89
90} 90}
91/* 91/*
92 * save speed, 92 * save speed,
93 * flow, 93 * flow,
94 * parity 94 * parity
95 */ 95 */
96void IrdaConfigWidget::save( Profile& prof ) { 96void IrdaConfigWidget::save( Profile& prof ) {
97 int flow, parity, speed; 97 int flow, parity, speed;
98 flow = parity = speed = 0;
98 prof.writeEntry("Device", m_deviceCmb->currentText() ); 99 prof.writeEntry("Device", m_deviceCmb->currentText() );
99 100
100 switch( m_base->flow() ) { 101 switch( m_base->flow() ) {
101 case IOLayerBase::None: 102 case IOLayerBase::None:
102 flow = 0; 103 flow = 0;
103 break; 104 break;
104 case IOLayerBase::Software: 105 case IOLayerBase::Software:
105 flow = 2; 106 flow = 2;
106 break; 107 break;
107 case IOLayerBase::Hardware: 108 case IOLayerBase::Hardware:
108 flow = 1; 109 flow = 1;
109 break; 110 break;
110 } 111 }
111 112
112 113
113 switch( m_base->parity() ) { 114 switch( m_base->parity() ) {
114 case IOLayerBase::Odd: 115 case IOLayerBase::Odd:
115 parity = 2; 116 parity = 2;
116 break; 117 break;
117 case IOLayerBase::Even: 118 case IOLayerBase::Even:
118 parity = 1; 119 parity = 1;
119 break; 120 break;
120 case IOLayerBase::NonePar: 121 case IOLayerBase::NonePar:
121 parity = 0; 122 parity = 0;
122 break; 123 break;
123 } 124 }
124 125
125 switch( m_base->speed() ) { 126 switch( m_base->speed() ) {
126 case IOLayerBase::Baud_115200: 127 case IOLayerBase::Baud_115200:
127 speed = 115200; 128 speed = 115200;
128 break; 129 break;
129 case IOLayerBase::Baud_57600: 130 case IOLayerBase::Baud_57600:
130 speed = 57600; 131 speed = 57600;
131 break; 132 break;
132 case IOLayerBase::Baud_38400: 133 case IOLayerBase::Baud_38400:
133 speed = 38400; 134 speed = 38400;
134 break; 135 break;
135 case IOLayerBase::Baud_19200: 136 case IOLayerBase::Baud_19200:
136 speed = 19200; 137 speed = 19200;
137 break; 138 break;
139 default:
138 case IOLayerBase::Baud_9600: 140 case IOLayerBase::Baud_9600:
139 speed = 9600; 141 speed = 9600;
140 break; 142 break;
141 } 143 }
142 144
143 prof.writeEntry("Flow", flow); 145 prof.writeEntry("Flow", flow);
144 prof.writeEntry("Parity", parity); 146 prof.writeEntry("Parity", parity);
145 prof.writeEntry("Speed", speed); 147 prof.writeEntry("Speed", speed);
146} 148}
diff --git a/noncore/apps/opie-console/main.cpp b/noncore/apps/opie-console/main.cpp
index 78a91a2..7f9f038 100644
--- a/noncore/apps/opie-console/main.cpp
+++ b/noncore/apps/opie-console/main.cpp
@@ -62,52 +62,53 @@ s0:24:respawn:/sbin/getty 9600 ttyS0
62#pd:5:respawn:/etc/sync/serialctl 62#pd:5:respawn:/etc/sync/serialctl
63 63
64# Specify program to run on tty1 64# Specify program to run on tty1
651:2:respawn:/sbin/getty 9600 tty1 651:2:respawn:/sbin/getty 9600 tty1
66ln:345:respawn:survive -l 6 /sbin/launch 66ln:345:respawn:survive -l 6 /sbin/launch
67#qt:5:respawn:/sbin/qt 67#qt:5:respawn:/sbin/qt
68 68
69# collie sp. 69# collie sp.
70sy::respawn:/sbin/shsync\n"; 70sy::respawn:/sbin/shsync\n";
71 71
72 72
73} 73}
74FixIt::~FixIt() { 74FixIt::~FixIt() {
75} 75}
76/* 76/*
77 * the retail Zaurus is broken in many ways 77 * the retail Zaurus is broken in many ways
78 * one is that pppd is listening on our port... 78 * one is that pppd is listening on our port...
79 * we've to stop it from that and then do kill(SIGHUP,1); 79 * we've to stop it from that and then do kill(SIGHUP,1);
80 */ 80 */
81void FixIt::fixIt() { 81void FixIt::fixIt() {
82 ::rename("/etc/inittab", QPEApplication::qpeDir() + "/etc/inittab" ); 82 ::rename("/etc/inittab", QPEApplication::qpeDir() + "/etc/inittab" );
83 QFile file( "/etc/inittab" ); 83 QFile file( "/etc/inittab" );
84 if ( file.open(IO_WriteOnly | IO_Raw ) ) { 84 if ( file.open(IO_WriteOnly | IO_Raw ) ) {
85 file.writeBlock(m_file,strlen(m_file) ); 85 file.writeBlock(m_file,strlen(m_file) );
86 } 86 }
87 file.close(); 87 file.close();
88 ::kill( SIGHUP, 1 ); 88 ::kill( SIGHUP, 1 );
89} 89}
90#endif 90#endif
91 91
92 92
93int main(int argc, char **argv) { 93int main(int argc, char **argv) {
94 argv[0]="embeddedkonsole";
94 QPEApplication app( argc, argv ); 95 QPEApplication app( argc, argv );
95 96
96#ifdef FSCKED_DISTRIBUTION 97#ifdef FSCKED_DISTRIBUTION
97 qWarning("fscked"); 98 qWarning("fscked");
98 FixIt it; 99 FixIt it;
99 it.fixIt(); 100 it.fixIt();
100#endif 101#endif
101 102
102 MainWindow mw; 103 MainWindow mw;
103 mw.setCaption(QObject::tr("Opie console") ); 104 mw.setCaption(QObject::tr("Opie console") );
104 app.showMainWidget( &mw ); 105 app.showMainWidget( &mw );
105 106
106 int ap = app.exec(); 107 int ap = app.exec();
107 108
108#ifdef FSCKED_DISTRIBUTION 109#ifdef FSCKED_DISTRIBUTION
109 /* should add a signal handler too */ 110 /* should add a signal handler too */
110 it.breakIt(); 111 it.breakIt();
111#endif 112#endif
112 return ap; 113 return ap;
113} 114}
diff --git a/noncore/apps/opie-console/modemconfigwidget.cpp b/noncore/apps/opie-console/modemconfigwidget.cpp
index d3a23fa..c37fafd 100644
--- a/noncore/apps/opie-console/modemconfigwidget.cpp
+++ b/noncore/apps/opie-console/modemconfigwidget.cpp
@@ -1,47 +1,47 @@
1#include <qlabel.h> 1#include <qlabel.h>
2#include <qlayout.h> 2#include <qlayout.h>
3#include <qcombobox.h> 3#include <qcombobox.h>
4#include <qlineedit.h> 4#include <qlineedit.h>
5#include <qpushbutton.h> 5#include <qpushbutton.h>
6#include <qhbox.h> 6#include <qhbox.h>
7#include <qregexp.h> 7#include <qregexp.h>
8 8
9#include "modemconfigwidget.h" 9#include "modemconfigwidget.h"
10#include "dialdialog.h" 10#include "dialdialog.h"
11 11
12namespace { 12namespace {
13 void setCurrent( const QString& str, QComboBox* bo ) { 13 void setCurrent( const QString& str, QComboBox* bo ) {
14 uint b = bo->count(); 14 uint b = bo->count();
15 for (uint i = 0; i < bo->count(); i++ ) { 15 for (int i = 0; i < bo->count(); i++ ) {
16 if ( bo->text(i) == str ) { 16 if ( bo->text(i) == str ) {
17 bo->setCurrentItem( i ); 17 bo->setCurrentItem( i );
18 return; 18 return;
19 } 19 }
20 } 20 }
21 bo->insertItem( str ); 21 bo->insertItem( str );
22 bo->setCurrentItem( b ); 22 bo->setCurrentItem( b );
23 } 23 }
24} 24}
25 25
26ModemConfigWidget::ModemConfigWidget( const QString& name, QWidget* parent, 26ModemConfigWidget::ModemConfigWidget( const QString& name, QWidget* parent,
27 const char* na ) 27 const char* na )
28 : ProfileDialogConnectionWidget( name, parent, na ) { 28 : ProfileDialogConnectionWidget( name, parent, na ) {
29 29
30 m_lay = new QVBoxLayout( this ); 30 m_lay = new QVBoxLayout( this );
31 m_device = new QLabel(tr( "Modem is attached to:" ), this ); 31 m_device = new QLabel(tr( "Modem is attached to:" ), this );
32 m_deviceCmb = new QComboBox(this ); 32 m_deviceCmb = new QComboBox(this );
33 m_deviceCmb->setEditable( TRUE ); 33 m_deviceCmb->setEditable( TRUE );
34 34
35 QLabel* telLabel = new QLabel( this ); 35 QLabel* telLabel = new QLabel( this );
36 telLabel->setText( tr( "Enter telefon number here:" ) ); 36 telLabel->setText( tr( "Enter telefon number here:" ) );
37 m_telNumber = new QLineEdit( this ); 37 m_telNumber = new QLineEdit( this );
38 QHBox *buttonBox = new QHBox( this ); 38 QHBox *buttonBox = new QHBox( this );
39 QPushButton *atButton = new QPushButton( buttonBox ); 39 QPushButton *atButton = new QPushButton( buttonBox );
40 atButton->setText( tr( "AT commands" ) ); 40 atButton->setText( tr( "AT commands" ) );
41 connect( atButton, SIGNAL( clicked() ), this, SLOT( slotAT() ) ); 41 connect( atButton, SIGNAL( clicked() ), this, SLOT( slotAT() ) );
42 42
43 QPushButton *dialButton = new QPushButton( buttonBox ); 43 QPushButton *dialButton = new QPushButton( buttonBox );
44 dialButton->setText( tr( "Enter number" ) ); 44 dialButton->setText( tr( "Enter number" ) );
45 connect( dialButton, SIGNAL( clicked() ), this, SLOT( slotDial() ) ); 45 connect( dialButton, SIGNAL( clicked() ), this, SLOT( slotDial() ) );
46 46
47 47
@@ -97,64 +97,65 @@ void ModemConfigWidget::load( const Profile& prof ) {
97 m_base->setSpeed( IOLayerBase::Baud_115200 ); 97 m_base->setSpeed( IOLayerBase::Baud_115200 );
98 break; 98 break;
99 case 57600: 99 case 57600:
100 m_base->setSpeed( IOLayerBase::Baud_57600 ); 100 m_base->setSpeed( IOLayerBase::Baud_57600 );
101 break; 101 break;
102 case 38400: 102 case 38400:
103 m_base->setSpeed( IOLayerBase::Baud_38400 ); 103 m_base->setSpeed( IOLayerBase::Baud_38400 );
104 break; 104 break;
105 case 19200: 105 case 19200:
106 m_base->setSpeed( IOLayerBase::Baud_19200 ); 106 m_base->setSpeed( IOLayerBase::Baud_19200 );
107 break; 107 break;
108 case 9600: 108 case 9600:
109 default: 109 default:
110 m_base->setSpeed( IOLayerBase::Baud_9600 ); 110 m_base->setSpeed( IOLayerBase::Baud_9600 );
111 break; 111 break;
112 } 112 }
113 113
114 if ( prof.readEntry( "Device" ).isEmpty() ) { 114 if ( prof.readEntry( "Device" ).isEmpty() ) {
115 return; 115 return;
116 } 116 }
117 setCurrent( prof.readEntry( "Device" ), m_deviceCmb ); 117 setCurrent( prof.readEntry( "Device" ), m_deviceCmb );
118 118
119 atConf->readConfig( prof ); 119 atConf->readConfig( prof );
120} 120}
121 121
122/* 122/*
123 * save speed, 123 * save speed,
124 * flow, 124 * flow,
125 * parity 125 * parity
126 */ 126 */
127void ModemConfigWidget::save( Profile& prof ) { 127void ModemConfigWidget::save( Profile& prof ) {
128 int flow, parity, speed; 128 int flow, parity, speed;
129 flow = parity = speed = 0;
129 prof.writeEntry( "Device", m_deviceCmb->currentText() ); 130 prof.writeEntry( "Device", m_deviceCmb->currentText() );
130 131
131 132
132 switch( m_base->flow() ) { 133 switch( m_base->flow() ) {
133 case IOLayerBase::None: 134 case IOLayerBase::None:
134 flow = 0; 135 flow = 0;
135 break; 136 break;
136 case IOLayerBase::Software: 137 case IOLayerBase::Software:
137 flow = 2; 138 flow = 2;
138 break; 139 break;
139 case IOLayerBase::Hardware: 140 case IOLayerBase::Hardware:
140 flow = 1; 141 flow = 1;
141 break; 142 break;
142 } 143 }
143 144
144 switch( m_base->parity() ) { 145 switch( m_base->parity() ) {
145 case IOLayerBase::Odd: 146 case IOLayerBase::Odd:
146 parity = 2; 147 parity = 2;
147 break; 148 break;
148 case IOLayerBase::Even: 149 case IOLayerBase::Even:
149 parity = 1; 150 parity = 1;
150 break; 151 break;
151 case IOLayerBase::NonePar: 152 case IOLayerBase::NonePar:
152 parity = 0; 153 parity = 0;
153 break; 154 break;
154 } 155 }
155 156
156 switch( m_base->speed() ) { 157 switch( m_base->speed() ) {
157 case IOLayerBase::Baud_115200: 158 case IOLayerBase::Baud_115200:
158 speed = 115200; 159 speed = 115200;
159 break; 160 break;
160 case IOLayerBase::Baud_57600: 161 case IOLayerBase::Baud_57600:
diff --git a/noncore/apps/opie-console/procctl.cpp b/noncore/apps/opie-console/procctl.cpp
index ff6bea8..a44529b 100644
--- a/noncore/apps/opie-console/procctl.cpp
+++ b/noncore/apps/opie-console/procctl.cpp
@@ -1,51 +1,52 @@
1#include <sys/wait.h> 1#include <sys/wait.h>
2 2
3#include <fcntl.h> 3#include <fcntl.h>
4#include <unistd.h> 4#include <unistd.h>
5 5
6#include "procctl.h" 6#include "procctl.h"
7 7
8ProcContainer *ProcCtl::m_last = 0; 8ProcContainer *ProcCtl::m_last = 0;
9ProcCtl* ProcCtl::m_self = 0; 9ProcCtl* ProcCtl::m_self = 0;
10 10
11ProcCtl::ProcCtl() { 11ProcCtl::ProcCtl() {
12 signal( SIGCHLD, signal_handler ); 12 signal( SIGCHLD, signal_handler );
13} 13}
14ProcCtl::~ProcCtl() { 14ProcCtl::~ProcCtl() {
15} 15}
16ProcCtl* ProcCtl::self() { 16ProcCtl* ProcCtl::self() {
17 if (!m_self ) { 17 if (!m_self ) {
18 m_self = new ProcCtl; 18 m_self = new ProcCtl;
19 } 19 }
20 return m_self;
20} 21}
21void ProcCtl::add(pid_t pi, int fd ) { 22void ProcCtl::add(pid_t pi, int fd ) {
22 ProcContainer * con = new ProcContainer; 23 ProcContainer * con = new ProcContainer;
23 //memset(con, 0, sizeof(con) ); 24 //memset(con, 0, sizeof(con) );
24 con->pid = pi; 25 con->pid = pi;
25 con->fd = fd; 26 con->fd = fd;
26 con->status = 0; 27 con->status = 0;
27 con->prev = m_last; 28 con->prev = m_last;
28 29
29 m_last = con; 30 m_last = con;
30 31
31} 32}
32void ProcCtl::remove( pid_t pi ) { 33void ProcCtl::remove( pid_t pi ) {
33 /* 34 /*
34 * We first check if the last item 35 * We first check if the last item
35 * is equal to pi the we 36 * is equal to pi the we
36 * 37 *
37 */ 38 */
38 ProcContainer* con; 39 ProcContainer* con;
39 if (m_last->pid == pi ) { 40 if (m_last->pid == pi ) {
40 con = m_last; 41 con = m_last;
41 m_last = con->prev; 42 m_last = con->prev;
42 delete con; 43 delete con;
43 return; 44 return;
44 } 45 }
45 46
46 con = m_last; 47 con = m_last;
47 ProcContainer* forw = 0l; 48 ProcContainer* forw = 0l;
48 while (con ) { 49 while (con ) {
49 /* remove it */ 50 /* remove it */
50 if ( pi == con->pid ) { 51 if ( pi == con->pid ) {
51 forw->prev = con->prev; 52 forw->prev = con->prev;
diff --git a/noncore/apps/opie-console/profileeditordialog.cpp b/noncore/apps/opie-console/profileeditordialog.cpp
index 413e80b..1765d42 100644
--- a/noncore/apps/opie-console/profileeditordialog.cpp
+++ b/noncore/apps/opie-console/profileeditordialog.cpp
@@ -63,65 +63,65 @@ void ProfileEditorDialog::initUI()
63 m_tabTerm = new QWidget(this); 63 m_tabTerm = new QWidget(this);
64 m_tabCon = new QWidget(this); 64 m_tabCon = new QWidget(this);
65 m_tabKey = new QWidget(this); 65 m_tabKey = new QWidget(this);
66 66
67 /* base layout for tabs */ 67 /* base layout for tabs */
68 m_layCon = new QHBoxLayout( m_tabCon , 2 ); 68 m_layCon = new QHBoxLayout( m_tabCon , 2 );
69 m_layTerm = new QHBoxLayout( m_tabTerm, 2 ); 69 m_layTerm = new QHBoxLayout( m_tabTerm, 2 );
70 m_layKey = new QHBoxLayout( m_tabKey, 2 ); 70 m_layKey = new QHBoxLayout( m_tabKey, 2 );
71 71
72 // profile tab 72 // profile tab
73 73
74 QLabel *name = new QLabel(QObject::tr("Profile name"), tabprof); 74 QLabel *name = new QLabel(QObject::tr("Profile name"), tabprof);
75 m_name = new QLineEdit(tabprof); 75 m_name = new QLineEdit(tabprof);
76 QLabel *con = new QLabel(tr("Connection"), tabprof ); 76 QLabel *con = new QLabel(tr("Connection"), tabprof );
77 QLabel *term = new QLabel(tr("Terminal"), tabprof ); 77 QLabel *term = new QLabel(tr("Terminal"), tabprof );
78 m_conCmb = new QComboBox( tabprof ); 78 m_conCmb = new QComboBox( tabprof );
79 m_termCmb = new QComboBox( tabprof ); 79 m_termCmb = new QComboBox( tabprof );
80 m_autoConnect = new QCheckBox(tr("Auto connect after load"), tabprof); 80 m_autoConnect = new QCheckBox(tr("Auto connect after load"), tabprof);
81 81
82 // layouting 82 // layouting
83 QVBoxLayout *vbox3 = new QVBoxLayout(tabprof, 2); 83 QVBoxLayout *vbox3 = new QVBoxLayout(tabprof, 2);
84 vbox3->add(name); 84 vbox3->add(name);
85 vbox3->add(m_name); 85 vbox3->add(m_name);
86 vbox3->add(con ); 86 vbox3->add(con );
87 vbox3->add(m_conCmb ); 87 vbox3->add(m_conCmb );
88 vbox3->add(term ); 88 vbox3->add(term );
89 vbox3->add(m_termCmb ); 89 vbox3->add(m_termCmb );
90 vbox3->add(m_autoConnect); 90 vbox3->add(m_autoConnect);
91 vbox3->addStretch(1); 91 vbox3->addStretch(1);
92 92
93 m_showconntab = 0; 93 m_showconntab = 0;
94 tabWidget->addTab(tabprof, "", QObject::tr("Profile")); 94 tabWidget->addTab(tabprof, "", QObject::tr("Profile"));
95 //tabWidget->addTab(m_tabCon, "", QObject::tr("Connection")); 95 tabWidget->addTab(m_tabCon, "", QObject::tr("Connection"));
96 tabWidget->addTab(m_tabTerm, "", QObject::tr("Terminal")); 96 tabWidget->addTab(m_tabTerm, "", QObject::tr("Terminal"));
97 tabWidget->addTab(m_tabKey, "", QObject::tr("Special Keys")); 97 tabWidget->addTab(m_tabKey, "", QObject::tr("Special Keys"));
98 tabWidget->setCurrentTab( tabprof ); 98 tabWidget->setCurrentTab( tabprof );
99 99
100 100
101 // fill the comboboxes 101 // fill the comboboxes
102 QStringList list = m_fact->connectionWidgets(); 102 QStringList list = m_fact->connectionWidgets();
103 QStringList::Iterator it; 103 QStringList::Iterator it;
104 for (it =list.begin(); it != list.end(); ++it ) { 104 for (it =list.begin(); it != list.end(); ++it ) {
105 m_conCmb->insertItem( (*it) ); 105 m_conCmb->insertItem( (*it) );
106 } 106 }
107 list = m_fact->terminalWidgets(); 107 list = m_fact->terminalWidgets();
108 for (it =list.begin(); it != list.end(); ++it ) { 108 for (it =list.begin(); it != list.end(); ++it ) {
109 m_termCmb->insertItem( (*it) ); 109 m_termCmb->insertItem( (*it) );
110 } 110 }
111 111
112 // load profile values 112 // load profile values
113 m_name->setText(m_prof.name()); 113 m_name->setText(m_prof.name());
114 slotConActivated( m_fact->external(m_prof.ioLayerName() ) ); 114 slotConActivated( m_fact->external(m_prof.ioLayerName() ) );
115 slotTermActivated( m_fact->external(m_prof.terminalName() ) ); 115 slotTermActivated( m_fact->external(m_prof.terminalName() ) );
116 slotKeyActivated( "Default Keyboard" ); 116 slotKeyActivated( "Default Keyboard" );
117 setCurrent( m_fact->external(m_prof.ioLayerName() ), m_conCmb ); 117 setCurrent( m_fact->external(m_prof.ioLayerName() ), m_conCmb );
118 setCurrent( m_fact->external(m_prof.terminalName() ), m_termCmb ); 118 setCurrent( m_fact->external(m_prof.terminalName() ), m_termCmb );
119 m_autoConnect->setChecked(m_prof.autoConnect()); 119 m_autoConnect->setChecked(m_prof.autoConnect());
120 120
121 121
122 // signal and slots 122 // signal and slots
123 connect(m_conCmb, SIGNAL(activated(const QString& ) ), 123 connect(m_conCmb, SIGNAL(activated(const QString& ) ),
124 this, SLOT(slotConActivated(const QString&) ) ); 124 this, SLOT(slotConActivated(const QString&) ) );
125 connect(m_termCmb, SIGNAL(activated(const QString& ) ), 125 connect(m_termCmb, SIGNAL(activated(const QString& ) ),
126 this, SLOT(slotTermActivated(const QString& ) ) ); 126 this, SLOT(slotTermActivated(const QString& ) ) );
127 127
@@ -156,60 +156,59 @@ void ProfileEditorDialog::accept()
156 m_key->save( m_prof ); 156 m_key->save( m_prof );
157 157
158 QDialog::accept(); 158 QDialog::accept();
159} 159}
160 160
161 161
162QString ProfileEditorDialog::profName()const 162QString ProfileEditorDialog::profName()const
163{ 163{
164 return m_name->text(); 164 return m_name->text();
165} 165}
166 166
167QCString ProfileEditorDialog::profType()const 167QCString ProfileEditorDialog::profType()const
168{ 168{
169 /*QStringList w = m_fact->configWidgets(); 169 /*QStringList w = m_fact->configWidgets();
170 for(QStringList::Iterator it = w.begin(); it != w.end(); it++) 170 for(QStringList::Iterator it = w.begin(); it != w.end(); it++)
171 if(device_box->currentText() == m_fact->name((*it))) return (*it); 171 if(device_box->currentText() == m_fact->name((*it))) return (*it);
172 */ 172 */
173 return QCString(); 173 return QCString();
174} 174}
175/* 175/*
176 * we need to switch the widget 176 * we need to switch the widget
177 */ 177 */
178void ProfileEditorDialog::slotConActivated( const QString& str ) { 178void ProfileEditorDialog::slotConActivated( const QString& str ) {
179 delete m_con; 179 delete m_con;
180 m_con = m_fact->newConnectionPlugin( str, m_tabCon ); 180 m_con = m_fact->newConnectionPlugin( str, m_tabCon );
181 181
182 if ( !m_con ) { 182 if ( !m_con ) {
183 m_con = new NoOptions( str, m_tabCon, "name"); 183 m_con = new NoOptions( str, m_tabCon, "name");
184 } 184 }
185 m_con->load( m_prof ); 185 m_con->load( m_prof );
186 m_layCon->addWidget( m_con ); 186 m_layCon->addWidget( m_con );
187 187
188 tabWidget->addTab( m_tabCon, "", QObject::tr("Connection") );
189 tabWidget->setCurrentTab( tabprof ); 188 tabWidget->setCurrentTab( tabprof );
190 189
191} 190}
192/* 191/*
193 * we need to switch the widget 192 * we need to switch the widget
194 */ 193 */
195void ProfileEditorDialog::slotTermActivated( const QString& str ) { 194void ProfileEditorDialog::slotTermActivated( const QString& str ) {
196 delete m_term; 195 delete m_term;
197 m_term = m_fact->newTerminalPlugin( str, m_tabTerm ); 196 m_term = m_fact->newTerminalPlugin( str, m_tabTerm );
198 197
199 if (m_term) { 198 if (m_term) {
200 m_term->load(m_prof ); 199 m_term->load(m_prof );
201 m_layTerm->addWidget( m_term ); 200 m_layTerm->addWidget( m_term );
202 } 201 }
203} 202}
204 203
205void ProfileEditorDialog::slotKeyActivated(const QString &str) { 204void ProfileEditorDialog::slotKeyActivated(const QString &str) {
206 delete m_key; 205 delete m_key;
207 m_key = m_fact->newKeyboardPlugin( str, m_tabKey ); 206 m_key = m_fact->newKeyboardPlugin( str, m_tabKey );
208 207
209 if (m_key) { 208 if (m_key) {
210 209
211 m_key->load(m_prof); 210 m_key->load(m_prof);
212 m_layKey->addWidget(m_key); 211 m_layKey->addWidget(m_key);
213 } 212 }
214 213
215} 214}
diff --git a/noncore/apps/opie-console/serialconfigwidget.cpp b/noncore/apps/opie-console/serialconfigwidget.cpp
index bd0312a..5c6d975 100644
--- a/noncore/apps/opie-console/serialconfigwidget.cpp
+++ b/noncore/apps/opie-console/serialconfigwidget.cpp
@@ -1,43 +1,43 @@
1#include <qlabel.h> 1#include <qlabel.h>
2#include <qlayout.h> 2#include <qlayout.h>
3#include <qcombobox.h> 3#include <qcombobox.h>
4 4
5#include "iolayerbase.h" 5#include "iolayerbase.h"
6#include "serialconfigwidget.h" 6#include "serialconfigwidget.h"
7 7
8namespace { 8namespace {
9 void setCurrent( const QString& str, QComboBox* bo ) { 9 void setCurrent( const QString& str, QComboBox* bo ) {
10 uint b = bo->count(); 10 uint b = bo->count();
11 for (uint i = 0; i < bo->count(); i++ ) { 11 for (int i = 0; i < bo->count(); i++ ) {
12 if ( bo->text(i) == str ) { 12 if ( bo->text(i) == str ) {
13 bo->setCurrentItem( i ); 13 bo->setCurrentItem( i );
14 return; 14 return;
15 } 15 }
16 } 16 }
17 bo->insertItem( str ); 17 bo->insertItem( str );
18 bo->setCurrentItem( b ); 18 bo->setCurrentItem( b );
19 } 19 }
20 20
21 21
22} 22}
23 23
24SerialConfigWidget::SerialConfigWidget( const QString& name, 24SerialConfigWidget::SerialConfigWidget( const QString& name,
25 QWidget* parent, 25 QWidget* parent,
26 const char* na ) 26 const char* na )
27 : ProfileDialogConnectionWidget( name, parent, na ) { 27 : ProfileDialogConnectionWidget( name, parent, na ) {
28 28
29 m_lay = new QVBoxLayout(this ); 29 m_lay = new QVBoxLayout(this );
30 m_device = new QLabel(tr("Device"), this ); 30 m_device = new QLabel(tr("Device"), this );
31 m_deviceCmb = new QComboBox(this ); 31 m_deviceCmb = new QComboBox(this );
32 m_deviceCmb->setEditable( TRUE ); 32 m_deviceCmb->setEditable( TRUE );
33 33
34 m_base = new IOLayerBase(this, "base"); 34 m_base = new IOLayerBase(this, "base");
35 35
36 m_lay->addWidget( m_device ); 36 m_lay->addWidget( m_device );
37 m_lay->addWidget( m_deviceCmb ); 37 m_lay->addWidget( m_deviceCmb );
38 m_lay->addWidget( m_base ); 38 m_lay->addWidget( m_base );
39 39
40 m_deviceCmb->insertItem( "/dev/ttyS0" ); 40 m_deviceCmb->insertItem( "/dev/ttyS0" );
41 m_deviceCmb->insertItem( "/dev/ttyS1" ); 41 m_deviceCmb->insertItem( "/dev/ttyS1" );
42 m_deviceCmb->insertItem( "/dev/ttySA0"); 42 m_deviceCmb->insertItem( "/dev/ttySA0");
43 m_deviceCmb->insertItem( "/dev/ttySA1"); 43 m_deviceCmb->insertItem( "/dev/ttySA1");
diff --git a/noncore/apps/opie-console/transferdialog.cpp b/noncore/apps/opie-console/transferdialog.cpp
index f89723c..75c4c72 100644
--- a/noncore/apps/opie-console/transferdialog.cpp
+++ b/noncore/apps/opie-console/transferdialog.cpp
@@ -1,52 +1,52 @@
1#include <qlayout.h> 1#include <qlayout.h>
2#include <qcombobox.h> 2#include <qcombobox.h>
3#include <qlabel.h> 3#include <qlabel.h>
4#include <qlineedit.h> 4#include <qlineedit.h>
5#include <qpushbutton.h> 5#include <qpushbutton.h>
6#include <qmessagebox.h> 6#include <qmessagebox.h>
7#include <qprogressbar.h> 7#include <qprogressbar.h>
8#include <qradiobutton.h> 8#include <qradiobutton.h>
9#include <qbuttongroup.h> 9#include <qbuttongroup.h>
10 10
11#include <opie/ofiledialog.h> 11#include <opie/ofiledialog.h>
12 12
13#include "file_layer.h" 13#include "file_layer.h"
14#include "receive_layer.h" 14#include "receive_layer.h"
15#include "metafactory.h" 15#include "metafactory.h"
16#include "mainwindow.h" 16#include "mainwindow.h"
17 17
18#include "transferdialog.h" 18#include "transferdialog.h"
19 19
20TransferDialog::TransferDialog(QWidget *parent, MainWindow *mainwindow, const char *name) 20TransferDialog::TransferDialog(QWidget *parent, MainWindow *mainwindow, const char *)
21: QDialog(parent, 0l, true), m_win(mainwindow) 21: QDialog(parent, 0l, true), m_win(mainwindow)
22{ 22{
23 m_lay = 0l; 23 m_lay = 0l;
24 m_recvlay = 0l; 24 m_recvlay = 0l;
25 QVBoxLayout *vbox, *vbox2; 25 QVBoxLayout *vbox, *vbox2;
26 QHBoxLayout *hbox, *hbox2, *hbox3; 26 QHBoxLayout *hbox, *hbox2, *hbox3;
27 QLabel *file, *mode, *progress, *status; 27 QLabel *file, *mode, *progress, *status;
28 QButtonGroup *group; 28 QButtonGroup *group;
29 QRadioButton *mode_send, *mode_receive; 29 QRadioButton *mode_send, *mode_receive;
30 30
31 m_autocleanup = 0; 31 m_autocleanup = 0;
32 32
33 group = new QButtonGroup(QObject::tr("Transfer mode"), this); 33 group = new QButtonGroup(QObject::tr("Transfer mode"), this);
34 mode_send = new QRadioButton(QObject::tr("Send"), group); 34 mode_send = new QRadioButton(QObject::tr("Send"), group);
35 mode_receive = new QRadioButton(QObject::tr("Receive"), group); 35 mode_receive = new QRadioButton(QObject::tr("Receive"), group);
36 group->insert(mode_send, id_send); 36 group->insert(mode_send, id_send);
37 group->insert(mode_receive, id_receive); 37 group->insert(mode_receive, id_receive);
38 vbox2 = new QVBoxLayout(group, 2); 38 vbox2 = new QVBoxLayout(group, 2);
39 vbox2->addSpacing(10); 39 vbox2->addSpacing(10);
40 hbox3 = new QHBoxLayout(vbox2, 2); 40 hbox3 = new QHBoxLayout(vbox2, 2);
41 hbox3->add(mode_send); 41 hbox3->add(mode_send);
42 hbox3->add(mode_receive); 42 hbox3->add(mode_receive);
43 mode_send->setChecked(true); 43 mode_send->setChecked(true);
44 m_transfermode = id_send; 44 m_transfermode = id_send;
45 45
46 file = new QLabel(QObject::tr("Send file"), this); 46 file = new QLabel(QObject::tr("Send file"), this);
47 mode = new QLabel(QObject::tr("Transfer protocol"), this); 47 mode = new QLabel(QObject::tr("Transfer protocol"), this);
48 progress = new QLabel(QObject::tr("Progress"), this); 48 progress = new QLabel(QObject::tr("Progress"), this);
49 status = new QLabel(QObject::tr("Status"), this); 49 status = new QLabel(QObject::tr("Status"), this);
50 50
51 statusbar = new QLabel(QObject::tr("Ready"), this); 51 statusbar = new QLabel(QObject::tr("Ready"), this);
52 statusbar->setFrameStyle(QFrame::Panel | QFrame::Sunken); 52 statusbar->setFrameStyle(QFrame::Panel | QFrame::Sunken);
@@ -152,115 +152,115 @@ void TransferDialog::cleanup()
152 m_lay = 0l; 152 m_lay = 0l;
153 } 153 }
154 if(m_recvlay) 154 if(m_recvlay)
155 { 155 {
156 m_recvlay->cancel(); 156 m_recvlay->cancel();
157 delete m_recvlay; 157 delete m_recvlay;
158 m_recvlay = 0l; 158 m_recvlay = 0l;
159 } 159 }
160} 160}
161 161
162void TransferDialog::slotCancel() 162void TransferDialog::slotCancel()
163{ 163{
164 ok->setEnabled(true); 164 ok->setEnabled(true);
165 statusbar->setText(QObject::tr("Ready")); 165 statusbar->setText(QObject::tr("Ready"));
166 166
167 if((m_lay) || (m_recvlay)) 167 if((m_lay) || (m_recvlay))
168 { 168 {
169 cleanup(); 169 cleanup();
170 if(m_autocleanup) close(); 170 if(m_autocleanup) close();
171 else 171 else
172 { 172 {
173 QMessageBox::information(this, 173 QMessageBox::information(this,
174 QObject::tr("Cancelled"), 174 QObject::tr("Cancelled"),
175 QObject::tr("The file transfer has been cancelled.")); 175 QObject::tr("The file transfer has been cancelled."));
176 } 176 }
177 } 177 }
178 else 178 else
179 { 179 {
180 close(); 180 close();
181 } 181 }
182} 182}
183 183
184void TransferDialog::slotProgress(const QString& file, int progress, int speed, int hours, int minutes, int seconds) 184void TransferDialog::slotProgress(const QString& , int progress, int , int , int, int )
185{ 185{
186 progressbar->setProgress(progress); 186 progressbar->setProgress(progress);
187} 187}
188 188
189void TransferDialog::slotError(int error, const QString& message) 189void TransferDialog::slotError(int error, const QString& )
190{ 190{
191 statusbar->setText(QObject::tr("Ready")); 191 statusbar->setText(QObject::tr("Ready"));
192 192
193 switch(error) 193 switch(error)
194 { 194 {
195 case FileTransferLayer::NotSupported: 195 case FileTransferLayer::NotSupported:
196 QMessageBox::critical(this, 196 QMessageBox::critical(this,
197 QObject::tr("Error"), 197 QObject::tr("Error"),
198 QObject::tr("Operation not supported.")); 198 QObject::tr("Operation not supported."));
199 break; 199 break;
200 case FileTransferLayer::StartError: 200 case FileTransferLayer::StartError:
201 QMessageBox::critical(this, 201 QMessageBox::critical(this,
202 QObject::tr("Error"), 202 QObject::tr("Error"),
203 QObject::tr("Transfer could not be started.")); 203 QObject::tr("Transfer could not be started."));
204 break; 204 break;
205 case FileTransferLayer::NoError: 205 case FileTransferLayer::NoError:
206 QMessageBox::critical(this, 206 QMessageBox::critical(this,
207 QObject::tr("Error"), 207 QObject::tr("Error"),
208 QObject::tr("No error.")); 208 QObject::tr("No error."));
209 break; 209 break;
210 case FileTransferLayer::Undefined: 210 case FileTransferLayer::Undefined:
211 QMessageBox::critical(this, 211 QMessageBox::critical(this,
212 QObject::tr("Error"), 212 QObject::tr("Error"),
213 QObject::tr("Undefined error occured.")); 213 QObject::tr("Undefined error occured."));
214 break; 214 break;
215 case FileTransferLayer::Incomplete: 215 case FileTransferLayer::Incomplete:
216 QMessageBox::critical(this, 216 QMessageBox::critical(this,
217 QObject::tr("Error"), 217 QObject::tr("Error"),
218 QObject::tr("Incomplete transfer.")); 218 QObject::tr("Incomplete transfer."));
219 break; 219 break;
220 case FileTransferLayer::Unknown: 220 case FileTransferLayer::Unknown:
221 default: 221 default:
222 QMessageBox::critical(this, 222 QMessageBox::critical(this,
223 QObject::tr("Error"), 223 QObject::tr("Error"),
224 QObject::tr("Unknown error occured.")); 224 QObject::tr("Unknown error occured."));
225 break; 225 break;
226 } 226 }
227 227
228 m_autocleanup = 1; 228 m_autocleanup = 1;
229} 229}
230 230
231void TransferDialog::slotSent() 231void TransferDialog::slotSent()
232{ 232{
233 progressbar->setProgress(100); 233 progressbar->setProgress(100);
234 QMessageBox::information(this, QObject::tr("Sent"), QObject::tr("File has been sent.")); 234 QMessageBox::information(this, QObject::tr("Sent"), QObject::tr("File has been sent."));
235 ok->setEnabled(true); 235 ok->setEnabled(true);
236 progressbar->setProgress(0); 236 progressbar->setProgress(0);
237 statusbar->setText(QObject::tr("Ready")); 237 statusbar->setText(QObject::tr("Ready"));
238 m_autocleanup = 1; 238 m_autocleanup = 1;
239} 239}
240 240
241void TransferDialog::slotReceived(const QString& file) 241void TransferDialog::slotReceived(const QString& )
242{ 242{
243 progressbar->setProgress(100); 243 progressbar->setProgress(100);
244 QMessageBox::information(this, QObject::tr("Received"), QObject::tr("File has been received.")); 244 QMessageBox::information(this, QObject::tr("Received"), QObject::tr("File has been received."));
245 //QMessageBox::information(this, QObject::tr("Sent"), QObject::tr("File has been received as %1.").arg(file)); 245 //QMessageBox::information(this, QObject::tr("Sent"), QObject::tr("File has been received as %1.").arg(file));
246 ok->setEnabled(true); 246 ok->setEnabled(true);
247 progressbar->setProgress(0); 247 progressbar->setProgress(0);
248 statusbar->setText(QObject::tr("Ready")); 248 statusbar->setText(QObject::tr("Ready"));
249 m_autocleanup = 1; 249 m_autocleanup = 1;
250} 250}
251 251
252void TransferDialog::slotMode(int id) 252void TransferDialog::slotMode(int id)
253{ 253{
254 if(id == id_send) 254 if(id == id_send)
255 { 255 {
256 selector->setEnabled(true); 256 selector->setEnabled(true);
257 filename->setEnabled(true); 257 filename->setEnabled(true);
258 } 258 }
259 else 259 else
260 { 260 {
261 selector->setEnabled(false); 261 selector->setEnabled(false);
262 filename->setEnabled(false); 262 filename->setEnabled(false);
263 } 263 }
264 m_transfermode = id; 264 m_transfermode = id;
265} 265}
266 266