summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/BUGS3
-rw-r--r--noncore/apps/opie-console/dialdialog.cpp46
-rw-r--r--noncore/apps/opie-console/dialdialog.h6
-rw-r--r--noncore/apps/opie-console/modemconfigwidget.cpp2
4 files changed, 34 insertions, 23 deletions
diff --git a/noncore/apps/opie-console/BUGS b/noncore/apps/opie-console/BUGS
index ffaceef..496e28a 100644
--- a/noncore/apps/opie-console/BUGS
+++ b/noncore/apps/opie-console/BUGS
@@ -1,9 +1,12 @@
1Ok we all know we write perfect code 1Ok we all know we write perfect code
2but sometimes the compiler produces bad code 2but sometimes the compiler produces bad code
3and we need to work around some compiler bugs!! -zecke 3and we need to work around some compiler bugs!! -zecke
4 4
5MyPty is broken in some ways 5MyPty is broken in some ways
6 if you do connect/disconnect/connect sh will be executed in the 6 if you do connect/disconnect/connect sh will be executed in the
7 process of opie-console.... funny aye? 7 process of opie-console.... funny aye?
8 8
9OTabWidget seems to give us problems too 9OTabWidget seems to give us problems too
10
11Send/receive: lrzsz behaves strange when trying to use
12--overwrite or --rename.
diff --git a/noncore/apps/opie-console/dialdialog.cpp b/noncore/apps/opie-console/dialdialog.cpp
index 0ace8f7..0d115bc 100644
--- a/noncore/apps/opie-console/dialdialog.cpp
+++ b/noncore/apps/opie-console/dialdialog.cpp
@@ -1,103 +1,111 @@
1 1
2 2
3#include <qlayout.h> 3#include <qlayout.h>
4#include <qlabel.h> 4#include <qlabel.h>
5#include <qcombobox.h> 5#include <qcombobox.h>
6#include <qscrollview.h> 6#include <qscrollview.h>
7#include <qpushbutton.h> 7#include <qpushbutton.h>
8#include <qfont.h> 8#include <qfont.h>
9#include <qbuttongroup.h> 9#include <qbuttongroup.h>
10 10
11#include "dialdialog.h" 11#include "dialdialog.h"
12 12
13 13
14 14
15DialDialog::DialDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) 15DialDialog::DialDialog( QWidget* parent, const char* name, bool modal, WFlags fl )
16 : QDialog( parent, name, modal, fl ) { 16 : QDialog( parent, name, modal, fl ) {
17 17
18 m_number = 0;
19
20 setCaption( tr( "Enter number" ) ); 18 setCaption( tr( "Enter number" ) );
21 19
22 QVBoxLayout *mainLayout = new QVBoxLayout( this ); 20 QVBoxLayout *mainLayout = new QVBoxLayout( this );
23 21
24 QLabel *textLabel = new QLabel( this ); 22 QLabel *textLabel = new QLabel( this );
25 textLabel->setText( tr("Enter the number you want to dial. When finished, press ok") ); 23 textLabel->setText( tr("Enter the number you want to dial. When finished, press ok") );
26 24
27 LCD = new QLCDNumber( this, "LCD" ); 25 LCD1 = new QLCDNumber( this, "LCD" );
28 QFont LCD_font( LCD->font() ); 26 QFont LCD_font1( LCD1->font() );
29 LCD_font.setPointSize( 7 ); 27 LCD_font1.setPointSize( 7 );
30 LCD->setFont( LCD_font ); 28 LCD1->setFont( LCD_font1 );
31 LCD->setNumDigits( 25 ); 29 LCD1->setNumDigits( 8 );
32 LCD->setSegmentStyle( QLCDNumber::Flat ); 30 LCD1->setSegmentStyle( QLCDNumber::Flat );
33 LCD->setMaximumHeight( 30 ); 31 LCD1->setMaximumHeight( 30 );
32
33 LCD2 = new QLCDNumber( this, "LCD" );
34 QFont LCD_font2( LCD2->font() );
35 LCD_font2.setPointSize( 7 );
36 LCD2->setFont( LCD_font2 );
37 LCD2->setNumDigits( 8 );
38 LCD2->setSegmentStyle( QLCDNumber::Flat );
39 LCD2->setMaximumHeight( 30 );
34 40
35 QGridLayout *layout = new QGridLayout( this , 4, 3 ); 41 QGridLayout *layout = new QGridLayout( this , 4, 3 );
36 42
37 QButtonGroup *dialButtons = new QButtonGroup( ); 43 QButtonGroup *dialButtons = new QButtonGroup( );
38 44
39 QPushButton *number0 = new QPushButton( this ); 45 QPushButton *number0 = new QPushButton( this );
40 number0->setText( QString( "0" ) ); 46 number0->setText( QString( "0" ) );
41 QFont number0_font( number0->font() ); 47 QFont number0_font( number0->font() );
42 number0_font.setBold( TRUE ); 48 number0_font.setBold( TRUE );
43 number0->setFont( number0_font ); 49 number0->setFont( number0_font );
44 layout->addWidget( number0, 4, 1 ); 50 layout->addWidget( number0, 4, 1 );
45 dialButtons->insert( number0 ); 51 dialButtons->insert( number0 );
46 52
47 int x = 0, y = 0; 53 int x = 0, y = 0;
48 for ( int i = 0 ; i < 9; i++ ) { 54 for ( int i = 0 ; i < 9; i++ ) {
49 QPushButton *number = new QPushButton( this ); 55 QPushButton *number = new QPushButton( this );
50 number->setText( QString( "%1" ).arg( i + 1 ) ); 56 number->setText( QString( "%1" ).arg( i + 1 ) );
51 QFont number_font( number->font() ); 57 QFont number_font( number->font() );
52 number_font.setBold( TRUE ); 58 number_font.setBold( TRUE );
53 number->setFont( number_font ); 59 number->setFont( number_font );
54 60
55 dialButtons->insert( number ); 61 dialButtons->insert( number );
56 62
57 layout->addWidget( number, x, y ); 63 layout->addWidget( number, x, y );
58 64
59 if ( y < 2 ) { 65 if ( y < 2 ) {
60 y++; 66 y++;
61 } else { 67 } else {
62 x++; 68 x++;
63 y = 0; 69 y = 0;
64 } 70 }
65 } 71 }
66 72
67 connect( dialButtons, SIGNAL( clicked( int ) ), this, SLOT( slotEnterNumber( int ) ) ); 73 connect( dialButtons, SIGNAL( clicked( int ) ), this, SLOT( slotEnterNumber( int ) ) );
68 74
69 mainLayout->addStretch( 0 ); 75 mainLayout->addStretch( 0 );
70 mainLayout->addWidget( textLabel ); 76 mainLayout->addWidget( textLabel );
71 mainLayout->addWidget( LCD ); 77 QHBoxLayout *lcdLayout = new QHBoxLayout(mainLayout);
78 lcdLayout->addWidget( LCD1 );
79 lcdLayout->addWidget( LCD2 );
72 mainLayout->addStretch( 0 ); 80 mainLayout->addStretch( 0 );
73 mainLayout->addLayout( layout ); 81 mainLayout->addLayout( layout );
74 mainLayout->addStretch( 0 ); 82 mainLayout->addStretch( 0 );
75
76
77} 83}
78 84
79 85
80void DialDialog::slotEnterNumber( int number ) { 86void DialDialog::slotEnterNumber( int number ) {
81 87
82 // pretty stupid, just for testing .-) 88 // pretty stupid, just for testing .-)
83 89
84 m_number = ( m_number * 10 ) + number; 90 m_number.append(QString("%1").arg(number));
85 qDebug( QString("%1").arg( m_number ) );
86 LCD->display( m_number );
87 91
92 setNumber(m_number);
88} 93}
89 94
90DialDialog::~DialDialog() { 95DialDialog::~DialDialog() {
91} 96}
92 97
93QString DialDialog::number() { 98QString DialDialog::number() {
94 return QString( "%1").arg( m_number ); 99 return m_number;
95 100
96} 101}
97 102
98void DialDialog::setNumber( int number ) 103void DialDialog::setNumber( QString number )
99{ 104{
100 m_number = number; 105 QString n1;
101 LCD->display( m_number ); 106 if(number.length() > 8) n1 = number.left(number.length() - 8);
107 QString n2 = number.right(8);
108 LCD1->display( n1.toInt() );
109 LCD2->display( n2.toInt() );
102} 110}
103 111
diff --git a/noncore/apps/opie-console/dialdialog.h b/noncore/apps/opie-console/dialdialog.h
index bec7b81..4a74b66 100644
--- a/noncore/apps/opie-console/dialdialog.h
+++ b/noncore/apps/opie-console/dialdialog.h
@@ -1,31 +1,31 @@
1 1
2#ifndef DIALDIALOG_H 2#ifndef DIALDIALOG_H
3#define DIALDIALOG_H 3#define DIALDIALOG_H
4 4
5#include <qdialog.h> 5#include <qdialog.h>
6#include <qstring.h> 6#include <qstring.h>
7#include <qlcdnumber.h> 7#include <qlcdnumber.h>
8 8
9class DialDialog : public QDialog { 9class DialDialog : public QDialog {
10 10
11 Q_OBJECT 11 Q_OBJECT
12 12
13public: 13public:
14 DialDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); 14 DialDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
15 15
16 ~DialDialog(); 16 ~DialDialog();
17 17
18 QString number(); 18 QString number();
19 19
20 void setNumber( int ); 20 void setNumber( QString number );
21 21
22private: 22private:
23 float m_number; 23 QString m_number;
24 QLCDNumber *LCD; 24 QLCDNumber *LCD1, *LCD2;
25 25
26private slots: 26private slots:
27 void slotEnterNumber( int ); 27 void slotEnterNumber( int );
28}; 28};
29 29
30 30
31#endif 31#endif
diff --git a/noncore/apps/opie-console/modemconfigwidget.cpp b/noncore/apps/opie-console/modemconfigwidget.cpp
index c0ab0fc..d3a23fa 100644
--- a/noncore/apps/opie-console/modemconfigwidget.cpp
+++ b/noncore/apps/opie-console/modemconfigwidget.cpp
@@ -1,200 +1,200 @@
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 (uint 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
48 m_base = new IOLayerBase( this, "base" ); 48 m_base = new IOLayerBase( this, "base" );
49 49
50 m_lay->addWidget( m_device ); 50 m_lay->addWidget( m_device );
51 m_lay->addWidget( m_deviceCmb ); 51 m_lay->addWidget( m_deviceCmb );
52 m_lay->addWidget( telLabel ); 52 m_lay->addWidget( telLabel );
53 m_lay->addWidget( m_telNumber ); 53 m_lay->addWidget( m_telNumber );
54 m_lay->addWidget( buttonBox ); 54 m_lay->addWidget( buttonBox );
55 m_lay->addWidget( m_base ); 55 m_lay->addWidget( m_base );
56 56
57 m_deviceCmb->insertItem( "/dev/ttyS0" ); 57 m_deviceCmb->insertItem( "/dev/ttyS0" );
58 m_deviceCmb->insertItem( "/dev/ttyS1" ); 58 m_deviceCmb->insertItem( "/dev/ttyS1" );
59 m_deviceCmb->insertItem( "/dev/ttyS2" ); 59 m_deviceCmb->insertItem( "/dev/ttyS2" );
60 60
61 atConf = new ATConfigDialog( this, "ATConfig", true ); 61 atConf = new ATConfigDialog( this, "ATConfig", true );
62} 62}
63 63
64ModemConfigWidget::~ModemConfigWidget() { 64ModemConfigWidget::~ModemConfigWidget() {
65 65
66} 66}
67void ModemConfigWidget::load( const Profile& prof ) { 67void ModemConfigWidget::load( const Profile& prof ) {
68 68
69 int rad_flow = prof.readNumEntry( "Flow" ); 69 int rad_flow = prof.readNumEntry( "Flow" );
70 int rad_parity = prof.readNumEntry( "Parity" ); 70 int rad_parity = prof.readNumEntry( "Parity" );
71 int speed = prof.readNumEntry( "Speed" ); 71 int speed = prof.readNumEntry( "Speed" );
72 QString number = prof.readEntry( "Number" ); 72 QString number = prof.readEntry( "Number" );
73 73
74 if ( !number.isEmpty() ) { 74 if ( !number.isEmpty() ) {
75 m_telNumber->setText( number ); 75 m_telNumber->setText( number );
76 } 76 }
77 77
78 if ( rad_flow == 1 ) { 78 if ( rad_flow == 1 ) {
79 m_base->setFlow( IOLayerBase::Hardware ); 79 m_base->setFlow( IOLayerBase::Hardware );
80 } else if (rad_flow == 2) { 80 } else if (rad_flow == 2) {
81 m_base->setFlow( IOLayerBase::Software ); 81 m_base->setFlow( IOLayerBase::Software );
82 } else if (rad_flow == 0) { 82 } else if (rad_flow == 0) {
83 m_base->setFlow( IOLayerBase::None ); 83 m_base->setFlow( IOLayerBase::None );
84 } 84 }
85 85
86 86
87 if ( rad_parity == 1 ) { 87 if ( rad_parity == 1 ) {
88 m_base->setParity( IOLayerBase::Even ); 88 m_base->setParity( IOLayerBase::Even );
89 } else if ( rad_parity == 2 ){ 89 } else if ( rad_parity == 2 ){
90 m_base->setParity( IOLayerBase::Odd ); 90 m_base->setParity( IOLayerBase::Odd );
91 } else { 91 } else {
92 m_base->setParity( IOLayerBase::NonePar ); 92 m_base->setParity( IOLayerBase::NonePar );
93 } 93 }
94 94
95 switch( speed ) { 95 switch( speed ) {
96 case 115200: 96 case 115200:
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 prof.writeEntry( "Device", m_deviceCmb->currentText() ); 129 prof.writeEntry( "Device", m_deviceCmb->currentText() );
130 130
131 131
132 switch( m_base->flow() ) { 132 switch( m_base->flow() ) {
133 case IOLayerBase::None: 133 case IOLayerBase::None:
134 flow = 0; 134 flow = 0;
135 break; 135 break;
136 case IOLayerBase::Software: 136 case IOLayerBase::Software:
137 flow = 2; 137 flow = 2;
138 break; 138 break;
139 case IOLayerBase::Hardware: 139 case IOLayerBase::Hardware:
140 flow = 1; 140 flow = 1;
141 break; 141 break;
142 } 142 }
143 143
144 switch( m_base->parity() ) { 144 switch( m_base->parity() ) {
145 case IOLayerBase::Odd: 145 case IOLayerBase::Odd:
146 parity = 2; 146 parity = 2;
147 break; 147 break;
148 case IOLayerBase::Even: 148 case IOLayerBase::Even:
149 parity = 1; 149 parity = 1;
150 break; 150 break;
151 case IOLayerBase::NonePar: 151 case IOLayerBase::NonePar:
152 parity = 0; 152 parity = 0;
153 break; 153 break;
154 } 154 }
155 155
156 switch( m_base->speed() ) { 156 switch( m_base->speed() ) {
157 case IOLayerBase::Baud_115200: 157 case IOLayerBase::Baud_115200:
158 speed = 115200; 158 speed = 115200;
159 break; 159 break;
160 case IOLayerBase::Baud_57600: 160 case IOLayerBase::Baud_57600:
161 speed = 57600; 161 speed = 57600;
162 break; 162 break;
163 case IOLayerBase::Baud_38400: 163 case IOLayerBase::Baud_38400:
164 speed = 38400; 164 speed = 38400;
165 break; 165 break;
166 case IOLayerBase::Baud_19200: 166 case IOLayerBase::Baud_19200:
167 speed = 19200; 167 speed = 19200;
168 break; 168 break;
169 case IOLayerBase::Baud_9600: 169 case IOLayerBase::Baud_9600:
170 speed = 9600; 170 speed = 9600;
171 break; 171 break;
172 } 172 }
173 173
174 prof.writeEntry( "Flow", flow ); 174 prof.writeEntry( "Flow", flow );
175 prof.writeEntry( "Parity", parity ); 175 prof.writeEntry( "Parity", parity );
176 prof.writeEntry( "Speed", speed ); 176 prof.writeEntry( "Speed", speed );
177 prof.writeEntry( "Number", m_telNumber->text() ); 177 prof.writeEntry( "Number", m_telNumber->text() );
178 178
179 179
180 atConf->writeConfig(prof); 180 atConf->writeConfig(prof);
181} 181}
182 182
183void ModemConfigWidget::slotAT() { 183void ModemConfigWidget::slotAT() {
184 // ATConfigDialog conf( this, "ATConfig", true ); 184 // ATConfigDialog conf( this, "ATConfig", true );
185 atConf->showMaximized(); 185 atConf->showMaximized();
186 if ( atConf->exec() != QDialog::Accepted ) { 186 if ( atConf->exec() != QDialog::Accepted ) {
187 // reload old settings 187 // reload old settings
188 } 188 }
189} 189}
190 190
191void ModemConfigWidget::slotDial() { 191void ModemConfigWidget::slotDial() {
192 DialDialog dial( this, "DialConfig", true ); 192 DialDialog dial( this, "DialConfig", true );
193 if(!m_telNumber->text().isEmpty()) { 193 if(!m_telNumber->text().isEmpty()) {
194 dial.setNumber(m_telNumber->text().replace(QRegExp("[\\-\\/\\ ]"), "").toInt()); 194 dial.setNumber(m_telNumber->text().replace(QRegExp("[\\-\\/\\ \\.\\,]"), ""));
195 } 195 }
196 dial.showMaximized(); 196 dial.showMaximized();
197 if ( dial.exec() == QDialog::Accepted ) { 197 if ( dial.exec() == QDialog::Accepted ) {
198 m_telNumber->setText( dial.number() ); 198 m_telNumber->setText( dial.number() );
199 } 199 }
200} 200}