-rw-r--r-- | noncore/apps/opie-console/btconfigwidget.cpp | 4 | ||||
-rw-r--r-- | noncore/apps/opie-console/dialdialog.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/opie-console/emulation_handler.cpp | 8 | ||||
-rw-r--r-- | noncore/apps/opie-console/emulation_layer.cpp | 24 | ||||
-rw-r--r-- | noncore/apps/opie-console/function_keyboard.cpp | 10 | ||||
-rw-r--r-- | noncore/apps/opie-console/io_bt.cpp | 4 | ||||
-rw-r--r-- | noncore/apps/opie-console/io_irda.cpp | 4 | ||||
-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 8 | ||||
-rw-r--r-- | noncore/apps/opie-console/profileeditordialog.cpp | 6 | ||||
-rw-r--r-- | noncore/apps/opie-console/session.cpp | 4 | ||||
-rw-r--r-- | noncore/apps/opie-console/sz_transfer.cpp | 18 | ||||
-rw-r--r-- | noncore/apps/opie-console/test/senderui.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/opie-console/transferdialog.cpp | 12 |
13 files changed, 53 insertions, 53 deletions
diff --git a/noncore/apps/opie-console/btconfigwidget.cpp b/noncore/apps/opie-console/btconfigwidget.cpp index 64046d8..0ac337f 100644 --- a/noncore/apps/opie-console/btconfigwidget.cpp +++ b/noncore/apps/opie-console/btconfigwidget.cpp | |||
@@ -1,139 +1,139 @@ | |||
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 | ||
11 | namespace { | 11 | namespace { |
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 (int 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 | ||
25 | BTConfigWidget::BTConfigWidget( const QString& name, | 25 | BTConfigWidget::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"); |
47 | 47 | ||
48 | m_lay->addWidget( m_device ); | 48 | m_lay->addWidget( m_device ); |
49 | m_lay->addWidget( deviceBox ); | 49 | m_lay->addWidget( deviceBox ); |
50 | m_lay->addWidget( macLabel ); | 50 | m_lay->addWidget( macLabel ); |
51 | m_lay->addWidget( macBox ); | 51 | m_lay->addWidget( macBox ); |
52 | m_lay->addWidget( m_base ); | 52 | m_lay->addWidget( m_base ); |
53 | 53 | ||
54 | m_deviceCmb->insertItem( "/dev/ttyU0" ); | 54 | m_deviceCmb->insertItem( "/dev/ttyU0" ); |
55 | m_deviceCmb->insertItem( "/dev/ttyU1" ); | 55 | m_deviceCmb->insertItem( "/dev/ttyU1" ); |
56 | } | 56 | } |
57 | 57 | ||
58 | BTConfigWidget::~BTConfigWidget() { | 58 | BTConfigWidget::~BTConfigWidget() { |
59 | 59 | ||
60 | } | 60 | } |
61 | void BTConfigWidget::load( const Profile& prof ) { | 61 | void BTConfigWidget::load( const Profile& prof ) { |
62 | int rad_flow = prof.readNumEntry("Flow"); | 62 | int rad_flow = prof.readNumEntry("Flow"); |
63 | int rad_parity = prof.readNumEntry("Parity"); | 63 | int rad_parity = prof.readNumEntry("Parity"); |
64 | int speed = prof.readNumEntry("Speed"); | 64 | int speed = prof.readNumEntry("Speed"); |
65 | QString mac = prof.readEntry("Mac"); | 65 | QString mac = prof.readEntry("Mac"); |
66 | 66 | ||
67 | if (!mac.isEmpty() ) { | 67 | if (!mac.isEmpty() ) { |
68 | m_mac->setText( mac ); | 68 | m_mac->setText( mac ); |
69 | } else { | 69 | } else { |
70 | m_devRadio->setChecked( true ); | 70 | m_devRadio->setChecked( true ); |
71 | } | 71 | } |
72 | 72 | ||
73 | if (rad_flow == 1) { | 73 | if (rad_flow == 1) { |
74 | m_base->setFlow( IOLayerBase::Hardware ); | 74 | m_base->setFlow( IOLayerBase::Hardware ); |
75 | } else if (rad_flow == 2) { | 75 | } else if (rad_flow == 2) { |
76 | m_base->setFlow( IOLayerBase::Software ); | 76 | m_base->setFlow( IOLayerBase::Software ); |
77 | } else if (rad_flow == 0) { | 77 | } else if (rad_flow == 0) { |
78 | m_base->setFlow( IOLayerBase::None ); | 78 | m_base->setFlow( IOLayerBase::None ); |
79 | } | 79 | } |
80 | 80 | ||
81 | if (rad_parity == 1) { | 81 | if (rad_parity == 1) { |
82 | m_base->setParity( IOLayerBase::Even ); | 82 | m_base->setParity( IOLayerBase::Even ); |
83 | } else if ( rad_parity == 2 ) { | 83 | } else if ( rad_parity == 2 ) { |
84 | m_base->setParity( IOLayerBase::Odd ); | 84 | m_base->setParity( IOLayerBase::Odd ); |
85 | } else { | 85 | } else { |
86 | m_base->setParity( IOLayerBase::NonePar ); | 86 | m_base->setParity( IOLayerBase::NonePar ); |
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 | */ |
117 | void BTConfigWidget::save( Profile& prof ) { | 117 | void BTConfigWidget::save( Profile& prof ) { |
118 | int flow, parity, speed; | 118 | int flow, parity, speed; |
119 | flow = parity = speed = 0; | 119 | flow = parity = speed = 0; |
120 | prof.writeEntry("Device", m_deviceCmb->currentText() ); | 120 | prof.writeEntry("Device", m_deviceCmb->currentText() ); |
121 | 121 | ||
122 | 122 | ||
123 | switch( m_base->flow() ) { | 123 | switch( m_base->flow() ) { |
124 | case IOLayerBase::None: | 124 | case IOLayerBase::None: |
125 | flow = 0; | 125 | flow = 0; |
126 | break; | 126 | break; |
127 | case IOLayerBase::Software: | 127 | case IOLayerBase::Software: |
128 | flow = 2; | 128 | flow = 2; |
129 | break; | 129 | break; |
130 | case IOLayerBase::Hardware: | 130 | case IOLayerBase::Hardware: |
131 | flow = 1; | 131 | flow = 1; |
132 | break; | 132 | break; |
133 | } | 133 | } |
134 | 134 | ||
135 | switch( m_base->parity() ) { | 135 | switch( m_base->parity() ) { |
136 | case IOLayerBase::Odd: | 136 | case IOLayerBase::Odd: |
137 | parity = 2; | 137 | parity = 2; |
138 | break; | 138 | break; |
139 | case IOLayerBase::Even: | 139 | case IOLayerBase::Even: |
diff --git a/noncore/apps/opie-console/dialdialog.cpp b/noncore/apps/opie-console/dialdialog.cpp index 6bc1240..526d55e 100644 --- a/noncore/apps/opie-console/dialdialog.cpp +++ b/noncore/apps/opie-console/dialdialog.cpp | |||
@@ -1,98 +1,98 @@ | |||
1 | 1 | ||
2 | 2 | ||
3 | #include <qlayout.h> | 3 | #include <qlayout.h> |
4 | #include <qlabel.h> | 4 | #include <qlabel.h> |
5 | #include <qpushbutton.h> | 5 | #include <qpushbutton.h> |
6 | #include <qbuttongroup.h> | 6 | #include <qbuttongroup.h> |
7 | 7 | ||
8 | #include "dialdialog.h" | 8 | #include "dialdialog.h" |
9 | 9 | ||
10 | 10 | ||
11 | 11 | ||
12 | DialDialog::DialDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) | 12 | DialDialog::DialDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) |
13 | : QDialog( parent, name, modal, fl ) { | 13 | : QDialog( parent, name, modal, fl ) { |
14 | 14 | ||
15 | setCaption( tr( "Enter number" ) ); | 15 | setCaption( tr( "Enter number" ) ); |
16 | 16 | ||
17 | QVBoxLayout *mainLayout = new QVBoxLayout( this ); | 17 | QVBoxLayout *mainLayout = new QVBoxLayout( this ); |
18 | 18 | ||
19 | QLabel *textLabel = new QLabel( this ); | 19 | QLabel *textLabel = new QLabel( this ); |
20 | textLabel->setTextFormat( QLabel::RichText ); | 20 | textLabel->setTextFormat( QLabel::RichText ); |
21 | textLabel->setText( tr("Enter the number you want to dial. When finished, press ok") ); | 21 | textLabel->setText( tr("Enter the number you want to dial. When finished, press ok") ); |
22 | 22 | ||
23 | m_dialLine = new QLineEdit( this ); | 23 | m_dialLine = new QLineEdit( this ); |
24 | m_dialLine->setReadOnly( true ); | 24 | m_dialLine->setReadOnly( true ); |
25 | m_dialLine->setFrame( false ); | 25 | m_dialLine->setFrame( false ); |
26 | m_dialLine->setAlignment( Qt::AlignLeft ); | 26 | m_dialLine->setAlignment( Qt::AlignLeft ); |
27 | QFont dialLine_font( m_dialLine->font() ); | 27 | QFont dialLine_font( m_dialLine->font() ); |
28 | dialLine_font.setBold( TRUE ); | 28 | dialLine_font.setBold( TRUE ); |
29 | dialLine_font.setPointSize( 18 ); | 29 | dialLine_font.setPointSize( 18 ); |
30 | m_dialLine->setFont( dialLine_font ); | 30 | m_dialLine->setFont( dialLine_font ); |
31 | 31 | ||
32 | QWidget* dialWidget = new QWidget( this ); | 32 | QWidget* dialWidget = new QWidget( this ); |
33 | QGridLayout *layout = new QGridLayout( dialWidget , 4, 3 ); | 33 | QGridLayout *layout = new QGridLayout( dialWidget , 4, 3 ); |
34 | 34 | ||
35 | QButtonGroup *dialButtons = new QButtonGroup( ); | 35 | QButtonGroup *dialButtons = new QButtonGroup( ); |
36 | 36 | ||
37 | QPushButton *number0 = new QPushButton( dialWidget ); | 37 | QPushButton *number0 = new QPushButton( dialWidget ); |
38 | number0->setText( QString( "0" ) ); | 38 | number0->setText( QString( "0" ) ); |
39 | QFont number0_font( number0->font() ); | 39 | QFont number0_font( number0->font() ); |
40 | number0_font.setBold( TRUE ); | 40 | number0_font.setBold( TRUE ); |
41 | number0->setFont( number0_font ); | 41 | number0->setFont( number0_font ); |
42 | layout->addWidget( number0, 4, 1 ); | 42 | layout->addWidget( number0, 4, 1 ); |
43 | dialButtons->insert( number0 ); | 43 | dialButtons->insert( number0 ); |
44 | 44 | ||
45 | int x = 0, y = 0; | 45 | int x = 0, y = 0; |
46 | for ( int i = 0 ; i < 9; i++ ) { | 46 | for ( int i = 0 ; i < 9; i++ ) { |
47 | QPushButton *number = new QPushButton( dialWidget ); | 47 | QPushButton *number = new QPushButton( dialWidget ); |
48 | number->setText( QString( "%1" ).arg( i + 1 ) ); | 48 | number->setText( QString( "%1" ).arg( i + 1 ) ); |
49 | QFont number_font( number->font() ); | 49 | QFont number_font( number->font() ); |
50 | number_font.setBold( TRUE ); | 50 | number_font.setBold( TRUE ); |
51 | number->setFont( number_font ); | 51 | number->setFont( number_font ); |
52 | 52 | ||
53 | dialButtons->insert( number ); | 53 | dialButtons->insert( number ); |
54 | 54 | ||
55 | layout->addWidget( number, x, y ); | 55 | layout->addWidget( number, x, y ); |
56 | 56 | ||
57 | if ( y < 2 ) { | 57 | if ( y < 2 ) { |
58 | y++; | 58 | y++; |
59 | } else { | 59 | } else { |
60 | x++; | 60 | x++; |
61 | y = 0; | 61 | y = 0; |
62 | } | 62 | } |
63 | } | 63 | } |
64 | 64 | ||
65 | connect( dialButtons, SIGNAL( clicked( int ) ), this, SLOT( slotEnterNumber( int ) ) ); | 65 | connect( dialButtons, SIGNAL( clicked(int) ), this, SLOT( slotEnterNumber(int) ) ); |
66 | 66 | ||
67 | mainLayout->addStretch( 2 ); | 67 | mainLayout->addStretch( 2 ); |
68 | mainLayout->addWidget( textLabel ); | 68 | mainLayout->addWidget( textLabel ); |
69 | mainLayout->addStretch( 1 ); | 69 | mainLayout->addStretch( 1 ); |
70 | mainLayout->addWidget( m_dialLine ); | 70 | mainLayout->addWidget( m_dialLine ); |
71 | mainLayout->addStretch( 2 ); | 71 | mainLayout->addStretch( 2 ); |
72 | mainLayout->addWidget( dialWidget ); | 72 | mainLayout->addWidget( dialWidget ); |
73 | mainLayout->addStretch( 4 ); | 73 | mainLayout->addStretch( 4 ); |
74 | } | 74 | } |
75 | 75 | ||
76 | 76 | ||
77 | void DialDialog::slotEnterNumber( int number ) { | 77 | void DialDialog::slotEnterNumber( int number ) { |
78 | 78 | ||
79 | // pretty stupid, just for testing .-) | 79 | // pretty stupid, just for testing .-) |
80 | 80 | ||
81 | m_number.append(QString("%1").arg(number)); | 81 | m_number.append(QString("%1").arg(number)); |
82 | 82 | ||
83 | setNumber(m_number); | 83 | setNumber(m_number); |
84 | } | 84 | } |
85 | 85 | ||
86 | DialDialog::~DialDialog() { | 86 | DialDialog::~DialDialog() { |
87 | } | 87 | } |
88 | 88 | ||
89 | QString DialDialog::number() { | 89 | QString DialDialog::number() { |
90 | return m_number; | 90 | return m_number; |
91 | 91 | ||
92 | } | 92 | } |
93 | 93 | ||
94 | void DialDialog::setNumber( QString number ) | 94 | void DialDialog::setNumber( QString number ) |
95 | { | 95 | { |
96 | m_dialLine->setText( QString("%1").arg( number ) ); | 96 | m_dialLine->setText( QString("%1").arg( number ) ); |
97 | } | 97 | } |
98 | 98 | ||
diff --git a/noncore/apps/opie-console/emulation_handler.cpp b/noncore/apps/opie-console/emulation_handler.cpp index 2c1d888..99d069f 100644 --- a/noncore/apps/opie-console/emulation_handler.cpp +++ b/noncore/apps/opie-console/emulation_handler.cpp | |||
@@ -1,119 +1,119 @@ | |||
1 | 1 | ||
2 | #include "TEmuVt102.h" | 2 | #include "TEmuVt102.h" |
3 | 3 | ||
4 | #include "profile.h" | 4 | #include "profile.h" |
5 | #include "emulation_handler.h" | 5 | #include "emulation_handler.h" |
6 | #include "script.h" | 6 | #include "script.h" |
7 | 7 | ||
8 | EmulationHandler::EmulationHandler( const Profile& prof, QWidget* parent,const char* name ) | 8 | EmulationHandler::EmulationHandler( const Profile& prof, QWidget* parent,const char* name ) |
9 | : QObject(0, name ) | 9 | : QObject(0, name ) |
10 | { | 10 | { |
11 | m_teWid = new TEWidget( parent, "TerminalMain"); | 11 | m_teWid = new TEWidget( parent, "TerminalMain"); |
12 | // use setWrapAt(0) for classic behaviour (wrap at screen width, no scrollbar) | 12 | // use setWrapAt(0) for classic behaviour (wrap at screen width, no scrollbar) |
13 | // use setWrapAt(80) for normal console with scrollbar | 13 | // use setWrapAt(80) for normal console with scrollbar |
14 | setWrap(prof.readNumEntry("Wrap", 0) ? 0 : 80); | 14 | setWrap(prof.readNumEntry("Wrap", 0) ? 0 : 80); |
15 | m_teWid->setMinimumSize(150, 70 ); | 15 | m_teWid->setMinimumSize(150, 70 ); |
16 | m_script = 0; | 16 | m_script = 0; |
17 | parent->resize( m_teWid->calcSize(80, 24 ) ); | 17 | parent->resize( m_teWid->calcSize(80, 24 ) ); |
18 | m_teEmu = new TEmuVt102(m_teWid ); | 18 | m_teEmu = new TEmuVt102(m_teWid ); |
19 | 19 | ||
20 | connect(m_teEmu,SIGNAL(ImageSizeChanged(int, int) ), | 20 | connect(m_teEmu,SIGNAL(ImageSizeChanged(int,int) ), |
21 | this, SIGNAL(changeSize(int, int) ) ); | 21 | this, SIGNAL(changeSize(int,int) ) ); |
22 | connect(m_teEmu, SIGNAL(sndBlock(const char*, int) ), | 22 | connect(m_teEmu, SIGNAL(sndBlock(const char*,int) ), |
23 | this, SLOT(recvEmulation(const char*, int) ) ); | 23 | this, SLOT(recvEmulation(const char*,int) ) ); |
24 | m_teEmu->setConnect( true ); | 24 | m_teEmu->setConnect( true ); |
25 | m_teEmu->setHistory( TRUE ); | 25 | m_teEmu->setHistory( TRUE ); |
26 | load( prof ); | 26 | load( prof ); |
27 | 27 | ||
28 | 28 | ||
29 | 29 | ||
30 | } | 30 | } |
31 | TEmulation* EmulationHandler::emulation() { | 31 | TEmulation* EmulationHandler::emulation() { |
32 | return m_teEmu; | 32 | return m_teEmu; |
33 | } | 33 | } |
34 | EmulationHandler::~EmulationHandler() { | 34 | EmulationHandler::~EmulationHandler() { |
35 | if (isRecording()) | 35 | if (isRecording()) |
36 | clearScript(); | 36 | clearScript(); |
37 | delete m_teEmu; | 37 | delete m_teEmu; |
38 | delete m_teWid; | 38 | delete m_teWid; |
39 | } | 39 | } |
40 | 40 | ||
41 | void EmulationHandler::load( const Profile& prof) { | 41 | void EmulationHandler::load( const Profile& prof) { |
42 | m_teWid->setVTFont( font( prof.readNumEntry("Font") ) ); | 42 | m_teWid->setVTFont( font( prof.readNumEntry("Font") ) ); |
43 | int num = prof.readNumEntry("Color"); | 43 | int num = prof.readNumEntry("Color"); |
44 | setColor( foreColor(num), backColor(num) ); | 44 | setColor( foreColor(num), backColor(num) ); |
45 | m_teWid->setBackgroundColor(backColor(num) ); | 45 | m_teWid->setBackgroundColor(backColor(num) ); |
46 | 46 | ||
47 | int term = prof.readNumEntry("Terminal", 0) ; | 47 | int term = prof.readNumEntry("Terminal", 0) ; |
48 | switch(term) { | 48 | switch(term) { |
49 | default: | 49 | default: |
50 | case Profile::VT102: | 50 | case Profile::VT102: |
51 | case Profile::VT100: | 51 | case Profile::VT100: |
52 | m_teEmu->setKeytrans("vt100.keytab"); | 52 | m_teEmu->setKeytrans("vt100.keytab"); |
53 | break; | 53 | break; |
54 | case Profile::Linux: | 54 | case Profile::Linux: |
55 | m_teEmu->setKeytrans("linux.keytab"); | 55 | m_teEmu->setKeytrans("linux.keytab"); |
56 | break; | 56 | break; |
57 | case Profile::XTerm: | 57 | case Profile::XTerm: |
58 | m_teEmu->setKeytrans("default.Keytab"); | 58 | m_teEmu->setKeytrans("default.Keytab"); |
59 | break; | 59 | break; |
60 | } | 60 | } |
61 | } | 61 | } |
62 | void EmulationHandler::recv( const QByteArray& ar) { | 62 | void EmulationHandler::recv( const QByteArray& ar) { |
63 | m_teEmu->onRcvBlock(ar.data(), ar.count() ); | 63 | m_teEmu->onRcvBlock(ar.data(), ar.count() ); |
64 | } | 64 | } |
65 | void EmulationHandler::recvEmulation(const char* src, int len ) { | 65 | void EmulationHandler::recvEmulation(const char* src, int len ) { |
66 | QByteArray ar(len); | 66 | QByteArray ar(len); |
67 | 67 | ||
68 | memcpy(ar.data(), src, sizeof(char) * len ); | 68 | memcpy(ar.data(), src, sizeof(char) * len ); |
69 | if (isRecording()) | 69 | if (isRecording()) |
70 | m_script->append(ar); | 70 | m_script->append(ar); |
71 | emit send(ar); | 71 | emit send(ar); |
72 | } | 72 | } |
73 | QWidget* EmulationHandler::widget() { | 73 | QWidget* EmulationHandler::widget() { |
74 | return m_teWid; | 74 | return m_teWid; |
75 | } | 75 | } |
76 | /* | 76 | /* |
77 | * allocate a new table of colors | 77 | * allocate a new table of colors |
78 | */ | 78 | */ |
79 | void EmulationHandler::setColor( const QColor& fore, const QColor& back ) { | 79 | void EmulationHandler::setColor( const QColor& fore, const QColor& back ) { |
80 | ColorEntry table[TABLE_COLORS]; | 80 | ColorEntry table[TABLE_COLORS]; |
81 | const ColorEntry *defaultCt = m_teWid->getdefaultColorTable(); | 81 | const ColorEntry *defaultCt = m_teWid->getdefaultColorTable(); |
82 | 82 | ||
83 | for (int i = 0; i < TABLE_COLORS; i++ ) { | 83 | for (int i = 0; i < TABLE_COLORS; i++ ) { |
84 | if ( i == 0 || i == 10 ) { | 84 | if ( i == 0 || i == 10 ) { |
85 | table[i].color = fore; | 85 | table[i].color = fore; |
86 | }else if ( i == 1 || i == 11 ) { | 86 | }else if ( i == 1 || i == 11 ) { |
87 | table[i].color = back; | 87 | table[i].color = back; |
88 | table[i].transparent = 0; | 88 | table[i].transparent = 0; |
89 | }else { | 89 | }else { |
90 | table[i].color = defaultCt[i].color; | 90 | table[i].color = defaultCt[i].color; |
91 | } | 91 | } |
92 | } | 92 | } |
93 | m_teWid->setColorTable(table ); | 93 | m_teWid->setColorTable(table ); |
94 | m_teWid->update(); | 94 | m_teWid->update(); |
95 | } | 95 | } |
96 | QFont EmulationHandler::font( int id ) { | 96 | QFont EmulationHandler::font( int id ) { |
97 | QString name; | 97 | QString name; |
98 | int size = 0; | 98 | int size = 0; |
99 | switch(id ) { | 99 | switch(id ) { |
100 | default: // fall through | 100 | default: // fall through |
101 | case 0: | 101 | case 0: |
102 | name = QString::fromLatin1("Micro"); | 102 | name = QString::fromLatin1("Micro"); |
103 | size = 4; | 103 | size = 4; |
104 | break; | 104 | break; |
105 | case 1: | 105 | case 1: |
106 | name = QString::fromLatin1("Fixed"); | 106 | name = QString::fromLatin1("Fixed"); |
107 | size = 7; | 107 | size = 7; |
108 | break; | 108 | break; |
109 | case 2: | 109 | case 2: |
110 | name = QString::fromLatin1("Fixed"); | 110 | name = QString::fromLatin1("Fixed"); |
111 | size = 12; | 111 | size = 12; |
112 | break; | 112 | break; |
113 | } | 113 | } |
114 | QFont font(name, size, QFont::Normal ); | 114 | QFont font(name, size, QFont::Normal ); |
115 | font.setFixedPitch(TRUE ); | 115 | font.setFixedPitch(TRUE ); |
116 | return font; | 116 | return font; |
117 | } | 117 | } |
118 | QColor EmulationHandler::foreColor(int col) { | 118 | QColor EmulationHandler::foreColor(int col) { |
119 | QColor co; | 119 | QColor co; |
diff --git a/noncore/apps/opie-console/emulation_layer.cpp b/noncore/apps/opie-console/emulation_layer.cpp index 2bef801..fd30ad7 100644 --- a/noncore/apps/opie-console/emulation_layer.cpp +++ b/noncore/apps/opie-console/emulation_layer.cpp | |||
@@ -13,204 +13,204 @@ | |||
13 | /* Ported Konsole to Qt/Embedded */ | 13 | /* Ported Konsole to Qt/Embedded */ |
14 | /* */ | 14 | /* */ |
15 | /* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */ | 15 | /* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */ |
16 | /* */ | 16 | /* */ |
17 | /* -------------------------------------------------------------------------- */ | 17 | /* -------------------------------------------------------------------------- */ |
18 | /* */ | 18 | /* */ |
19 | /* Modified to suit opie-console */ | 19 | /* Modified to suit opie-console */ |
20 | /* */ | 20 | /* */ |
21 | /* Copyright (C) 2002 by opie developers <opie@handhelds.org> */ | 21 | /* Copyright (C) 2002 by opie developers <opie@handhelds.org> */ |
22 | /* */ | 22 | /* */ |
23 | /* -------------------------------------------------------------------------- */ | 23 | /* -------------------------------------------------------------------------- */ |
24 | 24 | ||
25 | /*! \class EmulationLayer | 25 | /*! \class EmulationLayer |
26 | 26 | ||
27 | \brief Mediator between Widget and Screen. | 27 | \brief Mediator between Widget and Screen. |
28 | 28 | ||
29 | This class is responsible to scan the escapes sequences of the terminal | 29 | This class is responsible to scan the escapes sequences of the terminal |
30 | emulation and to map it to their corresponding semantic complements. | 30 | emulation and to map it to their corresponding semantic complements. |
31 | Thus this module knows mainly about decoding escapes sequences and | 31 | Thus this module knows mainly about decoding escapes sequences and |
32 | is a stateless device w.r.t. the semantics. | 32 | is a stateless device w.r.t. the semantics. |
33 | 33 | ||
34 | It is also responsible to refresh the Widget by certain rules. | 34 | It is also responsible to refresh the Widget by certain rules. |
35 | 35 | ||
36 | \sa Widget \sa Screen | 36 | \sa Widget \sa Screen |
37 | 37 | ||
38 | \par A note on refreshing | 38 | \par A note on refreshing |
39 | 39 | ||
40 | Although the modifications to the current screen image could immediately | 40 | Although the modifications to the current screen image could immediately |
41 | be propagated via `Widget' to the graphical surface, we have chosen | 41 | be propagated via `Widget' to the graphical surface, we have chosen |
42 | another way here. | 42 | another way here. |
43 | 43 | ||
44 | The reason for doing so is twofold. | 44 | The reason for doing so is twofold. |
45 | 45 | ||
46 | First, experiments show that directly displaying the operation results | 46 | First, experiments show that directly displaying the operation results |
47 | in slowing down the overall performance of emulations. Displaying | 47 | in slowing down the overall performance of emulations. Displaying |
48 | individual characters using X11 creates a lot of overhead. | 48 | individual characters using X11 creates a lot of overhead. |
49 | 49 | ||
50 | Second, by using the following refreshing method, the screen operations | 50 | Second, by using the following refreshing method, the screen operations |
51 | can be completely separated from the displaying. This greatly simplifies | 51 | can be completely separated from the displaying. This greatly simplifies |
52 | the programmer's task of coding and maintaining the screen operations, | 52 | the programmer's task of coding and maintaining the screen operations, |
53 | since one need not worry about differential modifications on the | 53 | since one need not worry about differential modifications on the |
54 | display affecting the operation of concern. | 54 | display affecting the operation of concern. |
55 | 55 | ||
56 | We use a refreshing algorithm here that has been adoped from rxvt/kvt. | 56 | We use a refreshing algorithm here that has been adoped from rxvt/kvt. |
57 | 57 | ||
58 | By this, refreshing is driven by a timer, which is (re)started whenever | 58 | By this, refreshing is driven by a timer, which is (re)started whenever |
59 | a new bunch of data to be interpreted by the emulation arives at `onRcvBlock'. | 59 | a new bunch of data to be interpreted by the emulation arives at `onRcvBlock'. |
60 | As soon as no more data arrive for `BULK_TIMEOUT' milliseconds, we trigger | 60 | As soon as no more data arrive for `BULK_TIMEOUT' milliseconds, we trigger |
61 | refresh. This rule suits both bulk display operation as done by curses as | 61 | refresh. This rule suits both bulk display operation as done by curses as |
62 | well as individual characters typed. | 62 | well as individual characters typed. |
63 | (BULK_TIMEOUT < 1000 / max characters received from keyboard per second). | 63 | (BULK_TIMEOUT < 1000 / max characters received from keyboard per second). |
64 | 64 | ||
65 | Additionally, we trigger refreshing by newlines comming in to make visual | 65 | Additionally, we trigger refreshing by newlines comming in to make visual |
66 | snapshots of lists as produced by `cat', `ls' and likely programs, thereby | 66 | snapshots of lists as produced by `cat', `ls' and likely programs, thereby |
67 | producing the illusion of a permanent and immediate display operation. | 67 | producing the illusion of a permanent and immediate display operation. |
68 | 68 | ||
69 | As a sort of catch-all needed for cases where none of the above | 69 | As a sort of catch-all needed for cases where none of the above |
70 | conditions catch, the screen refresh is also triggered by a count | 70 | conditions catch, the screen refresh is also triggered by a count |
71 | of incoming bulks (`bulk_incnt'). | 71 | of incoming bulks (`bulk_incnt'). |
72 | */ | 72 | */ |
73 | 73 | ||
74 | /* FIXME | 74 | /* FIXME |
75 | - evtl. the bulk operations could be made more transparent. | 75 | - evtl. the bulk operations could be made more transparent. |
76 | */ | 76 | */ |
77 | 77 | ||
78 | #include "emulation_layer.h" | 78 | #include "emulation_layer.h" |
79 | #include <stdio.h> | 79 | #include <stdio.h> |
80 | #include <stdlib.h> | 80 | #include <stdlib.h> |
81 | #include <unistd.h> | 81 | #include <unistd.h> |
82 | 82 | ||
83 | 83 | ||
84 | /* ------------------------------------------------------------------------- */ | 84 | /* ------------------------------------------------------------------------- */ |
85 | /* */ | 85 | /* */ |
86 | /* EmulationLayer */ | 86 | /* EmulationLayer */ |
87 | /* */ | 87 | /* */ |
88 | /* ------------------------------------------------------------------------- */ | 88 | /* ------------------------------------------------------------------------- */ |
89 | 89 | ||
90 | #define CNTL(c) ((c)-'@') | 90 | #define CNTL(c) ((c)-'@') |
91 | 91 | ||
92 | /*! | 92 | /*! |
93 | */ | 93 | */ |
94 | 94 | ||
95 | EmulationLayer::EmulationLayer( WidgetLayer* gui ) | 95 | EmulationLayer::EmulationLayer( WidgetLayer* gui ) |
96 | : decoder((QTextDecoder*)NULL) | 96 | : decoder((QTextDecoder*)NULL) |
97 | { | 97 | { |
98 | this->gui = gui; | 98 | this->gui = gui; |
99 | 99 | ||
100 | screen[0] = new Screen(gui->lines(),gui->columns()); | 100 | screen[0] = new Screen(gui->lines(),gui->columns()); |
101 | screen[1] = new Screen(gui->lines(),gui->columns()); | 101 | screen[1] = new Screen(gui->lines(),gui->columns()); |
102 | scr = screen[0]; | 102 | scr = screen[0]; |
103 | 103 | ||
104 | bulk_nlcnt = 0; // reset bulk newline counter | 104 | bulk_nlcnt = 0; // reset bulk newline counter |
105 | bulk_incnt = 0; // reset bulk counter | 105 | bulk_incnt = 0; // reset bulk counter |
106 | connected = FALSE; | 106 | connected = FALSE; |
107 | 107 | ||
108 | QObject::connect(&bulk_timer, SIGNAL( timeout() ), this, SLOT( showBulk() ) ); | 108 | QObject::connect(&bulk_timer, SIGNAL( timeout() ), this, SLOT( showBulk() ) ); |
109 | QObject::connect(gui,SIGNAL( imageSizeChanged( int, int ) ), | 109 | QObject::connect(gui,SIGNAL( imageSizeChanged(int,int) ), |
110 | this,SLOT( onImageSizeChange( int, int ) ) ); | 110 | this,SLOT( onImageSizeChange(int,int) ) ); |
111 | QObject::connect(gui,SIGNAL( changedHistoryCursor( int ) ), | 111 | QObject::connect(gui,SIGNAL( changedHistoryCursor(int) ), |
112 | this,SLOT( historyCursorChange( int ) ) ); | 112 | this,SLOT( historyCursorChange(int) ) ); |
113 | QObject::connect(gui,SIGNAL( keyPressed( QKeyEvent* ) ), | 113 | QObject::connect(gui,SIGNAL( keyPressed(QKeyEvent*) ), |
114 | this,SLOT( onKeyPress( QKeyEvent* ) ) ); | 114 | this,SLOT( onKeyPress(QKeyEvent*) ) ); |
115 | QObject::connect(gui,SIGNAL( selectionBegin( const int, const int) ), | 115 | QObject::connect(gui,SIGNAL( selectionBegin(const int,const int) ), |
116 | this,SLOT( onSelectionBegin( const int, const int ) ) ); | 116 | this,SLOT( onSelectionBegin(const int,const int) ) ); |
117 | QObject::connect(gui,SIGNAL( selectionExtended( const int, const int ) ), | 117 | QObject::connect(gui,SIGNAL( selectionExtended(const int,const int) ), |
118 | this,SLOT( onSelectionExtend( const int,const int ) ) ); | 118 | this,SLOT( onSelectionExtend(const int,const int) ) ); |
119 | QObject::connect(gui,SIGNAL( selectionEnd( const bool ) ), | 119 | QObject::connect(gui,SIGNAL( selectionEnd(const bool) ), |
120 | this,SLOT( setSelection( const bool ) ) ); | 120 | this,SLOT( setSelection(const bool) ) ); |
121 | QObject::connect(gui,SIGNAL( selectionCleared() ), | 121 | QObject::connect(gui,SIGNAL( selectionCleared() ), |
122 | this,SLOT( clearSelection() ) ); | 122 | this,SLOT( clearSelection() ) ); |
123 | } | 123 | } |
124 | 124 | ||
125 | /*! | 125 | /*! |
126 | */ | 126 | */ |
127 | 127 | ||
128 | EmulationLayer::~EmulationLayer() | 128 | EmulationLayer::~EmulationLayer() |
129 | { | 129 | { |
130 | delete screen[0]; | 130 | delete screen[0]; |
131 | delete screen[1]; | 131 | delete screen[1]; |
132 | bulk_timer.stop(); | 132 | bulk_timer.stop(); |
133 | } | 133 | } |
134 | 134 | ||
135 | /*! change between primary and alternate screen | 135 | /*! change between primary and alternate screen |
136 | */ | 136 | */ |
137 | 137 | ||
138 | void EmulationLayer::setScreen(int n) | 138 | void EmulationLayer::setScreen(int n) |
139 | { | 139 | { |
140 | scr = screen[n&1]; | 140 | scr = screen[n&1]; |
141 | } | 141 | } |
142 | 142 | ||
143 | void EmulationLayer::setHistory(bool on) | 143 | void EmulationLayer::setHistory(bool on) |
144 | { | 144 | { |
145 | screen[0]->setScroll(on); | 145 | screen[0]->setScroll(on); |
146 | if (!connected) return; | 146 | if (!connected) return; |
147 | showBulk(); | 147 | showBulk(); |
148 | } | 148 | } |
149 | 149 | ||
150 | bool EmulationLayer::history() | 150 | bool EmulationLayer::history() |
151 | { | 151 | { |
152 | return screen[0]->hasScroll(); | 152 | return screen[0]->hasScroll(); |
153 | } | 153 | } |
154 | 154 | ||
155 | void EmulationLayer::setCodec(int c) | 155 | void EmulationLayer::setCodec(int c) |
156 | { | 156 | { |
157 | //FIXME: check whether we have to free codec | 157 | //FIXME: check whether we have to free codec |
158 | codec = c ? QTextCodec::codecForName("utf8") | 158 | codec = c ? QTextCodec::codecForName("utf8") |
159 | : QTextCodec::codecForLocale(); | 159 | : QTextCodec::codecForLocale(); |
160 | if (decoder) delete decoder; | 160 | if (decoder) delete decoder; |
161 | decoder = codec->makeDecoder(); | 161 | decoder = codec->makeDecoder(); |
162 | } | 162 | } |
163 | 163 | ||
164 | void EmulationLayer::setKeytrans(int no) | 164 | void EmulationLayer::setKeytrans(int no) |
165 | { | 165 | { |
166 | keytrans = KeyTrans::find(no); | 166 | keytrans = KeyTrans::find(no); |
167 | } | 167 | } |
168 | 168 | ||
169 | void EmulationLayer::setKeytrans(const char * no) | 169 | void EmulationLayer::setKeytrans(const char * no) |
170 | { | 170 | { |
171 | keytrans = KeyTrans::find(no); | 171 | keytrans = KeyTrans::find(no); |
172 | } | 172 | } |
173 | 173 | ||
174 | // Interpreting Codes --------------------------------------------------------- | 174 | // Interpreting Codes --------------------------------------------------------- |
175 | 175 | ||
176 | /* | 176 | /* |
177 | This section deals with decoding the incoming character stream. | 177 | This section deals with decoding the incoming character stream. |
178 | Decoding means here, that the stream is first seperated into `tokens' | 178 | Decoding means here, that the stream is first seperated into `tokens' |
179 | which are then mapped to a `meaning' provided as operations by the | 179 | which are then mapped to a `meaning' provided as operations by the |
180 | `Screen' class. | 180 | `Screen' class. |
181 | */ | 181 | */ |
182 | 182 | ||
183 | /*! | 183 | /*! |
184 | */ | 184 | */ |
185 | 185 | ||
186 | void EmulationLayer::onRcvChar(int c) | 186 | void EmulationLayer::onRcvChar(int c) |
187 | // process application unicode input to terminal | 187 | // process application unicode input to terminal |
188 | // this is a trivial scanner | 188 | // this is a trivial scanner |
189 | { | 189 | { |
190 | c &= 0xff; | 190 | c &= 0xff; |
191 | switch (c) | 191 | switch (c) |
192 | { | 192 | { |
193 | case '\b' : scr->BackSpace(); break; | 193 | case '\b' : scr->BackSpace(); break; |
194 | case '\t' : scr->Tabulate(); break; | 194 | case '\t' : scr->Tabulate(); break; |
195 | case '\n' : scr->NewLine(); break; | 195 | case '\n' : scr->NewLine(); break; |
196 | case '\r' : scr->Return(); break; | 196 | case '\r' : scr->Return(); break; |
197 | case 0x07 : gui->bell(); break; | 197 | case 0x07 : gui->bell(); break; |
198 | default : scr->ShowCharacter(c); break; | 198 | default : scr->ShowCharacter(c); break; |
199 | }; | 199 | }; |
200 | } | 200 | } |
201 | 201 | ||
202 | /* ------------------------------------------------------------------------- */ | 202 | /* ------------------------------------------------------------------------- */ |
203 | /* */ | 203 | /* */ |
204 | /* Keyboard Handling */ | 204 | /* Keyboard Handling */ |
205 | /* */ | 205 | /* */ |
206 | /* ------------------------------------------------------------------------- */ | 206 | /* ------------------------------------------------------------------------- */ |
207 | 207 | ||
208 | /*! | 208 | /*! |
209 | */ | 209 | */ |
210 | 210 | ||
211 | void EmulationLayer::onKeyPress( QKeyEvent* ev ) | 211 | void EmulationLayer::onKeyPress( QKeyEvent* ev ) |
212 | { | 212 | { |
213 | if (!connected) return; // someone else gets the keys | 213 | if (!connected) return; // someone else gets the keys |
214 | if (scr->getHistCursor() != scr->getHistLines()); | 214 | if (scr->getHistCursor() != scr->getHistLines()); |
215 | scr->setHistCursor(scr->getHistLines()); | 215 | scr->setHistCursor(scr->getHistLines()); |
216 | if (!ev->text().isEmpty()) | 216 | if (!ev->text().isEmpty()) |
diff --git a/noncore/apps/opie-console/function_keyboard.cpp b/noncore/apps/opie-console/function_keyboard.cpp index c232d89..eb32551 100644 --- a/noncore/apps/opie-console/function_keyboard.cpp +++ b/noncore/apps/opie-console/function_keyboard.cpp | |||
@@ -167,231 +167,231 @@ void FunctionKeyboard::paintKey(uint row, uint col) { | |||
167 | 167 | ||
168 | // sometimes it doesnt draw the last line | 168 | // sometimes it doesnt draw the last line |
169 | 169 | ||
170 | p.drawLine((col+1) * keyWidth -1, row * keyHeight, | 170 | p.drawLine((col+1) * keyWidth -1, row * keyHeight, |
171 | (col+1) * keyWidth -1, (row + 1) * keyHeight | 171 | (col+1) * keyWidth -1, (row + 1) * keyHeight |
172 | ); | 172 | ); |
173 | } | 173 | } |
174 | 174 | ||
175 | } | 175 | } |
176 | 176 | ||
177 | void FunctionKeyboard::mousePressEvent(QMouseEvent *e) { | 177 | void FunctionKeyboard::mousePressEvent(QMouseEvent *e) { |
178 | 178 | ||
179 | pressedRow = e->y() / keyHeight; | 179 | pressedRow = e->y() / keyHeight; |
180 | pressedCol = (int) (e->x() / keyWidth); | 180 | pressedCol = (int) (e->x() / keyWidth); |
181 | 181 | ||
182 | paintKey(pressedRow, pressedCol); | 182 | paintKey(pressedRow, pressedCol); |
183 | 183 | ||
184 | // emit that sucker! | 184 | // emit that sucker! |
185 | FKey k = keys["r" + QString::number(pressedRow) + "c" + QString::number(pressedCol)]; | 185 | FKey k = keys["r" + QString::number(pressedRow) + "c" + QString::number(pressedCol)]; |
186 | emit keyPressed(k, pressedRow, pressedCol, 1); | 186 | emit keyPressed(k, pressedRow, pressedCol, 1); |
187 | 187 | ||
188 | } | 188 | } |
189 | 189 | ||
190 | void FunctionKeyboard::mouseReleaseEvent(QMouseEvent *) { | 190 | void FunctionKeyboard::mouseReleaseEvent(QMouseEvent *) { |
191 | 191 | ||
192 | if (pressedRow != -1 && pressedRow != -1) { | 192 | if (pressedRow != -1 && pressedRow != -1) { |
193 | 193 | ||
194 | int row = pressedRow; pressedRow = -1; | 194 | int row = pressedRow; pressedRow = -1; |
195 | int col = pressedCol; pressedCol = -1; | 195 | int col = pressedCol; pressedCol = -1; |
196 | paintKey(row, col); | 196 | paintKey(row, col); |
197 | 197 | ||
198 | FKey k = keys["r" + QString::number(row) + "c" + QString::number(col)]; | 198 | FKey k = keys["r" + QString::number(row) + "c" + QString::number(col)]; |
199 | emit keyPressed(k, row, col, 0); | 199 | emit keyPressed(k, row, col, 0); |
200 | } | 200 | } |
201 | 201 | ||
202 | } | 202 | } |
203 | 203 | ||
204 | 204 | ||
205 | void FunctionKeyboard::resizeEvent(QResizeEvent*) { | 205 | void FunctionKeyboard::resizeEvent(QResizeEvent*) { |
206 | 206 | ||
207 | /* set he default font height/width */ | 207 | /* set he default font height/width */ |
208 | QFontMetrics fm=fontMetrics(); | 208 | QFontMetrics fm=fontMetrics(); |
209 | keyHeight = fm.lineSpacing() + 2; | 209 | keyHeight = fm.lineSpacing() + 2; |
210 | keyWidth = (double)width()/numCols; | 210 | keyWidth = (double)width()/numCols; |
211 | 211 | ||
212 | } | 212 | } |
213 | 213 | ||
214 | QSize FunctionKeyboard::sizeHint() const { | 214 | QSize FunctionKeyboard::sizeHint() const { |
215 | 215 | ||
216 | return QSize(width(), keyHeight * numRows + 1); | 216 | return QSize(width(), keyHeight * numRows + 1); |
217 | } | 217 | } |
218 | 218 | ||
219 | void FunctionKeyboard::loadDefaults() { | 219 | void FunctionKeyboard::loadDefaults() { |
220 | 220 | ||
221 | numRows = DEFAULT_ROWS; | 221 | numRows = DEFAULT_ROWS; |
222 | numCols = DEFAULT_COLS; | 222 | numCols = DEFAULT_COLS; |
223 | keyWidth = (double)width()/numCols; // have to reset this thing too | 223 | keyWidth = (double)width()/numCols; // have to reset this thing too |
224 | 224 | ||
225 | keys.insert( "r0c0", FKey ("Enter", "enter", Qt::Key_Enter, 0)); | 225 | keys.insert( "r0c0", FKey ("Enter", "enter", Qt::Key_Enter, 0)); |
226 | keys.insert( "r0c1", FKey ("Space", "space", Qt::Key_Space, Qt::Key_Space)); | 226 | keys.insert( "r0c1", FKey ("Space", "space", Qt::Key_Space, Qt::Key_Space)); |
227 | keys.insert( "r0c2", FKey ("Tab", "tab", Qt::Key_Tab, 0)); | 227 | keys.insert( "r0c2", FKey ("Tab", "tab", Qt::Key_Tab, 0)); |
228 | keys.insert( "r0c3", FKey ("Up", "up", Qt::Key_Up, 0)); | 228 | keys.insert( "r0c3", FKey ("Up", "up", Qt::Key_Up, 0)); |
229 | keys.insert( "r0c4", FKey ("Down", "down", Qt::Key_Down, 0)); | 229 | keys.insert( "r0c4", FKey ("Down", "down", Qt::Key_Down, 0)); |
230 | 230 | ||
231 | keys.insert( "r0c7", FKey ("Ho", 0, 4112, 0)); | 231 | keys.insert( "r0c7", FKey ("Ho", 0, 4112, 0)); |
232 | keys.insert( "r0c8", FKey ("End", 0, 4113, 0)); | 232 | keys.insert( "r0c8", FKey ("End", 0, 4113, 0)); |
233 | keys.insert( "r0c9", FKey ("Pu", 0, 4118, 0)); | 233 | keys.insert( "r0c9", FKey ("Pu", 0, 4118, 0)); |
234 | keys.insert( "r0c10", FKey ("Pd", 0, 4119, 0)); | 234 | keys.insert( "r0c10", FKey ("Pd", 0, 4119, 0)); |
235 | keys.insert( "r0c11", FKey ("Esc", 0, Qt::Key_Escape, 0xfff)); | 235 | keys.insert( "r0c11", FKey ("Esc", 0, Qt::Key_Escape, 0xfff)); |
236 | 236 | ||
237 | keys.insert( "r1c0", FKey ("F1", 0, 4144, 0)); | 237 | keys.insert( "r1c0", FKey ("F1", 0, 4144, 0)); |
238 | keys.insert( "r1c1", FKey ("F2", 0, 4145, 0)); | 238 | keys.insert( "r1c1", FKey ("F2", 0, 4145, 0)); |
239 | keys.insert( "r1c2", FKey ("F3", 0, 4146, 0)); | 239 | keys.insert( "r1c2", FKey ("F3", 0, 4146, 0)); |
240 | keys.insert( "r1c3", FKey ("F4", 0, 4147, 0)); | 240 | keys.insert( "r1c3", FKey ("F4", 0, 4147, 0)); |
241 | keys.insert( "r1c4", FKey ("F5", 0, 4148, 0)); | 241 | keys.insert( "r1c4", FKey ("F5", 0, 4148, 0)); |
242 | keys.insert( "r1c5", FKey ("F6", 0, 4149, 0)); | 242 | keys.insert( "r1c5", FKey ("F6", 0, 4149, 0)); |
243 | keys.insert( "r1c6", FKey ("F7", 0, 4150, 0)); | 243 | keys.insert( "r1c6", FKey ("F7", 0, 4150, 0)); |
244 | keys.insert( "r1c7", FKey ("F8", 0, 4151, 0)); | 244 | keys.insert( "r1c7", FKey ("F8", 0, 4151, 0)); |
245 | keys.insert( "r1c8", FKey ("F9", 0, 4152, 0)); | 245 | keys.insert( "r1c8", FKey ("F9", 0, 4152, 0)); |
246 | keys.insert( "r1c9", FKey ("F10", 0, 4153, 0)); | 246 | keys.insert( "r1c9", FKey ("F10", 0, 4153, 0)); |
247 | keys.insert( "r1c10", FKey ("F11", 0, 4154, 0)); | 247 | keys.insert( "r1c10", FKey ("F11", 0, 4154, 0)); |
248 | keys.insert( "r1c11", FKey ("F12", 0, 4155, 0)); | 248 | keys.insert( "r1c11", FKey ("F12", 0, 4155, 0)); |
249 | 249 | ||
250 | 250 | ||
251 | } | 251 | } |
252 | 252 | ||
253 | /* FunctionKeyboardConfig {{{1 */ | 253 | /* FunctionKeyboardConfig {{{1 */ |
254 | 254 | ||
255 | FunctionKeyboardConfig::FunctionKeyboardConfig(const QString& name, QWidget* parent, const char* na ) | 255 | FunctionKeyboardConfig::FunctionKeyboardConfig(const QString& name, QWidget* parent, const char* na ) |
256 | : ProfileDialogKeyWidget(name, parent, na), | 256 | : ProfileDialogKeyWidget(name, parent, na), |
257 | selectedRow(0), selectedCol(0) | 257 | selectedRow(0), selectedCol(0) |
258 | { | 258 | { |
259 | qWarning("FunctionKeyboardConfig"); | 259 | qWarning("FunctionKeyboardConfig"); |
260 | 260 | ||
261 | 261 | ||
262 | kb = new FunctionKeyboard(this); | 262 | kb = new FunctionKeyboard(this); |
263 | connect (kb, SIGNAL(keyPressed(FKey, ushort, ushort, bool)), | 263 | connect (kb, SIGNAL(keyPressed(FKey,ushort,ushort,bool)), |
264 | this, SLOT(slotKeyPressed(FKey, ushort, ushort, bool))); | 264 | this, SLOT(slotKeyPressed(FKey,ushort,ushort,bool))); |
265 | 265 | ||
266 | QGroupBox *dimentions = new QGroupBox(2, Qt::Horizontal, tr("Dimensions"), this); | 266 | QGroupBox *dimentions = new QGroupBox(2, Qt::Horizontal, tr("Dimensions"), this); |
267 | QLabel *l = new QLabel("Rows", dimentions); | 267 | QLabel *l = new QLabel("Rows", dimentions); |
268 | m_rowBox = new QSpinBox(1, 15, 1, dimentions); | 268 | m_rowBox = new QSpinBox(1, 15, 1, dimentions); |
269 | connect (m_rowBox, SIGNAL(valueChanged(int)), this, SLOT(slotChangeRows(int))); | 269 | connect (m_rowBox, SIGNAL(valueChanged(int)), this, SLOT(slotChangeRows(int))); |
270 | l = new QLabel("Columns", dimentions); | 270 | l = new QLabel("Columns", dimentions); |
271 | m_colBox = new QSpinBox(1, 15, 1, dimentions); | 271 | m_colBox = new QSpinBox(1, 15, 1, dimentions); |
272 | connect (m_colBox, SIGNAL(valueChanged(int)), this, SLOT(slotChangeCols(int))); | 272 | connect (m_colBox, SIGNAL(valueChanged(int)), this, SLOT(slotChangeCols(int))); |
273 | 273 | ||
274 | QGroupBox *editKey = new QGroupBox(2, Qt::Horizontal, tr("Edit Key"), this); | 274 | QGroupBox *editKey = new QGroupBox(2, Qt::Horizontal, tr("Edit Key"), this); |
275 | l = new QLabel("Label", editKey); | 275 | l = new QLabel("Label", editKey); |
276 | m_labels = new QComboBox(true, editKey); | 276 | m_labels = new QComboBox(true, editKey); |
277 | m_labels->setInsertionPolicy(QComboBox::AtCurrent); | 277 | m_labels->setInsertionPolicy(QComboBox::AtCurrent); |
278 | m_labels->insertItem(""); | 278 | m_labels->insertItem(""); |
279 | 279 | ||
280 | QStringList files = QDir( QPEApplication::qpeDir() + "pics/console/keys/", "*.png").entryList(); | 280 | QStringList files = QDir( QPEApplication::qpeDir() + "pics/console/keys/", "*.png").entryList(); |
281 | 281 | ||
282 | for (uint i = 0; i < files.count(); i++) { | 282 | for (uint i = 0; i < files.count(); i++) { |
283 | 283 | ||
284 | m_labels->insertItem( Resource::loadPixmap("console/keys/" + files[i]), files[i]); | 284 | m_labels->insertItem( Resource::loadPixmap("console/keys/" + files[i]), files[i]); |
285 | } | 285 | } |
286 | connect (m_labels, SIGNAL(activated(int)), this, SLOT(slotChangeIcon(int))); | 286 | connect (m_labels, SIGNAL(activated(int)), this, SLOT(slotChangeIcon(int))); |
287 | connect (m_labels, SIGNAL(textChanged(const QString &)), this, SLOT(slotChangeLabelText(const QString&))); | 287 | connect (m_labels, SIGNAL(textChanged(const QString&)), this, SLOT(slotChangeLabelText(const QString&))); |
288 | 288 | ||
289 | l = new QLabel("Q Keycode", editKey); | 289 | l = new QLabel("Q Keycode", editKey); |
290 | m_qvalues = new QComboBox(true, editKey); | 290 | m_qvalues = new QComboBox(true, editKey); |
291 | m_qvalues->setInsertionPolicy(QComboBox::AtTop); | 291 | m_qvalues->setInsertionPolicy(QComboBox::AtTop); |
292 | m_qvalues->setDuplicatesEnabled(false); | 292 | m_qvalues->setDuplicatesEnabled(false); |
293 | m_qvalues->insertItem(""); | 293 | m_qvalues->insertItem(""); |
294 | connect (m_qvalues, SIGNAL(textChanged(const QString &)), this, SLOT(slotChangeQCode(const QString&))); | 294 | connect (m_qvalues, SIGNAL(textChanged(const QString&)), this, SLOT(slotChangeQCode(const QString&))); |
295 | 295 | ||
296 | l = new QLabel("Unicode Value", editKey); | 296 | l = new QLabel("Unicode Value", editKey); |
297 | m_uniValues = new QComboBox(true, editKey); | 297 | m_uniValues = new QComboBox(true, editKey); |
298 | m_uniValues->setInsertionPolicy(QComboBox::AtTop); | 298 | m_uniValues->setInsertionPolicy(QComboBox::AtTop); |
299 | m_uniValues->setDuplicatesEnabled(false); | 299 | m_uniValues->setDuplicatesEnabled(false); |
300 | m_uniValues->insertItem(""); | 300 | m_uniValues->insertItem(""); |
301 | connect (m_uniValues, SIGNAL(textChanged(const QString &)), this, SLOT(slotChangeUnicode(const QString&))); | 301 | connect (m_uniValues, SIGNAL(textChanged(const QString&)), this, SLOT(slotChangeUnicode(const QString&))); |
302 | 302 | ||
303 | QVBoxLayout *root = new QVBoxLayout(this, 2); | 303 | QVBoxLayout *root = new QVBoxLayout(this, 2); |
304 | root->addWidget(kb); | 304 | root->addWidget(kb); |
305 | root->addWidget(dimentions); | 305 | root->addWidget(dimentions); |
306 | root->addWidget(editKey); | 306 | root->addWidget(editKey); |
307 | } | 307 | } |
308 | FunctionKeyboardConfig::~FunctionKeyboardConfig() { | 308 | FunctionKeyboardConfig::~FunctionKeyboardConfig() { |
309 | 309 | ||
310 | } | 310 | } |
311 | void FunctionKeyboardConfig::load (const Profile& prof) { | 311 | void FunctionKeyboardConfig::load (const Profile& prof) { |
312 | 312 | ||
313 | kb->keys.clear(); | 313 | kb->keys.clear(); |
314 | kb->loadDefaults(); | 314 | kb->loadDefaults(); |
315 | 315 | ||
316 | m_rowBox->setValue(prof.readNumEntry("keb_rows", 2)); | 316 | m_rowBox->setValue(prof.readNumEntry("keb_rows", 2)); |
317 | m_colBox->setValue(prof.readNumEntry("keb_cols", 10)); | 317 | m_colBox->setValue(prof.readNumEntry("keb_cols", 10)); |
318 | 318 | ||
319 | /* load all the keys to the keyboard */ | 319 | /* load all the keys to the keyboard */ |
320 | for (int i = 0; i <= m_rowBox->value() -1; i++) | 320 | for (int i = 0; i <= m_rowBox->value() -1; i++) |
321 | for (int j = 0; j <= m_colBox->value() -1; j++) { | 321 | for (int j = 0; j <= m_colBox->value() -1; j++) { |
322 | 322 | ||
323 | QString h = "r" + QString::number(i) + "c" + QString::number(j); | 323 | QString h = "r" + QString::number(i) + "c" + QString::number(j); |
324 | QString values = prof.readEntry("keb_" + h); | 324 | QString values = prof.readEntry("keb_" + h); |
325 | 325 | ||
326 | if (!values.isEmpty()) { | 326 | if (!values.isEmpty()) { |
327 | 327 | ||
328 | QStringList l = QStringList::split(QChar('|'), values, TRUE); | 328 | QStringList l = QStringList::split(QChar('|'), values, TRUE); |
329 | kb->keys[h] = FKey(l[0], l[1], l[2].toInt(), l[3].toInt()); | 329 | kb->keys[h] = FKey(l[0], l[1], l[2].toInt(), l[3].toInt()); |
330 | 330 | ||
331 | // load pixmap if used | 331 | // load pixmap if used |
332 | if (!l[1].isEmpty()) { | 332 | if (!l[1].isEmpty()) { |
333 | 333 | ||
334 | kb->keys[h].pix = new QPixmap( Resource::loadPixmap( "console/keys/" + l[1] ) ); | 334 | kb->keys[h].pix = new QPixmap( Resource::loadPixmap( "console/keys/" + l[1] ) ); |
335 | } | 335 | } |
336 | } | 336 | } |
337 | } | 337 | } |
338 | 338 | ||
339 | } | 339 | } |
340 | void FunctionKeyboardConfig::save (Profile& prof) { | 340 | void FunctionKeyboardConfig::save (Profile& prof) { |
341 | 341 | ||
342 | prof.writeEntry("keb_rows", m_rowBox->value()); | 342 | prof.writeEntry("keb_rows", m_rowBox->value()); |
343 | prof.writeEntry("keb_cols", m_colBox->value()); | 343 | prof.writeEntry("keb_cols", m_colBox->value()); |
344 | 344 | ||
345 | QMap<QString, FKey>::Iterator it; | 345 | QMap<QString, FKey>::Iterator it; |
346 | for ( it = kb->keys.begin(); it != kb->keys.end(); it++) { | 346 | for ( it = kb->keys.begin(); it != kb->keys.end(); it++) { |
347 | 347 | ||
348 | FKey k = it.data(); | 348 | FKey k = it.data(); |
349 | QString entry = k.label + "|" | 349 | QString entry = k.label + "|" |
350 | + k.pixFile + "|" | 350 | + k.pixFile + "|" |
351 | + QString::number(k.qcode) + "|" | 351 | + QString::number(k.qcode) + "|" |
352 | + QString::number(k.unicode); | 352 | + QString::number(k.unicode); |
353 | 353 | ||
354 | prof.writeEntry("keb_" + it.key(), entry); | 354 | prof.writeEntry("keb_" + it.key(), entry); |
355 | 355 | ||
356 | } | 356 | } |
357 | 357 | ||
358 | } | 358 | } |
359 | void FunctionKeyboardConfig::slotChangeRows(int r) { | 359 | void FunctionKeyboardConfig::slotChangeRows(int r) { |
360 | 360 | ||
361 | kb->changeRows(r); | 361 | kb->changeRows(r); |
362 | 362 | ||
363 | } | 363 | } |
364 | void FunctionKeyboardConfig::slotChangeCols(int c) { | 364 | void FunctionKeyboardConfig::slotChangeCols(int c) { |
365 | 365 | ||
366 | kb->changeCols(c); | 366 | kb->changeCols(c); |
367 | } | 367 | } |
368 | void FunctionKeyboardConfig::slotKeyPressed(FKey k, ushort r, ushort c, bool pressed) { | 368 | void FunctionKeyboardConfig::slotKeyPressed(FKey k, ushort r, ushort c, bool pressed) { |
369 | 369 | ||
370 | if (!pressed) return; | 370 | if (!pressed) return; |
371 | 371 | ||
372 | selectedHandle = "r" + QString::number(r) + | 372 | selectedHandle = "r" + QString::number(r) + |
373 | "c" + QString::number(c); | 373 | "c" + QString::number(c); |
374 | selectedRow = r; | 374 | selectedRow = r; |
375 | selectedCol = c; | 375 | selectedCol = c; |
376 | 376 | ||
377 | if (k.pixFile.isEmpty()) { | 377 | if (k.pixFile.isEmpty()) { |
378 | 378 | ||
379 | m_labels->setEditable(true); | 379 | m_labels->setEditable(true); |
380 | m_labels->setCurrentItem(0); | 380 | m_labels->setCurrentItem(0); |
381 | m_labels->changeItem(k.label, 0); | 381 | m_labels->changeItem(k.label, 0); |
382 | 382 | ||
383 | } else { | 383 | } else { |
384 | 384 | ||
385 | // any better way to select the pixmap? | 385 | // any better way to select the pixmap? |
386 | m_labels->setCurrentItem((m_labels->listBox())->index((m_labels->listBox())->findItem(kb->keys[selectedHandle].pixFile))); | 386 | m_labels->setCurrentItem((m_labels->listBox())->index((m_labels->listBox())->findItem(kb->keys[selectedHandle].pixFile))); |
387 | m_labels->setEditable(false); | 387 | m_labels->setEditable(false); |
388 | } | 388 | } |
389 | m_qvalues->changeItem(QString::number(k.qcode), 0); | 389 | m_qvalues->changeItem(QString::number(k.qcode), 0); |
390 | m_uniValues->changeItem(QString::number(k.unicode), 0); | 390 | m_uniValues->changeItem(QString::number(k.unicode), 0); |
391 | } | 391 | } |
392 | void FunctionKeyboardConfig::slotChangeIcon(int index) { | 392 | void FunctionKeyboardConfig::slotChangeIcon(int index) { |
393 | 393 | ||
394 | if (index == 0) { | 394 | if (index == 0) { |
395 | 395 | ||
396 | // is text | 396 | // is text |
397 | m_labels->setEditable(true); | 397 | m_labels->setEditable(true); |
diff --git a/noncore/apps/opie-console/io_bt.cpp b/noncore/apps/opie-console/io_bt.cpp index 37bf797..1a8c979 100644 --- a/noncore/apps/opie-console/io_bt.cpp +++ b/noncore/apps/opie-console/io_bt.cpp | |||
@@ -1,92 +1,92 @@ | |||
1 | 1 | ||
2 | #include "io_bt.h" | 2 | #include "io_bt.h" |
3 | 3 | ||
4 | IOBt::IOBt( const Profile &config ) : IOSerial( config ) { | 4 | IOBt::IOBt( const Profile &config ) : IOSerial( config ) { |
5 | m_attach = 0; | 5 | m_attach = 0; |
6 | } | 6 | } |
7 | 7 | ||
8 | 8 | ||
9 | IOBt::~IOBt() { | 9 | IOBt::~IOBt() { |
10 | if ( m_attach ) { | 10 | if ( m_attach ) { |
11 | delete m_attach; | 11 | delete m_attach; |
12 | } | 12 | } |
13 | } | 13 | } |
14 | 14 | ||
15 | 15 | ||
16 | void IOBt::close() { | 16 | void IOBt::close() { |
17 | 17 | ||
18 | IOSerial::close(); | 18 | IOSerial::close(); |
19 | // still need error handling | 19 | // still need error handling |
20 | if ( m_attach ) { | 20 | if ( m_attach ) { |
21 | delete m_attach; | 21 | delete m_attach; |
22 | m_attach = 0; | 22 | m_attach = 0; |
23 | } | 23 | } |
24 | } | 24 | } |
25 | 25 | ||
26 | bool IOBt::open() { | 26 | bool IOBt::open() { |
27 | bool ret = false; | 27 | bool ret = false; |
28 | 28 | ||
29 | // only set up bt stuff if mac address was set, otherwise use the device set | 29 | // only set up bt stuff if mac address was set, otherwise use the device set |
30 | if ( !m_mac.isEmpty() ) { | 30 | if ( !m_mac.isEmpty() ) { |
31 | 31 | ||
32 | // now it should also be checked, if there is a connection to the device with that mac allready | 32 | // now it should also be checked, if there is a connection to the device with that mac allready |
33 | // hciattach here | 33 | // hciattach here |
34 | m_attach = new OProcess(); | 34 | m_attach = new OProcess(); |
35 | *m_attach << "hciattach /dev/ttyS2 any 57600"; | 35 | *m_attach << "hciattach /dev/ttyS2 any 57600"; |
36 | 36 | ||
37 | // then start hcid, then rcfomm handling (m_mac) | 37 | // then start hcid, then rcfomm handling (m_mac) |
38 | 38 | ||
39 | connect( m_attach, SIGNAL( processExited( OProcess* ) ), | 39 | connect( m_attach, SIGNAL( processExited(OProcess*) ), |
40 | this, SLOT( slotExited( OProcess* ) ) ); | 40 | this, SLOT( slotExited(OProcess*) ) ); |
41 | 41 | ||
42 | if ( m_attach->start() ) { | 42 | if ( m_attach->start() ) { |
43 | ret = IOSerial::open(); | 43 | ret = IOSerial::open(); |
44 | } else { | 44 | } else { |
45 | qWarning("could not attach to device"); | 45 | qWarning("could not attach to device"); |
46 | delete m_attach; | 46 | delete m_attach; |
47 | m_attach = 0; | 47 | m_attach = 0; |
48 | } | 48 | } |
49 | } else { | 49 | } else { |
50 | // directly to the normal serial | 50 | // directly to the normal serial |
51 | // TODO: look first if the connection really exists. ( is set up ) | 51 | // TODO: look first if the connection really exists. ( is set up ) |
52 | 52 | ||
53 | ret =IOSerial::open(); | 53 | ret =IOSerial::open(); |
54 | } | 54 | } |
55 | return ret; | 55 | return ret; |
56 | } | 56 | } |
57 | 57 | ||
58 | void IOBt::reload( const Profile &config ) { | 58 | void IOBt::reload( const Profile &config ) { |
59 | m_device = config.readEntry("Device", BT_DEFAULT_DEVICE); | 59 | m_device = config.readEntry("Device", BT_DEFAULT_DEVICE); |
60 | m_mac = config.readEntry("Mac", BT_DEFAULT_MAC); | 60 | m_mac = config.readEntry("Mac", BT_DEFAULT_MAC); |
61 | m_baud = config.readNumEntry("Baud", BT_DEFAULT_BAUD); | 61 | m_baud = config.readNumEntry("Baud", BT_DEFAULT_BAUD); |
62 | m_parity = config.readNumEntry("Parity", BT_DEFAULT_PARITY); | 62 | m_parity = config.readNumEntry("Parity", BT_DEFAULT_PARITY); |
63 | m_dbits = config.readNumEntry("DataBits", BT_DEFAULT_DBITS); | 63 | m_dbits = config.readNumEntry("DataBits", BT_DEFAULT_DBITS); |
64 | m_sbits = config.readNumEntry("StopBits", BT_DEFAULT_SBITS); | 64 | m_sbits = config.readNumEntry("StopBits", BT_DEFAULT_SBITS); |
65 | m_flow = config.readNumEntry("Flow", BT_DEFAULT_FLOW); | 65 | m_flow = config.readNumEntry("Flow", BT_DEFAULT_FLOW); |
66 | } | 66 | } |
67 | 67 | ||
68 | 68 | ||
69 | QString IOBt::identifier() const { | 69 | QString IOBt::identifier() const { |
70 | return "bluetooth"; | 70 | return "bluetooth"; |
71 | } | 71 | } |
72 | 72 | ||
73 | QString IOBt::name() const { | 73 | QString IOBt::name() const { |
74 | return "BLuetooth IO Layer"; | 74 | return "BLuetooth IO Layer"; |
75 | } | 75 | } |
76 | 76 | ||
77 | void IOBt::slotExited( OProcess* proc ){ | 77 | void IOBt::slotExited( OProcess* proc ){ |
78 | close(); | 78 | close(); |
79 | delete proc; | 79 | delete proc; |
80 | } | 80 | } |
81 | 81 | ||
82 | QBitArray IOBt::supports() const { | 82 | QBitArray IOBt::supports() const { |
83 | return QBitArray( 3 ); | 83 | return QBitArray( 3 ); |
84 | } | 84 | } |
85 | 85 | ||
86 | bool IOBt::isConnected() { | 86 | bool IOBt::isConnected() { |
87 | return false; | 87 | return false; |
88 | } | 88 | } |
89 | 89 | ||
90 | void IOBt::send(const QByteArray &data) { | 90 | void IOBt::send(const QByteArray &data) { |
91 | qDebug( "Please overload me..." ); | 91 | qDebug( "Please overload me..." ); |
92 | } | 92 | } |
diff --git a/noncore/apps/opie-console/io_irda.cpp b/noncore/apps/opie-console/io_irda.cpp index e360fb4..b281b7d 100644 --- a/noncore/apps/opie-console/io_irda.cpp +++ b/noncore/apps/opie-console/io_irda.cpp | |||
@@ -1,77 +1,77 @@ | |||
1 | 1 | ||
2 | #include "io_irda.h" | 2 | #include "io_irda.h" |
3 | 3 | ||
4 | IOIrda::IOIrda( const Profile &config ) : IOSerial( config ) { | 4 | IOIrda::IOIrda( const Profile &config ) : IOSerial( config ) { |
5 | m_attach = 0; | 5 | m_attach = 0; |
6 | } | 6 | } |
7 | 7 | ||
8 | 8 | ||
9 | IOIrda::~IOIrda() { | 9 | IOIrda::~IOIrda() { |
10 | if ( m_attach ) { | 10 | if ( m_attach ) { |
11 | delete m_attach; | 11 | delete m_attach; |
12 | } | 12 | } |
13 | } | 13 | } |
14 | 14 | ||
15 | 15 | ||
16 | void IOIrda::close() { | 16 | void IOIrda::close() { |
17 | 17 | ||
18 | IOSerial::close(); | 18 | IOSerial::close(); |
19 | // still need error handling | 19 | // still need error handling |
20 | delete m_attach; | 20 | delete m_attach; |
21 | } | 21 | } |
22 | 22 | ||
23 | bool IOIrda::open() { | 23 | bool IOIrda::open() { |
24 | bool ret; | 24 | bool ret; |
25 | 25 | ||
26 | // irdaattach here | 26 | // irdaattach here |
27 | m_attach = new OProcess(); | 27 | m_attach = new OProcess(); |
28 | *m_attach << "irattach /dev/ttyS2 -s"; | 28 | *m_attach << "irattach /dev/ttyS2 -s"; |
29 | 29 | ||
30 | connect( m_attach, SIGNAL( processExited( OProcess* ) ), | 30 | connect( m_attach, SIGNAL( processExited(OProcess*) ), |
31 | this, SLOT( slotExited( OProcess* ) ) ); | 31 | this, SLOT( slotExited(OProcess*) ) ); |
32 | 32 | ||
33 | if ( m_attach->start() ) { | 33 | if ( m_attach->start() ) { |
34 | ret= IOSerial::open(); | 34 | ret= IOSerial::open(); |
35 | } else { | 35 | } else { |
36 | // emit error!!! | 36 | // emit error!!! |
37 | qWarning("could not attach to device"); | 37 | qWarning("could not attach to device"); |
38 | delete m_attach; | 38 | delete m_attach; |
39 | m_attach = 0l; | 39 | m_attach = 0l; |
40 | } | 40 | } |
41 | return ret; | 41 | return ret; |
42 | } | 42 | } |
43 | 43 | ||
44 | void IOIrda::reload( const Profile &config ) { | 44 | void IOIrda::reload( const Profile &config ) { |
45 | m_device = config.readEntry("Device", IRDA_DEFAULT_DEVICE); | 45 | m_device = config.readEntry("Device", IRDA_DEFAULT_DEVICE); |
46 | m_baud = config.readNumEntry("Baud", IRDA_DEFAULT_BAUD); | 46 | m_baud = config.readNumEntry("Baud", IRDA_DEFAULT_BAUD); |
47 | m_parity = config.readNumEntry("Parity", IRDA_DEFAULT_PARITY); | 47 | m_parity = config.readNumEntry("Parity", IRDA_DEFAULT_PARITY); |
48 | m_dbits = config.readNumEntry("DataBits", IRDA_DEFAULT_DBITS); | 48 | m_dbits = config.readNumEntry("DataBits", IRDA_DEFAULT_DBITS); |
49 | m_sbits = config.readNumEntry("StopBits", IRDA_DEFAULT_SBITS); | 49 | m_sbits = config.readNumEntry("StopBits", IRDA_DEFAULT_SBITS); |
50 | m_flow = config.readNumEntry("Flow", IRDA_DEFAULT_FLOW); | 50 | m_flow = config.readNumEntry("Flow", IRDA_DEFAULT_FLOW); |
51 | } | 51 | } |
52 | 52 | ||
53 | 53 | ||
54 | QString IOIrda::identifier() const { | 54 | QString IOIrda::identifier() const { |
55 | return "irda"; | 55 | return "irda"; |
56 | } | 56 | } |
57 | 57 | ||
58 | QString IOIrda::name() const { | 58 | QString IOIrda::name() const { |
59 | return "Irda IO Layer"; | 59 | return "Irda IO Layer"; |
60 | } | 60 | } |
61 | 61 | ||
62 | void IOIrda::slotExited(OProcess* proc ){ | 62 | void IOIrda::slotExited(OProcess* proc ){ |
63 | close(); | 63 | close(); |
64 | delete proc; | 64 | delete proc; |
65 | } | 65 | } |
66 | 66 | ||
67 | QBitArray IOIrda::supports()const { | 67 | QBitArray IOIrda::supports()const { |
68 | return QBitArray( 3 ); | 68 | return QBitArray( 3 ); |
69 | } | 69 | } |
70 | 70 | ||
71 | bool IOIrda::isConnected() { | 71 | bool IOIrda::isConnected() { |
72 | return false; | 72 | return false; |
73 | } | 73 | } |
74 | 74 | ||
75 | void IOIrda::send(const QByteArray &data) { | 75 | void IOIrda::send(const QByteArray &data) { |
76 | qDebug( "Please overload me..." ); | 76 | qDebug( "Please overload me..." ); |
77 | } | 77 | } |
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp index 1d2385f..197f799 100644 --- a/noncore/apps/opie-console/mainwindow.cpp +++ b/noncore/apps/opie-console/mainwindow.cpp | |||
@@ -117,232 +117,232 @@ void MainWindow::initUI() { | |||
117 | connect( m_quickLaunch, SIGNAL( activated() ), | 117 | connect( m_quickLaunch, SIGNAL( activated() ), |
118 | this, SLOT( slotQuickLaunch() ) ); | 118 | this, SLOT( slotQuickLaunch() ) ); |
119 | 119 | ||
120 | QWhatsThis::add( m_icons, tr( "The shell button launches the \"default\" profile. If there is none default values are taken" ) ); | 120 | QWhatsThis::add( m_icons, tr( "The shell button launches the \"default\" profile. If there is none default values are taken" ) ); |
121 | 121 | ||
122 | m_transfer = new QAction( tr("Transfer file..."), Resource::loadPixmap("pass") , QString::null, | 122 | m_transfer = new QAction( tr("Transfer file..."), Resource::loadPixmap("pass") , QString::null, |
123 | 0, this, 0 ); | 123 | 0, this, 0 ); |
124 | m_transfer->addTo( m_console ); | 124 | m_transfer->addTo( m_console ); |
125 | connect(m_transfer, SIGNAL(activated() ), | 125 | connect(m_transfer, SIGNAL(activated() ), |
126 | this, SLOT(slotTransfer() ) ); | 126 | this, SLOT(slotTransfer() ) ); |
127 | 127 | ||
128 | 128 | ||
129 | 129 | ||
130 | /* | 130 | /* |
131 | * immediate change of line wrap policy | 131 | * immediate change of line wrap policy |
132 | */ | 132 | */ |
133 | m_isWrapped = false; | 133 | m_isWrapped = false; |
134 | m_wrap = new QAction( tr("Line wrap"), Resource::loadPixmap( "linewrap" ), QString::null, 0, this, 0 ); | 134 | m_wrap = new QAction( tr("Line wrap"), Resource::loadPixmap( "linewrap" ), QString::null, 0, this, 0 ); |
135 | m_wrap->addTo( m_console ); | 135 | m_wrap->addTo( m_console ); |
136 | connect( m_wrap, SIGNAL( activated() ), SLOT( slotWrap() ) ); | 136 | connect( m_wrap, SIGNAL( activated() ), SLOT( slotWrap() ) ); |
137 | 137 | ||
138 | /* | 138 | /* |
139 | * fullscreen | 139 | * fullscreen |
140 | */ | 140 | */ |
141 | m_isFullscreen = false; | 141 | m_isFullscreen = false; |
142 | 142 | ||
143 | m_fullscreen = new QAction( tr("Full screen"), Resource::loadPixmap( "fullscreen" ) | 143 | m_fullscreen = new QAction( tr("Full screen"), Resource::loadPixmap( "fullscreen" ) |
144 | , QString::null, 0, this, 0); | 144 | , QString::null, 0, this, 0); |
145 | m_fullscreen->addTo( m_console ); | 145 | m_fullscreen->addTo( m_console ); |
146 | connect( m_fullscreen, SIGNAL( activated() ), | 146 | connect( m_fullscreen, SIGNAL( activated() ), |
147 | this, SLOT( slotFullscreen() ) ); | 147 | this, SLOT( slotFullscreen() ) ); |
148 | 148 | ||
149 | m_console->insertSeparator(); | 149 | m_console->insertSeparator(); |
150 | 150 | ||
151 | QAction *a = new QAction(); | 151 | QAction *a = new QAction(); |
152 | a->setText( tr("Save history") ); | 152 | a->setText( tr("Save history") ); |
153 | a->addTo( m_console ); | 153 | a->addTo( m_console ); |
154 | connect(a, SIGNAL(activated() ), | 154 | connect(a, SIGNAL(activated() ), |
155 | this, SLOT(slotSaveHistory() ) ); | 155 | this, SLOT(slotSaveHistory() ) ); |
156 | /* | 156 | /* |
157 | * terminate action | 157 | * terminate action |
158 | */ | 158 | */ |
159 | m_terminate = new QAction(); | 159 | m_terminate = new QAction(); |
160 | m_terminate->setText( tr("Terminate") ); | 160 | m_terminate->setText( tr("Terminate") ); |
161 | m_terminate->addTo( m_console ); | 161 | m_terminate->addTo( m_console ); |
162 | connect(m_terminate, SIGNAL(activated() ), | 162 | connect(m_terminate, SIGNAL(activated() ), |
163 | this, SLOT(slotTerminate() ) ); | 163 | this, SLOT(slotTerminate() ) ); |
164 | 164 | ||
165 | m_closewindow = new QAction(); | 165 | m_closewindow = new QAction(); |
166 | m_closewindow->setText( tr("Close Window") ); | 166 | m_closewindow->setText( tr("Close Window") ); |
167 | m_closewindow->addTo( m_console ); | 167 | m_closewindow->addTo( m_console ); |
168 | connect( m_closewindow, SIGNAL(activated() ), | 168 | connect( m_closewindow, SIGNAL(activated() ), |
169 | this, SLOT(slotClose() ) ); | 169 | this, SLOT(slotClose() ) ); |
170 | 170 | ||
171 | 171 | ||
172 | /* | 172 | /* |
173 | * script actions | 173 | * script actions |
174 | */ | 174 | */ |
175 | m_runScript_id = m_scripts->insertItem(tr("Run Script"), m_scriptsPop, -1, 0); | 175 | m_runScript_id = m_scripts->insertItem(tr("Run Script"), m_scriptsPop, -1, 0); |
176 | connect(m_scriptsPop, SIGNAL(activated(int)), this, SLOT(slotRunScript(int))); | 176 | connect(m_scriptsPop, SIGNAL(activated(int)), this, SLOT(slotRunScript(int))); |
177 | 177 | ||
178 | m_recordScript = new QAction(tr("Record Script"), QString::null, 0, this, 0); | 178 | m_recordScript = new QAction(tr("Record Script"), QString::null, 0, this, 0); |
179 | m_recordScript->addTo(m_scripts); | 179 | m_recordScript->addTo(m_scripts); |
180 | connect(m_recordScript, SIGNAL(activated()), this, SLOT(slotRecordScript())); | 180 | connect(m_recordScript, SIGNAL(activated()), this, SLOT(slotRecordScript())); |
181 | 181 | ||
182 | m_saveScript = new QAction(tr("Save Script"), QString::null, 0, this, 0); | 182 | m_saveScript = new QAction(tr("Save Script"), QString::null, 0, this, 0); |
183 | m_saveScript->addTo(m_scripts); | 183 | m_saveScript->addTo(m_scripts); |
184 | connect(m_saveScript, SIGNAL(activated()), this, SLOT(slotSaveScript())); | 184 | connect(m_saveScript, SIGNAL(activated()), this, SLOT(slotSaveScript())); |
185 | 185 | ||
186 | 186 | ||
187 | /* | 187 | /* |
188 | * action that open/closes the keyboard | 188 | * action that open/closes the keyboard |
189 | */ | 189 | */ |
190 | m_openKeys = new QAction (tr("Open Keyboard..."), | 190 | m_openKeys = new QAction (tr("Open Keyboard..."), |
191 | Resource::loadPixmap( "console/keys/keyboard_icon" ), | 191 | Resource::loadPixmap( "console/keys/keyboard_icon" ), |
192 | QString::null, 0, this, 0); | 192 | QString::null, 0, this, 0); |
193 | m_openKeys->setToggleAction(true); | 193 | m_openKeys->setToggleAction(true); |
194 | connect (m_openKeys, SIGNAL(toggled(bool)), this, SLOT(slotOpenKeb(bool))); | 194 | connect (m_openKeys, SIGNAL(toggled(bool)), this, SLOT(slotOpenKeb(bool))); |
195 | 195 | ||
196 | /* insert the submenu */ | 196 | /* insert the submenu */ |
197 | m_console->insertItem(tr("New from Profile"), m_sessionsPop, | 197 | m_console->insertItem(tr("New from Profile"), m_sessionsPop, |
198 | -1, 0); | 198 | -1, 0); |
199 | 199 | ||
200 | /* insert the connection menu */ | 200 | /* insert the connection menu */ |
201 | m_bar->insertItem( tr("Connection"), m_console ); | 201 | m_bar->insertItem( tr("Connection"), m_console ); |
202 | 202 | ||
203 | /* the scripts menu */ | 203 | /* the scripts menu */ |
204 | m_bar->insertItem( tr("Scripts"), m_scripts ); | 204 | m_bar->insertItem( tr("Scripts"), m_scripts ); |
205 | 205 | ||
206 | /* and the keyboard */ | 206 | /* and the keyboard */ |
207 | m_keyBar = new QToolBar(this); | 207 | m_keyBar = new QToolBar(this); |
208 | addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE ); | 208 | addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE ); |
209 | m_keyBar->setHorizontalStretchable( TRUE ); | 209 | m_keyBar->setHorizontalStretchable( TRUE ); |
210 | m_keyBar->hide(); | 210 | m_keyBar->hide(); |
211 | 211 | ||
212 | m_kb = new FunctionKeyboard(m_keyBar); | 212 | m_kb = new FunctionKeyboard(m_keyBar); |
213 | connect(m_kb, SIGNAL(keyPressed(FKey, ushort, ushort, bool)), | 213 | connect(m_kb, SIGNAL(keyPressed(FKey,ushort,ushort,bool)), |
214 | this, SLOT(slotKeyReceived(FKey, ushort, ushort, bool))); | 214 | this, SLOT(slotKeyReceived(FKey,ushort,ushort,bool))); |
215 | 215 | ||
216 | 216 | ||
217 | a = new QAction(tr("Copy"), | 217 | a = new QAction(tr("Copy"), |
218 | Resource::loadPixmap("copy"), QString::null, | 218 | Resource::loadPixmap("copy"), QString::null, |
219 | 0, this, 0 ); | 219 | 0, this, 0 ); |
220 | //a->addTo( m_icons ); | 220 | //a->addTo( m_icons ); |
221 | connect( a, SIGNAL(activated() ), | 221 | connect( a, SIGNAL(activated() ), |
222 | this, SLOT(slotCopy() ) ); | 222 | this, SLOT(slotCopy() ) ); |
223 | 223 | ||
224 | QAction *paste = new QAction(tr("Paste"), | 224 | QAction *paste = new QAction(tr("Paste"), |
225 | Resource::loadPixmap("paste"), QString::null, | 225 | Resource::loadPixmap("paste"), QString::null, |
226 | 0, this, 0 ); | 226 | 0, this, 0 ); |
227 | connect( paste, SIGNAL(activated() ), | 227 | connect( paste, SIGNAL(activated() ), |
228 | this, SLOT(slotPaste() ) ); | 228 | this, SLOT(slotPaste() ) ); |
229 | 229 | ||
230 | 230 | ||
231 | newCon->addTo( m_icons ); | 231 | newCon->addTo( m_icons ); |
232 | //m_setProfiles->addTo( m_icons ); | 232 | //m_setProfiles->addTo( m_icons ); |
233 | paste->addTo( m_icons ); | 233 | paste->addTo( m_icons ); |
234 | m_openKeys->addTo(m_icons); | 234 | m_openKeys->addTo(m_icons); |
235 | m_fullscreen->addTo( m_icons ); | 235 | m_fullscreen->addTo( m_icons ); |
236 | 236 | ||
237 | m_connect->setEnabled( false ); | 237 | m_connect->setEnabled( false ); |
238 | m_disconnect->setEnabled( false ); | 238 | m_disconnect->setEnabled( false ); |
239 | m_terminate->setEnabled( false ); | 239 | m_terminate->setEnabled( false ); |
240 | m_transfer->setEnabled( false ); | 240 | m_transfer->setEnabled( false ); |
241 | m_scripts->setItemEnabled(m_runScript_id, false); | 241 | m_scripts->setItemEnabled(m_runScript_id, false); |
242 | m_recordScript->setEnabled( false ); | 242 | m_recordScript->setEnabled( false ); |
243 | m_saveScript->setEnabled( false ); | 243 | m_saveScript->setEnabled( false ); |
244 | m_fullscreen->setEnabled( false ); | 244 | m_fullscreen->setEnabled( false ); |
245 | m_closewindow->setEnabled( false ); | 245 | m_closewindow->setEnabled( false ); |
246 | m_wrap->setEnabled( false ); | 246 | m_wrap->setEnabled( false ); |
247 | 247 | ||
248 | /* | 248 | /* |
249 | * connect to the menu activation | 249 | * connect to the menu activation |
250 | */ | 250 | */ |
251 | connect( m_sessionsPop, SIGNAL(activated( int ) ), | 251 | connect( m_sessionsPop, SIGNAL(activated(int) ), |
252 | this, SLOT(slotProfile( int ) ) ); | 252 | this, SLOT(slotProfile(int) ) ); |
253 | 253 | ||
254 | m_consoleWindow = new TabWidget( this, "blah"); | 254 | m_consoleWindow = new TabWidget( this, "blah"); |
255 | connect(m_consoleWindow, SIGNAL(activated(Session*) ), | 255 | connect(m_consoleWindow, SIGNAL(activated(Session*) ), |
256 | this, SLOT(slotSessionChanged(Session*) ) ); | 256 | this, SLOT(slotSessionChanged(Session*) ) ); |
257 | setCentralWidget( m_consoleWindow ); | 257 | setCentralWidget( m_consoleWindow ); |
258 | 258 | ||
259 | slotQuickLaunch(); | 259 | slotQuickLaunch(); |
260 | } | 260 | } |
261 | 261 | ||
262 | ProfileManager* MainWindow::manager() { | 262 | ProfileManager* MainWindow::manager() { |
263 | return m_manager; | 263 | return m_manager; |
264 | } | 264 | } |
265 | TabWidget* MainWindow::tabWidget() { | 265 | TabWidget* MainWindow::tabWidget() { |
266 | return m_consoleWindow; | 266 | return m_consoleWindow; |
267 | } | 267 | } |
268 | void MainWindow::populateProfiles() { | 268 | void MainWindow::populateProfiles() { |
269 | m_sessionsPop->clear(); | 269 | m_sessionsPop->clear(); |
270 | Profile::ValueList list = manager()->all(); | 270 | Profile::ValueList list = manager()->all(); |
271 | for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) { | 271 | for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) { |
272 | m_sessionsPop->insertItem( (*it).name() ); | 272 | m_sessionsPop->insertItem( (*it).name() ); |
273 | } | 273 | } |
274 | 274 | ||
275 | } | 275 | } |
276 | 276 | ||
277 | void MainWindow::populateScripts() { | 277 | void MainWindow::populateScripts() { |
278 | m_scriptsPop->clear(); | 278 | m_scriptsPop->clear(); |
279 | m_scriptsData.clear(); | 279 | m_scriptsData.clear(); |
280 | DocLnkSet files(QPEApplication::documentDir(), "text/plain"); | 280 | DocLnkSet files(QPEApplication::documentDir(), "text/plain"); |
281 | QListIterator<DocLnk> dit(files.children()); | 281 | QListIterator<DocLnk> dit(files.children()); |
282 | for (; dit.current(); ++dit) { | 282 | for (; dit.current(); ++dit) { |
283 | if (*dit && (*dit)->name().length()>0) { | 283 | if (*dit && (*dit)->name().length()>0) { |
284 | QFileInfo info((*dit)->file()); | 284 | QFileInfo info((*dit)->file()); |
285 | if (info.extension(false) == "script") { | 285 | if (info.extension(false) == "script") { |
286 | m_scriptsData.append(new DocLnk(**dit)); | 286 | m_scriptsData.append(new DocLnk(**dit)); |
287 | m_scriptsPop->insertItem((*dit)->name()); | 287 | m_scriptsPop->insertItem((*dit)->name()); |
288 | } | 288 | } |
289 | } | 289 | } |
290 | } | 290 | } |
291 | 291 | ||
292 | } | 292 | } |
293 | 293 | ||
294 | MainWindow::~MainWindow() { | 294 | MainWindow::~MainWindow() { |
295 | delete m_factory; | 295 | delete m_factory; |
296 | manager()->save(); | 296 | manager()->save(); |
297 | } | 297 | } |
298 | 298 | ||
299 | MetaFactory* MainWindow::factory() { | 299 | MetaFactory* MainWindow::factory() { |
300 | return m_factory; | 300 | return m_factory; |
301 | } | 301 | } |
302 | 302 | ||
303 | Session* MainWindow::currentSession() { | 303 | Session* MainWindow::currentSession() { |
304 | return m_curSession; | 304 | return m_curSession; |
305 | } | 305 | } |
306 | 306 | ||
307 | QList<Session> MainWindow::sessions() { | 307 | QList<Session> MainWindow::sessions() { |
308 | return m_sessions; | 308 | return m_sessions; |
309 | } | 309 | } |
310 | 310 | ||
311 | void MainWindow::slotNew() { | 311 | void MainWindow::slotNew() { |
312 | ProfileEditorDialog dlg(factory() ); | 312 | ProfileEditorDialog dlg(factory() ); |
313 | dlg.setCaption( tr("New Connection") ); | 313 | dlg.setCaption( tr("New Connection") ); |
314 | int ret = QPEApplication::execDialog( &dlg ); | 314 | int ret = QPEApplication::execDialog( &dlg ); |
315 | 315 | ||
316 | if ( ret == QDialog::Accepted ) { | 316 | if ( ret == QDialog::Accepted ) { |
317 | create( dlg.profile() ); | 317 | create( dlg.profile() ); |
318 | } | 318 | } |
319 | } | 319 | } |
320 | 320 | ||
321 | void MainWindow::slotRecordScript() { | 321 | void MainWindow::slotRecordScript() { |
322 | if (currentSession()) { | 322 | if (currentSession()) { |
323 | currentSession()->emulationHandler()->startRecording(); | 323 | currentSession()->emulationHandler()->startRecording(); |
324 | m_saveScript->setEnabled(true); | 324 | m_saveScript->setEnabled(true); |
325 | m_recordScript->setEnabled(false); | 325 | m_recordScript->setEnabled(false); |
326 | } | 326 | } |
327 | } | 327 | } |
328 | 328 | ||
329 | void MainWindow::slotSaveScript() { | 329 | void MainWindow::slotSaveScript() { |
330 | if (currentSession() && currentSession()->emulationHandler()->isRecording()) { | 330 | if (currentSession() && currentSession()->emulationHandler()->isRecording()) { |
331 | QMap<QString, QStringList> map; | 331 | QMap<QString, QStringList> map; |
332 | QStringList text; | 332 | QStringList text; |
333 | text << "text/plain"; | 333 | text << "text/plain"; |
334 | map.insert(tr("Script"), text ); | 334 | map.insert(tr("Script"), text ); |
335 | QString filename = Opie::OFileDialog::getSaveFileName(2, QPEApplication::documentDir(), QString::null, map); | 335 | QString filename = Opie::OFileDialog::getSaveFileName(2, QPEApplication::documentDir(), QString::null, map); |
336 | if (!filename.isEmpty()) { | 336 | if (!filename.isEmpty()) { |
337 | QFileInfo info(filename); | 337 | QFileInfo info(filename); |
338 | if (info.extension(FALSE) != "script") | 338 | if (info.extension(FALSE) != "script") |
339 | filename += ".script"; | 339 | filename += ".script"; |
340 | DocLnk nf; | 340 | DocLnk nf; |
341 | nf.setType("text/plain"); | 341 | nf.setType("text/plain"); |
342 | nf.setFile(filename); | 342 | nf.setFile(filename); |
343 | nf.setName(info.fileName()); | 343 | nf.setName(info.fileName()); |
344 | FileManager fm; | 344 | FileManager fm; |
345 | fm.saveFile(nf, currentSession()->emulationHandler()->script()->script()); | 345 | fm.saveFile(nf, currentSession()->emulationHandler()->script()->script()); |
346 | currentSession()->emulationHandler()->clearScript(); | 346 | currentSession()->emulationHandler()->clearScript(); |
347 | m_saveScript->setEnabled(false); | 347 | m_saveScript->setEnabled(false); |
348 | m_recordScript->setEnabled(true); | 348 | m_recordScript->setEnabled(true); |
diff --git a/noncore/apps/opie-console/profileeditordialog.cpp b/noncore/apps/opie-console/profileeditordialog.cpp index 979e89d..6e1e23e 100644 --- a/noncore/apps/opie-console/profileeditordialog.cpp +++ b/noncore/apps/opie-console/profileeditordialog.cpp | |||
@@ -38,196 +38,196 @@ ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact ) | |||
38 | 38 | ||
39 | initUI(); | 39 | initUI(); |
40 | 40 | ||
41 | // Apply current profile | 41 | // Apply current profile |
42 | // plugin_plugin->load(profile); | 42 | // plugin_plugin->load(profile); |
43 | } | 43 | } |
44 | 44 | ||
45 | Profile ProfileEditorDialog::profile() const | 45 | Profile ProfileEditorDialog::profile() const |
46 | { | 46 | { |
47 | return m_prof; | 47 | return m_prof; |
48 | } | 48 | } |
49 | 49 | ||
50 | void ProfileEditorDialog::initUI() | 50 | void ProfileEditorDialog::initUI() |
51 | { | 51 | { |
52 | m_con = m_term = m_key = 0l; | 52 | m_con = m_term = m_key = 0l; |
53 | 53 | ||
54 | 54 | ||
55 | QVBoxLayout *mainLayout = new QVBoxLayout( this ); | 55 | QVBoxLayout *mainLayout = new QVBoxLayout( this ); |
56 | tabWidget = new OTabWidget( this ); | 56 | tabWidget = new OTabWidget( this ); |
57 | tabWidget->setTabStyle(OTabWidget::TextTab); | 57 | tabWidget->setTabStyle(OTabWidget::TextTab); |
58 | mainLayout->add(tabWidget); | 58 | mainLayout->add(tabWidget); |
59 | 59 | ||
60 | /* base tabs */ | 60 | /* base tabs */ |
61 | tabprof = new QWidget(this); | 61 | tabprof = new QWidget(this); |
62 | m_tabTerm = new QWidget(this); | 62 | m_tabTerm = new QWidget(this); |
63 | m_tabCon = new QWidget(this); | 63 | m_tabCon = new QWidget(this); |
64 | m_tabKey = new QWidget(this); | 64 | m_tabKey = new QWidget(this); |
65 | 65 | ||
66 | m_svCon = new QScrollView( m_tabCon ); | 66 | m_svCon = new QScrollView( m_tabCon ); |
67 | m_svCon->setResizePolicy( QScrollView::AutoOneFit ); | 67 | m_svCon->setResizePolicy( QScrollView::AutoOneFit ); |
68 | //m_svCon->setHScrollBarMode( QScrollView::AlwaysOff ); | 68 | //m_svCon->setHScrollBarMode( QScrollView::AlwaysOff ); |
69 | m_svCon->setFrameShape( QFrame::NoFrame ); | 69 | m_svCon->setFrameShape( QFrame::NoFrame ); |
70 | m_svTerm = new QScrollView( m_tabTerm ); | 70 | m_svTerm = new QScrollView( m_tabTerm ); |
71 | m_svTerm->setResizePolicy( QScrollView::AutoOneFit ); | 71 | m_svTerm->setResizePolicy( QScrollView::AutoOneFit ); |
72 | //m_svTerm->setHScrollBarMode( QScrollView::AlwaysOff ); | 72 | //m_svTerm->setHScrollBarMode( QScrollView::AlwaysOff ); |
73 | m_svTerm->setFrameShape( QFrame::NoFrame ); | 73 | m_svTerm->setFrameShape( QFrame::NoFrame ); |
74 | 74 | ||
75 | /* base layout for tabs */ | 75 | /* base layout for tabs */ |
76 | m_layCon = new QHBoxLayout( m_tabCon , 2 ); | 76 | m_layCon = new QHBoxLayout( m_tabCon , 2 ); |
77 | m_layTerm = new QHBoxLayout( m_tabTerm, 2 ); | 77 | m_layTerm = new QHBoxLayout( m_tabTerm, 2 ); |
78 | m_layKey = new QHBoxLayout( m_tabKey, 2 ); | 78 | m_layKey = new QHBoxLayout( m_tabKey, 2 ); |
79 | 79 | ||
80 | m_layCon->addWidget( m_svCon ); | 80 | m_layCon->addWidget( m_svCon ); |
81 | m_layTerm->addWidget( m_svTerm ); | 81 | m_layTerm->addWidget( m_svTerm ); |
82 | 82 | ||
83 | // profile tab | 83 | // profile tab |
84 | 84 | ||
85 | QLabel *name = new QLabel(QObject::tr("Profile name"), tabprof); | 85 | QLabel *name = new QLabel(QObject::tr("Profile name"), tabprof); |
86 | m_name = new QLineEdit(tabprof); | 86 | m_name = new QLineEdit(tabprof); |
87 | QLabel *con = new QLabel(tr("Connection"), tabprof ); | 87 | QLabel *con = new QLabel(tr("Connection"), tabprof ); |
88 | QLabel *term = new QLabel(tr("Terminal"), tabprof ); | 88 | QLabel *term = new QLabel(tr("Terminal"), tabprof ); |
89 | m_conCmb = new QComboBox( tabprof ); | 89 | m_conCmb = new QComboBox( tabprof ); |
90 | m_termCmb = new QComboBox( tabprof ); | 90 | m_termCmb = new QComboBox( tabprof ); |
91 | m_autoConnect = new QCheckBox(tr("Auto connect after load"), tabprof); | 91 | m_autoConnect = new QCheckBox(tr("Auto connect after load"), tabprof); |
92 | 92 | ||
93 | // layouting | 93 | // layouting |
94 | QVBoxLayout *vbox3 = new QVBoxLayout(tabprof, 2); | 94 | QVBoxLayout *vbox3 = new QVBoxLayout(tabprof, 2); |
95 | vbox3->add(name); | 95 | vbox3->add(name); |
96 | vbox3->add(m_name); | 96 | vbox3->add(m_name); |
97 | vbox3->add(con ); | 97 | vbox3->add(con ); |
98 | vbox3->add(m_conCmb ); | 98 | vbox3->add(m_conCmb ); |
99 | vbox3->add(term ); | 99 | vbox3->add(term ); |
100 | vbox3->add(m_termCmb ); | 100 | vbox3->add(m_termCmb ); |
101 | vbox3->add(m_autoConnect); | 101 | vbox3->add(m_autoConnect); |
102 | vbox3->addStretch(1); | 102 | vbox3->addStretch(1); |
103 | 103 | ||
104 | m_showconntab = 0; | 104 | m_showconntab = 0; |
105 | tabWidget->addTab(tabprof, "", QObject::tr("Profile")); | 105 | tabWidget->addTab(tabprof, "", QObject::tr("Profile")); |
106 | tabWidget->addTab(m_tabCon, "", QObject::tr("Connection")); | 106 | tabWidget->addTab(m_tabCon, "", QObject::tr("Connection")); |
107 | tabWidget->addTab(m_tabTerm, "", QObject::tr("Terminal")); | 107 | tabWidget->addTab(m_tabTerm, "", QObject::tr("Terminal")); |
108 | tabWidget->addTab(m_tabKey, "", QObject::tr("Special Keys")); | 108 | tabWidget->addTab(m_tabKey, "", QObject::tr("Special Keys")); |
109 | tabWidget->setCurrentTab( tabprof ); | 109 | tabWidget->setCurrentTab( tabprof ); |
110 | 110 | ||
111 | 111 | ||
112 | // fill the comboboxes | 112 | // fill the comboboxes |
113 | QStringList list = m_fact->connectionWidgets(); | 113 | QStringList list = m_fact->connectionWidgets(); |
114 | QStringList::Iterator it; | 114 | QStringList::Iterator it; |
115 | for (it =list.begin(); it != list.end(); ++it ) { | 115 | for (it =list.begin(); it != list.end(); ++it ) { |
116 | m_conCmb->insertItem( (*it) ); | 116 | m_conCmb->insertItem( (*it) ); |
117 | } | 117 | } |
118 | list = m_fact->terminalWidgets(); | 118 | list = m_fact->terminalWidgets(); |
119 | for (it =list.begin(); it != list.end(); ++it ) { | 119 | for (it =list.begin(); it != list.end(); ++it ) { |
120 | m_termCmb->insertItem( (*it) ); | 120 | m_termCmb->insertItem( (*it) ); |
121 | } | 121 | } |
122 | 122 | ||
123 | // load profile values | 123 | // load profile values |
124 | m_name->setText(m_prof.name()); | 124 | m_name->setText(m_prof.name()); |
125 | slotKeyActivated( "Default Keyboard" ); | 125 | slotKeyActivated( "Default Keyboard" ); |
126 | setCurrent( m_fact->external(m_prof.ioLayerName() ), m_conCmb ); | 126 | setCurrent( m_fact->external(m_prof.ioLayerName() ), m_conCmb ); |
127 | setCurrent( m_fact->external(m_prof.terminalName() ), m_termCmb ); | 127 | setCurrent( m_fact->external(m_prof.terminalName() ), m_termCmb ); |
128 | slotConActivated( m_fact->external(m_prof.ioLayerName() ) ); | 128 | slotConActivated( m_fact->external(m_prof.ioLayerName() ) ); |
129 | slotTermActivated( m_fact->external(m_prof.terminalName() ) ); | 129 | slotTermActivated( m_fact->external(m_prof.terminalName() ) ); |
130 | m_autoConnect->setChecked(m_prof.autoConnect()); | 130 | m_autoConnect->setChecked(m_prof.autoConnect()); |
131 | 131 | ||
132 | 132 | ||
133 | // signal and slots | 133 | // signal and slots |
134 | connect(m_conCmb, SIGNAL(activated(const QString& ) ), | 134 | connect(m_conCmb, SIGNAL(activated(const QString&) ), |
135 | this, SLOT(slotConActivated(const QString&) ) ); | 135 | this, SLOT(slotConActivated(const QString&) ) ); |
136 | connect(m_termCmb, SIGNAL(activated(const QString& ) ), | 136 | connect(m_termCmb, SIGNAL(activated(const QString&) ), |
137 | this, SLOT(slotTermActivated(const QString& ) ) ); | 137 | this, SLOT(slotTermActivated(const QString&) ) ); |
138 | 138 | ||
139 | } | 139 | } |
140 | 140 | ||
141 | ProfileEditorDialog::~ProfileEditorDialog() { | 141 | ProfileEditorDialog::~ProfileEditorDialog() { |
142 | 142 | ||
143 | } | 143 | } |
144 | void ProfileEditorDialog::accept() | 144 | void ProfileEditorDialog::accept() |
145 | { | 145 | { |
146 | if(profName().isEmpty()) | 146 | if(profName().isEmpty()) |
147 | { | 147 | { |
148 | QMessageBox::information(this, | 148 | QMessageBox::information(this, |
149 | QObject::tr("Invalid profile"), | 149 | QObject::tr("Invalid profile"), |
150 | QObject::tr("Please enter a profile name.")); | 150 | QObject::tr("Please enter a profile name.")); |
151 | return; | 151 | return; |
152 | } | 152 | } |
153 | // Save profile and plugin profile | 153 | // Save profile and plugin profile |
154 | //if(plugin_plugin) plugin_plugin->save(); | 154 | //if(plugin_plugin) plugin_plugin->save(); |
155 | 155 | ||
156 | // Save general values | 156 | // Save general values |
157 | m_prof.setName( profName() ); | 157 | m_prof.setName( profName() ); |
158 | m_prof.setIOLayer( m_fact->internal(m_conCmb ->currentText() ) ); | 158 | m_prof.setIOLayer( m_fact->internal(m_conCmb ->currentText() ) ); |
159 | m_prof.setTerminalName( m_fact->internal(m_termCmb->currentText() ) ); | 159 | m_prof.setTerminalName( m_fact->internal(m_termCmb->currentText() ) ); |
160 | m_prof.setAutoConnect( m_autoConnect->isChecked() ); | 160 | m_prof.setAutoConnect( m_autoConnect->isChecked() ); |
161 | 161 | ||
162 | if (m_con ) | 162 | if (m_con ) |
163 | m_con->save( m_prof ); | 163 | m_con->save( m_prof ); |
164 | if (m_term ) | 164 | if (m_term ) |
165 | m_term->save( m_prof ); | 165 | m_term->save( m_prof ); |
166 | if (m_key) | 166 | if (m_key) |
167 | m_key->save( m_prof ); | 167 | m_key->save( m_prof ); |
168 | 168 | ||
169 | QDialog::accept(); | 169 | QDialog::accept(); |
170 | } | 170 | } |
171 | 171 | ||
172 | 172 | ||
173 | QString ProfileEditorDialog::profName()const | 173 | QString ProfileEditorDialog::profName()const |
174 | { | 174 | { |
175 | return m_name->text(); | 175 | return m_name->text(); |
176 | } | 176 | } |
177 | 177 | ||
178 | QCString ProfileEditorDialog::profType()const | 178 | QCString ProfileEditorDialog::profType()const |
179 | { | 179 | { |
180 | /*QStringList w = m_fact->configWidgets(); | 180 | /*QStringList w = m_fact->configWidgets(); |
181 | for(QStringList::Iterator it = w.begin(); it != w.end(); it++) | 181 | for(QStringList::Iterator it = w.begin(); it != w.end(); it++) |
182 | if(device_box->currentText() == m_fact->name((*it))) return (*it); | 182 | if(device_box->currentText() == m_fact->name((*it))) return (*it); |
183 | */ | 183 | */ |
184 | return QCString(); | 184 | return QCString(); |
185 | } | 185 | } |
186 | /* | 186 | /* |
187 | * we need to switch the widget | 187 | * we need to switch the widget |
188 | */ | 188 | */ |
189 | void ProfileEditorDialog::slotConActivated( const QString& str ) { | 189 | void ProfileEditorDialog::slotConActivated( const QString& str ) { |
190 | 190 | ||
191 | delete m_con; | 191 | delete m_con; |
192 | 192 | ||
193 | m_con = m_fact->newConnectionPlugin( str, m_svCon->viewport() ); | 193 | m_con = m_fact->newConnectionPlugin( str, m_svCon->viewport() ); |
194 | 194 | ||
195 | if ( !m_con ) { | 195 | if ( !m_con ) { |
196 | m_con = new NoOptions( str, m_svCon->viewport(), "name"); | 196 | m_con = new NoOptions( str, m_svCon->viewport(), "name"); |
197 | } | 197 | } |
198 | 198 | ||
199 | // FIXME ugly hack right. Right solution would be to look into the layer and see if it | 199 | // FIXME ugly hack right. Right solution would be to look into the layer and see if it |
200 | // supports auto connect and then set it as prefered | 200 | // supports auto connect and then set it as prefered |
201 | if ( m_conCmb ->currentText() == tr("Local Console") ) { | 201 | if ( m_conCmb ->currentText() == tr("Local Console") ) { |
202 | m_autoConnect->setChecked( true ); | 202 | m_autoConnect->setChecked( true ); |
203 | m_prof.writeEntry("Terminal", Profile::Linux ); | 203 | m_prof.writeEntry("Terminal", Profile::Linux ); |
204 | slotTermActivated( m_fact->external (m_prof.terminalName() ) ); | 204 | slotTermActivated( m_fact->external (m_prof.terminalName() ) ); |
205 | } else { | 205 | } else { |
206 | m_prof.writeEntry("Terminal", Profile::VT102 ); | 206 | m_prof.writeEntry("Terminal", Profile::VT102 ); |
207 | slotTermActivated( m_fact->external (m_prof.terminalName() ) ); | 207 | slotTermActivated( m_fact->external (m_prof.terminalName() ) ); |
208 | m_autoConnect->setChecked( false ); | 208 | m_autoConnect->setChecked( false ); |
209 | } | 209 | } |
210 | 210 | ||
211 | m_con->load( m_prof ); | 211 | m_con->load( m_prof ); |
212 | m_svCon->addChild( m_con ); | 212 | m_svCon->addChild( m_con ); |
213 | } | 213 | } |
214 | 214 | ||
215 | 215 | ||
216 | /* | 216 | /* |
217 | * we need to switch the widget | 217 | * we need to switch the widget |
218 | */ | 218 | */ |
219 | void ProfileEditorDialog::slotTermActivated( const QString& str ) { | 219 | void ProfileEditorDialog::slotTermActivated( const QString& str ) { |
220 | 220 | ||
221 | delete m_term; | 221 | delete m_term; |
222 | 222 | ||
223 | m_term = m_fact->newTerminalPlugin( str, m_svTerm->viewport() ); | 223 | m_term = m_fact->newTerminalPlugin( str, m_svTerm->viewport() ); |
224 | 224 | ||
225 | if ( m_term ) { | 225 | if ( m_term ) { |
226 | m_term->load( m_prof ); | 226 | m_term->load( m_prof ); |
227 | m_svTerm->addChild( m_term ); | 227 | m_svTerm->addChild( m_term ); |
228 | } | 228 | } |
229 | } | 229 | } |
230 | 230 | ||
231 | void ProfileEditorDialog::slotKeyActivated(const QString &str) { | 231 | void ProfileEditorDialog::slotKeyActivated(const QString &str) { |
232 | delete m_key; | 232 | delete m_key; |
233 | m_key = m_fact->newKeyboardPlugin( str, m_tabKey ); | 233 | m_key = m_fact->newKeyboardPlugin( str, m_tabKey ); |
diff --git a/noncore/apps/opie-console/session.cpp b/noncore/apps/opie-console/session.cpp index 1034ede..b7f14c5 100644 --- a/noncore/apps/opie-console/session.cpp +++ b/noncore/apps/opie-console/session.cpp | |||
@@ -1,115 +1,115 @@ | |||
1 | 1 | ||
2 | 2 | ||
3 | #include "file_layer.h" | 3 | #include "file_layer.h" |
4 | #include "emulation_handler.h" | 4 | #include "emulation_handler.h" |
5 | #include "session.h" | 5 | #include "session.h" |
6 | 6 | ||
7 | 7 | ||
8 | Session::Session() { | 8 | Session::Session() { |
9 | m_widget = 0l; | 9 | m_widget = 0l; |
10 | m_layer = 0l; | 10 | m_layer = 0l; |
11 | m_emu = 0l; | 11 | m_emu = 0l; |
12 | m_transfer = 0l; | 12 | m_transfer = 0l; |
13 | } | 13 | } |
14 | Session::Session( const QString& na, QWidgetStack* widget, IOLayer* lay) | 14 | Session::Session( const QString& na, QWidgetStack* widget, IOLayer* lay) |
15 | : m_name( na ), m_widget( widget ), m_layer( lay ) | 15 | : m_name( na ), m_widget( widget ), m_layer( lay ) |
16 | { | 16 | { |
17 | // m_widLay = 0l; | 17 | // m_widLay = 0l; |
18 | // m_emLay = 0l; | 18 | // m_emLay = 0l; |
19 | m_emu = 0l; | 19 | m_emu = 0l; |
20 | } | 20 | } |
21 | Session::~Session() { | 21 | Session::~Session() { |
22 | delete m_layer; | 22 | delete m_layer; |
23 | delete m_emu; | 23 | delete m_emu; |
24 | delete m_widget; | 24 | delete m_widget; |
25 | /* the widget layer should be deleted by the m_widget */ | 25 | /* the widget layer should be deleted by the m_widget */ |
26 | } | 26 | } |
27 | QString Session::name()const { | 27 | QString Session::name()const { |
28 | return m_name; | 28 | return m_name; |
29 | } | 29 | } |
30 | QWidgetStack* Session::widgetStack() { | 30 | QWidgetStack* Session::widgetStack() { |
31 | return m_widget; | 31 | return m_widget; |
32 | } | 32 | } |
33 | IOLayer* Session::layer() { | 33 | IOLayer* Session::layer() { |
34 | return m_layer; | 34 | return m_layer; |
35 | } | 35 | } |
36 | EmulationHandler* Session::emulationHandler() { | 36 | EmulationHandler* Session::emulationHandler() { |
37 | return m_emu; | 37 | return m_emu; |
38 | } | 38 | } |
39 | QWidget* Session::widget() { | 39 | QWidget* Session::widget() { |
40 | if (!m_emu ) | 40 | if (!m_emu ) |
41 | return 0l; | 41 | return 0l; |
42 | 42 | ||
43 | return m_emu->widget(); | 43 | return m_emu->widget(); |
44 | } | 44 | } |
45 | Profile Session::profile()const { | 45 | Profile Session::profile()const { |
46 | return m_prof; | 46 | return m_prof; |
47 | } | 47 | } |
48 | /* | 48 | /* |
49 | WidgetLayer* Session::emulationWidget() { | 49 | WidgetLayer* Session::emulationWidget() { |
50 | return m_widLay; | 50 | return m_widLay; |
51 | } | 51 | } |
52 | */ | 52 | */ |
53 | void Session::connect() { | 53 | void Session::connect() { |
54 | if ( !m_layer || !m_emu ) | 54 | if ( !m_layer || !m_emu ) |
55 | return; | 55 | return; |
56 | 56 | ||
57 | QObject::connect(m_layer, SIGNAL(received(const QByteArray&) ), | 57 | QObject::connect(m_layer, SIGNAL(received(const QByteArray&) ), |
58 | m_emu, SLOT(recv(const QByteArray&) ) ); | 58 | m_emu, SLOT(recv(const QByteArray&) ) ); |
59 | QObject::connect(m_emu, SIGNAL(send(const QByteArray&) ), | 59 | QObject::connect(m_emu, SIGNAL(send(const QByteArray&) ), |
60 | m_layer, SLOT(send(const QByteArray&) ) ); | 60 | m_layer, SLOT(send(const QByteArray&) ) ); |
61 | QObject::connect(m_emu, SIGNAL(changeSize(int, int) ), | 61 | QObject::connect(m_emu, SIGNAL(changeSize(int,int) ), |
62 | m_layer, SLOT(setSize(int, int) ) ); | 62 | m_layer, SLOT(setSize(int,int) ) ); |
63 | } | 63 | } |
64 | 64 | ||
65 | void Session::disconnect() { | 65 | void Session::disconnect() { |
66 | 66 | ||
67 | if ( !m_layer || !m_emu ) | 67 | if ( !m_layer || !m_emu ) |
68 | return; | 68 | return; |
69 | 69 | ||
70 | QObject::disconnect(m_layer, SIGNAL(received(const QByteArray&) ), | 70 | QObject::disconnect(m_layer, SIGNAL(received(const QByteArray&) ), |
71 | m_emu, SLOT(recv(const QByteArray&) ) ); | 71 | m_emu, SLOT(recv(const QByteArray&) ) ); |
72 | QObject::disconnect(m_emu, SIGNAL(send(const QByteArray&) ), | 72 | QObject::disconnect(m_emu, SIGNAL(send(const QByteArray&) ), |
73 | m_layer, SLOT(send(const QByteArray&) ) ); | 73 | m_layer, SLOT(send(const QByteArray&) ) ); |
74 | } | 74 | } |
75 | 75 | ||
76 | void Session::setName( const QString& na){ | 76 | void Session::setName( const QString& na){ |
77 | m_name = na; | 77 | m_name = na; |
78 | } | 78 | } |
79 | 79 | ||
80 | void Session::setWidgetStack( QWidgetStack* wid ) { | 80 | void Session::setWidgetStack( QWidgetStack* wid ) { |
81 | delete m_emu; | 81 | delete m_emu; |
82 | m_emu = 0l; | 82 | m_emu = 0l; |
83 | delete m_widget; | 83 | delete m_widget; |
84 | /* the EmulationLayer was destroyed... */ | 84 | /* the EmulationLayer was destroyed... */ |
85 | 85 | ||
86 | m_widget = wid; | 86 | m_widget = wid; |
87 | } | 87 | } |
88 | void Session::setIOLayer( IOLayer* lay ) { | 88 | void Session::setIOLayer( IOLayer* lay ) { |
89 | delete m_layer; | 89 | delete m_layer; |
90 | m_layer = lay; | 90 | m_layer = lay; |
91 | } | 91 | } |
92 | 92 | ||
93 | void Session::setEmulationHandler( EmulationHandler* lay ) { | 93 | void Session::setEmulationHandler( EmulationHandler* lay ) { |
94 | delete m_emu; | 94 | delete m_emu; |
95 | m_emu = lay; | 95 | m_emu = lay; |
96 | } | 96 | } |
97 | void Session::setProfile( const Profile& prof ) { | 97 | void Session::setProfile( const Profile& prof ) { |
98 | m_prof = prof; | 98 | m_prof = prof; |
99 | } | 99 | } |
100 | /* | 100 | /* |
101 | void Session::setEmulationWidget( WidgetLayer* lay ) { | 101 | void Session::setEmulationWidget( WidgetLayer* lay ) { |
102 | delete m_widLay; | 102 | delete m_widLay; |
103 | m_widLay = lay; | 103 | m_widLay = lay; |
104 | } | 104 | } |
105 | */ | 105 | */ |
106 | void Session::setTransferDialog(QWidget *d) | 106 | void Session::setTransferDialog(QWidget *d) |
107 | { | 107 | { |
108 | m_transfer = d; | 108 | m_transfer = d; |
109 | } | 109 | } |
110 | 110 | ||
111 | QWidget *Session::transferDialog() | 111 | QWidget *Session::transferDialog() |
112 | { | 112 | { |
113 | return m_transfer; | 113 | return m_transfer; |
114 | } | 114 | } |
115 | 115 | ||
diff --git a/noncore/apps/opie-console/sz_transfer.cpp b/noncore/apps/opie-console/sz_transfer.cpp index c47e73e..2f82417 100644 --- a/noncore/apps/opie-console/sz_transfer.cpp +++ b/noncore/apps/opie-console/sz_transfer.cpp | |||
@@ -1,84 +1,84 @@ | |||
1 | 1 | ||
2 | #include "sz_transfer.h" | 2 | #include "sz_transfer.h" |
3 | #include <qfile.h> | 3 | #include <qfile.h> |
4 | #include <stdio.h> | 4 | #include <stdio.h> |
5 | #include <sys/termios.h> | 5 | #include <sys/termios.h> |
6 | 6 | ||
7 | 7 | ||
8 | 8 | ||
9 | SzTransfer::SzTransfer(Type t, IOLayer *layer) : FileTransferLayer(layer), m_t(t) | 9 | SzTransfer::SzTransfer(Type t, IOLayer *layer) : FileTransferLayer(layer), m_t(t) |
10 | { | 10 | { |
11 | } | 11 | } |
12 | 12 | ||
13 | SzTransfer::~SzTransfer() { | 13 | SzTransfer::~SzTransfer() { |
14 | } | 14 | } |
15 | 15 | ||
16 | void SzTransfer::sendFile(const QFile& file) { | 16 | void SzTransfer::sendFile(const QFile& file) { |
17 | 17 | ||
18 | sendFile(file.name()); | 18 | sendFile(file.name()); |
19 | } | 19 | } |
20 | 20 | ||
21 | void SzTransfer::sendFile(const QString& file) { | 21 | void SzTransfer::sendFile(const QString& file) { |
22 | 22 | ||
23 | //setcbreak(2); /* raw no echo */ | 23 | //setcbreak(2); /* raw no echo */ |
24 | 24 | ||
25 | proc = new OProcess; | 25 | proc = new OProcess; |
26 | *proc << "sz"; | 26 | *proc << "sz"; |
27 | *proc << "-v" << "-v" << "-b" << file; | 27 | *proc << "-v" << "-v" << "-b" << file; |
28 | connect(proc, SIGNAL(processExited(OProcess *)), | 28 | connect(proc, SIGNAL(processExited(OProcess*)), |
29 | this, SLOT(sent())); | 29 | this, SLOT(sent())); |
30 | connect(proc, SIGNAL(receivedStdout(OProcess *, char *, int)), | 30 | connect(proc, SIGNAL(receivedStdout(OProcess*,char*,int)), |
31 | this, SLOT(SzReceivedStdout(OProcess *, char *, int))); | 31 | this, SLOT(SzReceivedStdout(OProcess*,char*,int))); |
32 | connect(proc, SIGNAL(receivedStderr(OProcess *, char *, int)), | 32 | connect(proc, SIGNAL(receivedStderr(OProcess*,char*,int)), |
33 | this, SLOT(SzReceivedStderr(OProcess *, char *, int))); | 33 | this, SLOT(SzReceivedStderr(OProcess*,char*,int))); |
34 | connect(layer(), SIGNAL(received(const QByteArray &)), | 34 | connect(layer(), SIGNAL(received(const QByteArray&)), |
35 | this, SLOT(receivedStdin(const QByteArray &))); | 35 | this, SLOT(receivedStdin(const QByteArray&))); |
36 | proc->start(OProcess::NotifyOnExit, OProcess::All); | 36 | proc->start(OProcess::NotifyOnExit, OProcess::All); |
37 | 37 | ||
38 | } | 38 | } |
39 | 39 | ||
40 | void SzTransfer::SzReceivedStdout(OProcess *, char *buffer, int buflen) { | 40 | void SzTransfer::SzReceivedStdout(OProcess *, char *buffer, int buflen) { |
41 | 41 | ||
42 | qWarning("recieved from sz on stdout %d bytes", buflen); | 42 | qWarning("recieved from sz on stdout %d bytes", buflen); |
43 | 43 | ||
44 | QByteArray data(buflen); | 44 | QByteArray data(buflen); |
45 | data.fill(*buffer, buflen); | 45 | data.fill(*buffer, buflen); |
46 | for (uint i = 0; i < data.count(); i++ ) { | 46 | for (uint i = 0; i < data.count(); i++ ) { |
47 | printf("%c", buffer[i] ); | 47 | printf("%c", buffer[i] ); |
48 | } | 48 | } |
49 | printf("\n"); | 49 | printf("\n"); |
50 | 50 | ||
51 | // send out through the io layer | 51 | // send out through the io layer |
52 | layer()->send(data); | 52 | layer()->send(data); |
53 | } | 53 | } |
54 | 54 | ||
55 | void SzTransfer::SzReceivedStderr(OProcess *, char *buffer, int length) { | 55 | void SzTransfer::SzReceivedStderr(OProcess *, char *buffer, int length) { |
56 | 56 | ||
57 | // parse and show data in a progress dialog/widget | 57 | // parse and show data in a progress dialog/widget |
58 | printf("stderr:\n"); | 58 | printf("stderr:\n"); |
59 | //for (int i = 0; i < length; i++) | 59 | //for (int i = 0; i < length; i++) |
60 | // printf("%c", buffer[i]); | 60 | // printf("%c", buffer[i]); |
61 | //printf("\n"); | 61 | //printf("\n"); |
62 | } | 62 | } |
63 | 63 | ||
64 | void SzTransfer::receivedStdin(const QByteArray &data) { | 64 | void SzTransfer::receivedStdin(const QByteArray &data) { |
65 | 65 | ||
66 | qWarning("recieved from io_serial %d bytes", data.size()); | 66 | qWarning("recieved from io_serial %d bytes", data.size()); |
67 | 67 | ||
68 | // recieved data from the io layer goes to sz | 68 | // recieved data from the io layer goes to sz |
69 | proc->writeStdin(data.data(), data.size()); | 69 | proc->writeStdin(data.data(), data.size()); |
70 | 70 | ||
71 | } | 71 | } |
72 | 72 | ||
73 | void SzTransfer::sent() { | 73 | void SzTransfer::sent() { |
74 | 74 | ||
75 | qWarning("sent file"); | 75 | qWarning("sent file"); |
76 | 76 | ||
77 | //setcbreak(0); /* default */ | 77 | //setcbreak(0); /* default */ |
78 | 78 | ||
79 | 79 | ||
80 | delete proc; | 80 | delete proc; |
81 | disconnect(layer(), SIGNAL(received(const QByteArray &)), | 81 | disconnect(layer(), SIGNAL(received(const QByteArray&)), |
82 | this, SLOT(receivedStdin(const QByteArray &))); | 82 | this, SLOT(receivedStdin(const QByteArray&))); |
83 | 83 | ||
84 | } | 84 | } |
diff --git a/noncore/apps/opie-console/test/senderui.cpp b/noncore/apps/opie-console/test/senderui.cpp index 4a7202d..b1725db 100644 --- a/noncore/apps/opie-console/test/senderui.cpp +++ b/noncore/apps/opie-console/test/senderui.cpp | |||
@@ -1,77 +1,77 @@ | |||
1 | #include <stdlib.h> | 1 | #include <stdlib.h> |
2 | #include <stdio.h> | 2 | #include <stdio.h> |
3 | #include <fcntl.h> | 3 | #include <fcntl.h> |
4 | #include <sys/termios.h> | 4 | #include <sys/termios.h> |
5 | 5 | ||
6 | #include <qmultilineedit.h> | 6 | #include <qmultilineedit.h> |
7 | #include <qsocketnotifier.h> | 7 | #include <qsocketnotifier.h> |
8 | 8 | ||
9 | #include "../profile.h" | 9 | #include "../profile.h" |
10 | #include "../io_serial.h" | 10 | #include "../io_serial.h" |
11 | #include "../filetransfer.h" | 11 | #include "../filetransfer.h" |
12 | #include "../filereceive.h" | 12 | #include "../filereceive.h" |
13 | 13 | ||
14 | #include <opie2/oprocess.h> | 14 | #include <opie2/oprocess.h> |
15 | 15 | ||
16 | #include "senderui.h" | 16 | #include "senderui.h" |
17 | 17 | ||
18 | SenderUI::SenderUI() | 18 | SenderUI::SenderUI() |
19 | : Sender() { | 19 | : Sender() { |
20 | 20 | ||
21 | /* we do that manually */ | 21 | /* we do that manually */ |
22 | Profile prof; | 22 | Profile prof; |
23 | QString str = "/dev/bty0"; | 23 | QString str = "/dev/bty0"; |
24 | prof.writeEntry("Device",str ); | 24 | prof.writeEntry("Device",str ); |
25 | prof.writeEntry("Baud", 19200 ); | 25 | prof.writeEntry("Baud", 19200 ); |
26 | 26 | ||
27 | qWarning("prof " + prof.readEntry("Device") + " " + str); | 27 | qWarning("prof " + prof.readEntry("Device") + " " + str); |
28 | ser = new IOSerial(prof); | 28 | ser = new IOSerial(prof); |
29 | connect(ser, SIGNAL(received(const QByteArray& ) ), | 29 | connect(ser, SIGNAL(received(const QByteArray&) ), |
30 | this, SLOT(got(const QByteArray&) ) ); | 30 | this, SLOT(got(const QByteArray&) ) ); |
31 | 31 | ||
32 | if ( ser->open() ) | 32 | if ( ser->open() ) |
33 | qWarning("opened!!!"); | 33 | qWarning("opened!!!"); |
34 | else | 34 | else |
35 | qWarning("could not open"); | 35 | qWarning("could not open"); |
36 | 36 | ||
37 | 37 | ||
38 | } | 38 | } |
39 | SenderUI::~SenderUI() { | 39 | SenderUI::~SenderUI() { |
40 | 40 | ||
41 | } | 41 | } |
42 | void SenderUI::slotSendFile() { | 42 | void SenderUI::slotSendFile() { |
43 | 43 | ||
44 | sz = new FileTransfer(FileTransfer::SY, ser); | 44 | sz = new FileTransfer(FileTransfer::SY, ser); |
45 | sz->sendFile("/home/ich/bootopie-v06-13.jffs2"); | 45 | sz->sendFile("/home/ich/bootopie-v06-13.jffs2"); |
46 | 46 | ||
47 | connect (sz, SIGNAL(sent()), | 47 | connect (sz, SIGNAL(sent()), |
48 | this, SLOT(fileTransComplete())); | 48 | this, SLOT(fileTransComplete())); |
49 | } | 49 | } |
50 | 50 | ||
51 | void SenderUI::slotSend() { | 51 | void SenderUI::slotSend() { |
52 | QCString str = MultiLineEdit1->text().utf8(); | 52 | QCString str = MultiLineEdit1->text().utf8(); |
53 | qWarning("sending: %s", str.data() ); | 53 | qWarning("sending: %s", str.data() ); |
54 | str = str.replace( QRegExp("\n"), "\r"); | 54 | str = str.replace( QRegExp("\n"), "\r"); |
55 | ser->send( str ); | 55 | ser->send( str ); |
56 | } | 56 | } |
57 | void SenderUI::got(const QByteArray& ar) { | 57 | void SenderUI::got(const QByteArray& ar) { |
58 | qWarning("got:"); | 58 | qWarning("got:"); |
59 | for ( uint i = 0; i < ar.count(); i++ ) { | 59 | for ( uint i = 0; i < ar.count(); i++ ) { |
60 | printf("%c", ar[i] ); | 60 | printf("%c", ar[i] ); |
61 | } | 61 | } |
62 | printf("\n"); | 62 | printf("\n"); |
63 | } | 63 | } |
64 | 64 | ||
65 | void SenderUI::fileTransComplete() { | 65 | void SenderUI::fileTransComplete() { |
66 | 66 | ||
67 | qWarning("file transfer complete"); | 67 | qWarning("file transfer complete"); |
68 | } | 68 | } |
69 | void SenderUI::send() { | 69 | void SenderUI::send() { |
70 | 70 | ||
71 | } | 71 | } |
72 | void SenderUI::slotRev(){ | 72 | void SenderUI::slotRev(){ |
73 | qWarning("Going to receive!"); | 73 | qWarning("Going to receive!"); |
74 | FileReceive *rev = new FileReceive( FileReceive::SZ, ser ); | 74 | FileReceive *rev = new FileReceive( FileReceive::SZ, ser ); |
75 | rev->receive(); | 75 | rev->receive(); |
76 | 76 | ||
77 | } | 77 | } |
diff --git a/noncore/apps/opie-console/transferdialog.cpp b/noncore/apps/opie-console/transferdialog.cpp index 30e7caf..d494a6c 100644 --- a/noncore/apps/opie-console/transferdialog.cpp +++ b/noncore/apps/opie-console/transferdialog.cpp | |||
@@ -32,205 +32,205 @@ TransferDialog::TransferDialog(QWidget *parent, MainWindow *mainwindow, const ch | |||
32 | group = new QButtonGroup(QObject::tr("Transfer mode"), this); | 32 | group = new QButtonGroup(QObject::tr("Transfer mode"), this); |
33 | mode_send = new QRadioButton(QObject::tr("Send"), group); | 33 | mode_send = new QRadioButton(QObject::tr("Send"), group); |
34 | mode_receive = new QRadioButton(QObject::tr("Receive"), group); | 34 | mode_receive = new QRadioButton(QObject::tr("Receive"), group); |
35 | group->insert(mode_send, id_send); | 35 | group->insert(mode_send, id_send); |
36 | group->insert(mode_receive, id_receive); | 36 | group->insert(mode_receive, id_receive); |
37 | vbox2 = new QVBoxLayout(group, 2); | 37 | vbox2 = new QVBoxLayout(group, 2); |
38 | vbox2->addSpacing(10); | 38 | vbox2->addSpacing(10); |
39 | hbox3 = new QHBoxLayout(vbox2, 2); | 39 | hbox3 = new QHBoxLayout(vbox2, 2); |
40 | hbox3->add(mode_send); | 40 | hbox3->add(mode_send); |
41 | hbox3->add(mode_receive); | 41 | hbox3->add(mode_receive); |
42 | mode_send->setChecked(true); | 42 | mode_send->setChecked(true); |
43 | m_transfermode = id_send; | 43 | m_transfermode = id_send; |
44 | 44 | ||
45 | file = new QLabel(QObject::tr("Send file"), this); | 45 | file = new QLabel(QObject::tr("Send file"), this); |
46 | mode = new QLabel(QObject::tr("Transfer protocol"), this); | 46 | mode = new QLabel(QObject::tr("Transfer protocol"), this); |
47 | progress = new QLabel(QObject::tr("Progress"), this); | 47 | progress = new QLabel(QObject::tr("Progress"), this); |
48 | status = new QLabel(QObject::tr("Status"), this); | 48 | status = new QLabel(QObject::tr("Status"), this); |
49 | 49 | ||
50 | statusbar = new QLabel(QObject::tr("Ready"), this); | 50 | statusbar = new QLabel(QObject::tr("Ready"), this); |
51 | statusbar->setFrameStyle(QFrame::Panel | QFrame::Sunken); | 51 | statusbar->setFrameStyle(QFrame::Panel | QFrame::Sunken); |
52 | 52 | ||
53 | protocol = new QComboBox(this); | 53 | protocol = new QComboBox(this); |
54 | QStringList list = m_win->factory()->fileTransferLayers(); | 54 | QStringList list = m_win->factory()->fileTransferLayers(); |
55 | for (QStringList::Iterator it = list.begin(); it != list.end(); ++it) | 55 | for (QStringList::Iterator it = list.begin(); it != list.end(); ++it) |
56 | protocol->insertItem((*it)); | 56 | protocol->insertItem((*it)); |
57 | 57 | ||
58 | filename = new QLineEdit(this); | 58 | filename = new QLineEdit(this); |
59 | 59 | ||
60 | progressbar = new QProgressBar(this); | 60 | progressbar = new QProgressBar(this); |
61 | progressbar->setProgress(0); | 61 | progressbar->setProgress(0); |
62 | 62 | ||
63 | selector = new QPushButton("...", this); | 63 | selector = new QPushButton("...", this); |
64 | ok = new QPushButton(QObject::tr("Start transfer"), this); | 64 | ok = new QPushButton(QObject::tr("Start transfer"), this); |
65 | cancel = new QPushButton(QObject::tr("Cancel"), this); | 65 | cancel = new QPushButton(QObject::tr("Cancel"), this); |
66 | 66 | ||
67 | vbox = new QVBoxLayout(this, 2); | 67 | vbox = new QVBoxLayout(this, 2); |
68 | vbox->add(group); | 68 | vbox->add(group); |
69 | vbox->add(file); | 69 | vbox->add(file); |
70 | hbox = new QHBoxLayout(vbox, 0); | 70 | hbox = new QHBoxLayout(vbox, 0); |
71 | hbox->add(filename); | 71 | hbox->add(filename); |
72 | hbox->add(selector); | 72 | hbox->add(selector); |
73 | vbox->add(mode); | 73 | vbox->add(mode); |
74 | vbox->add(protocol); | 74 | vbox->add(protocol); |
75 | vbox->add(progress); | 75 | vbox->add(progress); |
76 | vbox->add(progressbar); | 76 | vbox->add(progressbar); |
77 | vbox->add(status); | 77 | vbox->add(status); |
78 | vbox->add(statusbar); | 78 | vbox->add(statusbar); |
79 | vbox->addStretch(1); | 79 | vbox->addStretch(1); |
80 | hbox2 = new QHBoxLayout(vbox, 2); | 80 | hbox2 = new QHBoxLayout(vbox, 2); |
81 | hbox2->add(ok); | 81 | hbox2->add(ok); |
82 | hbox2->add(cancel); | 82 | hbox2->add(cancel); |
83 | 83 | ||
84 | setCaption(QObject::tr("File transfer")); | 84 | setCaption(QObject::tr("File transfer")); |
85 | show(); | 85 | show(); |
86 | 86 | ||
87 | connect(selector, SIGNAL(clicked()), SLOT(slotFilename())); | 87 | connect(selector, SIGNAL(clicked()), SLOT(slotFilename())); |
88 | connect(ok, SIGNAL(clicked()), SLOT(slotTransfer())); | 88 | connect(ok, SIGNAL(clicked()), SLOT(slotTransfer())); |
89 | connect(cancel, SIGNAL(clicked()), SLOT(slotCancel())); | 89 | connect(cancel, SIGNAL(clicked()), SLOT(slotCancel())); |
90 | connect(group, SIGNAL(clicked(int)), SLOT(slotMode(int))); | 90 | connect(group, SIGNAL(clicked(int)), SLOT(slotMode(int))); |
91 | } | 91 | } |
92 | 92 | ||
93 | TransferDialog::~TransferDialog() | 93 | TransferDialog::~TransferDialog() |
94 | { | 94 | { |
95 | } | 95 | } |
96 | 96 | ||
97 | void TransferDialog::slotFilename() | 97 | void TransferDialog::slotFilename() |
98 | { | 98 | { |
99 | QString f; | 99 | QString f; |
100 | 100 | ||
101 | f = Opie::OFileDialog::getOpenFileName(0); | 101 | f = Opie::OFileDialog::getOpenFileName(0); |
102 | if(!f.isNull()) filename->setText(f); | 102 | if(!f.isNull()) filename->setText(f); |
103 | } | 103 | } |
104 | 104 | ||
105 | void TransferDialog::slotTransfer() | 105 | void TransferDialog::slotTransfer() |
106 | { | 106 | { |
107 | if((m_transfermode == id_send) && (filename->text().isEmpty())) | 107 | if((m_transfermode == id_send) && (filename->text().isEmpty())) |
108 | { | 108 | { |
109 | QMessageBox::information(this, | 109 | QMessageBox::information(this, |
110 | QObject::tr("Attention"), | 110 | QObject::tr("Attention"), |
111 | QObject::tr("No file has been specified.")); | 111 | QObject::tr("No file has been specified.")); |
112 | return; | 112 | return; |
113 | } | 113 | } |
114 | 114 | ||
115 | ok->setEnabled(false); | 115 | ok->setEnabled(false); |
116 | 116 | ||
117 | cleanup(); | 117 | cleanup(); |
118 | m_autocleanup = 0; | 118 | m_autocleanup = 0; |
119 | 119 | ||
120 | if(m_transfermode == id_send) statusbar->setText(QObject::tr("Sending...")); | 120 | if(m_transfermode == id_send) statusbar->setText(QObject::tr("Sending...")); |
121 | else statusbar->setText(QObject::tr("Receiving...")); | 121 | else statusbar->setText(QObject::tr("Receiving...")); |
122 | 122 | ||
123 | if(m_transfermode == id_send) | 123 | if(m_transfermode == id_send) |
124 | { | 124 | { |
125 | m_lay = m_win->factory()->newFileTransfer(protocol->currentText(), m_win->currentSession()->layer()); | 125 | m_lay = m_win->factory()->newFileTransfer(protocol->currentText(), m_win->currentSession()->layer()); |
126 | m_lay->sendFile(filename->text()); | 126 | m_lay->sendFile(filename->text()); |
127 | 127 | ||
128 | connect(m_lay, SIGNAL(progress(const QString&, int, int, int, int, int)), | 128 | connect(m_lay, SIGNAL(progress(const QString&,int,int,int,int,int)), |
129 | SLOT(slotProgress(const QString&, int, int, int, int, int))); | 129 | SLOT(slotProgress(const QString&,int,int,int,int,int))); |
130 | connect(m_lay, SIGNAL(error(int, const QString&)), SLOT(slotError(int, const QString&))); | 130 | connect(m_lay, SIGNAL(error(int,const QString&)), SLOT(slotError(int,const QString&))); |
131 | connect(m_lay, SIGNAL(sent()), SLOT(slotSent())); | 131 | connect(m_lay, SIGNAL(sent()), SLOT(slotSent())); |
132 | } | 132 | } |
133 | else | 133 | else |
134 | { | 134 | { |
135 | m_recvlay = m_win->factory()->newReceive(protocol->currentText(), m_win->currentSession()->layer()); | 135 | m_recvlay = m_win->factory()->newReceive(protocol->currentText(), m_win->currentSession()->layer()); |
136 | m_recvlay->receive(); | 136 | m_recvlay->receive(); |
137 | 137 | ||
138 | connect(m_recvlay, SIGNAL(progress(const QString&, int, int, int, int, int)), | 138 | connect(m_recvlay, SIGNAL(progress(const QString&,int,int,int,int,int)), |
139 | SLOT(slotProgress(const QString&, int, int, int, int, int))); | 139 | SLOT(slotProgress(const QString&,int,int,int,int,int))); |
140 | connect(m_recvlay, SIGNAL(error(int, const QString&)), SLOT(slotError(int, const QString&))); | 140 | connect(m_recvlay, SIGNAL(error(int,const QString&)), SLOT(slotError(int,const QString&))); |
141 | connect(m_recvlay, SIGNAL(received(const QString&)), SLOT(slotReceived(const QString&))); | 141 | connect(m_recvlay, SIGNAL(received(const QString&)), SLOT(slotReceived(const QString&))); |
142 | } | 142 | } |
143 | } | 143 | } |
144 | 144 | ||
145 | void TransferDialog::cleanup() | 145 | void TransferDialog::cleanup() |
146 | { | 146 | { |
147 | if(m_lay) | 147 | if(m_lay) |
148 | { | 148 | { |
149 | m_lay->cancel(); | 149 | m_lay->cancel(); |
150 | delete m_lay; | 150 | delete m_lay; |
151 | m_lay = 0l; | 151 | m_lay = 0l; |
152 | } | 152 | } |
153 | if(m_recvlay) | 153 | if(m_recvlay) |
154 | { | 154 | { |
155 | m_recvlay->cancel(); | 155 | m_recvlay->cancel(); |
156 | delete m_recvlay; | 156 | delete m_recvlay; |
157 | m_recvlay = 0l; | 157 | m_recvlay = 0l; |
158 | } | 158 | } |
159 | } | 159 | } |
160 | 160 | ||
161 | void TransferDialog::slotCancel() | 161 | void TransferDialog::slotCancel() |
162 | { | 162 | { |
163 | ok->setEnabled(true); | 163 | ok->setEnabled(true); |
164 | statusbar->setText(QObject::tr("Ready")); | 164 | statusbar->setText(QObject::tr("Ready")); |
165 | 165 | ||
166 | if((m_lay) || (m_recvlay)) | 166 | if((m_lay) || (m_recvlay)) |
167 | { | 167 | { |
168 | cleanup(); | 168 | cleanup(); |
169 | if(m_autocleanup) | 169 | if(m_autocleanup) |
170 | { | 170 | { |
171 | m_running = false; | 171 | m_running = false; |
172 | close(); | 172 | close(); |
173 | } | 173 | } |
174 | else | 174 | else |
175 | { | 175 | { |
176 | QMessageBox::information(this, | 176 | QMessageBox::information(this, |
177 | QObject::tr("Cancelled"), | 177 | QObject::tr("Cancelled"), |
178 | QObject::tr("The file transfer has been cancelled.")); | 178 | QObject::tr("The file transfer has been cancelled.")); |
179 | } | 179 | } |
180 | } | 180 | } |
181 | else | 181 | else |
182 | { | 182 | { |
183 | m_running = false; | 183 | m_running = false; |
184 | close(); | 184 | close(); |
185 | } | 185 | } |
186 | } | 186 | } |
187 | 187 | ||
188 | void TransferDialog::slotProgress(const QString& , int progress, int , int , int, int ) | 188 | void TransferDialog::slotProgress(const QString& , int progress, int , int , int, int ) |
189 | { | 189 | { |
190 | progressbar->setProgress(progress); | 190 | progressbar->setProgress(progress); |
191 | } | 191 | } |
192 | 192 | ||
193 | void TransferDialog::slotError(int error, const QString& ) | 193 | void TransferDialog::slotError(int error, const QString& ) |
194 | { | 194 | { |
195 | statusbar->setText(QObject::tr("Ready")); | 195 | statusbar->setText(QObject::tr("Ready")); |
196 | 196 | ||
197 | switch(error) | 197 | switch(error) |
198 | { | 198 | { |
199 | case FileTransferLayer::NotSupported: | 199 | case FileTransferLayer::NotSupported: |
200 | QMessageBox::critical(this, | 200 | QMessageBox::critical(this, |
201 | QObject::tr("Error"), | 201 | QObject::tr("Error"), |
202 | QObject::tr("Operation not supported.")); | 202 | QObject::tr("Operation not supported.")); |
203 | break; | 203 | break; |
204 | case FileTransferLayer::StartError: | 204 | case FileTransferLayer::StartError: |
205 | QMessageBox::critical(this, | 205 | QMessageBox::critical(this, |
206 | QObject::tr("Error"), | 206 | QObject::tr("Error"), |
207 | QObject::tr("Transfer could not be started.")); | 207 | QObject::tr("Transfer could not be started.")); |
208 | break; | 208 | break; |
209 | case FileTransferLayer::NoError: | 209 | case FileTransferLayer::NoError: |
210 | QMessageBox::critical(this, | 210 | QMessageBox::critical(this, |
211 | QObject::tr("Error"), | 211 | QObject::tr("Error"), |
212 | QObject::tr("No error.")); | 212 | QObject::tr("No error.")); |
213 | break; | 213 | break; |
214 | case FileTransferLayer::Undefined: | 214 | case FileTransferLayer::Undefined: |
215 | QMessageBox::critical(this, | 215 | QMessageBox::critical(this, |
216 | QObject::tr("Error"), | 216 | QObject::tr("Error"), |
217 | QObject::tr("Undefined error occured.")); | 217 | QObject::tr("Undefined error occured.")); |
218 | break; | 218 | break; |
219 | case FileTransferLayer::Incomplete: | 219 | case FileTransferLayer::Incomplete: |
220 | QMessageBox::critical(this, | 220 | QMessageBox::critical(this, |
221 | QObject::tr("Error"), | 221 | QObject::tr("Error"), |
222 | QObject::tr("Incomplete transfer.")); | 222 | QObject::tr("Incomplete transfer.")); |
223 | break; | 223 | break; |
224 | case FileTransferLayer::Unknown: | 224 | case FileTransferLayer::Unknown: |
225 | default: | 225 | default: |
226 | QMessageBox::critical(this, | 226 | QMessageBox::critical(this, |
227 | QObject::tr("Error"), | 227 | QObject::tr("Error"), |
228 | QObject::tr("Unknown error occured.")); | 228 | QObject::tr("Unknown error occured.")); |
229 | break; | 229 | break; |
230 | } | 230 | } |
231 | 231 | ||
232 | m_autocleanup = 1; | 232 | m_autocleanup = 1; |
233 | } | 233 | } |
234 | 234 | ||
235 | void TransferDialog::slotSent() | 235 | void TransferDialog::slotSent() |
236 | { | 236 | { |