summaryrefslogtreecommitdiff
authorchicken <chicken>2004-03-01 19:15:57 (UTC)
committer chicken <chicken>2004-03-01 19:15:57 (UTC)
commitfb0981f47e529f9d1dd77fa005ffa3c3ecedff67 (patch) (unidiff)
treec338eb54935bbbe8966d5a642303d4aae3c1f0c8
parentb5a544bf520ce6d0d8f7b314720e6a703079dc1d (diff)
downloadopie-fb0981f47e529f9d1dd77fa005ffa3c3ecedff67.zip
opie-fb0981f47e529f9d1dd77fa005ffa3c3ecedff67.tar.gz
opie-fb0981f47e529f9d1dd77fa005ffa3c3ecedff67.tar.bz2
fix includes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/atconfigdialog.cpp1
-rw-r--r--noncore/apps/opie-console/keytrans.cpp3
-rw-r--r--noncore/apps/opie-console/mainwindow.cpp1
3 files changed, 1 insertions, 4 deletions
diff --git a/noncore/apps/opie-console/atconfigdialog.cpp b/noncore/apps/opie-console/atconfigdialog.cpp
index e683ab3..8e91b9e 100644
--- a/noncore/apps/opie-console/atconfigdialog.cpp
+++ b/noncore/apps/opie-console/atconfigdialog.cpp
@@ -1,216 +1,215 @@
1 1
2#include <qlineedit.h> 2#include <qlineedit.h>
3#include <qspinbox.h> 3#include <qspinbox.h>
4#include <qlayout.h> 4#include <qlayout.h>
5#include <qcombobox.h> 5#include <qcombobox.h>
6#include <qtabwidget.h> 6#include <qtabwidget.h>
7#include <qlabel.h> 7#include <qlabel.h>
8#include <qcombobox.h>
9#include <qscrollview.h> 8#include <qscrollview.h>
10 9
11#include "atconfigdialog.h" 10#include "atconfigdialog.h"
12#include "io_modem.h" 11#include "io_modem.h"
13 12
14 13
15ATConfigDialog::ATConfigDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) 14ATConfigDialog::ATConfigDialog( QWidget* parent, const char* name, bool modal, WFlags fl )
16 : QDialog( parent, name, modal, fl ) { 15 : QDialog( parent, name, modal, fl ) {
17 16
18 17
19 setCaption( tr( "Dialing parameter setup" ) ); 18 setCaption( tr( "Dialing parameter setup" ) );
20 19
21 QVBoxLayout *layout = new QVBoxLayout( this ); 20 QVBoxLayout *layout = new QVBoxLayout( this );
22 QTabWidget *tabWidget = new QTabWidget( this ); 21 QTabWidget *tabWidget = new QTabWidget( this );
23 22
24 tabWidget->addTab( tab0( this ), tr("Settings1") ); 23 tabWidget->addTab( tab0( this ), tr("Settings1") );
25 tabWidget->addTab( tab1( this ), tr("Settings2") ); 24 tabWidget->addTab( tab1( this ), tr("Settings2") );
26 25
27 layout->addWidget( tabWidget ); 26 layout->addWidget( tabWidget );
28 27
29} 28}
30 29
31QWidget* ATConfigDialog::tab0( QWidget* parent) { 30QWidget* ATConfigDialog::tab0( QWidget* parent) {
32 31
33 32
34 QScrollView* sv = new QScrollView( parent ); 33 QScrollView* sv = new QScrollView( parent );
35 34
36 QWidget *returnWidget = new QWidget( sv->viewport() ); 35 QWidget *returnWidget = new QWidget( sv->viewport() );
37 sv->setResizePolicy( QScrollView::AutoOneFit ); 36 sv->setResizePolicy( QScrollView::AutoOneFit );
38// sv->setHScrollBarMode( QScrollView::AlwaysOff ); 37// sv->setHScrollBarMode( QScrollView::AlwaysOff );
39// sv->setFrameShape( QFrame::NoFrame ); 38// sv->setFrameShape( QFrame::NoFrame );
40 39
41 40
42 41
43 42
44 QGridLayout *layout = new QGridLayout( returnWidget, 10, 2 ); 43 QGridLayout *layout = new QGridLayout( returnWidget, 10, 2 );
45 44
46 QLabel *initStringLabel = new QLabel( tr("Init string "), returnWidget ); 45 QLabel *initStringLabel = new QLabel( tr("Init string "), returnWidget );
47 initStringLine = new QLineEdit( returnWidget ); 46 initStringLine = new QLineEdit( returnWidget );
48 layout->addWidget( initStringLabel, 0, 0 ); 47 layout->addWidget( initStringLabel, 0, 0 );
49 layout->addWidget( initStringLine, 0, 1 ); 48 layout->addWidget( initStringLine, 0, 1 );
50 49
51 QLabel *resetStringLabel = new QLabel( tr("Reset string "), returnWidget ); 50 QLabel *resetStringLabel = new QLabel( tr("Reset string "), returnWidget );
52 resetStringLine = new QLineEdit( returnWidget ); 51 resetStringLine = new QLineEdit( returnWidget );
53 layout->addWidget( resetStringLabel, 1, 0 ); 52 layout->addWidget( resetStringLabel, 1, 0 );
54 layout->addWidget( resetStringLine, 1, 1 ); 53 layout->addWidget( resetStringLine, 1, 1 );
55 54
56 QLabel *dialPref1Label = new QLabel( tr("Dialing prefix #1 " ), returnWidget ); 55 QLabel *dialPref1Label = new QLabel( tr("Dialing prefix #1 " ), returnWidget );
57 dialPref1Line = new QLineEdit( returnWidget ); 56 dialPref1Line = new QLineEdit( returnWidget );
58 layout->addWidget( dialPref1Label, 2, 0 ); 57 layout->addWidget( dialPref1Label, 2, 0 );
59 layout->addWidget( dialPref1Line, 2, 1 ); 58 layout->addWidget( dialPref1Line, 2, 1 );
60 59
61 QLabel *dialSuf1Label = new QLabel( tr("Dialing suffix #1 " ), returnWidget ); 60 QLabel *dialSuf1Label = new QLabel( tr("Dialing suffix #1 " ), returnWidget );
62 dialSuf1Line = new QLineEdit( returnWidget ); 61 dialSuf1Line = new QLineEdit( returnWidget );
63 layout->addWidget( dialSuf1Label, 3, 0 ); 62 layout->addWidget( dialSuf1Label, 3, 0 );
64 layout->addWidget( dialSuf1Line, 3, 1 ); 63 layout->addWidget( dialSuf1Line, 3, 1 );
65 64
66 QLabel *dialPref2Label = new QLabel( tr("Dialing prefix #2 " ), returnWidget ); 65 QLabel *dialPref2Label = new QLabel( tr("Dialing prefix #2 " ), returnWidget );
67 dialPref2Line = new QLineEdit( returnWidget ); 66 dialPref2Line = new QLineEdit( returnWidget );
68 layout->addWidget( dialPref2Label, 4, 0 ); 67 layout->addWidget( dialPref2Label, 4, 0 );
69 layout->addWidget( dialPref2Line, 4, 1 ); 68 layout->addWidget( dialPref2Line, 4, 1 );
70 69
71 QLabel *dialSuf2Label = new QLabel( tr("Dialing suffix #2 " ), returnWidget ); 70 QLabel *dialSuf2Label = new QLabel( tr("Dialing suffix #2 " ), returnWidget );
72 dialSuf2Line = new QLineEdit( returnWidget ); 71 dialSuf2Line = new QLineEdit( returnWidget );
73 layout->addWidget( dialSuf2Label, 5, 0 ); 72 layout->addWidget( dialSuf2Label, 5, 0 );
74 layout->addWidget( dialSuf2Line, 5, 1 ); 73 layout->addWidget( dialSuf2Line, 5, 1 );
75 74
76 QLabel *dialPref3Label = new QLabel( tr("Dialing prefix #3 " ), returnWidget ); 75 QLabel *dialPref3Label = new QLabel( tr("Dialing prefix #3 " ), returnWidget );
77 dialPref3Line = new QLineEdit( returnWidget ); 76 dialPref3Line = new QLineEdit( returnWidget );
78 layout->addWidget( dialPref3Label, 6, 0 ); 77 layout->addWidget( dialPref3Label, 6, 0 );
79 layout->addWidget( dialPref3Line, 6, 1 ); 78 layout->addWidget( dialPref3Line, 6, 1 );
80 79
81 QLabel *dialSuf3Label = new QLabel( tr("Dialing suffix #3 " ), returnWidget ); 80 QLabel *dialSuf3Label = new QLabel( tr("Dialing suffix #3 " ), returnWidget );
82 dialSuf3Line = new QLineEdit( returnWidget ); 81 dialSuf3Line = new QLineEdit( returnWidget );
83 layout->addWidget( dialSuf3Label, 7, 0 ); 82 layout->addWidget( dialSuf3Label, 7, 0 );
84 layout->addWidget( dialSuf3Line, 7, 1 ); 83 layout->addWidget( dialSuf3Line, 7, 1 );
85 84
86 QLabel *connectLabel = new QLabel( tr("Connect string " ), returnWidget ); 85 QLabel *connectLabel = new QLabel( tr("Connect string " ), returnWidget );
87 connectLine = new QLineEdit( returnWidget ); 86 connectLine = new QLineEdit( returnWidget );
88 layout->addWidget( connectLabel, 8, 0 ); 87 layout->addWidget( connectLabel, 8, 0 );
89 layout->addWidget( connectLine, 8, 1 ); 88 layout->addWidget( connectLine, 8, 1 );
90 89
91 QLabel *hangupLabel = new QLabel( tr("Hang-up string " ), returnWidget ); 90 QLabel *hangupLabel = new QLabel( tr("Hang-up string " ), returnWidget );
92 hangupLine = new QLineEdit( returnWidget ); 91 hangupLine = new QLineEdit( returnWidget );
93 layout->addWidget( hangupLabel, 9, 0 ); 92 layout->addWidget( hangupLabel, 9, 0 );
94 layout->addWidget( hangupLine, 9, 1 ); 93 layout->addWidget( hangupLine, 9, 1 );
95 94
96 sv->addChild( returnWidget ); 95 sv->addChild( returnWidget );
97 96
98 return sv; 97 return sv;
99 98
100} 99}
101 100
102QWidget* ATConfigDialog::tab1( QWidget* parent ) { 101QWidget* ATConfigDialog::tab1( QWidget* parent ) {
103 102
104 103
105 QWidget *returnWidget = new QWidget( parent ); 104 QWidget *returnWidget = new QWidget( parent );
106 105
107 QGridLayout *layout = new QGridLayout( returnWidget, 8, 2 ); 106 QGridLayout *layout = new QGridLayout( returnWidget, 8, 2 );
108 107
109 QLabel *dialTimeLabel = new QLabel( tr("Dial time " ), returnWidget ); 108 QLabel *dialTimeLabel = new QLabel( tr("Dial time " ), returnWidget );
110 dialTimeSpin = new QSpinBox( returnWidget ); 109 dialTimeSpin = new QSpinBox( returnWidget );
111 layout->addWidget( dialTimeLabel, 0, 0 ); 110 layout->addWidget( dialTimeLabel, 0, 0 );
112 layout->addWidget( dialTimeSpin, 0, 1 ); 111 layout->addWidget( dialTimeSpin, 0, 1 );
113 112
114 QLabel *delayRedialLabel = new QLabel( tr("Delay before redial " ), returnWidget ); 113 QLabel *delayRedialLabel = new QLabel( tr("Delay before redial " ), returnWidget );
115 delayRedialSpin = new QSpinBox( returnWidget ); 114 delayRedialSpin = new QSpinBox( returnWidget );
116 layout->addWidget( delayRedialLabel, 1, 0 ); 115 layout->addWidget( delayRedialLabel, 1, 0 );
117 layout->addWidget( delayRedialSpin, 1, 1 ); 116 layout->addWidget( delayRedialSpin, 1, 1 );
118 117
119 QLabel *numberTriesLabel = new QLabel( tr("Number of tries " ), returnWidget ); 118 QLabel *numberTriesLabel = new QLabel( tr("Number of tries " ), returnWidget );
120 numberTriesSpin = new QSpinBox( returnWidget ); 119 numberTriesSpin = new QSpinBox( returnWidget );
121 layout->addWidget( numberTriesLabel, 2, 0 ); 120 layout->addWidget( numberTriesLabel, 2, 0 );
122 layout->addWidget( numberTriesSpin, 2, 1 ); 121 layout->addWidget( numberTriesSpin, 2, 1 );
123 122
124 QLabel *dtrDropTimeLabel = new QLabel( tr("DTR drop time (0=no) " ), returnWidget ); 123 QLabel *dtrDropTimeLabel = new QLabel( tr("DTR drop time (0=no) " ), returnWidget );
125 dtrDropTimeSpin = new QSpinBox( returnWidget ); 124 dtrDropTimeSpin = new QSpinBox( returnWidget );
126 layout->addWidget( dtrDropTimeLabel, 3, 0 ); 125 layout->addWidget( dtrDropTimeLabel, 3, 0 );
127 layout->addWidget( dtrDropTimeSpin, 3, 1 ); 126 layout->addWidget( dtrDropTimeSpin, 3, 1 );
128 127
129 QLabel *bpsDetectLabel = new QLabel( tr("Auto bps detect " ), returnWidget ); 128 QLabel *bpsDetectLabel = new QLabel( tr("Auto bps detect " ), returnWidget );
130 bpsDetectBox = new QComboBox( returnWidget ); 129 bpsDetectBox = new QComboBox( returnWidget );
131 layout->addWidget( bpsDetectLabel, 4, 0 ); 130 layout->addWidget( bpsDetectLabel, 4, 0 );
132 layout->addWidget( bpsDetectBox, 4, 1 ); 131 layout->addWidget( bpsDetectBox, 4, 1 );
133 bpsDetectBox->insertItem( tr("No") ); 132 bpsDetectBox->insertItem( tr("No") );
134 bpsDetectBox->insertItem( tr("Yes") ); 133 bpsDetectBox->insertItem( tr("Yes") );
135 134
136 QLabel *dcdLinesLabel = new QLabel( tr("Modem has DCD line " ), returnWidget ); 135 QLabel *dcdLinesLabel = new QLabel( tr("Modem has DCD line " ), returnWidget );
137 dcdLinesBox = new QComboBox( returnWidget ); 136 dcdLinesBox = new QComboBox( returnWidget );
138 layout->addWidget( dcdLinesLabel, 5, 0 ); 137 layout->addWidget( dcdLinesLabel, 5, 0 );
139 layout->addWidget( dcdLinesBox, 5, 1 ); 138 layout->addWidget( dcdLinesBox, 5, 1 );
140 dcdLinesBox->insertItem( tr("No") ); 139 dcdLinesBox->insertItem( tr("No") );
141 dcdLinesBox->insertItem( tr("Yes") ); 140 dcdLinesBox->insertItem( tr("Yes") );
142 141
143 QLabel *multiLineUntagLabel = new QLabel( tr("Multi-line untag " ), returnWidget ); 142 QLabel *multiLineUntagLabel = new QLabel( tr("Multi-line untag " ), returnWidget );
144 multiLineUntagBox = new QComboBox( returnWidget ); 143 multiLineUntagBox = new QComboBox( returnWidget );
145 layout->addWidget( multiLineUntagLabel, 6, 0 ); 144 layout->addWidget( multiLineUntagLabel, 6, 0 );
146 layout->addWidget( multiLineUntagBox, 6, 1 ); 145 layout->addWidget( multiLineUntagBox, 6, 1 );
147 multiLineUntagBox->insertItem( tr("No") ); 146 multiLineUntagBox->insertItem( tr("No") );
148 multiLineUntagBox->insertItem( tr("Yes") ); 147 multiLineUntagBox->insertItem( tr("Yes") );
149 148
150 return returnWidget; 149 return returnWidget;
151 150
152} 151}
153 152
154 153
155void ATConfigDialog::readConfig( const Profile& config ) { 154void ATConfigDialog::readConfig( const Profile& config ) {
156 qWarning("config in atconfigdialog"); 155 qWarning("config in atconfigdialog");
157 156
158 initStringLine->setText( config.readEntry("InitString", MODEM_DEFAULT_INIT_STRING ) ); 157 initStringLine->setText( config.readEntry("InitString", MODEM_DEFAULT_INIT_STRING ) );
159 resetStringLine->setText( config.readEntry("ResetString", MODEM_DEFAULT_RESET_STRING ) ); 158 resetStringLine->setText( config.readEntry("ResetString", MODEM_DEFAULT_RESET_STRING ) );
160 dialPref1Line->setText( config.readEntry("DialPrefix1", MODEM_DEFAULT_DIAL_PREFIX1 ) ); 159 dialPref1Line->setText( config.readEntry("DialPrefix1", MODEM_DEFAULT_DIAL_PREFIX1 ) );
161 dialSuf1Line->setText( config.readEntry("DialSuffix1", MODEM_DEFAULT_DIAL_SUFFIX1 ) ); 160 dialSuf1Line->setText( config.readEntry("DialSuffix1", MODEM_DEFAULT_DIAL_SUFFIX1 ) );
162 dialPref2Line->setText( config.readEntry("DialPrefix2", MODEM_DEFAULT_DIAL_PREFIX1 ) ); 161 dialPref2Line->setText( config.readEntry("DialPrefix2", MODEM_DEFAULT_DIAL_PREFIX1 ) );
163 dialSuf2Line->setText( config.readEntry("DialSuffix2", MODEM_DEFAULT_DIAL_SUFFIX1 ) ); 162 dialSuf2Line->setText( config.readEntry("DialSuffix2", MODEM_DEFAULT_DIAL_SUFFIX1 ) );
164 dialPref3Line->setText( config.readEntry("DialPrefix3", MODEM_DEFAULT_DIAL_PREFIX1 ) ); 163 dialPref3Line->setText( config.readEntry("DialPrefix3", MODEM_DEFAULT_DIAL_PREFIX1 ) );
165 dialSuf3Line->setText( config.readEntry("DialSuffix3", MODEM_DEFAULT_DIAL_SUFFIX1 ) ); 164 dialSuf3Line->setText( config.readEntry("DialSuffix3", MODEM_DEFAULT_DIAL_SUFFIX1 ) );
166 connectLine->setText( config.readEntry("DefaultConnect", MODEM_DEFAULT_CONNECT_STRING ) ); 165 connectLine->setText( config.readEntry("DefaultConnect", MODEM_DEFAULT_CONNECT_STRING ) );
167 hangupLine->setText( config.readEntry("HangupString", MODEM_DEFAULT_HANGUP_STRING ) ); 166 hangupLine->setText( config.readEntry("HangupString", MODEM_DEFAULT_HANGUP_STRING ) );
168 dialTimeSpin->setValue( config.readNumEntry("DialTime", MODEM_DEFAULT_DIAL_TIME ) ); 167 dialTimeSpin->setValue( config.readNumEntry("DialTime", MODEM_DEFAULT_DIAL_TIME ) );
169 delayRedialSpin->setValue( config.readNumEntry("DelayRedial", MODEM_DEFAULT_DELAY_REDIAL ) ); 168 delayRedialSpin->setValue( config.readNumEntry("DelayRedial", MODEM_DEFAULT_DELAY_REDIAL ) );
170 numberTriesSpin->setValue( config.readNumEntry("NumberTries", MODEM_DEFAULT_NUMBER_TRIES ) ); 169 numberTriesSpin->setValue( config.readNumEntry("NumberTries", MODEM_DEFAULT_NUMBER_TRIES ) );
171 dtrDropTimeSpin->setValue( config.readNumEntry("DTRDRopTime", MODEM_DEFAULT_DTR_DROP_TIME ) ); 170 dtrDropTimeSpin->setValue( config.readNumEntry("DTRDRopTime", MODEM_DEFAULT_DTR_DROP_TIME ) );
172 bpsDetectBox->setCurrentItem( config.readBoolEntry("BPSDetect", MODEM_DEFAULT_BPS_DETECT ) ); 171 bpsDetectBox->setCurrentItem( config.readBoolEntry("BPSDetect", MODEM_DEFAULT_BPS_DETECT ) );
173 dcdLinesBox->setCurrentItem( config.readBoolEntry("DCDLines", MODEM_DEFAULT_DCD_LINES ) ); 172 dcdLinesBox->setCurrentItem( config.readBoolEntry("DCDLines", MODEM_DEFAULT_DCD_LINES ) );
174 multiLineUntagBox->setCurrentItem( config.readBoolEntry("MultiLineUntag", MODEM_DEFAULT_MULTI_LINE_UNTAG ) ); 173 multiLineUntagBox->setCurrentItem( config.readBoolEntry("MultiLineUntag", MODEM_DEFAULT_MULTI_LINE_UNTAG ) );
175 174
176 // Not implemented yet 175 // Not implemented yet
177 resetStringLine->setEnabled(false); 176 resetStringLine->setEnabled(false);
178 dialSuf1Line->setEnabled(false); 177 dialSuf1Line->setEnabled(false);
179 dialPref2Line->setEnabled(false); 178 dialPref2Line->setEnabled(false);
180 dialSuf2Line->setEnabled(false); 179 dialSuf2Line->setEnabled(false);
181 dialPref3Line->setEnabled(false); 180 dialPref3Line->setEnabled(false);
182 dialSuf3Line->setEnabled(false); 181 dialSuf3Line->setEnabled(false);
183 dialTimeSpin->setEnabled(false); 182 dialTimeSpin->setEnabled(false);
184 delayRedialSpin->setEnabled(false); 183 delayRedialSpin->setEnabled(false);
185 numberTriesSpin->setEnabled(false); 184 numberTriesSpin->setEnabled(false);
186 dtrDropTimeSpin->setEnabled(false); 185 dtrDropTimeSpin->setEnabled(false);
187 bpsDetectBox->setEnabled(false); 186 bpsDetectBox->setEnabled(false);
188 dcdLinesBox->setEnabled(false); 187 dcdLinesBox->setEnabled(false);
189 multiLineUntagBox->setEnabled(false); 188 multiLineUntagBox->setEnabled(false);
190} 189}
191 190
192void ATConfigDialog::writeConfig( Profile& config ) { 191void ATConfigDialog::writeConfig( Profile& config ) {
193 192
194 config.writeEntry( "InitString", initStringLine->text() ); 193 config.writeEntry( "InitString", initStringLine->text() );
195 config.writeEntry( "ResetString", resetStringLine->text() ); 194 config.writeEntry( "ResetString", resetStringLine->text() );
196 config.writeEntry( "DialPrefix1", dialPref1Line->text() ); 195 config.writeEntry( "DialPrefix1", dialPref1Line->text() );
197 config.writeEntry( "DialSuffix1", dialSuf1Line->text() ); 196 config.writeEntry( "DialSuffix1", dialSuf1Line->text() );
198 config.writeEntry( "DialPrefix2", dialPref2Line->text() ); 197 config.writeEntry( "DialPrefix2", dialPref2Line->text() );
199 config.writeEntry( "DialSuffix2", dialSuf2Line->text() ); 198 config.writeEntry( "DialSuffix2", dialSuf2Line->text() );
200 config.writeEntry( "DialPrefix3", dialPref3Line->text() ); 199 config.writeEntry( "DialPrefix3", dialPref3Line->text() );
201 config.writeEntry( "DialSuffix3", dialSuf3Line->text() ); 200 config.writeEntry( "DialSuffix3", dialSuf3Line->text() );
202 config.writeEntry( "DefaultConnect", connectLine->text() ); 201 config.writeEntry( "DefaultConnect", connectLine->text() );
203 config.writeEntry( "HangupString", hangupLine->text() ); 202 config.writeEntry( "HangupString", hangupLine->text() );
204 config.writeEntry( "DialTime", dialTimeSpin->value() ); 203 config.writeEntry( "DialTime", dialTimeSpin->value() );
205 config.writeEntry( "DelayRedial", delayRedialSpin->value() ); 204 config.writeEntry( "DelayRedial", delayRedialSpin->value() );
206 config.writeEntry( "NumberTries", numberTriesSpin->value() ); 205 config.writeEntry( "NumberTries", numberTriesSpin->value() );
207 config.writeEntry( "DTRDRopTime", dtrDropTimeSpin->value() ); 206 config.writeEntry( "DTRDRopTime", dtrDropTimeSpin->value() );
208 config.writeEntry( "BPSDetect", bpsDetectBox->currentItem() ); 207 config.writeEntry( "BPSDetect", bpsDetectBox->currentItem() );
209 config.writeEntry( "DCDLines", dcdLinesBox->currentItem() ); 208 config.writeEntry( "DCDLines", dcdLinesBox->currentItem() );
210 config.writeEntry( "MultiLineUntag", multiLineUntagBox->currentItem() ); 209 config.writeEntry( "MultiLineUntag", multiLineUntagBox->currentItem() );
211 210
212} 211}
213 212
214 213
215ATConfigDialog::~ATConfigDialog() { 214ATConfigDialog::~ATConfigDialog() {
216} 215}
diff --git a/noncore/apps/opie-console/keytrans.cpp b/noncore/apps/opie-console/keytrans.cpp
index d569ae0..45a7960 100644
--- a/noncore/apps/opie-console/keytrans.cpp
+++ b/noncore/apps/opie-console/keytrans.cpp
@@ -1,706 +1,705 @@
1/* -------------------------------------------------------------------------- */ 1/* -------------------------------------------------------------------------- */
2/* */ 2/* */
3/* [keytrans.C] Keyboard Translation */ 3/* [keytrans.C] Keyboard Translation */
4/* */ 4/* */
5/* -------------------------------------------------------------------------- */ 5/* -------------------------------------------------------------------------- */
6/* */ 6/* */
7/* Copyright (c) 1997,1998 by Lars Doelle <lars.doelle@on-line.de> */ 7/* Copyright (c) 1997,1998 by Lars Doelle <lars.doelle@on-line.de> */
8/* */ 8/* */
9/* This file is part of Konsole - an X terminal for KDE */ 9/* This file is part of Konsole - an X terminal for KDE */
10/* */ 10/* */
11/* -------------------------------------------------------------------------- */ 11/* -------------------------------------------------------------------------- */
12 /* */ 12 /* */
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/* 19/*
20 The keyboard translation table allows to configure konsoles behavior 20 The keyboard translation table allows to configure konsoles behavior
21 on key strokes. 21 on key strokes.
22 22
23 FIXME: some bug crept in, disallowing '\0' to be emitted. 23 FIXME: some bug crept in, disallowing '\0' to be emitted.
24*/ 24*/
25 25
26#include "keytrans.h" 26#include "keytrans.h"
27 27
28#include <qpe/qpeapplication.h> 28#include <qpe/qpeapplication.h>
29 29
30#include <qnamespace.h> 30#include <qnamespace.h>
31#include <qbuffer.h> 31#include <qbuffer.h>
32#include <qobject.h> 32#include <qobject.h>
33#include <qdict.h> 33#include <qdict.h>
34#include <qintdict.h> 34#include <qintdict.h>
35#include <qfile.h> 35#include <qfile.h>
36#include <qglobal.h> 36#include <qglobal.h>
37#include <qdir.h> 37#include <qdir.h>
38 38
39//#include <kstddirs.h> 39//#include <kstddirs.h>
40//nclude <klocale.h> 40//nclude <klocale.h>
41 41
42#include <stdio.h> 42#include <stdio.h>
43 43
44 44
45#undef USE_APPDATA_DIR 45#undef USE_APPDATA_DIR
46 46
47 47
48#define HERE printf("%s(%d): here\n",__FILE__,__LINE__) 48#define HERE printf("%s(%d): here\n",__FILE__,__LINE__)
49 49
50/* KeyEntry 50/* KeyEntry
51 51
52 instances represent the individual assignments 52 instances represent the individual assignments
53*/ 53*/
54 54
55KeyTrans::KeyEntry::KeyEntry(int _ref, int _key, int _bits, int _mask, int _cmd, QString _txt) 55KeyTrans::KeyEntry::KeyEntry(int _ref, int _key, int _bits, int _mask, int _cmd, QString _txt)
56: ref(_ref), key(_key), bits(_bits), mask(_mask), cmd(_cmd), txt(_txt) 56: ref(_ref), key(_key), bits(_bits), mask(_mask), cmd(_cmd), txt(_txt)
57{ 57{
58} 58}
59 59
60KeyTrans::KeyEntry::~KeyEntry() 60KeyTrans::KeyEntry::~KeyEntry()
61{ 61{
62} 62}
63 63
64bool KeyTrans::KeyEntry::matches(int _key, int _bits, int _mask) 64bool KeyTrans::KeyEntry::matches(int _key, int _bits, int _mask)
65{ int m = mask & _mask; 65{ int m = mask & _mask;
66 return _key == key && (bits & m) == (_bits & m); 66 return _key == key && (bits & m) == (_bits & m);
67} 67}
68 68
69QString KeyTrans::KeyEntry::text() 69QString KeyTrans::KeyEntry::text()
70{ 70{
71 return txt; 71 return txt;
72} 72}
73 73
74/* KeyTrans 74/* KeyTrans
75 75
76 combines the individual assignments to a proper map 76 combines the individual assignments to a proper map
77 Takes part in a collection themself. 77 Takes part in a collection themself.
78*/ 78*/
79 79
80KeyTrans::KeyTrans() 80KeyTrans::KeyTrans()
81{ 81{
82 path = ""; 82 path = "";
83 numb = 0; 83 numb = 0;
84} 84}
85 85
86KeyTrans::~KeyTrans() 86KeyTrans::~KeyTrans()
87{ 87{
88} 88}
89 89
90KeyTrans::KeyEntry* KeyTrans::addEntry(int ref, int key, int bits, int mask, int cmd, QString txt) 90KeyTrans::KeyEntry* KeyTrans::addEntry(int ref, int key, int bits, int mask, int cmd, QString txt)
91// returns conflicting entry 91// returns conflicting entry
92{ 92{
93 for (QListIterator<KeyEntry> it(table); it.current(); ++it) 93 for (QListIterator<KeyEntry> it(table); it.current(); ++it)
94 { 94 {
95 if (it.current()->matches(key,bits,mask)) 95 if (it.current()->matches(key,bits,mask))
96 { 96 {
97 return it.current(); 97 return it.current();
98 } 98 }
99 } 99 }
100 table.append(new KeyEntry(ref,key,bits,mask,cmd,txt)); 100 table.append(new KeyEntry(ref,key,bits,mask,cmd,txt));
101 return (KeyEntry*)NULL; 101 return (KeyEntry*)NULL;
102} 102}
103 103
104bool KeyTrans::findEntry(int key, int bits, int* cmd, const char** txt, int* len) 104bool KeyTrans::findEntry(int key, int bits, int* cmd, const char** txt, int* len)
105{ 105{
106 for (QListIterator<KeyEntry> it(table); it.current(); ++it) 106 for (QListIterator<KeyEntry> it(table); it.current(); ++it)
107 if (it.current()->matches(key,bits,0xffff)) 107 if (it.current()->matches(key,bits,0xffff))
108 { 108 {
109 *cmd = it.current()->cmd; 109 *cmd = it.current()->cmd;
110 *txt = it.current()->txt.ascii(); 110 *txt = it.current()->txt.ascii();
111 *len = it.current()->txt.length(); 111 *len = it.current()->txt.length();
112 return TRUE; 112 return TRUE;
113 } 113 }
114 return FALSE; 114 return FALSE;
115} 115}
116 116
117/* ------------------------------------------------------------------------- */ 117/* ------------------------------------------------------------------------- */
118/* */ 118/* */
119/* Scanner for keyboard configuration */ 119/* Scanner for keyboard configuration */
120/* */ 120/* */
121/* ------------------------------------------------------------------------- */ 121/* ------------------------------------------------------------------------- */
122 122
123// regular tokenizer 123// regular tokenizer
124/* Tokens 124/* Tokens
125 - Spaces 125 - Spaces
126 - Name (A-Za-z0-9)+ 126 - Name (A-Za-z0-9)+
127 - String 127 - String
128 - Opr on of +-: 128 - Opr on of +-:
129*/ 129*/
130 130
131#define SYMName 0 131#define SYMName 0
132#define SYMString 1 132#define SYMString 1
133#define SYMEol 2 133#define SYMEol 2
134#define SYMEof 3 134#define SYMEof 3
135#define SYMOpr 4 135#define SYMOpr 4
136#define SYMError 5 136#define SYMError 5
137 137
138#define inRange(L,X,H) ((L <= X) && (X <= H)) 138#define inRange(L,X,H) ((L <= X) && (X <= H))
139#define isNibble(X) (inRange('A',X,'F')||inRange('a',X,'f')||inRange('0',X,'9')) 139#define isNibble(X) (inRange('A',X,'F')||inRange('a',X,'f')||inRange('0',X,'9'))
140#define convNibble(X) (inRange('0',X,'9')?X-'0':X+10-(inRange('A',X,'F')?'A':'a')) 140#define convNibble(X) (inRange('0',X,'9')?X-'0':X+10-(inRange('A',X,'F')?'A':'a'))
141 141
142class KeytabReader 142class KeytabReader
143{ 143{
144public: 144public:
145 KeytabReader(QString p, QIODevice &d); 145 KeytabReader(QString p, QIODevice &d);
146public: 146public:
147 void getCc(); 147 void getCc();
148 void getSymbol(); 148 void getSymbol();
149 void parseTo(KeyTrans* kt); 149 void parseTo(KeyTrans* kt);
150 void ReportError(const char* msg); 150 void ReportError(const char* msg);
151 void ReportToken(); // diagnostic 151 void ReportToken(); // diagnostic
152private: 152private:
153 int sym; 153 int sym;
154 QString res; 154 QString res;
155 int len; 155 int len;
156 int slinno; 156 int slinno;
157 int scolno; 157 int scolno;
158private: 158private:
159 int cc; 159 int cc;
160 int linno; 160 int linno;
161 int colno; 161 int colno;
162 QIODevice* buf; 162 QIODevice* buf;
163 QString path; 163 QString path;
164}; 164};
165 165
166 166
167KeytabReader::KeytabReader(QString p, QIODevice &d) 167KeytabReader::KeytabReader(QString p, QIODevice &d)
168{ 168{
169 path = p; 169 path = p;
170 buf = &d; 170 buf = &d;
171 cc = 0; 171 cc = 0;
172} 172}
173 173
174void KeytabReader::getCc() 174void KeytabReader::getCc()
175{ 175{
176 if (cc == '\n') { linno += 1; colno = 0; } 176 if (cc == '\n') { linno += 1; colno = 0; }
177 if (cc < 0) return; 177 if (cc < 0) return;
178 cc = buf->getch(); 178 cc = buf->getch();
179 colno += 1; 179 colno += 1;
180} 180}
181 181
182void KeytabReader::getSymbol() 182void KeytabReader::getSymbol()
183{ 183{
184 res = ""; len = 0; sym = SYMError; 184 res = ""; len = 0; sym = SYMError;
185 while (cc == ' ') getCc(); // skip spaces 185 while (cc == ' ') getCc(); // skip spaces
186 if (cc == '#') // skip comment 186 if (cc == '#') // skip comment
187 { 187 {
188 while (cc != '\n' && cc > 0) getCc(); 188 while (cc != '\n' && cc > 0) getCc();
189 } 189 }
190 slinno = linno; 190 slinno = linno;
191 scolno = colno; 191 scolno = colno;
192 if (cc <= 0) 192 if (cc <= 0)
193 { 193 {
194 sym = SYMEof; return; // eos 194 sym = SYMEof; return; // eos
195 } 195 }
196 if (cc == '\n') 196 if (cc == '\n')
197 { 197 {
198 getCc(); 198 getCc();
199 sym = SYMEol; return; // eol 199 sym = SYMEol; return; // eol
200 } 200 }
201 if (inRange('A',cc,'Z')||inRange('a',cc,'z')||inRange('0',cc,'9')) 201 if (inRange('A',cc,'Z')||inRange('a',cc,'z')||inRange('0',cc,'9'))
202 { 202 {
203 while (inRange('A',cc,'Z') || inRange('a',cc,'z') || inRange('0',cc,'9')) 203 while (inRange('A',cc,'Z') || inRange('a',cc,'z') || inRange('0',cc,'9'))
204 { 204 {
205 res = res + (char)cc; 205 res = res + (char)cc;
206 getCc(); 206 getCc();
207 } 207 }
208 sym = SYMName; 208 sym = SYMName;
209 return; 209 return;
210 } 210 }
211 if (strchr("+-:",cc)) 211 if (strchr("+-:",cc))
212 { 212 {
213 res = ""; 213 res = "";
214 res = res + (char)cc; 214 res = res + (char)cc;
215 getCc(); 215 getCc();
216 sym = SYMOpr; return; 216 sym = SYMOpr; return;
217 } 217 }
218 if (cc == '"') 218 if (cc == '"')
219 { 219 {
220 getCc(); 220 getCc();
221 while (cc >= ' ' && cc != '"') 221 while (cc >= ' ' && cc != '"')
222 { int sc; 222 { int sc;
223 if (cc == '\\') // handle quotation 223 if (cc == '\\') // handle quotation
224 { 224 {
225 getCc(); 225 getCc();
226 switch (cc) 226 switch (cc)
227 { 227 {
228 case 'E' : sc = 27; getCc(); break; 228 case 'E' : sc = 27; getCc(); break;
229 case 'b' : sc = 8; getCc(); break; 229 case 'b' : sc = 8; getCc(); break;
230 case 'f' : sc = 12; getCc(); break; 230 case 'f' : sc = 12; getCc(); break;
231 case 't' : sc = 9; getCc(); break; 231 case 't' : sc = 9; getCc(); break;
232 case 'r' : sc = 13; getCc(); break; 232 case 'r' : sc = 13; getCc(); break;
233 case 'n' : sc = 10; getCc(); break; 233 case 'n' : sc = 10; getCc(); break;
234 case '\\' : // fall thru 234 case '\\' : // fall thru
235 case '"' : sc = cc; getCc(); break; 235 case '"' : sc = cc; getCc(); break;
236 case 'x' : getCc(); 236 case 'x' : getCc();
237 sc = 0; 237 sc = 0;
238 if (!isNibble(cc)) return; sc = 16*sc + convNibble(cc); getCc(); 238 if (!isNibble(cc)) return; sc = 16*sc + convNibble(cc); getCc();
239 if (!isNibble(cc)) return; sc = 16*sc + convNibble(cc); getCc(); 239 if (!isNibble(cc)) return; sc = 16*sc + convNibble(cc); getCc();
240 break; 240 break;
241 default : return; 241 default : return;
242 } 242 }
243 } 243 }
244 else 244 else
245 { 245 {
246 // regular char 246 // regular char
247 sc = cc; getCc(); 247 sc = cc; getCc();
248 } 248 }
249 res = res + (char)sc; 249 res = res + (char)sc;
250 len = len + 1; 250 len = len + 1;
251 } 251 }
252 if (cc != '"') return; 252 if (cc != '"') return;
253 getCc(); 253 getCc();
254 sym = SYMString; return; 254 sym = SYMString; return;
255 } 255 }
256} 256}
257 257
258void KeytabReader::ReportToken() // diagnostic 258void KeytabReader::ReportToken() // diagnostic
259{ 259{
260 printf("sym(%d): ",slinno); 260 printf("sym(%d): ",slinno);
261 switch(sym) 261 switch(sym)
262 { 262 {
263 case SYMEol : printf("End of line"); break; 263 case SYMEol : printf("End of line"); break;
264 case SYMEof : printf("End of file"); break; 264 case SYMEof : printf("End of file"); break;
265 case SYMName : printf("Name: %s",res.latin1()); break; 265 case SYMName : printf("Name: %s",res.latin1()); break;
266 case SYMOpr : printf("Opr : %s",res.latin1()); break; 266 case SYMOpr : printf("Opr : %s",res.latin1()); break;
267 case SYMString : printf("String len %d,%d ",res.length(),len); 267 case SYMString : printf("String len %d,%d ",res.length(),len);
268 for (unsigned i = 0; i < res.length(); i++) 268 for (unsigned i = 0; i < res.length(); i++)
269 printf(" %02x(%c)",res.latin1()[i],res.latin1()[i]>=' '?res.latin1()[i]:'?'); 269 printf(" %02x(%c)",res.latin1()[i],res.latin1()[i]>=' '?res.latin1()[i]:'?');
270 break; 270 break;
271 } 271 }
272 printf("\n"); 272 printf("\n");
273} 273}
274 274
275void KeytabReader::ReportError(const char* msg) // diagnostic 275void KeytabReader::ReportError(const char* msg) // diagnostic
276{ 276{
277 fprintf(stderr,"%s(%d,%d):error: %s.\n",path.ascii(),slinno,scolno,msg); 277 fprintf(stderr,"%s(%d,%d):error: %s.\n",path.ascii(),slinno,scolno,msg);
278} 278}
279 279
280// local symbol tables --------------------------------------------------------------------- 280// local symbol tables ---------------------------------------------------------------------
281 281
282class KeyTransSymbols 282class KeyTransSymbols
283{ 283{
284public: 284public:
285 KeyTransSymbols(); 285 KeyTransSymbols();
286protected: 286protected:
287 void defOprSyms(); 287 void defOprSyms();
288 void defModSyms(); 288 void defModSyms();
289 void defKeySyms(); 289 void defKeySyms();
290 void defKeySym(const char* key, int val); 290 void defKeySym(const char* key, int val);
291 void defOprSym(const char* key, int val); 291 void defOprSym(const char* key, int val);
292 void defModSym(const char* key, int val); 292 void defModSym(const char* key, int val);
293public: 293public:
294 QDict<QObject> keysyms; 294 QDict<QObject> keysyms;
295 QDict<QObject> modsyms; 295 QDict<QObject> modsyms;
296 QDict<QObject> oprsyms; 296 QDict<QObject> oprsyms;
297}; 297};
298 298
299static KeyTransSymbols * syms = 0L; 299static KeyTransSymbols * syms = 0L;
300 300
301// parser ---------------------------------------------------------------------------------- 301// parser ----------------------------------------------------------------------------------
302/* Syntax 302/* Syntax
303 - Line :: [KeyName { ("+" | "-") ModeName } ":" (String|CommandName)] "\n" 303 - Line :: [KeyName { ("+" | "-") ModeName } ":" (String|CommandName)] "\n"
304 - Comment :: '#' (any but \n)* 304 - Comment :: '#' (any but \n)*
305*/ 305*/
306 306
307KeyTrans* KeyTrans::fromDevice(QString path, QIODevice &buf) 307KeyTrans* KeyTrans::fromDevice(QString path, QIODevice &buf)
308{ 308{
309 KeyTrans* kt = new KeyTrans; 309 KeyTrans* kt = new KeyTrans;
310 kt->path = path; 310 kt->path = path;
311 KeytabReader ktr(path,buf); ktr.parseTo(kt); 311 KeytabReader ktr(path,buf); ktr.parseTo(kt);
312 return kt; 312 return kt;
313} 313}
314 314
315 315
316#define assertSyntax(Cond,Message) if (!(Cond)) { ReportError(Message); goto ERROR; } 316#define assertSyntax(Cond,Message) if (!(Cond)) { ReportError(Message); goto ERROR; }
317 317
318void KeytabReader::parseTo(KeyTrans* kt) 318void KeytabReader::parseTo(KeyTrans* kt)
319{ 319{
320 // Opening sequence 320 // Opening sequence
321 321
322 buf->open(IO_ReadOnly); 322 buf->open(IO_ReadOnly);
323 getCc(); 323 getCc();
324 linno = 1; 324 linno = 1;
325 colno = 1; 325 colno = 1;
326 getSymbol(); 326 getSymbol();
327 327
328Loop: 328Loop:
329 // syntax: ["key" KeyName { ("+" | "-") ModeName } ":" String/CommandName] ["#" Comment] 329 // syntax: ["key" KeyName { ("+" | "-") ModeName } ":" String/CommandName] ["#" Comment]
330 if (sym == SYMName && !strcmp(res.latin1(),"keyboard")) 330 if (sym == SYMName && !strcmp(res.latin1(),"keyboard"))
331 { 331 {
332 getSymbol(); assertSyntax(sym == SYMString, "Header expected") 332 getSymbol(); assertSyntax(sym == SYMString, "Header expected")
333 kt->hdr = res.latin1(); 333 kt->hdr = res.latin1();
334 getSymbol(); assertSyntax(sym == SYMEol, "Text unexpected") 334 getSymbol(); assertSyntax(sym == SYMEol, "Text unexpected")
335 getSymbol(); // eoln 335 getSymbol(); // eoln
336 goto Loop; 336 goto Loop;
337 } 337 }
338 if (sym == SYMName && !strcmp(res.latin1(),"key")) 338 if (sym == SYMName && !strcmp(res.latin1(),"key"))
339 { 339 {
340//printf("line %3d: ",startofsym); 340//printf("line %3d: ",startofsym);
341 getSymbol(); assertSyntax(sym == SYMName, "Name expected") 341 getSymbol(); assertSyntax(sym == SYMName, "Name expected")
342 assertSyntax(syms->keysyms[res], "Unknown key name") 342 assertSyntax(syms->keysyms[res], "Unknown key name")
343 int key = (int)syms->keysyms[res]-1; 343 int key = (int)syms->keysyms[res]-1;
344//printf(" key %s (%04x)",res.latin1(),(int)syms->keysyms[res]-1); 344//printf(" key %s (%04x)",res.latin1(),(int)syms->keysyms[res]-1);
345 getSymbol(); // + - : 345 getSymbol(); // + - :
346 int mode = 0; 346 int mode = 0;
347 int mask = 0; 347 int mask = 0;
348 while (sym == SYMOpr && (!strcmp(res.latin1(),"+") || !strcmp(res.latin1(),"-"))) 348 while (sym == SYMOpr && (!strcmp(res.latin1(),"+") || !strcmp(res.latin1(),"-")))
349 { 349 {
350 bool on = !strcmp(res.latin1(),"+"); 350 bool on = !strcmp(res.latin1(),"+");
351 getSymbol(); 351 getSymbol();
352 // mode name 352 // mode name
353 assertSyntax(sym == SYMName, "Name expected") 353 assertSyntax(sym == SYMName, "Name expected")
354 assertSyntax(syms->modsyms[res], "Unknown mode name") 354 assertSyntax(syms->modsyms[res], "Unknown mode name")
355 int bits = (int)syms->modsyms[res]-1; 355 int bits = (int)syms->modsyms[res]-1;
356 if (mask & (1 << bits)) 356 if (mask & (1 << bits))
357 { 357 {
358 fprintf(stderr,"%s(%d,%d): mode name used multible times.\n",path.ascii(),slinno,scolno); 358 fprintf(stderr,"%s(%d,%d): mode name used multible times.\n",path.ascii(),slinno,scolno);
359 } 359 }
360 else 360 else
361 { 361 {
362 mode |= (on << bits); 362 mode |= (on << bits);
363 mask |= (1 << bits); 363 mask |= (1 << bits);
364 } 364 }
365//printf(", mode %s(%d) %s",res.latin1(),(int)syms->modsyms[res]-1,on?"on":"off"); 365//printf(", mode %s(%d) %s",res.latin1(),(int)syms->modsyms[res]-1,on?"on":"off");
366 getSymbol(); 366 getSymbol();
367 } 367 }
368 assertSyntax(sym == SYMOpr && !strcmp(res.latin1(),":"), "':' expected") 368 assertSyntax(sym == SYMOpr && !strcmp(res.latin1(),":"), "':' expected")
369 getSymbol(); 369 getSymbol();
370 // string or command 370 // string or command
371 assertSyntax(sym == SYMName || sym == SYMString,"Command or string expected") 371 assertSyntax(sym == SYMName || sym == SYMString,"Command or string expected")
372 int cmd = 0; 372 int cmd = 0;
373 if (sym == SYMName) 373 if (sym == SYMName)
374 { 374 {
375 assertSyntax(syms->oprsyms[res], "Unknown operator name") 375 assertSyntax(syms->oprsyms[res], "Unknown operator name")
376 cmd = (int)syms->oprsyms[res]-1; 376 cmd = (int)syms->oprsyms[res]-1;
377//printf(": do %s(%d)",res.latin1(),(int)syms->oprsyms[res]-1); 377//printf(": do %s(%d)",res.latin1(),(int)syms->oprsyms[res]-1);
378 } 378 }
379 if (sym == SYMString) 379 if (sym == SYMString)
380 { 380 {
381 cmd = CMD_send; 381 cmd = CMD_send;
382//printf(": send"); 382//printf(": send");
383//for (unsigned i = 0; i < res.length(); i++) 383//for (unsigned i = 0; i < res.length(); i++)
384//printf(" %02x(%c)",res.latin1()[i],res.latin1()[i]>=' '?res.latin1()[i]:'?'); 384//printf(" %02x(%c)",res.latin1()[i],res.latin1()[i]>=' '?res.latin1()[i]:'?');
385 } 385 }
386//printf(". summary %04x,%02x,%02x,%d\n",key,mode,mask,cmd); 386//printf(". summary %04x,%02x,%02x,%d\n",key,mode,mask,cmd);
387 KeyTrans::KeyEntry* ke = kt->addEntry(slinno,key,mode,mask,cmd,res); 387 KeyTrans::KeyEntry* ke = kt->addEntry(slinno,key,mode,mask,cmd,res);
388 if (ke) 388 if (ke)
389 { 389 {
390 fprintf(stderr,"%s(%d): keystroke already assigned in line %d.\n",path.ascii(),slinno,ke->ref); 390 fprintf(stderr,"%s(%d): keystroke already assigned in line %d.\n",path.ascii(),slinno,ke->ref);
391 } 391 }
392 getSymbol(); 392 getSymbol();
393 assertSyntax(sym == SYMEol, "Unexpected text") 393 assertSyntax(sym == SYMEol, "Unexpected text")
394 goto Loop; 394 goto Loop;
395 } 395 }
396 if (sym == SYMEol) 396 if (sym == SYMEol)
397 { 397 {
398 getSymbol(); 398 getSymbol();
399 goto Loop; 399 goto Loop;
400 } 400 }
401 401
402 assertSyntax(sym == SYMEof, "Undecodable Line") 402 assertSyntax(sym == SYMEof, "Undecodable Line")
403 403
404 buf->close(); 404 buf->close();
405 return; 405 return;
406 406
407ERROR: 407ERROR:
408 while (sym != SYMEol && sym != SYMEof) getSymbol(); // eoln 408 while (sym != SYMEol && sym != SYMEof) getSymbol(); // eoln
409 goto Loop; 409 goto Loop;
410} 410}
411 411
412 412
413KeyTrans* KeyTrans::defaultKeyTrans() 413KeyTrans* KeyTrans::defaultKeyTrans()
414{ 414{
415 QCString txt = 415 QCString txt =
416#include "default.keytab.h" 416 #include "default.keytab.h"
417 ; 417 ;
418 QBuffer buf(txt); 418 QBuffer buf(txt);
419 return fromDevice("[buildin]",buf); 419 return fromDevice("[buildin]",buf);
420} 420}
421 421
422KeyTrans* KeyTrans::fromFile(const char* path) 422KeyTrans* KeyTrans::fromFile(const char* path)
423{ 423{
424 QFile file(path); 424 QFile file(path);
425 return fromDevice(path,file); 425 return fromDevice(path,file);
426} 426}
427 427
428// local symbol tables --------------------------------------------------------------------- 428// local symbol tables ---------------------------------------------------------------------
429// material needed for parsing the config file. 429// material needed for parsing the config file.
430// This is incomplete work. 430// This is incomplete work.
431 431
432void KeyTransSymbols::defKeySym(const char* key, int val) 432void KeyTransSymbols::defKeySym(const char* key, int val)
433{ 433{
434 keysyms.insert(key,(QObject*)(val+1)); 434 keysyms.insert(key,(QObject*)(val+1));
435} 435}
436 436
437void KeyTransSymbols::defOprSym(const char* key, int val) 437void KeyTransSymbols::defOprSym(const char* key, int val)
438{ 438{
439 oprsyms.insert(key,(QObject*)(val+1)); 439 oprsyms.insert(key,(QObject*)(val+1));
440} 440}
441 441
442void KeyTransSymbols::defModSym(const char* key, int val) 442void KeyTransSymbols::defModSym(const char* key, int val)
443{ 443{
444 modsyms.insert(key,(QObject*)(val+1)); 444 modsyms.insert(key,(QObject*)(val+1));
445} 445}
446 446
447void KeyTransSymbols::defOprSyms() 447void KeyTransSymbols::defOprSyms()
448{ 448{
449 // Modifier 449 // Modifier
450 defOprSym("scrollLineUp", CMD_scrollLineUp ); 450 defOprSym("scrollLineUp", CMD_scrollLineUp );
451 defOprSym("scrollLineDown",CMD_scrollLineDown); 451 defOprSym("scrollLineDown",CMD_scrollLineDown);
452 defOprSym("scrollPageUp", CMD_scrollPageUp ); 452 defOprSym("scrollPageUp", CMD_scrollPageUp );
453 defOprSym("scrollPageDown",CMD_scrollPageDown); 453 defOprSym("scrollPageDown",CMD_scrollPageDown);
454 defOprSym("emitSelection", CMD_emitSelection ); 454 defOprSym("emitSelection", CMD_emitSelection );
455 defOprSym("prevSession", CMD_prevSession ); 455 defOprSym("prevSession", CMD_prevSession );
456 defOprSym("nextSession", CMD_nextSession ); 456 defOprSym("nextSession", CMD_nextSession );
457} 457}
458 458
459void KeyTransSymbols::defModSyms() 459void KeyTransSymbols::defModSyms()
460{ 460{
461 // Modifier 461 // Modifier
462 defModSym("Shift", BITS_Shift ); 462 defModSym("Shift", BITS_Shift );
463 defModSym("Control", BITS_Control ); 463 defModSym("Control", BITS_Control );
464 defModSym("Alt", BITS_Alt ); 464 defModSym("Alt", BITS_Alt );
465 // Modes 465 // Modes
466 defModSym("BsHack", BITS_BsHack ); // deprecated 466 defModSym("BsHack", BITS_BsHack ); // deprecated
467 defModSym("Ansi", BITS_Ansi ); 467 defModSym("Ansi", BITS_Ansi );
468 defModSym("NewLine", BITS_NewLine ); 468 defModSym("NewLine", BITS_NewLine );
469 defModSym("AppCuKeys", BITS_AppCuKeys ); 469 defModSym("AppCuKeys", BITS_AppCuKeys );
470} 470}
471 471
472void KeyTransSymbols::defKeySyms() 472void KeyTransSymbols::defKeySyms()
473{ 473{
474 // Grey keys 474 // Grey keys
475 defKeySym("Escape", Qt::Key_Escape ); 475 defKeySym("Escape", Qt::Key_Escape );
476 defKeySym("Tab", Qt::Key_Tab ); 476 defKeySym("Tab", Qt::Key_Tab );
477 defKeySym("Backtab", Qt::Key_Backtab ); 477 defKeySym("Backtab", Qt::Key_Backtab );
478 defKeySym("Backspace", Qt::Key_Backspace ); 478 defKeySym("Backspace", Qt::Key_Backspace );
479 defKeySym("Return", Qt::Key_Return ); 479 defKeySym("Return", Qt::Key_Return );
480 defKeySym("Enter", Qt::Key_Enter ); 480 defKeySym("Enter", Qt::Key_Enter );
481 defKeySym("Insert", Qt::Key_Insert ); 481 defKeySym("Insert", Qt::Key_Insert );
482 defKeySym("Delete", Qt::Key_Delete ); 482 defKeySym("Delete", Qt::Key_Delete );
483 defKeySym("Pause", Qt::Key_Pause ); 483 defKeySym("Pause", Qt::Key_Pause );
484 defKeySym("Print", Qt::Key_Print ); 484 defKeySym("Print", Qt::Key_Print );
485 defKeySym("SysReq", Qt::Key_SysReq ); 485 defKeySym("SysReq", Qt::Key_SysReq );
486 defKeySym("Home", Qt::Key_Home ); 486 defKeySym("Home", Qt::Key_Home );
487 defKeySym("End", Qt::Key_End ); 487 defKeySym("End", Qt::Key_End );
488 defKeySym("Left", Qt::Key_Left ); 488 defKeySym("Left", Qt::Key_Left );
489 defKeySym("Up", Qt::Key_Up ); 489 defKeySym("Up", Qt::Key_Up );
490 defKeySym("Right", Qt::Key_Right ); 490 defKeySym("Right", Qt::Key_Right );
491 defKeySym("Down", Qt::Key_Down ); 491 defKeySym("Down", Qt::Key_Down );
492 defKeySym("Prior", Qt::Key_Prior ); 492 defKeySym("Prior", Qt::Key_Prior );
493 defKeySym("Next", Qt::Key_Next ); 493 defKeySym("Next", Qt::Key_Next );
494 defKeySym("Shift", Qt::Key_Shift ); 494 defKeySym("Shift", Qt::Key_Shift );
495 defKeySym("Control", Qt::Key_Control ); 495 defKeySym("Control", Qt::Key_Control );
496 defKeySym("Meta", Qt::Key_Meta ); 496 defKeySym("Meta", Qt::Key_Meta );
497 defKeySym("Alt", Qt::Key_Alt ); 497 defKeySym("Alt", Qt::Key_Alt );
498 defKeySym("CapsLock", Qt::Key_CapsLock ); 498 defKeySym("CapsLock", Qt::Key_CapsLock );
499 defKeySym("NumLock", Qt::Key_NumLock ); 499 defKeySym("NumLock", Qt::Key_NumLock );
500 defKeySym("ScrollLock", Qt::Key_ScrollLock ); 500 defKeySym("ScrollLock", Qt::Key_ScrollLock );
501 defKeySym("F1", Qt::Key_F1 ); 501 defKeySym("F1", Qt::Key_F1 );
502 defKeySym("F2", Qt::Key_F2 ); 502 defKeySym("F2", Qt::Key_F2 );
503 defKeySym("F3", Qt::Key_F3 ); 503 defKeySym("F3", Qt::Key_F3 );
504 defKeySym("F4", Qt::Key_F4 ); 504 defKeySym("F4", Qt::Key_F4 );
505 defKeySym("F5", Qt::Key_F5 ); 505 defKeySym("F5", Qt::Key_F5 );
506 defKeySym("F6", Qt::Key_F6 ); 506 defKeySym("F6", Qt::Key_F6 );
507 defKeySym("F7", Qt::Key_F7 ); 507 defKeySym("F7", Qt::Key_F7 );
508 defKeySym("F8", Qt::Key_F8 ); 508 defKeySym("F8", Qt::Key_F8 );
509 defKeySym("F9", Qt::Key_F9 ); 509 defKeySym("F9", Qt::Key_F9 );
510 defKeySym("F10", Qt::Key_F10 ); 510 defKeySym("F10", Qt::Key_F10 );
511 defKeySym("F11", Qt::Key_F11 ); 511 defKeySym("F11", Qt::Key_F11 );
512 defKeySym("F12", Qt::Key_F12 ); 512 defKeySym("F12", Qt::Key_F12 );
513 defKeySym("F13", Qt::Key_F13 ); 513 defKeySym("F13", Qt::Key_F13 );
514 defKeySym("F14", Qt::Key_F14 ); 514 defKeySym("F14", Qt::Key_F14 );
515 defKeySym("F15", Qt::Key_F15 ); 515 defKeySym("F15", Qt::Key_F15 );
516 defKeySym("F16", Qt::Key_F16 ); 516 defKeySym("F16", Qt::Key_F16 );
517 defKeySym("F17", Qt::Key_F17 ); 517 defKeySym("F17", Qt::Key_F17 );
518 defKeySym("F18", Qt::Key_F18 ); 518 defKeySym("F18", Qt::Key_F18 );
519 defKeySym("F19", Qt::Key_F19 ); 519 defKeySym("F19", Qt::Key_F19 );
520 defKeySym("F20", Qt::Key_F20 ); 520 defKeySym("F20", Qt::Key_F20 );
521 defKeySym("F21", Qt::Key_F21 ); 521 defKeySym("F21", Qt::Key_F21 );
522 defKeySym("F22", Qt::Key_F22 ); 522 defKeySym("F22", Qt::Key_F22 );
523 defKeySym("F23", Qt::Key_F23 ); 523 defKeySym("F23", Qt::Key_F23 );
524 defKeySym("F24", Qt::Key_F24 ); 524 defKeySym("F24", Qt::Key_F24 );
525 defKeySym("F25", Qt::Key_F25 ); 525 defKeySym("F25", Qt::Key_F25 );
526 defKeySym("F26", Qt::Key_F26 ); 526 defKeySym("F26", Qt::Key_F26 );
527 defKeySym("F27", Qt::Key_F27 ); 527 defKeySym("F27", Qt::Key_F27 );
528 defKeySym("F28", Qt::Key_F28 ); 528 defKeySym("F28", Qt::Key_F28 );
529 defKeySym("F29", Qt::Key_F29 ); 529 defKeySym("F29", Qt::Key_F29 );
530 defKeySym("F30", Qt::Key_F30 ); 530 defKeySym("F30", Qt::Key_F30 );
531 defKeySym("F31", Qt::Key_F31 ); 531 defKeySym("F31", Qt::Key_F31 );
532 defKeySym("F32", Qt::Key_F32 ); 532 defKeySym("F32", Qt::Key_F32 );
533 defKeySym("F33", Qt::Key_F33 ); 533 defKeySym("F33", Qt::Key_F33 );
534 defKeySym("F34", Qt::Key_F34 ); 534 defKeySym("F34", Qt::Key_F34 );
535 defKeySym("F35", Qt::Key_F35 ); 535 defKeySym("F35", Qt::Key_F35 );
536 defKeySym("Super_L", Qt::Key_Super_L ); 536 defKeySym("Super_L", Qt::Key_Super_L );
537 defKeySym("Super_R", Qt::Key_Super_R ); 537 defKeySym("Super_R", Qt::Key_Super_R );
538 defKeySym("Menu", Qt::Key_Menu ); 538 defKeySym("Menu", Qt::Key_Menu );
539 defKeySym("Hyper_L", Qt::Key_Hyper_L ); 539 defKeySym("Hyper_L", Qt::Key_Hyper_L );
540 defKeySym("Hyper_R", Qt::Key_Hyper_R ); 540 defKeySym("Hyper_R", Qt::Key_Hyper_R );
541 541
542 // Regular keys 542 // Regular keys
543 defKeySym("Space", Qt::Key_Space ); 543 defKeySym("Space", Qt::Key_Space );
544 defKeySym("Exclam", Qt::Key_Exclam ); 544 defKeySym("Exclam", Qt::Key_Exclam );
545 defKeySym("QuoteDbl", Qt::Key_QuoteDbl ); 545 defKeySym("QuoteDbl", Qt::Key_QuoteDbl );
546 defKeySym("NumberSign", Qt::Key_NumberSign ); 546 defKeySym("NumberSign", Qt::Key_NumberSign );
547 defKeySym("Dollar", Qt::Key_Dollar ); 547 defKeySym("Dollar", Qt::Key_Dollar );
548 defKeySym("Percent", Qt::Key_Percent ); 548 defKeySym("Percent", Qt::Key_Percent );
549 defKeySym("Ampersand", Qt::Key_Ampersand ); 549 defKeySym("Ampersand", Qt::Key_Ampersand );
550 defKeySym("Apostrophe", Qt::Key_Apostrophe ); 550 defKeySym("Apostrophe", Qt::Key_Apostrophe );
551 defKeySym("ParenLeft", Qt::Key_ParenLeft ); 551 defKeySym("ParenLeft", Qt::Key_ParenLeft );
552 defKeySym("ParenRight", Qt::Key_ParenRight ); 552 defKeySym("ParenRight", Qt::Key_ParenRight );
553 defKeySym("Asterisk", Qt::Key_Asterisk ); 553 defKeySym("Asterisk", Qt::Key_Asterisk );
554 defKeySym("Plus", Qt::Key_Plus ); 554 defKeySym("Plus", Qt::Key_Plus );
555 defKeySym("Comma", Qt::Key_Comma ); 555 defKeySym("Comma", Qt::Key_Comma );
556 defKeySym("Minus", Qt::Key_Minus ); 556 defKeySym("Minus", Qt::Key_Minus );
557 defKeySym("Period", Qt::Key_Period ); 557 defKeySym("Period", Qt::Key_Period );
558 defKeySym("Slash", Qt::Key_Slash ); 558 defKeySym("Slash", Qt::Key_Slash );
559 defKeySym("0", Qt::Key_0 ); 559 defKeySym("0", Qt::Key_0 );
560 defKeySym("1", Qt::Key_1 ); 560 defKeySym("1", Qt::Key_1 );
561 defKeySym("2", Qt::Key_2 ); 561 defKeySym("2", Qt::Key_2 );
562 defKeySym("3", Qt::Key_3 ); 562 defKeySym("3", Qt::Key_3 );
563 defKeySym("4", Qt::Key_4 ); 563 defKeySym("4", Qt::Key_4 );
564 defKeySym("5", Qt::Key_5 ); 564 defKeySym("5", Qt::Key_5 );
565 defKeySym("6", Qt::Key_6 ); 565 defKeySym("6", Qt::Key_6 );
566 defKeySym("7", Qt::Key_7 ); 566 defKeySym("7", Qt::Key_7 );
567 defKeySym("8", Qt::Key_8 ); 567 defKeySym("8", Qt::Key_8 );
568 defKeySym("9", Qt::Key_9 ); 568 defKeySym("9", Qt::Key_9 );
569 defKeySym("Colon", Qt::Key_Colon ); 569 defKeySym("Colon", Qt::Key_Colon );
570 defKeySym("Semicolon", Qt::Key_Semicolon ); 570 defKeySym("Semicolon", Qt::Key_Semicolon );
571 defKeySym("Less", Qt::Key_Less ); 571 defKeySym("Less", Qt::Key_Less );
572 defKeySym("Equal", Qt::Key_Equal ); 572 defKeySym("Equal", Qt::Key_Equal );
573 defKeySym("Greater", Qt::Key_Greater ); 573 defKeySym("Greater", Qt::Key_Greater );
574 defKeySym("Question", Qt::Key_Question ); 574 defKeySym("Question", Qt::Key_Question );
575 defKeySym("At", Qt::Key_At ); 575 defKeySym("At", Qt::Key_At );
576 defKeySym("A", Qt::Key_A ); 576 defKeySym("A", Qt::Key_A );
577 defKeySym("B", Qt::Key_B ); 577 defKeySym("B", Qt::Key_B );
578 defKeySym("C", Qt::Key_C ); 578 defKeySym("C", Qt::Key_C );
579 defKeySym("D", Qt::Key_D ); 579 defKeySym("D", Qt::Key_D );
580 defKeySym("E", Qt::Key_E ); 580 defKeySym("E", Qt::Key_E );
581 defKeySym("F", Qt::Key_F ); 581 defKeySym("F", Qt::Key_F );
582 defKeySym("G", Qt::Key_G ); 582 defKeySym("G", Qt::Key_G );
583 defKeySym("H", Qt::Key_H ); 583 defKeySym("H", Qt::Key_H );
584 defKeySym("I", Qt::Key_I ); 584 defKeySym("I", Qt::Key_I );
585 defKeySym("J", Qt::Key_J ); 585 defKeySym("J", Qt::Key_J );
586 defKeySym("K", Qt::Key_K ); 586 defKeySym("K", Qt::Key_K );
587 defKeySym("L", Qt::Key_L ); 587 defKeySym("L", Qt::Key_L );
588 defKeySym("M", Qt::Key_M ); 588 defKeySym("M", Qt::Key_M );
589 defKeySym("N", Qt::Key_N ); 589 defKeySym("N", Qt::Key_N );
590 defKeySym("O", Qt::Key_O ); 590 defKeySym("O", Qt::Key_O );
591 defKeySym("P", Qt::Key_P ); 591 defKeySym("P", Qt::Key_P );
592 defKeySym("Q", Qt::Key_Q ); 592 defKeySym("Q", Qt::Key_Q );
593 defKeySym("R", Qt::Key_R ); 593 defKeySym("R", Qt::Key_R );
594 defKeySym("S", Qt::Key_S ); 594 defKeySym("S", Qt::Key_S );
595 defKeySym("T", Qt::Key_T ); 595 defKeySym("T", Qt::Key_T );
596 defKeySym("U", Qt::Key_U ); 596 defKeySym("U", Qt::Key_U );
597 defKeySym("V", Qt::Key_V ); 597 defKeySym("V", Qt::Key_V );
598 defKeySym("W", Qt::Key_W ); 598 defKeySym("W", Qt::Key_W );
599 defKeySym("X", Qt::Key_X ); 599 defKeySym("X", Qt::Key_X );
600 defKeySym("Y", Qt::Key_Y ); 600 defKeySym("Y", Qt::Key_Y );
601 defKeySym("Z", Qt::Key_Z ); 601 defKeySym("Z", Qt::Key_Z );
602 defKeySym("BracketLeft", Qt::Key_BracketLeft ); 602 defKeySym("BracketLeft", Qt::Key_BracketLeft );
603 defKeySym("Backslash", Qt::Key_Backslash ); 603 defKeySym("Backslash", Qt::Key_Backslash );
604 defKeySym("BracketRight", Qt::Key_BracketRight); 604 defKeySym("BracketRight", Qt::Key_BracketRight);
605 defKeySym("AsciiCircum", Qt::Key_AsciiCircum ); 605 defKeySym("AsciiCircum", Qt::Key_AsciiCircum );
606 defKeySym("Underscore", Qt::Key_Underscore ); 606 defKeySym("Underscore", Qt::Key_Underscore );
607 defKeySym("QuoteLeft", Qt::Key_QuoteLeft ); 607 defKeySym("QuoteLeft", Qt::Key_QuoteLeft );
608 defKeySym("BraceLeft", Qt::Key_BraceLeft ); 608 defKeySym("BraceLeft", Qt::Key_BraceLeft );
609 defKeySym("Bar", Qt::Key_Bar ); 609 defKeySym("Bar", Qt::Key_Bar );
610 defKeySym("BraceRight", Qt::Key_BraceRight ); 610 defKeySym("BraceRight", Qt::Key_BraceRight );
611 defKeySym("AsciiTilde", Qt::Key_AsciiTilde ); 611 defKeySym("AsciiTilde", Qt::Key_AsciiTilde );
612} 612}
613 613
614KeyTransSymbols::KeyTransSymbols() 614KeyTransSymbols::KeyTransSymbols()
615{ 615{
616 defModSyms(); 616 defModSyms();
617 defOprSyms(); 617 defOprSyms();
618 defKeySyms(); 618 defKeySyms();
619} 619}
620 620
621// Global material ----------------------------------------------------------- 621// Global material -----------------------------------------------------------
622 622
623static int keytab_serial = 0; //FIXME: remove,localize 623static int keytab_serial = 0; //FIXME: remove,localize
624 624
625static QIntDict<KeyTrans> * numb2keymap = 0L; 625static QIntDict<KeyTrans> * numb2keymap = 0L;
626static QDict<KeyTrans> * path2keymap = 0L; 626static QDict<KeyTrans> * path2keymap = 0L;
627 627
628KeyTrans* KeyTrans::find(int numb) 628KeyTrans* KeyTrans::find(int numb)
629{ 629{
630 KeyTrans* res = numb2keymap->find(numb); 630 KeyTrans* res = numb2keymap->find(numb);
631 return res ? res : numb2keymap->find(0); 631 return res ? res : numb2keymap->find(0);
632} 632}
633 633
634KeyTrans* KeyTrans::find(const char* path) 634KeyTrans* KeyTrans::find(const char* path)
635{ 635{
636 KeyTrans* res = path2keymap->find(path); 636 KeyTrans* res = path2keymap->find(path);
637 return res ? res : numb2keymap->find(0); 637 return res ? res : numb2keymap->find(0);
638} 638}
639 639
640int KeyTrans::count() 640int KeyTrans::count()
641{ 641{
642 return numb2keymap->count(); 642 return numb2keymap->count();
643} 643}
644 644
645void KeyTrans::addKeyTrans() 645void KeyTrans::addKeyTrans()
646{ 646{
647 this->numb = keytab_serial ++; 647 this->numb = keytab_serial ++;
648 numb2keymap->insert(numb,this); 648 numb2keymap->insert(numb,this);
649 path2keymap->insert(path,this); 649 path2keymap->insert(path,this);
650} 650}
651 651
652void KeyTrans::loadAll() 652void KeyTrans::loadAll()
653{ 653{
654 if (!numb2keymap) 654 if (!numb2keymap)
655 numb2keymap = new QIntDict<KeyTrans>; 655 numb2keymap = new QIntDict<KeyTrans>;
656 if (!path2keymap) 656 if (!path2keymap)
657 path2keymap = new QDict<KeyTrans>; 657 path2keymap = new QDict<KeyTrans>;
658 if (!syms) 658 if (!syms)
659 syms = new KeyTransSymbols; 659 syms = new KeyTransSymbols;
660 660
661 defaultKeyTrans()->addKeyTrans(); 661 defaultKeyTrans()->addKeyTrans();
662 662
663 663
664 QString path = QPEApplication::qpeDir() + "etc/keytabs"; 664 QString path = QPEApplication::qpeDir() + "etc/keytabs";
665 QDir dir(path); 665 QDir dir(path);
666 QStringList lst = dir.entryList("*.keytab"); 666 QStringList lst = dir.entryList("*.keytab");
667 667
668 for(QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) { 668 for(QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) {
669 QFile file(path + "/" + *it); 669 QFile file(path + "/" + *it);
670 KeyTrans* sc = KeyTrans::fromDevice(*it, file); 670 KeyTrans* sc = KeyTrans::fromDevice(*it, file);
671 if (sc) { 671 if (sc) {
672 sc->addKeyTrans(); 672 sc->addKeyTrans();
673 } 673 }
674 } 674 }
675 675
676} 676}
677 677
678// Debugging material ----------------------------------------------------------- 678// Debugging material -----------------------------------------------------------
679/* 679/*
680void TestTokenizer(QBuffer &buf) 680void TestTokenizer(QBuffer &buf)
681{ 681{
682 // opening sequence 682 // opening sequence
683 683
684 buf.open(IO_ReadOnly); 684 buf.open(IO_ReadOnly);
685 cc = buf.getch(); 685 cc = buf.getch();
686 lineno = 1; 686 lineno = 1;
687 687
688 // Test tokenizer 688 // Test tokenizer
689 689
690 while (getSymbol(buf)) ReportToken(); 690 while (getSymbol(buf)) ReportToken();
691 691
692 buf.close(); 692 buf.close();
693} 693}
694 694
695void test() 695void test()
696{ 696{
697 // Opening sequence 697 // Opening sequence
698 698
699 QCString txt = 699 QCString txt =
700#include "default.keytab.h"
701 ; 700 ;
702 QBuffer buf(txt); 701 QBuffer buf(txt);
703 if (0) TestTokenizer(buf); 702 if (0) TestTokenizer(buf);
704 if (1) { KeyTrans kt; kt.scanTable(buf); } 703 if (1) { KeyTrans kt; kt.scanTable(buf); }
705} 704}
706*/ 705*/
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp
index 0a475d8..1d2385f 100644
--- a/noncore/apps/opie-console/mainwindow.cpp
+++ b/noncore/apps/opie-console/mainwindow.cpp
@@ -1,728 +1,727 @@
1#include <assert.h> 1#include <assert.h>
2 2
3#include <qaction.h> 3#include <qaction.h>
4#include <qmenubar.h> 4#include <qmenubar.h>
5#include <qtoolbar.h> 5#include <qtoolbar.h>
6#include <qmessagebox.h> 6#include <qmessagebox.h>
7#include <qwhatsthis.h> 7#include <qwhatsthis.h>
8#include <qfileinfo.h> 8#include <qfileinfo.h>
9 9
10#include <qpe/filemanager.h> 10#include <qpe/filemanager.h>
11#include <qpe/qpeapplication.h>
12 11
13#include <opie2/ofiledialog.h> 12#include <opie2/ofiledialog.h>
14 13
15#include "TEmulation.h" 14#include "TEmulation.h"
16#include "profileeditordialog.h" 15#include "profileeditordialog.h"
17#include "configdialog.h" 16#include "configdialog.h"
18#include "default.h" 17#include "default.h"
19#include "profilemanager.h" 18#include "profilemanager.h"
20#include "mainwindow.h" 19#include "mainwindow.h"
21#include "tabwidget.h" 20#include "tabwidget.h"
22#include "transferdialog.h" 21#include "transferdialog.h"
23#include "function_keyboard.h" 22#include "function_keyboard.h"
24#include "emulation_handler.h" 23#include "emulation_handler.h"
25#include "script.h" 24#include "script.h"
26 25
27 26
28MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) { 27MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) {
29 KeyTrans::loadAll(); 28 KeyTrans::loadAll();
30 for (int i = 0; i < KeyTrans::count(); i++ ) { 29 for (int i = 0; i < KeyTrans::count(); i++ ) {
31 KeyTrans* s = KeyTrans::find(i ); 30 KeyTrans* s = KeyTrans::find(i );
32 assert( s ); 31 assert( s );
33 } 32 }
34 m_factory = new MetaFactory(); 33 m_factory = new MetaFactory();
35 Default def(m_factory); 34 Default def(m_factory);
36 m_sessions.setAutoDelete( TRUE ); 35 m_sessions.setAutoDelete( TRUE );
37 m_curSession = 0; 36 m_curSession = 0;
38 m_manager = new ProfileManager( m_factory ); 37 m_manager = new ProfileManager( m_factory );
39 m_manager->load(); 38 m_manager->load();
40 m_scriptsData.setAutoDelete(TRUE); 39 m_scriptsData.setAutoDelete(TRUE);
41 40
42 initUI(); 41 initUI();
43 populateProfiles(); 42 populateProfiles();
44 populateScripts(); 43 populateScripts();
45} 44}
46 45
47void MainWindow::initUI() { 46void MainWindow::initUI() {
48 47
49 setToolBarsMovable( FALSE ); 48 setToolBarsMovable( FALSE );
50 49
51 /* tool bar for the menu */ 50 /* tool bar for the menu */
52 m_tool = new QToolBar( this ); 51 m_tool = new QToolBar( this );
53 m_tool->setHorizontalStretchable( TRUE ); 52 m_tool->setHorizontalStretchable( TRUE );
54 53
55 m_bar = new QMenuBar( m_tool ); 54 m_bar = new QMenuBar( m_tool );
56 m_console = new QPopupMenu( this ); 55 m_console = new QPopupMenu( this );
57 m_scripts = new QPopupMenu( this ); 56 m_scripts = new QPopupMenu( this );
58 m_sessionsPop= new QPopupMenu( this ); 57 m_sessionsPop= new QPopupMenu( this );
59 m_scriptsPop = new QPopupMenu( this ); 58 m_scriptsPop = new QPopupMenu( this );
60 59
61 /* add a toolbar for icons */ 60 /* add a toolbar for icons */
62 m_icons = new QToolBar(this); 61 m_icons = new QToolBar(this);
63 62
64 /* 63 /*
65 * the settings action 64 * the settings action
66 */ 65 */
67 m_setProfiles = new QAction(tr("Configure Profiles"), 66 m_setProfiles = new QAction(tr("Configure Profiles"),
68 Resource::loadPixmap( "SettingsIcon" ), 67 Resource::loadPixmap( "SettingsIcon" ),
69 QString::null, 0, this, 0); 68 QString::null, 0, this, 0);
70 m_setProfiles->addTo( m_console ); 69 m_setProfiles->addTo( m_console );
71 connect( m_setProfiles, SIGNAL(activated() ), 70 connect( m_setProfiles, SIGNAL(activated() ),
72 this, SLOT(slotConfigure() ) ); 71 this, SLOT(slotConfigure() ) );
73 72
74 m_console->insertSeparator(); 73 m_console->insertSeparator();
75 /* 74 /*
76 * new Action for new sessions 75 * new Action for new sessions
77 */ 76 */
78 QAction* newCon = new QAction(tr("New Profile"), 77 QAction* newCon = new QAction(tr("New Profile"),
79 Resource::loadPixmap( "new" ), 78 Resource::loadPixmap( "new" ),
80 QString::null, 0, this, 0); 79 QString::null, 0, this, 0);
81 newCon->addTo( m_console ); 80 newCon->addTo( m_console );
82 connect( newCon, SIGNAL(activated() ), 81 connect( newCon, SIGNAL(activated() ),
83 this, SLOT(slotNew() ) ); 82 this, SLOT(slotNew() ) );
84 83
85 m_console->insertSeparator(); 84 m_console->insertSeparator();
86 85
87 QAction *saveCon = new QAction( tr("Save Profile" ), 86 QAction *saveCon = new QAction( tr("Save Profile" ),
88 Resource::loadPixmap( "save" ), QString::null, 87 Resource::loadPixmap( "save" ), QString::null,
89 0, this, 0 ); 88 0, this, 0 );
90 saveCon->addTo( m_console ); 89 saveCon->addTo( m_console );
91 connect( saveCon, SIGNAL(activated() ), 90 connect( saveCon, SIGNAL(activated() ),
92 this, SLOT(slotSaveSession() ) ); 91 this, SLOT(slotSaveSession() ) );
93 m_console->insertSeparator(); 92 m_console->insertSeparator();
94 93
95 /* 94 /*
96 * connect action 95 * connect action
97 */ 96 */
98 m_connect = new QAction( tr("Connect"), Resource::loadPixmap("console/connected"), 97 m_connect = new QAction( tr("Connect"), Resource::loadPixmap("console/connected"),
99 QString::null, 0, this, 0 ); 98 QString::null, 0, this, 0 );
100 m_connect->addTo( m_console ); 99 m_connect->addTo( m_console );
101 connect(m_connect, SIGNAL(activated() ), 100 connect(m_connect, SIGNAL(activated() ),
102 this, SLOT(slotConnect() ) ); 101 this, SLOT(slotConnect() ) );
103 102
104 /* 103 /*
105 * disconnect action 104 * disconnect action
106 */ 105 */
107 m_disconnect = new QAction( tr("Disconnect"), Resource::loadPixmap("console/notconnected"), 106 m_disconnect = new QAction( tr("Disconnect"), Resource::loadPixmap("console/notconnected"),
108 QString::null, 0, this, 0 ); 107 QString::null, 0, this, 0 );
109 m_disconnect->addTo( m_console ); 108 m_disconnect->addTo( m_console );
110 connect(m_disconnect, SIGNAL(activated() ), 109 connect(m_disconnect, SIGNAL(activated() ),
111 this, SLOT(slotDisconnect() ) ); 110 this, SLOT(slotDisconnect() ) );
112 111
113 m_console->insertSeparator(); 112 m_console->insertSeparator();
114 113
115 114
116 m_quickLaunch = new QAction( tr("QuickLaunch"), Resource::loadPixmap("console/konsole_mini"), QString::null, 0, this, 0 ); 115 m_quickLaunch = new QAction( tr("QuickLaunch"), Resource::loadPixmap("console/konsole_mini"), QString::null, 0, this, 0 );
117 m_quickLaunch->addTo( m_icons ); 116 m_quickLaunch->addTo( m_icons );
118 connect( m_quickLaunch, SIGNAL( activated() ), 117 connect( m_quickLaunch, SIGNAL( activated() ),
119 this, SLOT( slotQuickLaunch() ) ); 118 this, SLOT( slotQuickLaunch() ) );
120 119
121 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" ) );
122 121
123 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,
124 0, this, 0 ); 123 0, this, 0 );
125 m_transfer->addTo( m_console ); 124 m_transfer->addTo( m_console );
126 connect(m_transfer, SIGNAL(activated() ), 125 connect(m_transfer, SIGNAL(activated() ),
127 this, SLOT(slotTransfer() ) ); 126 this, SLOT(slotTransfer() ) );
128 127
129 128
130 129
131 /* 130 /*
132 * immediate change of line wrap policy 131 * immediate change of line wrap policy
133 */ 132 */
134 m_isWrapped = false; 133 m_isWrapped = false;
135 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 );
136 m_wrap->addTo( m_console ); 135 m_wrap->addTo( m_console );
137 connect( m_wrap, SIGNAL( activated() ), SLOT( slotWrap() ) ); 136 connect( m_wrap, SIGNAL( activated() ), SLOT( slotWrap() ) );
138 137
139 /* 138 /*
140 * fullscreen 139 * fullscreen
141 */ 140 */
142 m_isFullscreen = false; 141 m_isFullscreen = false;
143 142
144 m_fullscreen = new QAction( tr("Full screen"), Resource::loadPixmap( "fullscreen" ) 143 m_fullscreen = new QAction( tr("Full screen"), Resource::loadPixmap( "fullscreen" )
145 , QString::null, 0, this, 0); 144 , QString::null, 0, this, 0);
146 m_fullscreen->addTo( m_console ); 145 m_fullscreen->addTo( m_console );
147 connect( m_fullscreen, SIGNAL( activated() ), 146 connect( m_fullscreen, SIGNAL( activated() ),
148 this, SLOT( slotFullscreen() ) ); 147 this, SLOT( slotFullscreen() ) );
149 148
150 m_console->insertSeparator(); 149 m_console->insertSeparator();
151 150
152 QAction *a = new QAction(); 151 QAction *a = new QAction();
153 a->setText( tr("Save history") ); 152 a->setText( tr("Save history") );
154 a->addTo( m_console ); 153 a->addTo( m_console );
155 connect(a, SIGNAL(activated() ), 154 connect(a, SIGNAL(activated() ),
156 this, SLOT(slotSaveHistory() ) ); 155 this, SLOT(slotSaveHistory() ) );
157 /* 156 /*
158 * terminate action 157 * terminate action
159 */ 158 */
160 m_terminate = new QAction(); 159 m_terminate = new QAction();
161 m_terminate->setText( tr("Terminate") ); 160 m_terminate->setText( tr("Terminate") );
162 m_terminate->addTo( m_console ); 161 m_terminate->addTo( m_console );
163 connect(m_terminate, SIGNAL(activated() ), 162 connect(m_terminate, SIGNAL(activated() ),
164 this, SLOT(slotTerminate() ) ); 163 this, SLOT(slotTerminate() ) );
165 164
166 m_closewindow = new QAction(); 165 m_closewindow = new QAction();
167 m_closewindow->setText( tr("Close Window") ); 166 m_closewindow->setText( tr("Close Window") );
168 m_closewindow->addTo( m_console ); 167 m_closewindow->addTo( m_console );
169 connect( m_closewindow, SIGNAL(activated() ), 168 connect( m_closewindow, SIGNAL(activated() ),
170 this, SLOT(slotClose() ) ); 169 this, SLOT(slotClose() ) );
171 170
172 171
173 /* 172 /*
174 * script actions 173 * script actions
175 */ 174 */
176 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);
177 connect(m_scriptsPop, SIGNAL(activated(int)), this, SLOT(slotRunScript(int))); 176 connect(m_scriptsPop, SIGNAL(activated(int)), this, SLOT(slotRunScript(int)));
178 177
179 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);
180 m_recordScript->addTo(m_scripts); 179 m_recordScript->addTo(m_scripts);
181 connect(m_recordScript, SIGNAL(activated()), this, SLOT(slotRecordScript())); 180 connect(m_recordScript, SIGNAL(activated()), this, SLOT(slotRecordScript()));
182 181
183 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);
184 m_saveScript->addTo(m_scripts); 183 m_saveScript->addTo(m_scripts);
185 connect(m_saveScript, SIGNAL(activated()), this, SLOT(slotSaveScript())); 184 connect(m_saveScript, SIGNAL(activated()), this, SLOT(slotSaveScript()));
186 185
187 186
188 /* 187 /*
189 * action that open/closes the keyboard 188 * action that open/closes the keyboard
190 */ 189 */
191 m_openKeys = new QAction (tr("Open Keyboard..."), 190 m_openKeys = new QAction (tr("Open Keyboard..."),
192 Resource::loadPixmap( "console/keys/keyboard_icon" ), 191 Resource::loadPixmap( "console/keys/keyboard_icon" ),
193 QString::null, 0, this, 0); 192 QString::null, 0, this, 0);
194 m_openKeys->setToggleAction(true); 193 m_openKeys->setToggleAction(true);
195 connect (m_openKeys, SIGNAL(toggled(bool)), this, SLOT(slotOpenKeb(bool))); 194 connect (m_openKeys, SIGNAL(toggled(bool)), this, SLOT(slotOpenKeb(bool)));
196 195
197 /* insert the submenu */ 196 /* insert the submenu */
198 m_console->insertItem(tr("New from Profile"), m_sessionsPop, 197 m_console->insertItem(tr("New from Profile"), m_sessionsPop,
199 -1, 0); 198 -1, 0);
200 199
201 /* insert the connection menu */ 200 /* insert the connection menu */
202 m_bar->insertItem( tr("Connection"), m_console ); 201 m_bar->insertItem( tr("Connection"), m_console );
203 202
204 /* the scripts menu */ 203 /* the scripts menu */
205 m_bar->insertItem( tr("Scripts"), m_scripts ); 204 m_bar->insertItem( tr("Scripts"), m_scripts );
206 205
207 /* and the keyboard */ 206 /* and the keyboard */
208 m_keyBar = new QToolBar(this); 207 m_keyBar = new QToolBar(this);
209 addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE ); 208 addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE );
210 m_keyBar->setHorizontalStretchable( TRUE ); 209 m_keyBar->setHorizontalStretchable( TRUE );
211 m_keyBar->hide(); 210 m_keyBar->hide();
212 211
213 m_kb = new FunctionKeyboard(m_keyBar); 212 m_kb = new FunctionKeyboard(m_keyBar);
214 connect(m_kb, SIGNAL(keyPressed(FKey, ushort, ushort, bool)), 213 connect(m_kb, SIGNAL(keyPressed(FKey, ushort, ushort, bool)),
215 this, SLOT(slotKeyReceived(FKey, ushort, ushort, bool))); 214 this, SLOT(slotKeyReceived(FKey, ushort, ushort, bool)));
216 215
217 216
218 a = new QAction(tr("Copy"), 217 a = new QAction(tr("Copy"),
219 Resource::loadPixmap("copy"), QString::null, 218 Resource::loadPixmap("copy"), QString::null,
220 0, this, 0 ); 219 0, this, 0 );
221 //a->addTo( m_icons ); 220 //a->addTo( m_icons );
222 connect( a, SIGNAL(activated() ), 221 connect( a, SIGNAL(activated() ),
223 this, SLOT(slotCopy() ) ); 222 this, SLOT(slotCopy() ) );
224 223
225 QAction *paste = new QAction(tr("Paste"), 224 QAction *paste = new QAction(tr("Paste"),
226 Resource::loadPixmap("paste"), QString::null, 225 Resource::loadPixmap("paste"), QString::null,
227 0, this, 0 ); 226 0, this, 0 );
228 connect( paste, SIGNAL(activated() ), 227 connect( paste, SIGNAL(activated() ),
229 this, SLOT(slotPaste() ) ); 228 this, SLOT(slotPaste() ) );
230 229
231 230
232 newCon->addTo( m_icons ); 231 newCon->addTo( m_icons );
233 //m_setProfiles->addTo( m_icons ); 232 //m_setProfiles->addTo( m_icons );
234 paste->addTo( m_icons ); 233 paste->addTo( m_icons );
235 m_openKeys->addTo(m_icons); 234 m_openKeys->addTo(m_icons);
236 m_fullscreen->addTo( m_icons ); 235 m_fullscreen->addTo( m_icons );
237 236
238 m_connect->setEnabled( false ); 237 m_connect->setEnabled( false );
239 m_disconnect->setEnabled( false ); 238 m_disconnect->setEnabled( false );
240 m_terminate->setEnabled( false ); 239 m_terminate->setEnabled( false );
241 m_transfer->setEnabled( false ); 240 m_transfer->setEnabled( false );
242 m_scripts->setItemEnabled(m_runScript_id, false); 241 m_scripts->setItemEnabled(m_runScript_id, false);
243 m_recordScript->setEnabled( false ); 242 m_recordScript->setEnabled( false );
244 m_saveScript->setEnabled( false ); 243 m_saveScript->setEnabled( false );
245 m_fullscreen->setEnabled( false ); 244 m_fullscreen->setEnabled( false );
246 m_closewindow->setEnabled( false ); 245 m_closewindow->setEnabled( false );
247 m_wrap->setEnabled( false ); 246 m_wrap->setEnabled( false );
248 247
249 /* 248 /*
250 * connect to the menu activation 249 * connect to the menu activation
251 */ 250 */
252 connect( m_sessionsPop, SIGNAL(activated( int ) ), 251 connect( m_sessionsPop, SIGNAL(activated( int ) ),
253 this, SLOT(slotProfile( int ) ) ); 252 this, SLOT(slotProfile( int ) ) );
254 253
255 m_consoleWindow = new TabWidget( this, "blah"); 254 m_consoleWindow = new TabWidget( this, "blah");
256 connect(m_consoleWindow, SIGNAL(activated(Session*) ), 255 connect(m_consoleWindow, SIGNAL(activated(Session*) ),
257 this, SLOT(slotSessionChanged(Session*) ) ); 256 this, SLOT(slotSessionChanged(Session*) ) );
258 setCentralWidget( m_consoleWindow ); 257 setCentralWidget( m_consoleWindow );
259 258
260 slotQuickLaunch(); 259 slotQuickLaunch();
261} 260}
262 261
263ProfileManager* MainWindow::manager() { 262ProfileManager* MainWindow::manager() {
264 return m_manager; 263 return m_manager;
265} 264}
266TabWidget* MainWindow::tabWidget() { 265TabWidget* MainWindow::tabWidget() {
267 return m_consoleWindow; 266 return m_consoleWindow;
268} 267}
269void MainWindow::populateProfiles() { 268void MainWindow::populateProfiles() {
270 m_sessionsPop->clear(); 269 m_sessionsPop->clear();
271 Profile::ValueList list = manager()->all(); 270 Profile::ValueList list = manager()->all();
272 for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) { 271 for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) {
273 m_sessionsPop->insertItem( (*it).name() ); 272 m_sessionsPop->insertItem( (*it).name() );
274 } 273 }
275 274
276} 275}
277 276
278void MainWindow::populateScripts() { 277void MainWindow::populateScripts() {
279 m_scriptsPop->clear(); 278 m_scriptsPop->clear();
280 m_scriptsData.clear(); 279 m_scriptsData.clear();
281 DocLnkSet files(QPEApplication::documentDir(), "text/plain"); 280 DocLnkSet files(QPEApplication::documentDir(), "text/plain");
282 QListIterator<DocLnk> dit(files.children()); 281 QListIterator<DocLnk> dit(files.children());
283 for (; dit.current(); ++dit) { 282 for (; dit.current(); ++dit) {
284 if (*dit && (*dit)->name().length()>0) { 283 if (*dit && (*dit)->name().length()>0) {
285 QFileInfo info((*dit)->file()); 284 QFileInfo info((*dit)->file());
286 if (info.extension(false) == "script") { 285 if (info.extension(false) == "script") {
287 m_scriptsData.append(new DocLnk(**dit)); 286 m_scriptsData.append(new DocLnk(**dit));
288 m_scriptsPop->insertItem((*dit)->name()); 287 m_scriptsPop->insertItem((*dit)->name());
289 } 288 }
290 } 289 }
291 } 290 }
292 291
293} 292}
294 293
295MainWindow::~MainWindow() { 294MainWindow::~MainWindow() {
296 delete m_factory; 295 delete m_factory;
297 manager()->save(); 296 manager()->save();
298} 297}
299 298
300MetaFactory* MainWindow::factory() { 299MetaFactory* MainWindow::factory() {
301 return m_factory; 300 return m_factory;
302} 301}
303 302
304Session* MainWindow::currentSession() { 303Session* MainWindow::currentSession() {
305 return m_curSession; 304 return m_curSession;
306} 305}
307 306
308QList<Session> MainWindow::sessions() { 307QList<Session> MainWindow::sessions() {
309 return m_sessions; 308 return m_sessions;
310} 309}
311 310
312void MainWindow::slotNew() { 311void MainWindow::slotNew() {
313 ProfileEditorDialog dlg(factory() ); 312 ProfileEditorDialog dlg(factory() );
314 dlg.setCaption( tr("New Connection") ); 313 dlg.setCaption( tr("New Connection") );
315 int ret = QPEApplication::execDialog( &dlg ); 314 int ret = QPEApplication::execDialog( &dlg );
316 315
317 if ( ret == QDialog::Accepted ) { 316 if ( ret == QDialog::Accepted ) {
318 create( dlg.profile() ); 317 create( dlg.profile() );
319 } 318 }
320} 319}
321 320
322void MainWindow::slotRecordScript() { 321void MainWindow::slotRecordScript() {
323 if (currentSession()) { 322 if (currentSession()) {
324 currentSession()->emulationHandler()->startRecording(); 323 currentSession()->emulationHandler()->startRecording();
325 m_saveScript->setEnabled(true); 324 m_saveScript->setEnabled(true);
326 m_recordScript->setEnabled(false); 325 m_recordScript->setEnabled(false);
327 } 326 }
328} 327}
329 328
330void MainWindow::slotSaveScript() { 329void MainWindow::slotSaveScript() {
331 if (currentSession() && currentSession()->emulationHandler()->isRecording()) { 330 if (currentSession() && currentSession()->emulationHandler()->isRecording()) {
332 QMap<QString, QStringList> map; 331 QMap<QString, QStringList> map;
333 QStringList text; 332 QStringList text;
334 text << "text/plain"; 333 text << "text/plain";
335 map.insert(tr("Script"), text ); 334 map.insert(tr("Script"), text );
336 QString filename = Opie::OFileDialog::getSaveFileName(2, QPEApplication::documentDir(), QString::null, map); 335 QString filename = Opie::OFileDialog::getSaveFileName(2, QPEApplication::documentDir(), QString::null, map);
337 if (!filename.isEmpty()) { 336 if (!filename.isEmpty()) {
338 QFileInfo info(filename); 337 QFileInfo info(filename);
339 if (info.extension(FALSE) != "script") 338 if (info.extension(FALSE) != "script")
340 filename += ".script"; 339 filename += ".script";
341 DocLnk nf; 340 DocLnk nf;
342 nf.setType("text/plain"); 341 nf.setType("text/plain");
343 nf.setFile(filename); 342 nf.setFile(filename);
344 nf.setName(info.fileName()); 343 nf.setName(info.fileName());
345 FileManager fm; 344 FileManager fm;
346 fm.saveFile(nf, currentSession()->emulationHandler()->script()->script()); 345 fm.saveFile(nf, currentSession()->emulationHandler()->script()->script());
347 currentSession()->emulationHandler()->clearScript(); 346 currentSession()->emulationHandler()->clearScript();
348 m_saveScript->setEnabled(false); 347 m_saveScript->setEnabled(false);
349 m_recordScript->setEnabled(true); 348 m_recordScript->setEnabled(true);
350 populateScripts(); 349 populateScripts();
351 } 350 }
352 } 351 }
353} 352}
354 353
355void MainWindow::slotRunScript(int id) { 354void MainWindow::slotRunScript(int id) {
356 if (currentSession()) { 355 if (currentSession()) {
357 int index = m_scriptsPop->indexOf(id); 356 int index = m_scriptsPop->indexOf(id);
358 DocLnk *lnk = m_scriptsData.at(index); 357 DocLnk *lnk = m_scriptsData.at(index);
359 QString filePath = lnk->file(); 358 QString filePath = lnk->file();
360 Script script(filePath); 359 Script script(filePath);
361 currentSession()->emulationHandler()->runScript(&script); 360 currentSession()->emulationHandler()->runScript(&script);
362 } 361 }
363} 362}
364 363
365void MainWindow::slotConnect() { 364void MainWindow::slotConnect() {
366 if ( currentSession() ) { 365 if ( currentSession() ) {
367 bool ret = currentSession()->layer()->open(); 366 bool ret = currentSession()->layer()->open();
368 if(!ret) QMessageBox::warning(currentSession()->widgetStack(), 367 if(!ret) QMessageBox::warning(currentSession()->widgetStack(),
369 QObject::tr("Failed"), 368 QObject::tr("Failed"),
370 QObject::tr("Connecting failed for this session.")); 369 QObject::tr("Connecting failed for this session."));
371 else { 370 else {
372 m_connect->setEnabled( false ); 371 m_connect->setEnabled( false );
373 m_disconnect->setEnabled( true ); 372 m_disconnect->setEnabled( true );
374 373
375 // if it does not support file transfer, disable the menu entry 374 // if it does not support file transfer, disable the menu entry
376 if ( ( m_curSession->layer() )->supports()[1] == 0 ) { 375 if ( ( m_curSession->layer() )->supports()[1] == 0 ) {
377 m_transfer->setEnabled( false ); 376 m_transfer->setEnabled( false );
378 } else { 377 } else {
379 m_transfer->setEnabled( true ); 378 m_transfer->setEnabled( true );
380 } 379 }
381 380
382 m_recordScript->setEnabled( true ); 381 m_recordScript->setEnabled( true );
383 m_scripts->setItemEnabled(m_runScript_id, true); 382 m_scripts->setItemEnabled(m_runScript_id, true);
384 } 383 }
385 } 384 }
386} 385}
387 386
388void MainWindow::slotDisconnect() { 387void MainWindow::slotDisconnect() {
389 if ( currentSession() ) { 388 if ( currentSession() ) {
390 currentSession()->layer()->close(); 389 currentSession()->layer()->close();
391 m_connect->setEnabled( true ); 390 m_connect->setEnabled( true );
392 m_disconnect->setEnabled( false ); 391 m_disconnect->setEnabled( false );
393 m_transfer->setEnabled( false ); 392 m_transfer->setEnabled( false );
394 m_recordScript->setEnabled( false); 393 m_recordScript->setEnabled( false);
395 m_saveScript->setEnabled( false ); 394 m_saveScript->setEnabled( false );
396 m_scripts->setItemEnabled(m_runScript_id, false); 395 m_scripts->setItemEnabled(m_runScript_id, false);
397 } 396 }
398} 397}
399 398
400void MainWindow::slotTerminate() { 399void MainWindow::slotTerminate() {
401 if ( currentSession() ) 400 if ( currentSession() )
402 currentSession()->layer()->close(); 401 currentSession()->layer()->close();
403 402
404 slotClose(); 403 slotClose();
405 /* FIXME move to the next session */ 404 /* FIXME move to the next session */
406} 405}
407 406
408 407
409 408
410 409
411 410
412 411
413void MainWindow::slotQuickLaunch() { 412void MainWindow::slotQuickLaunch() {
414 Profile prof = manager()->profile( "default" ); 413 Profile prof = manager()->profile( "default" );
415 if ( prof.name() == "default" ) { 414 if ( prof.name() == "default" ) {
416 create( prof ); 415 create( prof );
417 } else { 416 } else {
418 Profile newProf = Profile( "default", "console", "default" , 0, 3, 0 ); 417 Profile newProf = Profile( "default", "console", "default" , 0, 3, 0 );
419 newProf.setAutoConnect( true ); 418 newProf.setAutoConnect( true );
420 create( newProf ); 419 create( newProf );
421 slotSaveSession(); 420 slotSaveSession();
422 } 421 }
423 422
424} 423}
425 424
426void MainWindow::slotConfigure() { 425void MainWindow::slotConfigure() {
427 ConfigDialog conf( manager()->all(), factory() ); 426 ConfigDialog conf( manager()->all(), factory() );
428 427
429 int ret = QPEApplication::execDialog( &conf ); 428 int ret = QPEApplication::execDialog( &conf );
430 429
431 if ( QDialog::Accepted == ret ) { 430 if ( QDialog::Accepted == ret ) {
432 manager()->setProfiles( conf.list() ); 431 manager()->setProfiles( conf.list() );
433 manager()->save(); 432 manager()->save();
434 populateProfiles(); 433 populateProfiles();
435 } 434 }
436} 435}
437/* 436/*
438 * we will remove 437 * we will remove
439 * this window from the tabwidget 438 * this window from the tabwidget
440 * remove it from the list 439 * remove it from the list
441 * delete it 440 * delete it
442 * and set the currentSession() 441 * and set the currentSession()
443 */ 442 */
444void MainWindow::slotClose() { 443void MainWindow::slotClose() {
445 if (!currentSession() ) 444 if (!currentSession() )
446 return; 445 return;
447 446
448 Session* ses = currentSession(); 447 Session* ses = currentSession();
449 qWarning("removing! currentSession %s", currentSession()->name().latin1() ); 448 qWarning("removing! currentSession %s", currentSession()->name().latin1() );
450 /* set to NULL to be safe, if its needed slotSessionChanged resets it automatically */ 449 /* set to NULL to be safe, if its needed slotSessionChanged resets it automatically */
451 m_curSession = NULL; 450 m_curSession = NULL;
452 tabWidget()->remove( /*currentSession()*/ses ); 451 tabWidget()->remove( /*currentSession()*/ses );
453 /*it's autodelete */ 452 /*it's autodelete */
454 m_sessions.remove( ses ); 453 m_sessions.remove( ses );
455 qWarning("after remove!!"); 454 qWarning("after remove!!");
456 455
457 if (!currentSession() ) { 456 if (!currentSession() ) {
458 m_connect->setEnabled( false ); 457 m_connect->setEnabled( false );
459 m_disconnect->setEnabled( false ); 458 m_disconnect->setEnabled( false );
460 m_terminate->setEnabled( false ); 459 m_terminate->setEnabled( false );
461 m_transfer->setEnabled( false ); 460 m_transfer->setEnabled( false );
462 m_recordScript->setEnabled( false ); 461 m_recordScript->setEnabled( false );
463 m_saveScript->setEnabled( false ); 462 m_saveScript->setEnabled( false );
464 m_scripts->setItemEnabled(m_runScript_id, false); 463 m_scripts->setItemEnabled(m_runScript_id, false);
465 m_fullscreen->setEnabled( false ); 464 m_fullscreen->setEnabled( false );
466 m_wrap->setEnabled( false ); 465 m_wrap->setEnabled( false );
467 m_closewindow->setEnabled( false ); 466 m_closewindow->setEnabled( false );
468 } 467 }
469 468
470 m_kb->loadDefaults(); 469 m_kb->loadDefaults();
471} 470}
472 471
473/* 472/*
474 * We will get the name 473 * We will get the name
475 * Then the profile 474 * Then the profile
476 * and then we will make a profile 475 * and then we will make a profile
477 */ 476 */
478void MainWindow::slotProfile( int id) { 477void MainWindow::slotProfile( int id) {
479 Profile prof = manager()->profile( m_sessionsPop->text( id) ); 478 Profile prof = manager()->profile( m_sessionsPop->text( id) );
480 create( prof ); 479 create( prof );
481} 480}
482 481
483 482
484 483
485void MainWindow::create( const Profile& prof ) { 484void MainWindow::create( const Profile& prof ) {
486 if(m_curSession) 485 if(m_curSession)
487 if(m_curSession->transferDialog()) m_curSession->transferDialog()->hide(); 486 if(m_curSession->transferDialog()) m_curSession->transferDialog()->hide();
488 487
489 Session *ses = manager()->fromProfile( prof, tabWidget() ); 488 Session *ses = manager()->fromProfile( prof, tabWidget() );
490 489
491 if((!ses) || (!ses->layer()) || (!ses->widgetStack())) 490 if((!ses) || (!ses->layer()) || (!ses->widgetStack()))
492 { 491 {
493 QMessageBox::warning(this, 492 QMessageBox::warning(this,
494 QObject::tr("Session failed"), 493 QObject::tr("Session failed"),
495 QObject::tr("<qt>Cannot open session: Not all components were found.</qt>")); 494 QObject::tr("<qt>Cannot open session: Not all components were found.</qt>"));
496 //if(ses) delete ses; 495 //if(ses) delete ses;
497 return; 496 return;
498 } 497 }
499 498
500 m_sessions.append( ses ); 499 m_sessions.append( ses );
501 tabWidget()->add( ses ); 500 tabWidget()->add( ses );
502 tabWidget()->repaint(); 501 tabWidget()->repaint();
503 m_curSession = ses; 502 m_curSession = ses;
504 503
505 // dicide if its a local term ( then no connction and no tranfer), maybe make a wrapper method out of it 504 // dicide if its a local term ( then no connction and no tranfer), maybe make a wrapper method out of it
506 m_connect->setEnabled( true ); 505 m_connect->setEnabled( true );
507 m_disconnect->setEnabled( false ); 506 m_disconnect->setEnabled( false );
508 m_terminate->setEnabled( true ); 507 m_terminate->setEnabled( true );
509 m_fullscreen->setEnabled( true ); 508 m_fullscreen->setEnabled( true );
510 m_wrap->setEnabled( true ); 509 m_wrap->setEnabled( true );
511 m_closewindow->setEnabled( true ); 510 m_closewindow->setEnabled( true );
512 m_transfer->setEnabled( false ); 511 m_transfer->setEnabled( false );
513 m_recordScript->setEnabled( false ); 512 m_recordScript->setEnabled( false );
514 m_saveScript->setEnabled( false ); 513 m_saveScript->setEnabled( false );
515 m_scripts->setItemEnabled(m_runScript_id, false); 514 m_scripts->setItemEnabled(m_runScript_id, false);
516 515
517 // is io_layer wants direct connection, then autoconnect 516 // is io_layer wants direct connection, then autoconnect
518 //if ( ( m_curSession->layer() )->supports()[0] == 1 ) { 517 //if ( ( m_curSession->layer() )->supports()[0] == 1 ) {
519 if (prof.autoConnect()) { 518 if (prof.autoConnect()) {
520 slotConnect(); 519 slotConnect();
521 } 520 }
522 521
523 522
524 QWidget *w = currentSession()->widget(); 523 QWidget *w = currentSession()->widget();
525 if(w) w->setFocus(); 524 if(w) w->setFocus();
526 525
527 if(currentSession()->profile().readNumEntry("Wrap", 80)){ 526 if(currentSession()->profile().readNumEntry("Wrap", 80)){
528 m_isWrapped = true; 527 m_isWrapped = true;
529 } else { 528 } else {
530 m_isWrapped = false; 529 m_isWrapped = false;
531 } 530 }
532 531
533 m_kb->load(currentSession()->profile()); 532 m_kb->load(currentSession()->profile());
534} 533}
535 534
536void MainWindow::slotTransfer() 535void MainWindow::slotTransfer()
537{ 536{
538 if ( currentSession() ) { 537 if ( currentSession() ) {
539 Session *mysession = currentSession(); 538 Session *mysession = currentSession();
540 TransferDialog dlg(/*mysession->widgetStack()*/this, this); 539 TransferDialog dlg(/*mysession->widgetStack()*/this, this);
541 mysession->setTransferDialog(&dlg); 540 mysession->setTransferDialog(&dlg);
542 //dlg.reparent(mysession->widgetStack(), QPoint(0, 0)); 541 //dlg.reparent(mysession->widgetStack(), QPoint(0, 0));
543 //dlg.showMaximized(); 542 //dlg.showMaximized();
544 currentSession()->widgetStack()->addWidget(&dlg, -1); 543 currentSession()->widgetStack()->addWidget(&dlg, -1);
545 dlg.show(); 544 dlg.show();
546 //dlg.exec(); 545 //dlg.exec();
547 while(dlg.isRunning()) qApp->processEvents(); 546 while(dlg.isRunning()) qApp->processEvents();
548 mysession->setTransferDialog(0l); 547 mysession->setTransferDialog(0l);
549 } 548 }
550} 549}
551 550
552 551
553void MainWindow::slotOpenKeb(bool state) { 552void MainWindow::slotOpenKeb(bool state) {
554 553
555 if (state) m_keyBar->show(); 554 if (state) m_keyBar->show();
556 else m_keyBar->hide(); 555 else m_keyBar->hide();
557 556
558} 557}
559 558
560 559
561void MainWindow::slotOpenButtons( bool state ) { 560void MainWindow::slotOpenButtons( bool state ) {
562 561
563 if ( state ) { 562 if ( state ) {
564 m_buttonBar->show(); 563 m_buttonBar->show();
565 } else { 564 } else {
566 m_buttonBar->hide(); 565 m_buttonBar->hide();
567 } 566 }
568} 567}
569 568
570 569
571 570
572void MainWindow::slotSessionChanged( Session* ses ) { 571void MainWindow::slotSessionChanged( Session* ses ) {
573 qWarning("changed!"); 572 qWarning("changed!");
574 573
575 if(m_curSession) 574 if(m_curSession)
576 if(m_curSession->transferDialog()) m_curSession->transferDialog()->hide(); 575 if(m_curSession->transferDialog()) m_curSession->transferDialog()->hide();
577 if(ses) 576 if(ses)
578 if(ses->transferDialog()) ses->transferDialog()->show(); 577 if(ses->transferDialog()) ses->transferDialog()->show();
579 578
580 if ( ses ) { 579 if ( ses ) {
581 m_curSession = ses; 580 m_curSession = ses;
582 qDebug(QString("is connected : %1").arg( m_curSession->layer()->isConnected() ) ); 581 qDebug(QString("is connected : %1").arg( m_curSession->layer()->isConnected() ) );
583 if ( m_curSession->layer()->isConnected() ) { 582 if ( m_curSession->layer()->isConnected() ) {
584 m_connect->setEnabled( false ); 583 m_connect->setEnabled( false );
585 m_disconnect->setEnabled( true ); 584 m_disconnect->setEnabled( true );
586 m_recordScript->setEnabled(!m_curSession->emulationHandler()->isRecording()); 585 m_recordScript->setEnabled(!m_curSession->emulationHandler()->isRecording());
587 m_saveScript->setEnabled(m_curSession->emulationHandler()->isRecording()); 586 m_saveScript->setEnabled(m_curSession->emulationHandler()->isRecording());
588 m_scripts->setItemEnabled(m_runScript_id, true); 587 m_scripts->setItemEnabled(m_runScript_id, true);
589 } else { 588 } else {
590 m_connect->setEnabled( true ); 589 m_connect->setEnabled( true );
591 m_disconnect->setEnabled( false ); 590 m_disconnect->setEnabled( false );
592 m_recordScript->setEnabled( false ); 591 m_recordScript->setEnabled( false );
593 m_saveScript->setEnabled( false ); 592 m_saveScript->setEnabled( false );
594 m_scripts->setItemEnabled(m_runScript_id, false); 593 m_scripts->setItemEnabled(m_runScript_id, false);
595 } 594 }
596 595
597 if ( ( m_curSession->layer() )->supports()[1] == 0 ) { 596 if ( ( m_curSession->layer() )->supports()[1] == 0 ) {
598 m_transfer->setEnabled( false ); 597 m_transfer->setEnabled( false );
599 } else { 598 } else {
600 m_transfer->setEnabled( true ); 599 m_transfer->setEnabled( true );
601 } 600 }
602 601
603 QWidget *w = m_curSession->widget(); 602 QWidget *w = m_curSession->widget();
604 if(w) w->setFocus(); 603 if(w) w->setFocus();
605 604
606 if(currentSession()->profile().readNumEntry("Wrap", 80)){ 605 if(currentSession()->profile().readNumEntry("Wrap", 80)){
607 m_isWrapped = true; 606 m_isWrapped = true;
608 } else { 607 } else {
609 m_isWrapped = false; 608 m_isWrapped = false;
610 } 609 }
611 610
612 m_kb->load(currentSession()->profile()); 611 m_kb->load(currentSession()->profile());
613 } 612 }
614} 613}
615 614
616void MainWindow::slotWrap() 615void MainWindow::slotWrap()
617{ 616{
618 if(m_curSession) 617 if(m_curSession)
619 { 618 {
620 EmulationHandler *e = m_curSession->emulationHandler(); 619 EmulationHandler *e = m_curSession->emulationHandler();
621 if(e) 620 if(e)
622 { 621 {
623 if(m_isWrapped) 622 if(m_isWrapped)
624 { 623 {
625 e->setWrap(80); 624 e->setWrap(80);
626 m_isWrapped = false; 625 m_isWrapped = false;
627 } 626 }
628 else 627 else
629 { 628 {
630 e->setWrap(0); 629 e->setWrap(0);
631 m_isWrapped = true; 630 m_isWrapped = true;
632 } 631 }
633 } 632 }
634 } 633 }
635} 634}
636 635
637void MainWindow::slotFullscreen() { 636void MainWindow::slotFullscreen() {
638 637
639 638
640 639
641 if ( m_isFullscreen ) { 640 if ( m_isFullscreen ) {
642 ( m_curSession->widgetStack() )->reparent( savedParentFullscreen, 0, QPoint(0,0), true ); 641 ( m_curSession->widgetStack() )->reparent( savedParentFullscreen, 0, QPoint(0,0), true );
643 ( m_curSession->widgetStack() )->resize( savedParentFullscreen->width(), savedParentFullscreen->height() ); 642 ( m_curSession->widgetStack() )->resize( savedParentFullscreen->width(), savedParentFullscreen->height() );
644 ( m_curSession->emulationHandler() )->cornerButton()->hide(); 643 ( m_curSession->emulationHandler() )->cornerButton()->hide();
645 disconnect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) ); 644 disconnect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) );
646 645
647 } else { 646 } else {
648 savedParentFullscreen = ( m_curSession->widgetStack() )->parentWidget(); 647 savedParentFullscreen = ( m_curSession->widgetStack() )->parentWidget();
649 ( m_curSession->widgetStack() )->setFrameStyle( QFrame::NoFrame ); 648 ( m_curSession->widgetStack() )->setFrameStyle( QFrame::NoFrame );
650 ( m_curSession->widgetStack() )->reparent( 0, WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop 649 ( m_curSession->widgetStack() )->reparent( 0, WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop
651 , QPoint(0,0), false ); 650 , QPoint(0,0), false );
652 ( m_curSession->widgetStack() )->resize( qApp->desktop()->width(), qApp->desktop()->height() ); 651 ( m_curSession->widgetStack() )->resize( qApp->desktop()->width(), qApp->desktop()->height() );
653 ( m_curSession->widgetStack() )->setFocus(); 652 ( m_curSession->widgetStack() )->setFocus();
654 ( m_curSession->widgetStack() )->show(); 653 ( m_curSession->widgetStack() )->show();
655 654
656 ( ( m_curSession->emulationHandler() )->cornerButton() )->show(); 655 ( ( m_curSession->emulationHandler() )->cornerButton() )->show();
657 656
658 connect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) ); 657 connect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) );
659 } 658 }
660 659
661 m_isFullscreen = !m_isFullscreen; 660 m_isFullscreen = !m_isFullscreen;
662} 661}
663 662
664 663
665void MainWindow::slotKeyReceived(FKey k, ushort, ushort, bool pressed) { 664void MainWindow::slotKeyReceived(FKey k, ushort, ushort, bool pressed) {
666 665
667 if ( m_curSession ) { 666 if ( m_curSession ) {
668 667
669 QEvent::Type state; 668 QEvent::Type state;
670 669
671 if (pressed) state = QEvent::KeyPress; 670 if (pressed) state = QEvent::KeyPress;
672 else state = QEvent::KeyRelease; 671 else state = QEvent::KeyRelease;
673 672
674 QKeyEvent ke(state, k.qcode, k.unicode, 0, QString(QChar(k.unicode))); 673 QKeyEvent ke(state, k.qcode, k.unicode, 0, QString(QChar(k.unicode)));
675 674
676 // is this the best way to do this? cant figure out any other way to work 675 // is this the best way to do this? cant figure out any other way to work
677 QApplication::sendEvent((QObject *)m_curSession->widget(), &ke); 676 QApplication::sendEvent((QObject *)m_curSession->widget(), &ke);
678 ke.ignore(); 677 ke.ignore();
679 } 678 }
680} 679}
681void MainWindow::slotCopy() { 680void MainWindow::slotCopy() {
682 if (!currentSession() ) return; 681 if (!currentSession() ) return;
683 currentSession()->emulationHandler()->copy(); 682 currentSession()->emulationHandler()->copy();
684} 683}
685void MainWindow::slotPaste() { 684void MainWindow::slotPaste() {
686 if (!currentSession() ) return; 685 if (!currentSession() ) return;
687 currentSession()->emulationHandler()->paste(); 686 currentSession()->emulationHandler()->paste();
688} 687}
689 688
690/* 689/*
691 * Save the session 690 * Save the session
692 */ 691 */
693 692
694void MainWindow::slotSaveSession() { 693void MainWindow::slotSaveSession() {
695 if (!currentSession() ) { 694 if (!currentSession() ) {
696 QMessageBox::information(this, tr("Save Connection"), 695 QMessageBox::information(this, tr("Save Connection"),
697 tr("<qt>There is no Connection.</qt>"), 1 ); 696 tr("<qt>There is no Connection.</qt>"), 1 );
698 return; 697 return;
699 } 698 }
700 manager()->add( currentSession()->profile() ); 699 manager()->add( currentSession()->profile() );
701 manager()->save(); 700 manager()->save();
702 populateProfiles(); 701 populateProfiles();
703} 702}
704void MainWindow::slotSaveHistory() { 703void MainWindow::slotSaveHistory() {
705 QMap<QString, QStringList> map; 704 QMap<QString, QStringList> map;
706 QStringList text; 705 QStringList text;
707 text << "text/plain"; 706 text << "text/plain";
708 map.insert(tr("History"), text ); 707 map.insert(tr("History"), text );
709 QString filename = Opie::OFileDialog::getSaveFileName(2, QPEApplication::documentDir(), QString::null, map); 708 QString filename = Opie::OFileDialog::getSaveFileName(2, QPEApplication::documentDir(), QString::null, map);
710 if (filename.isEmpty() ) return; 709 if (filename.isEmpty() ) return;
711 710
712 QFileInfo info(filename); 711 QFileInfo info(filename);
713 712
714 DocLnk nf; 713 DocLnk nf;
715 nf.setType("text/plain"); 714 nf.setType("text/plain");
716 nf.setFile(filename); 715 nf.setFile(filename);
717 nf.setName(info.fileName()); 716 nf.setName(info.fileName());
718 717
719 718
720 QFile file(filename); 719 QFile file(filename);
721 file.open(IO_WriteOnly ); 720 file.open(IO_WriteOnly );
722 QTextStream str(&file ); 721 QTextStream str(&file );
723 if ( currentSession() ) 722 if ( currentSession() )
724 currentSession()->emulationHandler()->emulation()->streamHistory(&str); 723 currentSession()->emulationHandler()->emulation()->streamHistory(&str);
725 724
726 file.close(); 725 file.close();
727 nf.writeLink(); 726 nf.writeLink();
728} 727}