summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/mainwindow.cpp21
-rw-r--r--noncore/apps/opie-console/mainwindow.h2
-rw-r--r--noncore/apps/opie-console/terminalwidget.cpp26
-rw-r--r--pics/console/konsole_mini.pngbin0 -> 783 bytes
4 files changed, 36 insertions, 13 deletions
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp
index abcdb84..a6fc30b 100644
--- a/noncore/apps/opie-console/mainwindow.cpp
+++ b/noncore/apps/opie-console/mainwindow.cpp
@@ -1,255 +1,263 @@
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 <qlabel.h> 5#include <qlabel.h>
6#include <qpopupmenu.h> 6#include <qpopupmenu.h>
7#include <qtoolbar.h> 7#include <qtoolbar.h>
8#include <qmessagebox.h> 8#include <qmessagebox.h>
9#include <qpushbutton.h> 9#include <qpushbutton.h>
10#include <qwhatsthis.h> 10#include <qwhatsthis.h>
11#include <qfileinfo.h> 11#include <qfileinfo.h>
12#include <qtextstream.h> 12#include <qtextstream.h>
13 13
14#include <qpe/resource.h> 14#include <qpe/resource.h>
15#include <qpe/qpeapplication.h> 15#include <qpe/qpeapplication.h>
16#include <qpe/filemanager.h> 16#include <qpe/filemanager.h>
17#include <qpe/mimetype.h> 17#include <qpe/mimetype.h>
18 18
19#include <opie/ofiledialog.h> 19#include <opie/ofiledialog.h>
20 20
21#include "TEmulation.h" 21#include "TEmulation.h"
22#include "keytrans.h" 22#include "keytrans.h"
23#include "profileeditordialog.h" 23#include "profileeditordialog.h"
24#include "configdialog.h" 24#include "configdialog.h"
25#include "default.h" 25#include "default.h"
26#include "metafactory.h" 26#include "metafactory.h"
27#include "profile.h" 27#include "profile.h"
28#include "profilemanager.h" 28#include "profilemanager.h"
29#include "mainwindow.h" 29#include "mainwindow.h"
30#include "tabwidget.h" 30#include "tabwidget.h"
31#include "transferdialog.h" 31#include "transferdialog.h"
32#include "function_keyboard.h" 32#include "function_keyboard.h"
33#include "emulation_handler.h" 33#include "emulation_handler.h"
34#include "script.h" 34#include "script.h"
35 35
36 36
37MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) { 37MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) {
38 KeyTrans::loadAll(); 38 KeyTrans::loadAll();
39 for (int i = 0; i < KeyTrans::count(); i++ ) { 39 for (int i = 0; i < KeyTrans::count(); i++ ) {
40 KeyTrans* s = KeyTrans::find(i ); 40 KeyTrans* s = KeyTrans::find(i );
41 assert( s ); 41 assert( s );
42 } 42 }
43 m_factory = new MetaFactory(); 43 m_factory = new MetaFactory();
44 Default def(m_factory); 44 Default def(m_factory);
45 m_sessions.setAutoDelete( TRUE ); 45 m_sessions.setAutoDelete( TRUE );
46 m_curSession = 0; 46 m_curSession = 0;
47 m_manager = new ProfileManager( m_factory ); 47 m_manager = new ProfileManager( m_factory );
48 m_manager->load(); 48 m_manager->load();
49 m_scriptsData.setAutoDelete(TRUE); 49 m_scriptsData.setAutoDelete(TRUE);
50 50
51 initUI(); 51 initUI();
52 populateProfiles(); 52 populateProfiles();
53 populateScripts(); 53 populateScripts();
54} 54}
55
55void MainWindow::initUI() { 56void MainWindow::initUI() {
56 setToolBarsMovable( FALSE ); 57 setToolBarsMovable( FALSE );
57 58
58 /* tool bar for the menu */ 59 /* tool bar for the menu */
59 m_tool = new QToolBar( this ); 60 m_tool = new QToolBar( this );
60 m_tool->setHorizontalStretchable( TRUE ); 61 m_tool->setHorizontalStretchable( TRUE );
61 62
62 m_bar = new QMenuBar( m_tool ); 63 m_bar = new QMenuBar( m_tool );
63 m_console = new QPopupMenu( this ); 64 m_console = new QPopupMenu( this );
64 m_scripts = new QPopupMenu( this ); 65 m_scripts = new QPopupMenu( this );
65 m_sessionsPop= new QPopupMenu( this ); 66 m_sessionsPop= new QPopupMenu( this );
66 m_scriptsPop = new QPopupMenu( this ); 67 m_scriptsPop = new QPopupMenu( this );
67 68
68 /* add a toolbar for icons */ 69 /* add a toolbar for icons */
69 m_icons = new QToolBar(this); 70 m_icons = new QToolBar(this);
70 71
71 /* 72 /*
72 * the settings action 73 * the settings action
73 */ 74 */
74 m_setProfiles = new QAction(tr("Configure Profiles"), 75 m_setProfiles = new QAction(tr("Configure Profiles"),
75 Resource::loadPixmap( "SettingsIcon" ), 76 Resource::loadPixmap( "SettingsIcon" ),
76 QString::null, 0, this, 0); 77 QString::null, 0, this, 0);
77 m_setProfiles->addTo( m_console ); 78 m_setProfiles->addTo( m_console );
78 connect( m_setProfiles, SIGNAL(activated() ), 79 connect( m_setProfiles, SIGNAL(activated() ),
79 this, SLOT(slotConfigure() ) ); 80 this, SLOT(slotConfigure() ) );
80 81
81 m_console->insertSeparator(); 82 m_console->insertSeparator();
82 /* 83 /*
83 * new Action for new sessions 84 * new Action for new sessions
84 */ 85 */
85 QAction* newCon = new QAction(tr("New Connection"), 86 QAction* newCon = new QAction(tr("New Connection"),
86 Resource::loadPixmap( "new" ), 87 Resource::loadPixmap( "new" ),
87 QString::null, 0, this, 0); 88 QString::null, 0, this, 0);
88 newCon->addTo( m_console ); 89 newCon->addTo( m_console );
89 connect( newCon, SIGNAL(activated() ), 90 connect( newCon, SIGNAL(activated() ),
90 this, SLOT(slotNew() ) ); 91 this, SLOT(slotNew() ) );
91 92
92 m_console->insertSeparator(); 93 m_console->insertSeparator();
93 94
94 QAction *saveCon = new QAction(tr("Save Connection"), 95 QAction *saveCon = new QAction(tr("Save Connection"),
95 Resource::loadPixmap( "save" ), QString::null, 96 Resource::loadPixmap( "save" ), QString::null,
96 0, this, 0 ); 97 0, this, 0 );
97 saveCon->addTo( m_console ); 98 saveCon->addTo( m_console );
98 connect( saveCon, SIGNAL(activated() ), 99 connect( saveCon, SIGNAL(activated() ),
99 this, SLOT(slotSaveSession() ) ); 100 this, SLOT(slotSaveSession() ) );
100 m_console->insertSeparator(); 101 m_console->insertSeparator();
101 102
102 /* 103 /*
103 * connect action 104 * connect action
104 */ 105 */
105 m_connect = new QAction( tr("Connect"), Resource::loadPixmap("console/connected"), 106 m_connect = new QAction( tr("Connect"), Resource::loadPixmap("console/connected"),
106 QString::null, 0, this, 0 ); 107 QString::null, 0, this, 0 );
107 m_connect->addTo( m_console ); 108 m_connect->addTo( m_console );
108 connect(m_connect, SIGNAL(activated() ), 109 connect(m_connect, SIGNAL(activated() ),
109 this, SLOT(slotConnect() ) ); 110 this, SLOT(slotConnect() ) );
110 111
111 /* 112 /*
112 * disconnect action 113 * disconnect action
113 */ 114 */
114 m_disconnect = new QAction( tr("Disconnect"), Resource::loadPixmap("console/notconnected"), 115 m_disconnect = new QAction( tr("Disconnect"), Resource::loadPixmap("console/notconnected"),
115 QString::null, 0, this, 0 ); 116 QString::null, 0, this, 0 );
116 m_disconnect->addTo( m_console ); 117 m_disconnect->addTo( m_console );
117 connect(m_disconnect, SIGNAL(activated() ), 118 connect(m_disconnect, SIGNAL(activated() ),
118 this, SLOT(slotDisconnect() ) ); 119 this, SLOT(slotDisconnect() ) );
119 120
120 m_console->insertSeparator(); 121 m_console->insertSeparator();
121 122
123 m_quickLaunch = new QAction( tr("QuickLaunch"), Resource::loadPixmap("console/konsole_mini"), QString::null, 0, this, 0 );
124 m_quickLaunch->addTo( m_icons );
125 connect( m_quickLaunch, SIGNAL( activated() ),
126 this, SLOT( slotQuickLaunch() ) );
127
122 m_transfer = new QAction( tr("Transfer file..."), Resource::loadPixmap("pass") , QString::null, 128 m_transfer = new QAction( tr("Transfer file..."), Resource::loadPixmap("pass") , QString::null,
123 0, this, 0 ); 129 0, this, 0 );
124 m_transfer->addTo( m_console ); 130 m_transfer->addTo( m_console );
125 connect(m_transfer, SIGNAL(activated() ), 131 connect(m_transfer, SIGNAL(activated() ),
126 this, SLOT(slotTransfer() ) ); 132 this, SLOT(slotTransfer() ) );
127 133
134
135
128 /* 136 /*
129 * immediate change of line wrap policy 137 * immediate change of line wrap policy
130 */ 138 */
131 m_isWrapped = false; 139 m_isWrapped = false;
132 m_wrap = new QAction( tr("Line wrap"), Resource::loadPixmap( "linewrap" ), QString::null, 0, this, 0 ); 140 m_wrap = new QAction( tr("Line wrap"), Resource::loadPixmap( "linewrap" ), QString::null, 0, this, 0 );
133 m_wrap->addTo( m_console ); 141 m_wrap->addTo( m_console );
134 connect( m_wrap, SIGNAL( activated() ), SLOT( slotWrap() ) ); 142 connect( m_wrap, SIGNAL( activated() ), SLOT( slotWrap() ) );
135 143
136 /* 144 /*
137 * fullscreen 145 * fullscreen
138 */ 146 */
139 m_isFullscreen = false; 147 m_isFullscreen = false;
140 148
141 m_fullscreen = new QAction( tr("Full screen"), Resource::loadPixmap( "fullscreen" ) 149 m_fullscreen = new QAction( tr("Full screen"), Resource::loadPixmap( "fullscreen" )
142 , QString::null, 0, this, 0); 150 , QString::null, 0, this, 0);
143 m_fullscreen->addTo( m_console ); 151 m_fullscreen->addTo( m_console );
144 connect( m_fullscreen, SIGNAL( activated() ), 152 connect( m_fullscreen, SIGNAL( activated() ),
145 this, SLOT( slotFullscreen() ) ); 153 this, SLOT( slotFullscreen() ) );
146 154
147 m_console->insertSeparator(); 155 m_console->insertSeparator();
148 156
149 QAction *a = new QAction(); 157 QAction *a = new QAction();
150 a->setText( tr("Save history") ); 158 a->setText( tr("Save history") );
151 a->addTo( m_console ); 159 a->addTo( m_console );
152 connect(a, SIGNAL(activated() ), 160 connect(a, SIGNAL(activated() ),
153 this, SLOT(slotSaveHistory() ) ); 161 this, SLOT(slotSaveHistory() ) );
154 /* 162 /*
155 * terminate action 163 * terminate action
156 */ 164 */
157 m_terminate = new QAction(); 165 m_terminate = new QAction();
158 m_terminate->setText( tr("Terminate") ); 166 m_terminate->setText( tr("Terminate") );
159 m_terminate->addTo( m_console ); 167 m_terminate->addTo( m_console );
160 connect(m_terminate, SIGNAL(activated() ), 168 connect(m_terminate, SIGNAL(activated() ),
161 this, SLOT(slotTerminate() ) ); 169 this, SLOT(slotTerminate() ) );
162 170
163 m_closewindow = new QAction(); 171 m_closewindow = new QAction();
164 m_closewindow->setText( tr("Close Window") ); 172 m_closewindow->setText( tr("Close Window") );
165 m_closewindow->addTo( m_console ); 173 m_closewindow->addTo( m_console );
166 connect( m_closewindow, SIGNAL(activated() ), 174 connect( m_closewindow, SIGNAL(activated() ),
167 this, SLOT(slotClose() ) ); 175 this, SLOT(slotClose() ) );
168 176
169 177
170 /* 178 /*
171 * script actions 179 * script actions
172 */ 180 */
173 m_runScript_id = m_scripts->insertItem(tr("Run Script"), m_scriptsPop, -1, 0); 181 m_runScript_id = m_scripts->insertItem(tr("Run Script"), m_scriptsPop, -1, 0);
174 connect(m_scriptsPop, SIGNAL(activated(int)), this, SLOT(slotRunScript(int))); 182 connect(m_scriptsPop, SIGNAL(activated(int)), this, SLOT(slotRunScript(int)));
175 183
176 m_recordScript = new QAction(tr("Record Script"), QString::null, 0, this, 0); 184 m_recordScript = new QAction(tr("Record Script"), QString::null, 0, this, 0);
177 m_recordScript->addTo(m_scripts); 185 m_recordScript->addTo(m_scripts);
178 connect(m_recordScript, SIGNAL(activated()), this, SLOT(slotRecordScript())); 186 connect(m_recordScript, SIGNAL(activated()), this, SLOT(slotRecordScript()));
179 187
180 m_saveScript = new QAction(tr("Save Script"), QString::null, 0, this, 0); 188 m_saveScript = new QAction(tr("Save Script"), QString::null, 0, this, 0);
181 m_saveScript->addTo(m_scripts); 189 m_saveScript->addTo(m_scripts);
182 connect(m_saveScript, SIGNAL(activated()), this, SLOT(slotSaveScript())); 190 connect(m_saveScript, SIGNAL(activated()), this, SLOT(slotSaveScript()));
183 191
184 192
185 /* 193 /*
186 * action that open/closes the keyboard 194 * action that open/closes the keyboard
187 */ 195 */
188 m_openKeys = new QAction (tr("Open Keyboard..."), 196 m_openKeys = new QAction (tr("Open Keyboard..."),
189 Resource::loadPixmap( "console/keys/keyboard_icon" ), 197 Resource::loadPixmap( "console/keys/keyboard_icon" ),
190 QString::null, 0, this, 0); 198 QString::null, 0, this, 0);
191 m_openKeys->setToggleAction(true); 199 m_openKeys->setToggleAction(true);
192 connect (m_openKeys, SIGNAL(toggled(bool)), this, SLOT(slotOpenKeb(bool))); 200 connect (m_openKeys, SIGNAL(toggled(bool)), this, SLOT(slotOpenKeb(bool)));
193 201
194 /* insert the submenu */ 202 /* insert the submenu */
195 m_console->insertItem(tr("New from Profile"), m_sessionsPop, 203 m_console->insertItem(tr("New from Profile"), m_sessionsPop,
196 -1, 0); 204 -1, 0);
197 205
198 /* insert the connection menu */ 206 /* insert the connection menu */
199 m_bar->insertItem( tr("Connection"), m_console ); 207 m_bar->insertItem( tr("Connection"), m_console );
200 208
201 /* the scripts menu */ 209 /* the scripts menu */
202 m_bar->insertItem( tr("Scripts"), m_scripts ); 210 m_bar->insertItem( tr("Scripts"), m_scripts );
203 211
204 /* and the keyboard */ 212 /* and the keyboard */
205 m_keyBar = new QToolBar(this); 213 m_keyBar = new QToolBar(this);
206 addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE ); 214 addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE );
207 m_keyBar->setHorizontalStretchable( TRUE ); 215 m_keyBar->setHorizontalStretchable( TRUE );
208 m_keyBar->hide(); 216 m_keyBar->hide();
209 217
210 m_kb = new FunctionKeyboard(m_keyBar); 218 m_kb = new FunctionKeyboard(m_keyBar);
211 connect(m_kb, SIGNAL(keyPressed(FKey, ushort, ushort, bool)), 219 connect(m_kb, SIGNAL(keyPressed(FKey, ushort, ushort, bool)),
212 this, SLOT(slotKeyReceived(FKey, ushort, ushort, bool))); 220 this, SLOT(slotKeyReceived(FKey, ushort, ushort, bool)));
213 221
214 222
215 a = new QAction(tr("Copy"), 223 a = new QAction(tr("Copy"),
216 Resource::loadPixmap("copy"), QString::null, 224 Resource::loadPixmap("copy"), QString::null,
217 0, this, 0 ); 225 0, this, 0 );
218 //a->addTo( m_icons ); 226 //a->addTo( m_icons );
219 connect( a, SIGNAL(activated() ), 227 connect( a, SIGNAL(activated() ),
220 this, SLOT(slotCopy() ) ); 228 this, SLOT(slotCopy() ) );
221 229
222 QAction *paste = new QAction(tr("Paste"), 230 QAction *paste = new QAction(tr("Paste"),
223 Resource::loadPixmap("paste"), QString::null, 231 Resource::loadPixmap("paste"), QString::null,
224 0, this, 0 ); 232 0, this, 0 );
225 connect( paste, SIGNAL(activated() ), 233 connect( paste, SIGNAL(activated() ),
226 this, SLOT(slotPaste() ) ); 234 this, SLOT(slotPaste() ) );
227 235
228 236
229 newCon->addTo( m_icons ); 237 newCon->addTo( m_icons );
230 m_setProfiles->addTo( m_icons ); 238 m_setProfiles->addTo( m_icons );
231 paste->addTo( m_icons ); 239 paste->addTo( m_icons );
232 m_openKeys->addTo(m_icons); 240 m_openKeys->addTo(m_icons);
233 m_fullscreen->addTo( m_icons ); 241 m_fullscreen->addTo( m_icons );
234 242
235 m_connect->setEnabled( false ); 243 m_connect->setEnabled( false );
236 m_disconnect->setEnabled( false ); 244 m_disconnect->setEnabled( false );
237 m_terminate->setEnabled( false ); 245 m_terminate->setEnabled( false );
238 m_transfer->setEnabled( false ); 246 m_transfer->setEnabled( false );
239 m_scripts->setItemEnabled(m_runScript_id, false); 247 m_scripts->setItemEnabled(m_runScript_id, false);
240 m_recordScript->setEnabled( false ); 248 m_recordScript->setEnabled( false );
241 m_saveScript->setEnabled( false ); 249 m_saveScript->setEnabled( false );
242 m_fullscreen->setEnabled( false ); 250 m_fullscreen->setEnabled( false );
243 m_closewindow->setEnabled( false ); 251 m_closewindow->setEnabled( false );
244 m_wrap->setEnabled( false ); 252 m_wrap->setEnabled( false );
245 253
246 /* 254 /*
247 * connect to the menu activation 255 * connect to the menu activation
248 */ 256 */
249 connect( m_sessionsPop, SIGNAL(activated( int ) ), 257 connect( m_sessionsPop, SIGNAL(activated( int ) ),
250 this, SLOT(slotProfile( int ) ) ); 258 this, SLOT(slotProfile( int ) ) );
251 259
252 m_consoleWindow = new TabWidget( this, "blah"); 260 m_consoleWindow = new TabWidget( this, "blah");
253 connect(m_consoleWindow, SIGNAL(activated(Session*) ), 261 connect(m_consoleWindow, SIGNAL(activated(Session*) ),
254 this, SLOT(slotSessionChanged(Session*) ) ); 262 this, SLOT(slotSessionChanged(Session*) ) );
255 setCentralWidget( m_consoleWindow ); 263 setCentralWidget( m_consoleWindow );
@@ -277,313 +285,326 @@ void MainWindow::populateScripts() {
277 DocLnkSet files(QPEApplication::documentDir(), "text/plain"); 285 DocLnkSet files(QPEApplication::documentDir(), "text/plain");
278 QListIterator<DocLnk> dit(files.children()); 286 QListIterator<DocLnk> dit(files.children());
279 for (; dit.current(); ++dit) { 287 for (; dit.current(); ++dit) {
280 if (*dit && (*dit)->name().length()>0) { 288 if (*dit && (*dit)->name().length()>0) {
281 QFileInfo info((*dit)->file()); 289 QFileInfo info((*dit)->file());
282 if (info.extension(false) == "script") { 290 if (info.extension(false) == "script") {
283 m_scriptsData.append(new DocLnk(**dit)); 291 m_scriptsData.append(new DocLnk(**dit));
284 m_scriptsPop->insertItem((*dit)->name()); 292 m_scriptsPop->insertItem((*dit)->name());
285 } 293 }
286 } 294 }
287 } 295 }
288 296
289} 297}
290 298
291MainWindow::~MainWindow() { 299MainWindow::~MainWindow() {
292 delete m_factory; 300 delete m_factory;
293 manager()->save(); 301 manager()->save();
294} 302}
295 303
296MetaFactory* MainWindow::factory() { 304MetaFactory* MainWindow::factory() {
297 return m_factory; 305 return m_factory;
298} 306}
299 307
300Session* MainWindow::currentSession() { 308Session* MainWindow::currentSession() {
301 return m_curSession; 309 return m_curSession;
302} 310}
303 311
304QList<Session> MainWindow::sessions() { 312QList<Session> MainWindow::sessions() {
305 return m_sessions; 313 return m_sessions;
306} 314}
307 315
308void MainWindow::slotNew() { 316void MainWindow::slotNew() {
309 ProfileEditorDialog dlg(factory() ); 317 ProfileEditorDialog dlg(factory() );
310 dlg.showMaximized(); 318 dlg.showMaximized();
311 dlg.setCaption( tr("New Connection") ); 319 dlg.setCaption( tr("New Connection") );
312 int ret = dlg.exec(); 320 int ret = dlg.exec();
313 321
314 if ( ret == QDialog::Accepted ) { 322 if ( ret == QDialog::Accepted ) {
315 create( dlg.profile() ); 323 create( dlg.profile() );
316 } 324 }
317} 325}
318 326
319void MainWindow::slotRecordScript() { 327void MainWindow::slotRecordScript() {
320 if (currentSession()) { 328 if (currentSession()) {
321 currentSession()->emulationHandler()->startRecording(); 329 currentSession()->emulationHandler()->startRecording();
322 m_saveScript->setEnabled(true); 330 m_saveScript->setEnabled(true);
323 m_recordScript->setEnabled(false); 331 m_recordScript->setEnabled(false);
324 } 332 }
325} 333}
326 334
327void MainWindow::slotSaveScript() { 335void MainWindow::slotSaveScript() {
328 if (currentSession() && currentSession()->emulationHandler()->isRecording()) { 336 if (currentSession() && currentSession()->emulationHandler()->isRecording()) {
329 QMap<QString, QStringList> map; 337 QMap<QString, QStringList> map;
330 QStringList text; 338 QStringList text;
331 text << "text/plain"; 339 text << "text/plain";
332 map.insert(tr("Script"), text ); 340 map.insert(tr("Script"), text );
333 QString filename = OFileDialog::getSaveFileName(2, QPEApplication::documentDir(), QString::null, map); 341 QString filename = OFileDialog::getSaveFileName(2, QPEApplication::documentDir(), QString::null, map);
334 if (!filename.isEmpty()) { 342 if (!filename.isEmpty()) {
335 QFileInfo info(filename); 343 QFileInfo info(filename);
336 if (info.extension(FALSE) != "script") 344 if (info.extension(FALSE) != "script")
337 filename += ".script"; 345 filename += ".script";
338 DocLnk nf; 346 DocLnk nf;
339 nf.setType("text/plain"); 347 nf.setType("text/plain");
340 nf.setFile(filename); 348 nf.setFile(filename);
341 nf.setName(info.fileName()); 349 nf.setName(info.fileName());
342 FileManager fm; 350 FileManager fm;
343 fm.saveFile(nf, currentSession()->emulationHandler()->script()->script()); 351 fm.saveFile(nf, currentSession()->emulationHandler()->script()->script());
344 currentSession()->emulationHandler()->clearScript(); 352 currentSession()->emulationHandler()->clearScript();
345 m_saveScript->setEnabled(false); 353 m_saveScript->setEnabled(false);
346 m_recordScript->setEnabled(true); 354 m_recordScript->setEnabled(true);
347 populateScripts(); 355 populateScripts();
348 } 356 }
349 } 357 }
350} 358}
351 359
352void MainWindow::slotRunScript(int id) { 360void MainWindow::slotRunScript(int id) {
353 if (currentSession()) { 361 if (currentSession()) {
354 int index = m_scriptsPop->indexOf(id); 362 int index = m_scriptsPop->indexOf(id);
355 DocLnk *lnk = m_scriptsData.at(index); 363 DocLnk *lnk = m_scriptsData.at(index);
356 QString filePath = lnk->file(); 364 QString filePath = lnk->file();
357 Script script(filePath); 365 Script script(filePath);
358 currentSession()->emulationHandler()->runScript(&script); 366 currentSession()->emulationHandler()->runScript(&script);
359 } 367 }
360} 368}
361 369
362void MainWindow::slotConnect() { 370void MainWindow::slotConnect() {
363 if ( currentSession() ) { 371 if ( currentSession() ) {
364 bool ret = currentSession()->layer()->open(); 372 bool ret = currentSession()->layer()->open();
365 if(!ret) QMessageBox::warning(currentSession()->widgetStack(), 373 if(!ret) QMessageBox::warning(currentSession()->widgetStack(),
366 QObject::tr("Failed"), 374 QObject::tr("Failed"),
367 QObject::tr("Connecting failed for this session.")); 375 QObject::tr("Connecting failed for this session."));
368 else { 376 else {
369 m_connect->setEnabled( false ); 377 m_connect->setEnabled( false );
370 m_disconnect->setEnabled( true ); 378 m_disconnect->setEnabled( true );
371 379
372 // if it does not support file transfer, disable the menu entry 380 // if it does not support file transfer, disable the menu entry
373 if ( ( m_curSession->layer() )->supports()[1] == 0 ) { 381 if ( ( m_curSession->layer() )->supports()[1] == 0 ) {
374 m_transfer->setEnabled( false ); 382 m_transfer->setEnabled( false );
375 } else { 383 } else {
376 m_transfer->setEnabled( true ); 384 m_transfer->setEnabled( true );
377 } 385 }
378 386
379 m_recordScript->setEnabled( true ); 387 m_recordScript->setEnabled( true );
380 m_scripts->setItemEnabled(m_runScript_id, true); 388 m_scripts->setItemEnabled(m_runScript_id, true);
381 } 389 }
382 } 390 }
383} 391}
384 392
385void MainWindow::slotDisconnect() { 393void MainWindow::slotDisconnect() {
386 if ( currentSession() ) { 394 if ( currentSession() ) {
387 currentSession()->layer()->close(); 395 currentSession()->layer()->close();
388 m_connect->setEnabled( true ); 396 m_connect->setEnabled( true );
389 m_disconnect->setEnabled( false ); 397 m_disconnect->setEnabled( false );
390 m_transfer->setEnabled( false ); 398 m_transfer->setEnabled( false );
391 m_recordScript->setEnabled( false); 399 m_recordScript->setEnabled( false);
392 m_saveScript->setEnabled( false ); 400 m_saveScript->setEnabled( false );
393 m_scripts->setItemEnabled(m_runScript_id, false); 401 m_scripts->setItemEnabled(m_runScript_id, false);
394 } 402 }
395} 403}
396 404
397void MainWindow::slotTerminate() { 405void MainWindow::slotTerminate() {
398 if ( currentSession() ) 406 if ( currentSession() )
399 currentSession()->layer()->close(); 407 currentSession()->layer()->close();
400 408
401 slotClose(); 409 slotClose();
402 /* FIXME move to the next session */ 410 /* FIXME move to the next session */
403} 411}
404 412
413void MainWindow::slotQuickLaunch() {
414 Profile prof = manager()->profile( "default" );
415 if ( prof.name() == "default" ) {
416 create( prof );
417 } else {
418 QMessageBox::warning(this, tr("Failure"),tr("please configure one profile named \"default\""));
419 }
420
421}
422
405void MainWindow::slotConfigure() { 423void MainWindow::slotConfigure() {
406 ConfigDialog conf( manager()->all(), factory() ); 424 ConfigDialog conf( manager()->all(), factory() );
407 conf.showMaximized(); 425 conf.showMaximized();
408 426
409 int ret = conf.exec(); 427 int ret = conf.exec();
410 428
411 if ( QDialog::Accepted == ret ) { 429 if ( QDialog::Accepted == ret ) {
412 manager()->setProfiles( conf.list() ); 430 manager()->setProfiles( conf.list() );
413 manager()->save(); 431 manager()->save();
414 populateProfiles(); 432 populateProfiles();
415 } 433 }
416} 434}
417/* 435/*
418 * we will remove 436 * we will remove
419 * this window from the tabwidget 437 * this window from the tabwidget
420 * remove it from the list 438 * remove it from the list
421 * delete it 439 * delete it
422 * and set the currentSession() 440 * and set the currentSession()
423 */ 441 */
424void MainWindow::slotClose() { 442void MainWindow::slotClose() {
425 if (!currentSession() ) 443 if (!currentSession() )
426 return; 444 return;
427 445
428 Session* ses = currentSession(); 446 Session* ses = currentSession();
429 qWarning("removing! currentSession %s", currentSession()->name().latin1() ); 447 qWarning("removing! currentSession %s", currentSession()->name().latin1() );
430 /* set to NULL to be safe, if its needed slotSessionChanged resets it automatically */ 448 /* set to NULL to be safe, if its needed slotSessionChanged resets it automatically */
431 m_curSession = NULL; 449 m_curSession = NULL;
432 tabWidget()->remove( /*currentSession()*/ses ); 450 tabWidget()->remove( /*currentSession()*/ses );
433 /*it's autodelete */ 451 /*it's autodelete */
434 m_sessions.remove( ses ); 452 m_sessions.remove( ses );
435 qWarning("after remove!!"); 453 qWarning("after remove!!");
436 454
437 if (!currentSession() ) { 455 if (!currentSession() ) {
438 m_connect->setEnabled( false ); 456 m_connect->setEnabled( false );
439 m_disconnect->setEnabled( false ); 457 m_disconnect->setEnabled( false );
440 m_terminate->setEnabled( false ); 458 m_terminate->setEnabled( false );
441 m_transfer->setEnabled( false ); 459 m_transfer->setEnabled( false );
442 m_recordScript->setEnabled( false ); 460 m_recordScript->setEnabled( false );
443 m_saveScript->setEnabled( false ); 461 m_saveScript->setEnabled( false );
444 m_scripts->setItemEnabled(m_runScript_id, false); 462 m_scripts->setItemEnabled(m_runScript_id, false);
445 m_fullscreen->setEnabled( false ); 463 m_fullscreen->setEnabled( false );
446 m_wrap->setEnabled( false ); 464 m_wrap->setEnabled( false );
447 m_closewindow->setEnabled( false ); 465 m_closewindow->setEnabled( false );
448 } 466 }
449 467
450 m_kb->loadDefaults(); 468 m_kb->loadDefaults();
451} 469}
452 470
453/* 471/*
454 * We will get the name 472 * We will get the name
455 * Then the profile 473 * Then the profile
456 * and then we will make a profile 474 * and then we will make a profile
457 */ 475 */
458void MainWindow::slotProfile( int id) { 476void MainWindow::slotProfile( int id) {
459 Profile prof = manager()->profile( m_sessionsPop->text( id) ); 477 Profile prof = manager()->profile( m_sessionsPop->text( id) );
460 create( prof ); 478 create( prof );
461} 479}
480
481
482
462void MainWindow::create( const Profile& prof ) { 483void MainWindow::create( const Profile& prof ) {
463 if(m_curSession) 484 if(m_curSession)
464 if(m_curSession->transferDialog()) m_curSession->transferDialog()->hide(); 485 if(m_curSession->transferDialog()) m_curSession->transferDialog()->hide();
465 486
466 Session *ses = manager()->fromProfile( prof, tabWidget() ); 487 Session *ses = manager()->fromProfile( prof, tabWidget() );
467 488
468 if((!ses) || (!ses->layer()) || (!ses->widgetStack())) 489 if((!ses) || (!ses->layer()) || (!ses->widgetStack()))
469 { 490 {
470 QMessageBox::warning(this, 491 QMessageBox::warning(this,
471 QObject::tr("Session failed"), 492 QObject::tr("Session failed"),
472 QObject::tr("<qt>Cannot open session: Not all components were found.</qt>")); 493 QObject::tr("<qt>Cannot open session: Not all components were found.</qt>"));
473 //if(ses) delete ses; 494 //if(ses) delete ses;
474 return; 495 return;
475 } 496 }
476 497
477 m_sessions.append( ses ); 498 m_sessions.append( ses );
478 tabWidget()->add( ses ); 499 tabWidget()->add( ses );
479 tabWidget()->repaint(); 500 tabWidget()->repaint();
480 m_curSession = ses; 501 m_curSession = ses;
481 502
482 // dicide if its a local term ( then no connction and no tranfer), maybe make a wrapper method out of it 503 // dicide if its a local term ( then no connction and no tranfer), maybe make a wrapper method out of it
483 m_connect->setEnabled( true ); 504 m_connect->setEnabled( true );
484 m_disconnect->setEnabled( false ); 505 m_disconnect->setEnabled( false );
485 m_terminate->setEnabled( true ); 506 m_terminate->setEnabled( true );
486 m_fullscreen->setEnabled( true ); 507 m_fullscreen->setEnabled( true );
487 m_wrap->setEnabled( true ); 508 m_wrap->setEnabled( true );
488 m_closewindow->setEnabled( true ); 509 m_closewindow->setEnabled( true );
489 m_transfer->setEnabled( false ); 510 m_transfer->setEnabled( false );
490 m_recordScript->setEnabled( false ); 511 m_recordScript->setEnabled( false );
491 m_saveScript->setEnabled( false ); 512 m_saveScript->setEnabled( false );
492 m_scripts->setItemEnabled(m_runScript_id, false); 513 m_scripts->setItemEnabled(m_runScript_id, false);
493 514
494 // is io_layer wants direct connection, then autoconnect 515 // is io_layer wants direct connection, then autoconnect
495 //if ( ( m_curSession->layer() )->supports()[0] == 1 ) { 516 //if ( ( m_curSession->layer() )->supports()[0] == 1 ) {
496 if (prof.autoConnect()) { 517 if (prof.autoConnect()) {
497 slotConnect(); 518 slotConnect();
498 } 519 }
499 520
500 521
501 QWidget *w = currentSession()->widget(); 522 QWidget *w = currentSession()->widget();
502 if(w) w->setFocus(); 523 if(w) w->setFocus();
503 524
504 if(currentSession()->profile().readNumEntry("Wrap", 80)){ 525 if(currentSession()->profile().readNumEntry("Wrap", 80)){
505 m_isWrapped = true; 526 m_isWrapped = true;
506 } else { 527 } else {
507 m_isWrapped = false; 528 m_isWrapped = false;
508 } 529 }
509 530
510 m_kb->load(currentSession()->profile()); 531 m_kb->load(currentSession()->profile());
511} 532}
512 533
513void MainWindow::slotTransfer() 534void MainWindow::slotTransfer()
514{ 535{
515 if ( currentSession() ) { 536 if ( currentSession() ) {
516 Session *mysession = currentSession(); 537 Session *mysession = currentSession();
517 TransferDialog dlg(/*mysession->widgetStack()*/this, this); 538 TransferDialog dlg(/*mysession->widgetStack()*/this, this);
518 mysession->setTransferDialog(&dlg); 539 mysession->setTransferDialog(&dlg);
519 //dlg.reparent(mysession->widgetStack(), QPoint(0, 0)); 540 //dlg.reparent(mysession->widgetStack(), QPoint(0, 0));
520 //dlg.showMaximized(); 541 //dlg.showMaximized();
521 currentSession()->widgetStack()->addWidget(&dlg, -1); 542 currentSession()->widgetStack()->addWidget(&dlg, -1);
522 dlg.show(); 543 dlg.show();
523 //dlg.exec(); 544 //dlg.exec();
524 while(dlg.isRunning()) qApp->processEvents(); 545 while(dlg.isRunning()) qApp->processEvents();
525 mysession->setTransferDialog(0l); 546 mysession->setTransferDialog(0l);
526 } 547 }
527} 548}
528 549
529 550
530void MainWindow::slotOpenKeb(bool state) { 551void MainWindow::slotOpenKeb(bool state) {
531 552
532 if (state) m_keyBar->show(); 553 if (state) m_keyBar->show();
533 else m_keyBar->hide(); 554 else m_keyBar->hide();
534 555
535} 556}
536 557
537 558
538void MainWindow::slotOpenButtons( bool state ) { 559void MainWindow::slotOpenButtons( bool state ) {
539 560
540 if ( state ) { 561 if ( state ) {
541 m_buttonBar->show(); 562 m_buttonBar->show();
542 } else { 563 } else {
543 m_buttonBar->hide(); 564 m_buttonBar->hide();
544 } 565 }
545} 566}
546 567
547 568
548 569
549void MainWindow::slotSessionChanged( Session* ses ) { 570void MainWindow::slotSessionChanged( Session* ses ) {
550 qWarning("changed!"); 571 qWarning("changed!");
551 572
552 if(m_curSession) 573 if(m_curSession)
553 if(m_curSession->transferDialog()) m_curSession->transferDialog()->hide(); 574 if(m_curSession->transferDialog()) m_curSession->transferDialog()->hide();
554 if(ses) 575 if(ses)
555 if(ses->transferDialog()) ses->transferDialog()->show(); 576 if(ses->transferDialog()) ses->transferDialog()->show();
556 577
557 if ( ses ) { 578 if ( ses ) {
558 m_curSession = ses; 579 m_curSession = ses;
559 qDebug(QString("is connected : %1").arg( m_curSession->layer()->isConnected() ) ); 580 qDebug(QString("is connected : %1").arg( m_curSession->layer()->isConnected() ) );
560 if ( m_curSession->layer()->isConnected() ) { 581 if ( m_curSession->layer()->isConnected() ) {
561 m_connect->setEnabled( false ); 582 m_connect->setEnabled( false );
562 m_disconnect->setEnabled( true ); 583 m_disconnect->setEnabled( true );
563 m_recordScript->setEnabled(!m_curSession->emulationHandler()->isRecording()); 584 m_recordScript->setEnabled(!m_curSession->emulationHandler()->isRecording());
564 m_saveScript->setEnabled(m_curSession->emulationHandler()->isRecording()); 585 m_saveScript->setEnabled(m_curSession->emulationHandler()->isRecording());
565 m_scripts->setItemEnabled(m_runScript_id, true); 586 m_scripts->setItemEnabled(m_runScript_id, true);
566 } else { 587 } else {
567 m_connect->setEnabled( true ); 588 m_connect->setEnabled( true );
568 m_disconnect->setEnabled( false ); 589 m_disconnect->setEnabled( false );
569 m_recordScript->setEnabled( false ); 590 m_recordScript->setEnabled( false );
570 m_saveScript->setEnabled( false ); 591 m_saveScript->setEnabled( false );
571 m_scripts->setItemEnabled(m_runScript_id, false); 592 m_scripts->setItemEnabled(m_runScript_id, false);
572 } 593 }
573 594
574 if ( ( m_curSession->layer() )->supports()[1] == 0 ) { 595 if ( ( m_curSession->layer() )->supports()[1] == 0 ) {
575 m_transfer->setEnabled( false ); 596 m_transfer->setEnabled( false );
576 } else { 597 } else {
577 m_transfer->setEnabled( true ); 598 m_transfer->setEnabled( true );
578 } 599 }
579 600
580 QWidget *w = m_curSession->widget(); 601 QWidget *w = m_curSession->widget();
581 if(w) w->setFocus(); 602 if(w) w->setFocus();
582 603
583 if(currentSession()->profile().readNumEntry("Wrap", 80)){ 604 if(currentSession()->profile().readNumEntry("Wrap", 80)){
584 m_isWrapped = true; 605 m_isWrapped = true;
585 } else { 606 } else {
586 m_isWrapped = false; 607 m_isWrapped = false;
587 } 608 }
588 609
589 m_kb->load(currentSession()->profile()); 610 m_kb->load(currentSession()->profile());
diff --git a/noncore/apps/opie-console/mainwindow.h b/noncore/apps/opie-console/mainwindow.h
index 0fac38b..86939c1 100644
--- a/noncore/apps/opie-console/mainwindow.h
+++ b/noncore/apps/opie-console/mainwindow.h
@@ -1,136 +1,138 @@
1#ifndef OPIE_MAIN_WINDOW_H 1#ifndef OPIE_MAIN_WINDOW_H
2#define OPIE_MAIN_WINDOW_H 2#define OPIE_MAIN_WINDOW_H
3 3
4#include <qmainwindow.h> 4#include <qmainwindow.h>
5#include <qlist.h> 5#include <qlist.h>
6 6
7#include "session.h" 7#include "session.h"
8 8
9/** 9/**
10 * this is the MainWindow of the new opie console 10 * this is the MainWindow of the new opie console
11 * it's also the dispatcher between the different 11 * it's also the dispatcher between the different
12 * actions supported by the gui 12 * actions supported by the gui
13 */ 13 */
14class QToolBar; 14class QToolBar;
15class QToolButton; 15class QToolButton;
16class QMenuBar; 16class QMenuBar;
17class QAction; 17class QAction;
18class MetaFactory; 18class MetaFactory;
19class TabWidget; 19class TabWidget;
20class ProfileManager; 20class ProfileManager;
21class Profile; 21class Profile;
22class FunctionKeyboard; 22class FunctionKeyboard;
23class FKey; 23class FKey;
24class DocLnk; 24class DocLnk;
25 25
26class MainWindow : public QMainWindow { 26class MainWindow : public QMainWindow {
27 Q_OBJECT 27 Q_OBJECT
28public: 28public:
29 MainWindow( QWidget *parent = 0, const char *name = 0, WFlags fl = 0 ); 29 MainWindow( QWidget *parent = 0, const char *name = 0, WFlags fl = 0 );
30 ~MainWindow(); 30 ~MainWindow();
31 31
32 /** 32 /**
33 * our factory to generate IOLayer and so on 33 * our factory to generate IOLayer and so on
34 * 34 *
35 */ 35 */
36 MetaFactory* factory(); 36 MetaFactory* factory();
37 37
38 /** 38 /**
39 * A session contains a QWidget*, 39 * A session contains a QWidget*,
40 * an IOLayer* and some infos for us 40 * an IOLayer* and some infos for us
41 */ 41 */
42 Session* currentSession(); 42 Session* currentSession();
43 43
44 /** 44 /**
45 * the session list 45 * the session list
46 */ 46 */
47 QList<Session> sessions(); 47 QList<Session> sessions();
48 48
49 /** 49 /**
50 * 50 *
51 */ 51 */
52 ProfileManager* manager(); 52 ProfileManager* manager();
53 TabWidget* tabWidget(); 53 TabWidget* tabWidget();
54 54
55private slots: 55private slots:
56 void slotNew(); 56 void slotNew();
57 void slotConnect(); 57 void slotConnect();
58 void slotDisconnect(); 58 void slotDisconnect();
59 void slotTerminate(); 59 void slotTerminate();
60 void slotConfigure(); 60 void slotConfigure();
61 void slotClose(); 61 void slotClose();
62 void slotProfile(int); 62 void slotProfile(int);
63 void slotTransfer(); 63 void slotTransfer();
64 void slotOpenKeb(bool); 64 void slotOpenKeb(bool);
65 void slotOpenButtons(bool); 65 void slotOpenButtons(bool);
66 void slotRecordScript(); 66 void slotRecordScript();
67 void slotSaveScript(); 67 void slotSaveScript();
68 void slotRunScript(int); 68 void slotRunScript(int);
69 void slotFullscreen(); 69 void slotFullscreen();
70 void slotQuickLaunch();
70 void slotWrap(); 71 void slotWrap();
71 void slotSessionChanged( Session* ); 72 void slotSessionChanged( Session* );
72 void slotKeyReceived(FKey, ushort, ushort, bool); 73 void slotKeyReceived(FKey, ushort, ushort, bool);
73 void slotSaveHistory(); 74 void slotSaveHistory();
74 75
75 /* what could these both slot do? */ 76 /* what could these both slot do? */
76 void slotCopy(); 77 void slotCopy();
77 void slotPaste(); 78 void slotPaste();
78 79
79 /* save the currentSession() to Profiles */ 80 /* save the currentSession() to Profiles */
80 void slotSaveSession(); 81 void slotSaveSession();
81 82
82private: 83private:
83 void initUI(); 84 void initUI();
84 void populateProfiles(); 85 void populateProfiles();
85 void populateScripts(); 86 void populateScripts();
86 void create( const Profile& ); 87 void create( const Profile& );
87 /** 88 /**
88 * the current session 89 * the current session
89 */ 90 */
90 Session* m_curSession; 91 Session* m_curSession;
91 92
92 /** 93 /**
93 * the session list 94 * the session list
94 */ 95 */
95 QList<Session> m_sessions; 96 QList<Session> m_sessions;
96 QList<DocLnk> m_scriptsData; 97 QList<DocLnk> m_scriptsData;
97 98
98 /** 99 /**
99 * the metafactory 100 * the metafactory
100 */ 101 */
101 MetaFactory* m_factory; 102 MetaFactory* m_factory;
102 ProfileManager* m_manager; 103 ProfileManager* m_manager;
103 104
104 TabWidget* m_consoleWindow; 105 TabWidget* m_consoleWindow;
105 QToolBar* m_tool; 106 QToolBar* m_tool;
106 QToolBar* m_icons; 107 QToolBar* m_icons;
107 QToolBar* m_keyBar; 108 QToolBar* m_keyBar;
108 QToolBar* m_buttonBar; 109 QToolBar* m_buttonBar;
109 QMenuBar* m_bar; 110 QMenuBar* m_bar;
110 QPopupMenu* m_console; 111 QPopupMenu* m_console;
111 QPopupMenu* m_sessionsPop; 112 QPopupMenu* m_sessionsPop;
112 QPopupMenu* m_scriptsPop; 113 QPopupMenu* m_scriptsPop;
113 QPopupMenu* m_scripts; 114 QPopupMenu* m_scripts;
114 QAction* m_connect; 115 QAction* m_connect;
115 QAction* m_disconnect; 116 QAction* m_disconnect;
117 QAction* m_quickLaunch;
116 QAction* m_terminate; 118 QAction* m_terminate;
117 QAction* m_transfer; 119 QAction* m_transfer;
118 QAction* m_setProfiles; 120 QAction* m_setProfiles;
119 QAction* m_openKeys; 121 QAction* m_openKeys;
120 QAction* m_openButtons; 122 QAction* m_openButtons;
121 QAction* m_recordScript; 123 QAction* m_recordScript;
122 QAction* m_saveScript; 124 QAction* m_saveScript;
123 QAction* m_fullscreen; 125 QAction* m_fullscreen;
124 QAction* m_wrap; 126 QAction* m_wrap;
125 QAction* m_closewindow; 127 QAction* m_closewindow;
126 128
127 FunctionKeyboard *m_kb; 129 FunctionKeyboard *m_kb;
128 int m_runScript_id; 130 int m_runScript_id;
129 bool m_isFullscreen; 131 bool m_isFullscreen;
130 bool m_isWrapped; 132 bool m_isWrapped;
131 133
132 QWidget* savedParentFullscreen; 134 QWidget* savedParentFullscreen;
133}; 135};
134 136
135 137
136#endif 138#endif
diff --git a/noncore/apps/opie-console/terminalwidget.cpp b/noncore/apps/opie-console/terminalwidget.cpp
index a8cee93..70f7c9b 100644
--- a/noncore/apps/opie-console/terminalwidget.cpp
+++ b/noncore/apps/opie-console/terminalwidget.cpp
@@ -1,200 +1,200 @@
1#include <qbuttongroup.h> 1#include <qbuttongroup.h>
2#include <qlabel.h> 2#include <qlabel.h>
3#include <qcheckbox.h> 3#include <qcheckbox.h>
4#include <qcombobox.h> 4#include <qcombobox.h>
5#include <qradiobutton.h> 5#include <qradiobutton.h>
6#include <qgroupbox.h> 6#include <qgroupbox.h>
7#include <qvbox.h> 7#include <qvbox.h>
8#include <qhgroupbox.h> 8#include <qhgroupbox.h>
9#include <qhbuttongroup.h> 9#include <qhbuttongroup.h>
10#include <qlayout.h> 10#include <qlayout.h>
11#include <qhbox.h> 11#include <qhbox.h>
12 12
13#include "terminalwidget.h" 13#include "terminalwidget.h"
14 14
15namespace { 15namespace {
16 enum TermIds { 16 enum TermIds {
17 id_term_vt100 = 0, 17 id_term_vt100 = 0,
18 id_term_vt102, 18 id_term_vt102,
19 id_term_linux, 19 id_term_linux,
20 id_term_xterm 20 id_term_xterm
21 }; 21 };
22 22
23 enum ColourIds { 23 enum ColourIds {
24 id_term_black, 24 id_term_black,
25 id_term_white, 25 id_term_white,
26 id_term_green, 26 id_term_green,
27 id_term_orange 27 id_term_orange
28 }; 28 };
29 29
30 enum FontIds { 30 enum FontIds {
31 id_size_small, 31 id_size_small,
32 id_size_medium, 32 id_size_medium,
33 id_size_large 33 id_size_large
34 }; 34 };
35}; 35};
36 36
37TerminalWidget::TerminalWidget( const QString& name, QWidget* parent, 37TerminalWidget::TerminalWidget( const QString& name, QWidget* parent,
38 const char* na ) 38 const char* na )
39 : ProfileDialogTerminalWidget( name, parent, na ) { 39 : ProfileDialogTerminalWidget( name, parent, na ) {
40 40
41 m_terminal = new QLabel(tr("Terminal Type"), this ); 41 m_terminal = new QLabel(tr("Terminal Type"), this );
42 m_terminalBox = new QComboBox(this); 42 m_terminalBox = new QComboBox(this);
43 m_colorLabel = new QLabel(tr("Color scheme"), this); 43 m_colorLabel = new QLabel(tr("Color scheme"), this);
44 m_colorCmb = new QComboBox(this ); 44 m_colorCmb = new QComboBox(this );
45 45
46 m_groupSize = new QHButtonGroup(tr("Font size"), this ); 46 m_groupSize = new QHButtonGroup(tr("Font size"), this );
47 m_sizeSmall = new QRadioButton(tr("small"), m_groupSize ); 47 m_sizeSmall = new QRadioButton(tr("small"), m_groupSize );
48 m_sizeMedium = new QRadioButton(tr("medium"), m_groupSize ); 48 m_sizeMedium = new QRadioButton(tr("medium"), m_groupSize );
49 m_sizeLarge = new QRadioButton(tr("large"), m_groupSize ); 49 m_sizeLarge = new QRadioButton(tr("large"), m_groupSize );
50 50
51 m_groupConv = new QHGroupBox(tr("Line-break conversions"), this ); 51 m_groupConv = new QHGroupBox( tr("Line-break conversions"), this );
52 m_convInbound = new QCheckBox(tr("Inbound"), m_groupConv ); 52 m_convInbound = new QCheckBox( tr("Inbound"), m_groupConv );
53 m_convOutbound = new QCheckBox(tr("Outbound"), m_groupConv ); 53 m_convOutbound = new QCheckBox( tr("Outbound"), m_groupConv );
54 54
55 m_groupOptions = new QHGroupBox( tr("Options"), this ); 55 m_groupOptions = new QHGroupBox( tr("Options"), this );
56 m_optionEcho = new QCheckBox(tr("Local echo"), m_groupOptions ); 56 m_optionEcho = new QCheckBox( tr("Local echo"), m_groupOptions );
57 m_optionWrap = new QCheckBox(tr("Line wrap"), m_groupOptions ); 57 m_optionWrap = new QCheckBox( tr("Line wrap"), m_groupOptions );
58 58
59 m_lroot = new QVBoxLayout( this ); 59 m_lroot = new QVBoxLayout( this );
60 m_typeBox = new QVBoxLayout( m_lroot ); 60 m_typeBox = new QVBoxLayout( m_lroot );
61 m_colorBox = new QVBoxLayout( m_lroot ); 61 m_colorBox = new QVBoxLayout( m_lroot );
62 62
63 // Layout 63 // Layout
64 m_typeBox->add(m_terminal ); 64 m_typeBox->add( m_terminal );
65 m_typeBox->add(m_terminalBox ); 65 m_typeBox->add( m_terminalBox );
66 m_lroot->add(m_groupSize ); 66 m_lroot->add( m_groupSize );
67 67
68 m_colorBox->add( m_colorLabel ); 68 m_colorBox->add( m_colorLabel );
69 m_colorBox->add( m_colorCmb ); 69 m_colorBox->add( m_colorCmb );
70 70
71 m_lroot->add(m_groupConv ); 71 m_lroot->add( m_groupConv );
72 m_lroot->add(m_groupOptions ); 72 m_lroot->add( m_groupOptions );
73 m_lroot->addStretch( 0 ); 73 m_lroot->addStretch( 0 );
74 74
75 // Fill in some options 75 // Fill in some options
76 qWarning("Options for terminal box"); 76 qWarning("Options for terminal box");
77 m_terminalBox->insertItem( tr("VT 100"), 0 ); // /*, id_term_vt100*/ ); 77 m_terminalBox->insertItem( tr("VT 100"), 0 ); // /*, id_term_vt100*/ );
78 m_terminalBox->insertItem( tr("VT 102"), 1 ); // /* , id_term_vt102 */); 78 m_terminalBox->insertItem( tr("VT 102"), 1 ); // /* , id_term_vt102 */);
79 m_terminalBox->insertItem( tr("Linux Console"), 2 ); //, id_term_linux ); 79 m_terminalBox->insertItem( tr("Linux Console"), 2 ); //, id_term_linux );
80 m_terminalBox->insertItem( tr("X-Terminal"), 3 ); //, id_term_xterm ); 80 m_terminalBox->insertItem( tr("X-Terminal"), 3 ); //, id_term_xterm );
81 //m_terminalBox->insertItem( tr("ANSI"), id_term_ansi ); 81 //m_terminalBox->insertItem( tr("ANSI"), id_term_ansi );
82 82
83 m_colorCmb->insertItem( tr("black on white"), id_term_black ); 83 m_colorCmb->insertItem( tr("black on white"), id_term_black );
84 m_colorCmb->insertItem( tr("white on black"), id_term_white ); 84 m_colorCmb->insertItem( tr("white on black"), id_term_white );
85 m_colorCmb->insertItem( tr("green on black"), id_term_green ); 85 m_colorCmb->insertItem( tr("green on black"), id_term_green );
86 m_colorCmb->insertItem( tr("orange on black"), id_term_orange ); 86 m_colorCmb->insertItem( tr("orange on black"), id_term_orange );
87 87
88 // signals + slots 88 // signals + slots
89 /* 89 /*
90 connect(m_terminalBox, SIGNAL(activated(int) ), 90 connect(m_terminalBox, SIGNAL(activated(int) ),
91 this, SLOT(slotTermTerm(int) ) ); 91 this, SLOT(slotTermTerm(int) ) );
92 connect(m_colorBox, SIGNAL(activated(int) ), 92 connect(m_colorBox, SIGNAL(activated(int) ),
93 tis, SLOT(slotTermColor(int) ) ); 93 tis, SLOT(slotTermColor(int) ) );
94 connect(m_groupSize, SIGNAL(activated(int) ), 94 connect(m_groupSize, SIGNAL(activated(int) ),
95 this, SLOT(slotTermFont(int) ) ); 95 this, SLOT(slotTermFont(int) ) );
96 96
97 connect(m_optionEcho, SIGNAL(toggled(bool) ), 97 connect(m_optionEcho, SIGNAL(toggled(bool) ),
98 this, SLOT(slotTermEcho(bool) ) ); 98 this, SLOT(slotTermEcho(bool) ) );
99 connect(m_optionWrap, SIGNAL(toggled(bool) ), 99 connect(m_optionWrap, SIGNAL(toggled(bool) ),
100 this, SLOT(slotTermWrap(bool) ) ); 100 this, SLOT(slotTermWrap(bool) ) );
101 connect(m_convInbound, SIGNAL(toggled(bool) ), 101 connect(m_convInbound, SIGNAL(toggled(bool) ),
102 this, SLOT(slotTermInbound(bool) ) ); 102 this, SLOT(slotTermInbound(bool) ) );
103 connect(m_convOutbound, SIGNAL(toggled(bool) ), 103 connect(m_convOutbound, SIGNAL(toggled(bool) ),
104 this, SLOT(slotTermOutbound(bool) ) ); 104 this, SLOT(slotTermOutbound(bool) ) );
105*/ 105*/
106} 106}
107TerminalWidget::~TerminalWidget() { 107TerminalWidget::~TerminalWidget() {
108} 108}
109void TerminalWidget::load( const Profile& prof ) { 109void TerminalWidget::load( const Profile& prof ) {
110 int term = prof.readNumEntry("Terminal"); 110 int term = prof.readNumEntry("Terminal");
111 int color = prof.readNumEntry("Color"); 111 int color = prof.readNumEntry("Color");
112 int fontsize = prof.readNumEntry("Font"); 112 int fontsize = prof.readNumEntry("Font");
113 int opt_echo = prof.readNumEntry("Echo"); 113 int opt_echo = prof.readNumEntry("Echo");
114 int opt_wrap = prof.readNumEntry("Wrap"); 114 int opt_wrap = prof.readNumEntry("Wrap");
115 int opt_inbound = prof.readNumEntry("Inbound"); 115 int opt_inbound = prof.readNumEntry("Inbound");
116 int opt_outbound = prof.readNumEntry("Outbound"); 116 int opt_outbound = prof.readNumEntry("Outbound");
117 117
118 switch( term ) { 118 switch( term ) {
119 case Profile::VT100: 119 case Profile::VT100:
120 m_terminalBox->setCurrentItem(id_term_vt100 ); 120 m_terminalBox->setCurrentItem(id_term_vt100 );
121 break; 121 break;
122 case Profile::VT102: 122 case Profile::VT102:
123 m_terminalBox->setCurrentItem(id_term_vt102 ); 123 m_terminalBox->setCurrentItem(id_term_vt102 );
124 break; 124 break;
125 case Profile::Linux: 125 case Profile::Linux:
126 m_terminalBox->setCurrentItem(id_term_linux ); 126 m_terminalBox->setCurrentItem(id_term_linux );
127 break; 127 break;
128 case Profile::XTerm: 128 case Profile::XTerm:
129 m_terminalBox->setCurrentItem(id_term_xterm ); 129 m_terminalBox->setCurrentItem(id_term_xterm );
130 break; 130 break;
131 default: 131 default:
132 m_terminalBox->setCurrentItem(id_term_vt102 ); 132 m_terminalBox->setCurrentItem(id_term_vt102 );
133 break; 133 break;
134 }; 134 };
135 135
136 switch( color ) { 136 switch( color ) {
137 case Profile::Black: 137 case Profile::Black:
138 m_colorCmb->setCurrentItem(id_term_black ); 138 m_colorCmb->setCurrentItem(id_term_black );
139 break; 139 break;
140 case Profile::White: 140 case Profile::White:
141 m_colorCmb->setCurrentItem(id_term_white ); 141 m_colorCmb->setCurrentItem(id_term_white );
142 break; 142 break;
143 case Profile::Green: 143 case Profile::Green:
144 m_colorCmb->setCurrentItem(id_term_green ); 144 m_colorCmb->setCurrentItem(id_term_green );
145 break; 145 break;
146 case Profile::Orange: 146 case Profile::Orange:
147 m_colorCmb->setCurrentItem(id_term_orange ); 147 m_colorCmb->setCurrentItem(id_term_orange );
148 break; 148 break;
149 default: 149 default:
150 break; 150 break;
151 }; 151 };
152 152
153 switch( fontsize ) { 153 switch( fontsize ) {
154 case Profile::Micro: 154 case Profile::Micro:
155 m_sizeSmall->setChecked(true ); 155 m_sizeSmall->setChecked(true );
156 break; 156 break;
157 case Profile::Small: 157 case Profile::Small:
158 m_sizeMedium->setChecked(true ); 158 m_sizeMedium->setChecked(true );
159 break; 159 break;
160 case Profile::Medium: 160 case Profile::Medium:
161 m_sizeLarge->setChecked( true ); 161 m_sizeLarge->setChecked( true );
162 break; 162 break;
163 default: 163 default:
164 m_sizeMedium->setChecked(true ); 164 m_sizeMedium->setChecked(true );
165 break; 165 break;
166 }; 166 };
167 167
168 if (opt_echo) m_optionEcho->setChecked( true ); 168 if (opt_echo) m_optionEcho->setChecked( true );
169 if (opt_wrap) m_optionWrap->setChecked( true ); 169 if (opt_wrap) m_optionWrap->setChecked( true );
170 if (opt_inbound) m_convInbound->setChecked( true ); 170 if (opt_inbound) m_convInbound->setChecked( true );
171 if (opt_outbound) m_convOutbound->setChecked( true ); 171 if (opt_outbound) m_convOutbound->setChecked( true );
172 172
173} 173}
174void TerminalWidget::save( Profile& profile ) { 174void TerminalWidget::save( Profile& profile ) {
175 switch(m_terminalBox->currentItem() ) { 175 switch(m_terminalBox->currentItem() ) {
176 case id_term_vt100: 176 case id_term_vt100:
177 profile.writeEntry("Terminal", Profile::VT100 ); 177 profile.writeEntry("Terminal", Profile::VT100 );
178 break; 178 break;
179 case id_term_vt102: 179 case id_term_vt102:
180 profile.writeEntry("Terminal", Profile::VT102 ); 180 profile.writeEntry("Terminal", Profile::VT102 );
181 break; 181 break;
182 case id_term_linux: 182 case id_term_linux:
183 profile.writeEntry("Terminal", Profile::Linux ); 183 profile.writeEntry("Terminal", Profile::Linux );
184 break; 184 break;
185 case id_term_xterm: 185 case id_term_xterm:
186 profile.writeEntry("Terminal", Profile::XTerm ); 186 profile.writeEntry("Terminal", Profile::XTerm );
187 break; 187 break;
188 //case id_term_ansi: 188 //case id_term_ansi:
189 // profile.writeEntry("Terminal", Profile::VT102 ); 189 // profile.writeEntry("Terminal", Profile::VT102 );
190 // break; 190 // break;
191 default: 191 default:
192 break; 192 break;
193 }; 193 };
194 194
195 // color 195 // color
196 switch(m_colorCmb->currentItem() ) { 196 switch(m_colorCmb->currentItem() ) {
197 case id_term_black: 197 case id_term_black:
198 profile.writeEntry("Color", Profile::Black ); 198 profile.writeEntry("Color", Profile::Black );
199 break; 199 break;
200 case id_term_white: 200 case id_term_white:
diff --git a/pics/console/konsole_mini.png b/pics/console/konsole_mini.png
new file mode 100644
index 0000000..590a417
--- a/dev/null
+++ b/pics/console/konsole_mini.png
Binary files differ