summaryrefslogtreecommitdiff
Side-by-side diff
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 @@
Ok we all know we write perfect code
but sometimes the compiler produces bad code
and we need to work around some compiler bugs!! -zecke
MyPty is broken in some ways
if you do connect/disconnect/connect sh will be executed in the
process of opie-console.... funny aye?
OTabWidget seems to give us problems too
+
+Send/receive: lrzsz behaves strange when trying to use
+--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 @@
#include <qlayout.h>
#include <qlabel.h>
#include <qcombobox.h>
#include <qscrollview.h>
#include <qpushbutton.h>
#include <qfont.h>
#include <qbuttongroup.h>
#include "dialdialog.h"
DialDialog::DialDialog( QWidget* parent, const char* name, bool modal, WFlags fl )
: QDialog( parent, name, modal, fl ) {
- m_number = 0;
-
setCaption( tr( "Enter number" ) );
QVBoxLayout *mainLayout = new QVBoxLayout( this );
QLabel *textLabel = new QLabel( this );
textLabel->setText( tr("Enter the number you want to dial. When finished, press ok") );
- LCD = new QLCDNumber( this, "LCD" );
- QFont LCD_font( LCD->font() );
- LCD_font.setPointSize( 7 );
- LCD->setFont( LCD_font );
- LCD->setNumDigits( 25 );
- LCD->setSegmentStyle( QLCDNumber::Flat );
- LCD->setMaximumHeight( 30 );
+ LCD1 = new QLCDNumber( this, "LCD" );
+ QFont LCD_font1( LCD1->font() );
+ LCD_font1.setPointSize( 7 );
+ LCD1->setFont( LCD_font1 );
+ LCD1->setNumDigits( 8 );
+ LCD1->setSegmentStyle( QLCDNumber::Flat );
+ LCD1->setMaximumHeight( 30 );
+
+ LCD2 = new QLCDNumber( this, "LCD" );
+ QFont LCD_font2( LCD2->font() );
+ LCD_font2.setPointSize( 7 );
+ LCD2->setFont( LCD_font2 );
+ LCD2->setNumDigits( 8 );
+ LCD2->setSegmentStyle( QLCDNumber::Flat );
+ LCD2->setMaximumHeight( 30 );
QGridLayout *layout = new QGridLayout( this , 4, 3 );
QButtonGroup *dialButtons = new QButtonGroup( );
QPushButton *number0 = new QPushButton( this );
number0->setText( QString( "0" ) );
QFont number0_font( number0->font() );
number0_font.setBold( TRUE );
number0->setFont( number0_font );
layout->addWidget( number0, 4, 1 );
dialButtons->insert( number0 );
int x = 0, y = 0;
for ( int i = 0 ; i < 9; i++ ) {
QPushButton *number = new QPushButton( this );
number->setText( QString( "%1" ).arg( i + 1 ) );
QFont number_font( number->font() );
number_font.setBold( TRUE );
number->setFont( number_font );
dialButtons->insert( number );
layout->addWidget( number, x, y );
if ( y < 2 ) {
y++;
} else {
x++;
y = 0;
}
}
connect( dialButtons, SIGNAL( clicked( int ) ), this, SLOT( slotEnterNumber( int ) ) );
mainLayout->addStretch( 0 );
mainLayout->addWidget( textLabel );
- mainLayout->addWidget( LCD );
+ QHBoxLayout *lcdLayout = new QHBoxLayout(mainLayout);
+ lcdLayout->addWidget( LCD1 );
+ lcdLayout->addWidget( LCD2 );
mainLayout->addStretch( 0 );
mainLayout->addLayout( layout );
mainLayout->addStretch( 0 );
-
-
}
void DialDialog::slotEnterNumber( int number ) {
// pretty stupid, just for testing .-)
- m_number = ( m_number * 10 ) + number;
- qDebug( QString("%1").arg( m_number ) );
- LCD->display( m_number );
+ m_number.append(QString("%1").arg(number));
+ setNumber(m_number);
}
DialDialog::~DialDialog() {
}
QString DialDialog::number() {
- return QString( "%1").arg( m_number );
+ return m_number;
}
-void DialDialog::setNumber( int number )
+void DialDialog::setNumber( QString number )
{
- m_number = number;
- LCD->display( m_number );
+ QString n1;
+ if(number.length() > 8) n1 = number.left(number.length() - 8);
+ QString n2 = number.right(8);
+ LCD1->display( n1.toInt() );
+ LCD2->display( n2.toInt() );
}
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 @@
#ifndef DIALDIALOG_H
#define DIALDIALOG_H
#include <qdialog.h>
#include <qstring.h>
#include <qlcdnumber.h>
class DialDialog : public QDialog {
Q_OBJECT
public:
DialDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
~DialDialog();
QString number();
- void setNumber( int );
+ void setNumber( QString number );
private:
- float m_number;
- QLCDNumber *LCD;
+ QString m_number;
+ QLCDNumber *LCD1, *LCD2;
private slots:
void slotEnterNumber( int );
};
#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 @@
#include <qlabel.h>
#include <qlayout.h>
#include <qcombobox.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qhbox.h>
#include <qregexp.h>
#include "modemconfigwidget.h"
#include "dialdialog.h"
namespace {
void setCurrent( const QString& str, QComboBox* bo ) {
uint b = bo->count();
for (uint i = 0; i < bo->count(); i++ ) {
if ( bo->text(i) == str ) {
bo->setCurrentItem( i );
return;
}
}
bo->insertItem( str );
bo->setCurrentItem( b );
}
}
ModemConfigWidget::ModemConfigWidget( const QString& name, QWidget* parent,
const char* na )
: ProfileDialogConnectionWidget( name, parent, na ) {
m_lay = new QVBoxLayout( this );
m_device = new QLabel(tr( "Modem is attached to:" ), this );
m_deviceCmb = new QComboBox(this );
m_deviceCmb->setEditable( TRUE );
QLabel* telLabel = new QLabel( this );
telLabel->setText( tr( "Enter telefon number here:" ) );
m_telNumber = new QLineEdit( this );
QHBox *buttonBox = new QHBox( this );
QPushButton *atButton = new QPushButton( buttonBox );
atButton->setText( tr( "AT commands" ) );
connect( atButton, SIGNAL( clicked() ), this, SLOT( slotAT() ) );
QPushButton *dialButton = new QPushButton( buttonBox );
dialButton->setText( tr( "Enter number" ) );
connect( dialButton, SIGNAL( clicked() ), this, SLOT( slotDial() ) );
m_base = new IOLayerBase( this, "base" );
m_lay->addWidget( m_device );
m_lay->addWidget( m_deviceCmb );
m_lay->addWidget( telLabel );
m_lay->addWidget( m_telNumber );
m_lay->addWidget( buttonBox );
m_lay->addWidget( m_base );
m_deviceCmb->insertItem( "/dev/ttyS0" );
m_deviceCmb->insertItem( "/dev/ttyS1" );
m_deviceCmb->insertItem( "/dev/ttyS2" );
atConf = new ATConfigDialog( this, "ATConfig", true );
}
ModemConfigWidget::~ModemConfigWidget() {
}
void ModemConfigWidget::load( const Profile& prof ) {
int rad_flow = prof.readNumEntry( "Flow" );
int rad_parity = prof.readNumEntry( "Parity" );
int speed = prof.readNumEntry( "Speed" );
QString number = prof.readEntry( "Number" );
if ( !number.isEmpty() ) {
m_telNumber->setText( number );
}
if ( rad_flow == 1 ) {
m_base->setFlow( IOLayerBase::Hardware );
} else if (rad_flow == 2) {
m_base->setFlow( IOLayerBase::Software );
} else if (rad_flow == 0) {
m_base->setFlow( IOLayerBase::None );
}
if ( rad_parity == 1 ) {
m_base->setParity( IOLayerBase::Even );
} else if ( rad_parity == 2 ){
m_base->setParity( IOLayerBase::Odd );
} else {
m_base->setParity( IOLayerBase::NonePar );
}
switch( speed ) {
case 115200:
m_base->setSpeed( IOLayerBase::Baud_115200 );
break;
case 57600:
m_base->setSpeed( IOLayerBase::Baud_57600 );
break;
case 38400:
m_base->setSpeed( IOLayerBase::Baud_38400 );
break;
case 19200:
m_base->setSpeed( IOLayerBase::Baud_19200 );
break;
case 9600:
default:
m_base->setSpeed( IOLayerBase::Baud_9600 );
break;
}
if ( prof.readEntry( "Device" ).isEmpty() ) {
return;
}
setCurrent( prof.readEntry( "Device" ), m_deviceCmb );
atConf->readConfig( prof );
}
/*
* save speed,
* flow,
* parity
*/
void ModemConfigWidget::save( Profile& prof ) {
int flow, parity, speed;
prof.writeEntry( "Device", m_deviceCmb->currentText() );
switch( m_base->flow() ) {
case IOLayerBase::None:
flow = 0;
break;
case IOLayerBase::Software:
flow = 2;
break;
case IOLayerBase::Hardware:
flow = 1;
break;
}
switch( m_base->parity() ) {
case IOLayerBase::Odd:
parity = 2;
break;
case IOLayerBase::Even:
parity = 1;
break;
case IOLayerBase::NonePar:
parity = 0;
break;
}
switch( m_base->speed() ) {
case IOLayerBase::Baud_115200:
speed = 115200;
break;
case IOLayerBase::Baud_57600:
speed = 57600;
break;
case IOLayerBase::Baud_38400:
speed = 38400;
break;
case IOLayerBase::Baud_19200:
speed = 19200;
break;
case IOLayerBase::Baud_9600:
speed = 9600;
break;
}
prof.writeEntry( "Flow", flow );
prof.writeEntry( "Parity", parity );
prof.writeEntry( "Speed", speed );
prof.writeEntry( "Number", m_telNumber->text() );
atConf->writeConfig(prof);
}
void ModemConfigWidget::slotAT() {
// ATConfigDialog conf( this, "ATConfig", true );
atConf->showMaximized();
if ( atConf->exec() != QDialog::Accepted ) {
// reload old settings
}
}
void ModemConfigWidget::slotDial() {
DialDialog dial( this, "DialConfig", true );
if(!m_telNumber->text().isEmpty()) {
- dial.setNumber(m_telNumber->text().replace(QRegExp("[\\-\\/\\ ]"), "").toInt());
+ dial.setNumber(m_telNumber->text().replace(QRegExp("[\\-\\/\\ \\.\\,]"), ""));
}
dial.showMaximized();
if ( dial.exec() == QDialog::Accepted ) {
m_telNumber->setText( dial.number() );
}
}