summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/PLANS12
-rw-r--r--noncore/apps/opie-console/default.cpp7
-rw-r--r--noncore/apps/opie-console/default.h4
-rw-r--r--noncore/apps/opie-console/emulation_layer.h2
-rw-r--r--noncore/apps/opie-console/keytrans.cpp3
-rw-r--r--noncore/apps/opie-console/mainwindow.cpp48
-rw-r--r--noncore/apps/opie-console/mainwindow.h4
-rw-r--r--noncore/apps/opie-console/metafactory.cpp25
-rw-r--r--noncore/apps/opie-console/metafactory.h21
-rw-r--r--noncore/apps/opie-console/profilemanager.cpp44
-rw-r--r--noncore/apps/opie-console/profilemanager.h2
-rw-r--r--noncore/apps/opie-console/session.cpp49
-rw-r--r--noncore/apps/opie-console/session.h38
-rw-r--r--noncore/apps/opie-console/tabwidget.cpp21
-rw-r--r--noncore/apps/opie-console/tabwidget.h5
-rw-r--r--noncore/apps/opie-console/vt102emulation.cpp2
-rw-r--r--noncore/apps/opie-console/vt102emulation.h2
17 files changed, 248 insertions, 41 deletions
diff --git a/noncore/apps/opie-console/PLANS b/noncore/apps/opie-console/PLANS
index 8f6b807..0ec45cb 100644
--- a/noncore/apps/opie-console/PLANS
+++ b/noncore/apps/opie-console/PLANS
@@ -1,34 +1,38 @@
1can we please get a working serial connection for now? if that works 1can we please get a working serial connection for now? if that works
2i can test file transfers and stuff. -hash 2i can test file transfers and stuff. -hash
3sure. I finished the ConfigDialog and now doing the Profile->Session
4stuff. Then you just need to click Open -zecke
3 5
4From a UNIX point of view we want to do something like minicom 6From a UNIX point of view we want to do something like minicom
5with a better GUI. 7with a better GUI.
6It should feature some terminal emulation vt100/102, ansi, 8It should feature some terminal emulation vt100/102, ansi,
7filetransfer via {x,y,z}modem, and some sort of session management. 9filetransfer via {x,y,z}modem, and some sort of session management.
8Besides this requirement we would like to be able to execute 'scripts' 10Besides this requirement we would like to be able to execute 'scripts'
9in a session. 11in a session.
10A script would just write to the TEmulation and then be sent via 12A script would just write to the TEmulation and then be sent via
11an IOlayer. 13an IOlayer.
12Then we would like to send keys? Do we want that? 14Then we would like to send keys? Do we want that?
13 15
14We want a modular architecture which might support plugins in 16We want a modular architecture which might support plugins in
15the future 17the future
16 18
17(Almost) DONE: 19(Almost) DONE:
18Framework 20Framework
19Serial IOLayer 21Serial IOLayer
20Saving and Restoring Profiles 22Saving and Restoring Profiles
23ConfigDialog Framework
24FilesendingLayer - hash
21 25
22TASKS in progress: 26TASKS in progress:
23Profile->Session and MainWidget --- Harlekin 27Profile->Session and MainWidget --- Harlekin
24FilesendingLayer - hash
25IOLayer - wazlaf 28IOLayer - wazlaf
26Configuration - josef
27TE - ibotty 29TE - ibotty
28
29OPEN tasks:
30Session->Profile - hash 30Session->Profile - hash
31Scripting - wazlaf 31Scripting - wazlaf
32
33OPEN tasks:
34Irda ConfigWidget
35BT ConfigWidget
32Keys - open 36Keys - open
33IRDA-Layer - open 37IRDA-Layer - open
34Bluetooth-Layer - open 38Bluetooth-Layer - open
diff --git a/noncore/apps/opie-console/default.cpp b/noncore/apps/opie-console/default.cpp
index d9a0557..da6f3e2 100644
--- a/noncore/apps/opie-console/default.cpp
+++ b/noncore/apps/opie-console/default.cpp
@@ -1,67 +1,74 @@
1#include "io_serial.h" 1#include "io_serial.h"
2#include "sz_transfer.h" 2#include "sz_transfer.h"
3#include "serialconfigwidget.h" 3#include "serialconfigwidget.h"
4#include "terminalwidget.h" 4#include "terminalwidget.h"
5#include "vt102emulation.h"
5 6
6#include "default.h" 7#include "default.h"
7 8
8extern "C" { 9extern "C" {
9 // FILE Transfer Stuff 10 // FILE Transfer Stuff
10 FileTransferLayer* newSZTransfer(IOLayer* lay) { 11 FileTransferLayer* newSZTransfer(IOLayer* lay) {
11 return new SzTransfer( SzTransfer::SZ, lay ); 12 return new SzTransfer( SzTransfer::SZ, lay );
12 } 13 }
13 FileTransferLayer* newSYTransfer(IOLayer* lay) { 14 FileTransferLayer* newSYTransfer(IOLayer* lay) {
14 return new SzTransfer( SzTransfer::SY, lay ); 15 return new SzTransfer( SzTransfer::SY, lay );
15 } 16 }
16 FileTransferLayer* newSXTransfer(IOLayer* lay) { 17 FileTransferLayer* newSXTransfer(IOLayer* lay) {
17 return new SzTransfer( SzTransfer::SX, lay ); 18 return new SzTransfer( SzTransfer::SX, lay );
18 } 19 }
19 20
20 // Layer stuff 21 // Layer stuff
21 IOLayer* newSerialLayer( const Profile& prof) { 22 IOLayer* newSerialLayer( const Profile& prof) {
22 return new IOSerial( prof ); 23 return new IOSerial( prof );
23 } 24 }
24 IOLayer* newBTLayer( const Profile& ) { 25 IOLayer* newBTLayer( const Profile& ) {
25 return 0l; 26 return 0l;
26 } 27 }
27 IOLayer* newIrDaLayer( const Profile& ) { 28 IOLayer* newIrDaLayer( const Profile& ) {
28 return 0l; 29 return 0l;
29 } 30 }
30 31
31 // Connection Widgets 32 // Connection Widgets
32 ProfileDialogWidget* newSerialWidget(const QString& str, QWidget* wid) { 33 ProfileDialogWidget* newSerialWidget(const QString& str, QWidget* wid) {
33 return new SerialConfigWidget(str, wid ); 34 return new SerialConfigWidget(str, wid );
34 } 35 }
35 ProfileDialogWidget* newIrDaWidget( const QString& str, QWidget* wid) { 36 ProfileDialogWidget* newIrDaWidget( const QString& str, QWidget* wid) {
36 return newSerialWidget(str, wid); 37 return newSerialWidget(str, wid);
37 } 38 }
38 ProfileDialogWidget* newBTWidget( const QString& str, QWidget* wid) { 39 ProfileDialogWidget* newBTWidget( const QString& str, QWidget* wid) {
39 return newSerialWidget(str, wid ); 40 return newSerialWidget(str, wid );
40 } 41 }
41 42
42 // Terminal Widget(s) 43 // Terminal Widget(s)
43 ProfileDialogWidget* newTerminalWidget(const QString& na, QWidget* wid) { 44 ProfileDialogWidget* newTerminalWidget(const QString& na, QWidget* wid) {
44 return new TerminalWidget(na, wid,0 ); 45 return new TerminalWidget(na, wid,0 );
45 } 46 }
46 47
48 // VT Emulations
49 EmulationLayer* newVT102( Widget* wid ) {
50 return new Vt102Emulation( wid );
51 }
52
47}; 53};
48 54
49Default::Default( MetaFactory* fact ) { 55Default::Default( MetaFactory* fact ) {
50 fact->addFileTransferLayer( "SZ", QObject::tr("Z-Modem"), newSZTransfer ); 56 fact->addFileTransferLayer( "SZ", QObject::tr("Z-Modem"), newSZTransfer );
51 fact->addFileTransferLayer( "SY", QObject::tr("Y-Modem"), newSYTransfer ); 57 fact->addFileTransferLayer( "SY", QObject::tr("Y-Modem"), newSYTransfer );
52 fact->addFileTransferLayer( "SX", QObject::tr("X-Modem"), newSXTransfer ); 58 fact->addFileTransferLayer( "SX", QObject::tr("X-Modem"), newSXTransfer );
53 59
54 fact->addIOLayerFactory( "serial", QObject::tr("Serial"), newSerialLayer ); 60 fact->addIOLayerFactory( "serial", QObject::tr("Serial"), newSerialLayer );
55 fact->addIOLayerFactory( "irda", QObject::tr("Infrared"), newIrDaLayer ); 61 fact->addIOLayerFactory( "irda", QObject::tr("Infrared"), newIrDaLayer );
56 fact->addIOLayerFactory( "bt", QObject::tr("Bluetooth"), newBTLayer ); 62 fact->addIOLayerFactory( "bt", QObject::tr("Bluetooth"), newBTLayer );
57 63
58 fact->addConnectionWidgetFactory( "serial", QObject::tr("Serial"), newSerialWidget ); 64 fact->addConnectionWidgetFactory( "serial", QObject::tr("Serial"), newSerialWidget );
59 fact->addConnectionWidgetFactory( "irda", QObject::tr("Infrared"), newIrDaWidget ); 65 fact->addConnectionWidgetFactory( "irda", QObject::tr("Infrared"), newIrDaWidget );
60 fact->addConnectionWidgetFactory( "bt", QObject::tr("Bluetooth"), newBTWidget ); 66 fact->addConnectionWidgetFactory( "bt", QObject::tr("Bluetooth"), newBTWidget );
61 67
62 fact->addTerminalWidgetFactory( "default", QObject::tr("Default Terminal"), newTerminalWidget ); 68 fact->addTerminalWidgetFactory( "default", QObject::tr("Default Terminal"), newTerminalWidget );
63 69
70 fact->addEmulationLayer( "default", QObject::tr("Default Terminal"), newVT102 );
64} 71}
65Default::~Default() { 72Default::~Default() {
66 73
67} 74}
diff --git a/noncore/apps/opie-console/default.h b/noncore/apps/opie-console/default.h
index ed78986..b9af898 100644
--- a/noncore/apps/opie-console/default.h
+++ b/noncore/apps/opie-console/default.h
@@ -1,30 +1,34 @@
1#ifndef OPIE_DEFAULT_H 1#ifndef OPIE_DEFAULT_H
2#define OPIE_DEFAULT_H 2#define OPIE_DEFAULT_H
3 3
4#include "metafactory.h" 4#include "metafactory.h"
5 5
6class Widget;
7
6extern "C" { 8extern "C" {
7 FileTransferLayer* newSZTransfer(IOLayer*); 9 FileTransferLayer* newSZTransfer(IOLayer*);
8 FileTransferLayer* newSYTransfer(IOLayer*); 10 FileTransferLayer* newSYTransfer(IOLayer*);
9 FileTransferLayer* newSXTransfer(IOLayer*); 11 FileTransferLayer* newSXTransfer(IOLayer*);
10 12
11 IOLayer* newSerialLayer(const Profile&); 13 IOLayer* newSerialLayer(const Profile&);
12 IOLayer* newBTLayer(const Profile& ); 14 IOLayer* newBTLayer(const Profile& );
13 IOLayer* newIrDaLayer(const Profile& ); 15 IOLayer* newIrDaLayer(const Profile& );
14 16
15 ProfileDialogWidget* newSerialWidget(const QString&, QWidget* ); 17 ProfileDialogWidget* newSerialWidget(const QString&, QWidget* );
16 ProfileDialogWidget* newIrDaWidget (const QString&, QWidget* ); 18 ProfileDialogWidget* newIrDaWidget (const QString&, QWidget* );
17 ProfileDialogWidget* newBTWidget (const QString&, QWidget* ); 19 ProfileDialogWidget* newBTWidget (const QString&, QWidget* );
18 20
19 ProfileDialogWidget* newTerminalWidget(const QString&, QWidget* ); 21 ProfileDialogWidget* newTerminalWidget(const QString&, QWidget* );
22
23 EmulationLayer* newVT102( Widget* );
20}; 24};
21 25
22class MetaFactory; 26class MetaFactory;
23struct Default { 27struct Default {
24public: 28public:
25 Default(MetaFactory* ); 29 Default(MetaFactory* );
26 ~Default(); 30 ~Default();
27}; 31};
28 32
29 33
30#endif 34#endif
diff --git a/noncore/apps/opie-console/emulation_layer.h b/noncore/apps/opie-console/emulation_layer.h
index 0f54331..5781acc 100644
--- a/noncore/apps/opie-console/emulation_layer.h
+++ b/noncore/apps/opie-console/emulation_layer.h
@@ -1,125 +1,125 @@
1/* -------------------------------------------------------------------------- */ 1/* -------------------------------------------------------------------------- */
2/* */ 2/* */
3/* [emulation.h] Fundamental Terminal Emulation */ 3/* [emulation.h] Fundamental Terminal Emulation */
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/* made to a layer between io_layer and widget */ 20/* made to a layer between io_layer and widget */
21 /* */ 21 /* */
22/* Copyright (C) 2002 by opie developers <opie@handhelds.org> */ 22/* Copyright (C) 2002 by opie developers <opie@handhelds.org> */
23 /* */ 23 /* */
24/* -------------------------------------------------------------------------- */ 24/* -------------------------------------------------------------------------- */
25 25
26#ifndef EMULATION_LAYER_H 26#ifndef EMULATION_LAYER_H
27#define EMULATION_LAYER_H 27#define EMULATION_LAYER_H
28 28
29#include "widget.h" 29#include "widget_layer.h"
30#include "screen.h" 30#include "screen.h"
31#include <qtimer.h> 31#include <qtimer.h>
32#include <stdio.h> 32#include <stdio.h>
33#include <qtextcodec.h> 33#include <qtextcodec.h>
34#include "keytrans.h" 34#include "keytrans.h"
35 35
36class EmulationLayer : public QObject 36class EmulationLayer : public QObject
37{ Q_OBJECT 37{ Q_OBJECT
38 38
39public: 39public:
40 40
41 EmulationLayer(Widget* gui); 41 EmulationLayer(Widget* gui);
42 ~EmulationLayer(); 42 ~EmulationLayer();
43 43
44public: 44public:
45 virtual void setHistory(bool on); 45 virtual void setHistory(bool on);
46 virtual bool history(); 46 virtual bool history();
47 47
48public slots: // signals incoming from Widget 48public slots: // signals incoming from Widget
49 49
50 virtual void onImageSizeChange(int lines, int columns); 50 virtual void onImageSizeChange(int lines, int columns);
51 virtual void onHistoryCursorChange(int cursor); 51 virtual void onHistoryCursorChange(int cursor);
52 virtual void onKeyPress(QKeyEvent*); 52 virtual void onKeyPress(QKeyEvent*);
53 53
54 virtual void clearSelection(); 54 virtual void clearSelection();
55 virtual void onSelectionBegin(const int x, const int y); 55 virtual void onSelectionBegin(const int x, const int y);
56 virtual void onSelectionExtend(const int x, const int y); 56 virtual void onSelectionExtend(const int x, const int y);
57 virtual void setSelection(const BOOL preserve_line_breaks); 57 virtual void setSelection(const BOOL preserve_line_breaks);
58 58
59public slots: // signals incoming from data source 59public slots: // signals incoming from data source
60 60
61 /** 61 /**
62 * to be called, when new data arrives 62 * to be called, when new data arrives
63 */ 63 */
64 void onRcvBlock(const QByteArray&); 64 void onRcvBlock(const QByteArray&);
65 65
66signals: 66signals:
67 67
68 /** 68 /**
69 * will send data, encoded to suit emulation 69 * will send data, encoded to suit emulation
70 */ 70 */
71 void sndBlock(const QByteArray&); 71 void sndBlock(const QByteArray&);
72 72
73 void ImageSizeChanged(int lines, int columns); 73 void ImageSizeChanged(int lines, int columns);
74 74
75 void changeColumns(int columns); 75 void changeColumns(int columns);
76 76
77 void changeTitle(int arg, const char* str); 77 void changeTitle(int arg, const char* str);
78 78
79 79
80public: 80public:
81 81
82 /** 82 /**
83 * process single char (decode) 83 * process single char (decode)
84 */ 84 */
85 virtual void onRcvChar(int); 85 virtual void onRcvChar(int);
86 86
87 virtual void setMode (int) = 0; 87 virtual void setMode (int) = 0;
88 virtual void resetMode(int) = 0; 88 virtual void resetMode(int) = 0;
89 89
90 /** 90 /**
91 * @deprecated use qbytearray instead 91 * @deprecated use qbytearray instead
92 */ 92 */
93 virtual void sendString(const char*) = 0; 93 virtual void sendString(const char*) = 0;
94 94
95 /** 95 /**
96 * sends a string to IOLayer 96 * sends a string to IOLayer
97 * encodes to suit emulation before 97 * encodes to suit emulation before
98 */ 98 */
99 virtual void sendString(const QByteArray&) = 0; 99 virtual void sendString(const QByteArray&) = 0;
100 100
101 virtual void setConnect(bool r); 101 virtual void setConnect(bool r);
102 void setColumns(int columns); 102 void setColumns(int columns);
103 103
104 void setKeytrans(int no); 104 void setKeytrans(int no);
105 void setKeytrans(const char * no); 105 void setKeytrans(const char * no);
106 106
107protected: 107protected:
108 108
109 Widget* gui; 109 Widget* gui;
110 Screen* scr; // referes to one `screen' 110 Screen* scr; // referes to one `screen'
111 Screen* screen[2]; // 0 = primary, 1 = alternate 111 Screen* screen[2]; // 0 = primary, 1 = alternate
112 void setScreen(int n); // set `scr' to `screen[n]' 112 void setScreen(int n); // set `scr' to `screen[n]'
113 113
114 bool connected; // communicate with widget 114 bool connected; // communicate with widget
115 115
116 void setCodec(int c); // codec number, 0 = locale, 1=utf8 116 void setCodec(int c); // codec number, 0 = locale, 1=utf8
117 117
118 QTextCodec* codec; 118 QTextCodec* codec;
119 QTextCodec* localeCodec; 119 QTextCodec* localeCodec;
120 QTextDecoder* decoder; 120 QTextDecoder* decoder;
121 121
122 KeyTrans* keytrans; 122 KeyTrans* keytrans;
123 123
124// refreshing related material. 124// refreshing related material.
125// this is localized in the class. 125// this is localized in the class.
diff --git a/noncore/apps/opie-console/keytrans.cpp b/noncore/apps/opie-console/keytrans.cpp
index d569ae0..5ea192e 100644
--- a/noncore/apps/opie-console/keytrans.cpp
+++ b/noncore/apps/opie-console/keytrans.cpp
@@ -534,173 +534,176 @@ void KeyTransSymbols::defKeySyms()
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 loadAll();
630 KeyTrans* res = numb2keymap->find(numb); 631 KeyTrans* res = numb2keymap->find(numb);
631 return res ? res : numb2keymap->find(0); 632 return res ? res : numb2keymap->find(0);
632} 633}
633 634
634KeyTrans* KeyTrans::find(const char* path) 635KeyTrans* KeyTrans::find(const char* path)
635{ 636{
637 loadAll();
636 KeyTrans* res = path2keymap->find(path); 638 KeyTrans* res = path2keymap->find(path);
637 return res ? res : numb2keymap->find(0); 639 return res ? res : numb2keymap->find(0);
638} 640}
639 641
640int KeyTrans::count() 642int KeyTrans::count()
641{ 643{
644 loadAll();
642 return numb2keymap->count(); 645 return numb2keymap->count();
643} 646}
644 647
645void KeyTrans::addKeyTrans() 648void KeyTrans::addKeyTrans()
646{ 649{
647 this->numb = keytab_serial ++; 650 this->numb = keytab_serial ++;
648 numb2keymap->insert(numb,this); 651 numb2keymap->insert(numb,this);
649 path2keymap->insert(path,this); 652 path2keymap->insert(path,this);
650} 653}
651 654
652void KeyTrans::loadAll() 655void KeyTrans::loadAll()
653{ 656{
654 if (!numb2keymap) 657 if (!numb2keymap)
655 numb2keymap = new QIntDict<KeyTrans>; 658 numb2keymap = new QIntDict<KeyTrans>;
656 if (!path2keymap) 659 if (!path2keymap)
657 path2keymap = new QDict<KeyTrans>; 660 path2keymap = new QDict<KeyTrans>;
658 if (!syms) 661 if (!syms)
659 syms = new KeyTransSymbols; 662 syms = new KeyTransSymbols;
660 663
661 defaultKeyTrans()->addKeyTrans(); 664 defaultKeyTrans()->addKeyTrans();
662 665
663 666
664 QString path = QPEApplication::qpeDir() + "etc/keytabs"; 667 QString path = QPEApplication::qpeDir() + "etc/keytabs";
665 QDir dir(path); 668 QDir dir(path);
666 QStringList lst = dir.entryList("*.keytab"); 669 QStringList lst = dir.entryList("*.keytab");
667 670
668 for(QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) { 671 for(QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) {
669 QFile file(path + "/" + *it); 672 QFile file(path + "/" + *it);
670 KeyTrans* sc = KeyTrans::fromDevice(*it, file); 673 KeyTrans* sc = KeyTrans::fromDevice(*it, file);
671 if (sc) { 674 if (sc) {
672 sc->addKeyTrans(); 675 sc->addKeyTrans();
673 } 676 }
674 } 677 }
675 678
676} 679}
677 680
678// Debugging material ----------------------------------------------------------- 681// Debugging material -----------------------------------------------------------
679/* 682/*
680void TestTokenizer(QBuffer &buf) 683void TestTokenizer(QBuffer &buf)
681{ 684{
682 // opening sequence 685 // opening sequence
683 686
684 buf.open(IO_ReadOnly); 687 buf.open(IO_ReadOnly);
685 cc = buf.getch(); 688 cc = buf.getch();
686 lineno = 1; 689 lineno = 1;
687 690
688 // Test tokenizer 691 // Test tokenizer
689 692
690 while (getSymbol(buf)) ReportToken(); 693 while (getSymbol(buf)) ReportToken();
691 694
692 buf.close(); 695 buf.close();
693} 696}
694 697
695void test() 698void test()
696{ 699{
697 // Opening sequence 700 // Opening sequence
698 701
699 QCString txt = 702 QCString txt =
700#include "default.keytab.h" 703#include "default.keytab.h"
701 ; 704 ;
702 QBuffer buf(txt); 705 QBuffer buf(txt);
703 if (0) TestTokenizer(buf); 706 if (0) TestTokenizer(buf);
704 if (1) { KeyTrans kt; kt.scanTable(buf); } 707 if (1) { KeyTrans kt; kt.scanTable(buf); }
705} 708}
706*/ 709*/
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp
index 3531478..aeb3742 100644
--- a/noncore/apps/opie-console/mainwindow.cpp
+++ b/noncore/apps/opie-console/mainwindow.cpp
@@ -1,180 +1,216 @@
1 1
2#include <qaction.h> 2#include <qaction.h>
3#include <qmenubar.h> 3#include <qmenubar.h>
4#include <qlabel.h> 4#include <qlabel.h>
5#include <qpopupmenu.h> 5#include <qpopupmenu.h>
6#include <qtoolbar.h> 6#include <qtoolbar.h>
7 7
8#include "profileeditordialog.h"
8#include "configdialog.h" 9#include "configdialog.h"
9#include "default.h" 10#include "default.h"
10#include "metafactory.h" 11#include "metafactory.h"
12#include "profile.h"
11#include "profilemanager.h" 13#include "profilemanager.h"
12#include "mainwindow.h" 14#include "mainwindow.h"
13#include "tabwidget.h" 15#include "tabwidget.h"
14 16
15MainWindow::MainWindow() { 17MainWindow::MainWindow() {
16 m_factory = new MetaFactory(); 18 m_factory = new MetaFactory();
17 Default def(m_factory); 19 Default def(m_factory);
18 m_sessions.setAutoDelete( TRUE ); 20 m_sessions.setAutoDelete( TRUE );
19 m_curSession = 0; 21 m_curSession = 0;
20 m_manager = new ProfileManager( m_factory ); 22 m_manager = new ProfileManager( m_factory );
21 m_manager->load(); 23 m_manager->load();
22 24
23 initUI(); 25 initUI();
24 populateProfiles(); 26 populateProfiles();
25} 27}
26void MainWindow::initUI() { 28void MainWindow::initUI() {
27 setToolBarsMovable( FALSE ); 29 setToolBarsMovable( FALSE );
28 30
29 m_tool = new QToolBar( this ); 31 m_tool = new QToolBar( this );
30 m_tool->setHorizontalStretchable( TRUE ); 32 m_tool->setHorizontalStretchable( TRUE );
31 33
32 m_bar = new QMenuBar( m_tool ); 34 m_bar = new QMenuBar( m_tool );
33 m_console = new QPopupMenu( this ); 35 m_console = new QPopupMenu( this );
34 m_sessionsPop= new QPopupMenu( this ); 36 m_sessionsPop= new QPopupMenu( this );
35 m_settings = new QPopupMenu( this ); 37 m_settings = new QPopupMenu( this );
36 38
37 /* 39 /*
38 * new Action for new sessions 40 * new Action for new sessions
39 */ 41 */
40 QAction* a = new QAction(); 42 QAction* a = new QAction();
41 a->setText( tr("New Connection") ); 43 a->setText( tr("New Connection") );
42 a->addTo( m_console ); 44 a->addTo( m_console );
43 connect(a, SIGNAL(activated() ), 45 connect(a, SIGNAL(activated() ),
44 this, SLOT(slotNew() ) ); 46 this, SLOT(slotNew() ) );
45 47
46 /* 48 /*
47 * connect action 49 * connect action
48 */ 50 */
49 m_connect = new QAction(); 51 m_connect = new QAction();
50 m_connect->setText( tr("Connect") ); 52 m_connect->setText( tr("Connect") );
51 m_connect->addTo( m_console ); 53 m_connect->addTo( m_console );
52 connect(m_connect, SIGNAL(activated() ), 54 connect(m_connect, SIGNAL(activated() ),
53 this, SLOT(slotConnect() ) ); 55 this, SLOT(slotConnect() ) );
54 56
55 /* 57 /*
56 * disconnect action 58 * disconnect action
57 */ 59 */
58 m_disconnect = new QAction(); 60 m_disconnect = new QAction();
59 m_disconnect->setText( tr("Disconnect") ); 61 m_disconnect->setText( tr("Disconnect") );
60 m_disconnect->addTo( m_console ); 62 m_disconnect->addTo( m_console );
61 connect(m_disconnect, SIGNAL(activated() ), 63 connect(m_disconnect, SIGNAL(activated() ),
62 this, SLOT(slotDisconnect() ) ); 64 this, SLOT(slotDisconnect() ) );
63 65
64 /* 66 /*
65 * terminate action 67 * terminate action
66 */ 68 */
67 m_terminate = new QAction(); 69 m_terminate = new QAction();
68 m_terminate->setText( tr("Terminate") ); 70 m_terminate->setText( tr("Terminate") );
69 m_terminate->addTo( m_console ); 71 m_terminate->addTo( m_console );
70 connect(m_disconnect, SIGNAL(activated() ), 72 connect(m_disconnect, SIGNAL(activated() ),
71 this, SLOT(slotTerminate() ) ); 73 this, SLOT(slotTerminate() ) );
72 74
73 a = new QAction(); 75 a = new QAction();
74 a->setText( tr("Close Window") ); 76 a->setText( tr("Close Window") );
75 a->addTo( m_console ); 77 a->addTo( m_console );
76 connect(a, SIGNAL(activated() ), 78 connect(a, SIGNAL(activated() ),
77 this, SLOT(slotClose() ) ); 79 this, SLOT(slotClose() ) );
78 80
79 /* 81 /*
80 * the settings action 82 * the settings action
81 */ 83 */
82 m_setProfiles = new QAction(); 84 m_setProfiles = new QAction();
83 m_setProfiles->setText( tr("Configure Profiles") ); 85 m_setProfiles->setText( tr("Configure Profiles") );
84 m_setProfiles->addTo( m_settings ); 86 m_setProfiles->addTo( m_settings );
85 connect( m_setProfiles, SIGNAL(activated() ), 87 connect( m_setProfiles, SIGNAL(activated() ),
86 this, SLOT(slotConfigure() ) ); 88 this, SLOT(slotConfigure() ) );
87 89
88 /* insert the submenu */ 90 /* insert the submenu */
89 m_console->insertItem(tr("New from Profile"), m_sessionsPop, 91 m_console->insertItem(tr("New from Profile"), m_sessionsPop,
90 -1, 0); 92 -1, 0);
91 93
92 /* insert the connection menu */ 94 /* insert the connection menu */
93 m_bar->insertItem( tr("Connection"), m_console ); 95 m_bar->insertItem( tr("Connection"), m_console );
94 96
95 /* the settings menu */ 97 /* the settings menu */
96 m_bar->insertItem( tr("Settings"), m_settings ); 98 m_bar->insertItem( tr("Settings"), m_settings );
97 99
98 /* 100 /*
99 * connect to the menu activation 101 * connect to the menu activation
100 */ 102 */
101 connect( m_sessionsPop, SIGNAL(activated( int ) ), 103 connect( m_sessionsPop, SIGNAL(activated( int ) ),
102 this, SLOT(slotProfile( int ) ) ); 104 this, SLOT(slotProfile( int ) ) );
103 105
104 m_consoleWindow = new TabWidget( this, "blah"); 106 m_consoleWindow = new TabWidget( this, "blah");
105 setCentralWidget( m_consoleWindow ); 107 setCentralWidget( m_consoleWindow );
106 108
107} 109}
108 110
109ProfileManager* MainWindow::manager() { 111ProfileManager* MainWindow::manager() {
110 return m_manager; 112 return m_manager;
111} 113}
112 114TabWidget* MainWindow::tabWidget() {
115 return m_consoleWindow;
116}
113void MainWindow::populateProfiles() { 117void MainWindow::populateProfiles() {
114 m_sessionsPop->clear(); 118 m_sessionsPop->clear();
115 Profile::ValueList list = manager()->all(); 119 Profile::ValueList list = manager()->all();
116 for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) { 120 for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) {
117 m_sessionsPop->insertItem( (*it).name() ); 121 m_sessionsPop->insertItem( (*it).name() );
118 } 122 }
119 123
120} 124}
121MainWindow::~MainWindow() { 125MainWindow::~MainWindow() {
122 delete m_factory; 126 delete m_factory;
123 manager()->save(); 127 manager()->save();
124} 128}
125 129
126MetaFactory* MainWindow::factory() { 130MetaFactory* MainWindow::factory() {
127 return m_factory; 131 return m_factory;
128} 132}
129 133
130Session* MainWindow::currentSession() { 134Session* MainWindow::currentSession() {
131 return m_curSession; 135 return m_curSession;
132} 136}
133 137
134QList<Session> MainWindow::sessions() { 138QList<Session> MainWindow::sessions() {
135 return m_sessions; 139 return m_sessions;
136} 140}
137 141
138void MainWindow::slotNew() { 142void MainWindow::slotNew() {
139 qWarning("New Connection"); 143 qWarning("New Connection");
144 ProfileEditorDialog dlg(factory() );
145 int ret = dlg.exec();
146
147 if ( ret == QDialog::Accepted ) {
148 create( dlg.profile() );
149 }
140} 150}
141 151
142void MainWindow::slotConnect() { 152void MainWindow::slotConnect() {
143 if ( currentSession() ) 153 if ( currentSession() )
144 currentSession()->layer()->open(); 154 currentSession()->layer()->open();
145} 155}
146 156
147void MainWindow::slotDisconnect() { 157void MainWindow::slotDisconnect() {
148 if ( currentSession() ) 158 if ( currentSession() )
149 currentSession()->layer()->close(); 159 currentSession()->layer()->close();
150} 160}
151 161
152void MainWindow::slotTerminate() { 162void MainWindow::slotTerminate() {
153 if ( currentSession() ) 163 if ( currentSession() )
154 currentSession()->layer()->close(); 164 currentSession()->layer()->close();
155 delete m_curSession; 165
156 m_curSession = 0l; 166 slotClose();
157 /* FIXME move to the next session */ 167 /* FIXME move to the next session */
158} 168}
159 169
160void MainWindow::slotConfigure() { 170void MainWindow::slotConfigure() {
161 qWarning("configure"); 171 qWarning("configure");
162 ConfigDialog conf( manager()->all(), factory() ); 172 ConfigDialog conf( manager()->all(), factory() );
163 conf.showMaximized(); 173 conf.showMaximized();
164 174
165 int ret = conf.exec(); 175 int ret = conf.exec();
166 176
167 if ( QDialog::Accepted == ret ) { 177 if ( QDialog::Accepted == ret ) {
168 qWarning("conf %d", conf.list().count() ); 178 qWarning("conf %d", conf.list().count() );
169 manager()->setProfiles( conf.list() ); 179 manager()->setProfiles( conf.list() );
170 populateProfiles(); 180 populateProfiles();
171 } 181 }
172} 182}
173 183/*
184 * we will remove
185 * this window from the tabwidget
186 * remove it from the list
187 * delete it
188 * and set the currentSession()
189 */
174void MainWindow::slotClose() { 190void MainWindow::slotClose() {
175} 191 if (!currentSession() )
192 return;
176 193
177void MainWindow::slotProfile( int ) { 194 tabWidget()->remove( currentSession() );
195 tabWidget()->setCurrent( m_sessions.first() );
196 m_sessions.remove( m_curSession );
197 delete m_curSession;
198 m_curSession = m_sessions.first();
199}
178 200
201/*
202 * We will get the name
203 * Then the profile
204 * and then we will make a profile
205 */
206void MainWindow::slotProfile( int id) {
207 Profile prof = manager()->profile( m_sessionsPop->text( id) );
208 create( prof );
209}
210void MainWindow::create( const Profile& prof ) {
211 Session *ses = manager()->fromProfile( prof, tabWidget() );
179 212
213 m_sessions.append( ses );
214 tabWidget()->add( ses );
215 m_curSession = ses;
180} 216}
diff --git a/noncore/apps/opie-console/mainwindow.h b/noncore/apps/opie-console/mainwindow.h
index 36eb3a7..7ef9c26 100644
--- a/noncore/apps/opie-console/mainwindow.h
+++ b/noncore/apps/opie-console/mainwindow.h
@@ -1,91 +1,93 @@
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 QMenuBar; 15class QMenuBar;
16class QAction; 16class QAction;
17class MetaFactory; 17class MetaFactory;
18class TabWidget; 18class TabWidget;
19class ProfileManager; 19class ProfileManager;
20 20class Profile;
21class MainWindow : public QMainWindow { 21class MainWindow : public QMainWindow {
22 Q_OBJECT 22 Q_OBJECT
23public: 23public:
24 MainWindow(); 24 MainWindow();
25 ~MainWindow(); 25 ~MainWindow();
26 26
27 /** 27 /**
28 * our factory to generate IOLayer and so on 28 * our factory to generate IOLayer and so on
29 * 29 *
30 */ 30 */
31 MetaFactory* factory(); 31 MetaFactory* factory();
32 32
33 /** 33 /**
34 * A session contains a QWidget*, 34 * A session contains a QWidget*,
35 * an IOLayer* and some infos for us 35 * an IOLayer* and some infos for us
36 */ 36 */
37 Session* currentSession(); 37 Session* currentSession();
38 38
39 /** 39 /**
40 * the session list 40 * the session list
41 */ 41 */
42 QList<Session> sessions(); 42 QList<Session> sessions();
43 43
44 /** 44 /**
45 * 45 *
46 */ 46 */
47 ProfileManager* manager(); 47 ProfileManager* manager();
48 TabWidget* tabWidget();
48 49
49private slots: 50private slots:
50 void slotNew(); 51 void slotNew();
51 void slotConnect(); 52 void slotConnect();
52 void slotDisconnect(); 53 void slotDisconnect();
53 void slotTerminate(); 54 void slotTerminate();
54 void slotConfigure(); 55 void slotConfigure();
55 void slotClose(); 56 void slotClose();
56 void slotProfile(int); 57 void slotProfile(int);
57 58
58private: 59private:
59 void initUI(); 60 void initUI();
60 void populateProfiles(); 61 void populateProfiles();
62 void create( const Profile& );
61 /** 63 /**
62 * the current session 64 * the current session
63 */ 65 */
64 Session* m_curSession; 66 Session* m_curSession;
65 67
66 /** 68 /**
67 * the session list 69 * the session list
68 */ 70 */
69 QList<Session> m_sessions; 71 QList<Session> m_sessions;
70 72
71 /** 73 /**
72 * the metafactory 74 * the metafactory
73 */ 75 */
74 MetaFactory* m_factory; 76 MetaFactory* m_factory;
75 ProfileManager* m_manager; 77 ProfileManager* m_manager;
76 78
77 TabWidget* m_consoleWindow; 79 TabWidget* m_consoleWindow;
78 QToolBar* m_tool; 80 QToolBar* m_tool;
79 QMenuBar* m_bar; 81 QMenuBar* m_bar;
80 QPopupMenu* m_console; 82 QPopupMenu* m_console;
81 QPopupMenu* m_settings; 83 QPopupMenu* m_settings;
82 QPopupMenu* m_sessionsPop; 84 QPopupMenu* m_sessionsPop;
83 QAction* m_connect; 85 QAction* m_connect;
84 QAction* m_disconnect; 86 QAction* m_disconnect;
85 QAction* m_terminate; 87 QAction* m_terminate;
86 QAction* m_setProfiles; 88 QAction* m_setProfiles;
87 89
88}; 90};
89 91
90 92
91#endif 93#endif
diff --git a/noncore/apps/opie-console/metafactory.cpp b/noncore/apps/opie-console/metafactory.cpp
index 4501ec2..02a9f9b 100644
--- a/noncore/apps/opie-console/metafactory.cpp
+++ b/noncore/apps/opie-console/metafactory.cpp
@@ -1,114 +1,139 @@
1#include <qpe/config.h> 1#include <qpe/config.h>
2#include "metafactory.h" 2#include "metafactory.h"
3 3
4MetaFactory::MetaFactory() { 4MetaFactory::MetaFactory() {
5} 5}
6MetaFactory::~MetaFactory() { 6MetaFactory::~MetaFactory() {
7 7
8} 8}
9void MetaFactory::addConnectionWidgetFactory( const QCString& name, 9void MetaFactory::addConnectionWidgetFactory( const QCString& name,
10 const QString& str, 10 const QString& str,
11 configWidget wid) { 11 configWidget wid) {
12 m_strings.insert( str, name ); 12 m_strings.insert( str, name );
13 m_conFact.insert( str, wid ); 13 m_conFact.insert( str, wid );
14} 14}
15void MetaFactory::addTerminalWidgetFactory( const QCString& name, 15void MetaFactory::addTerminalWidgetFactory( const QCString& name,
16 const QString& str, 16 const QString& str,
17 configWidget wid ) { 17 configWidget wid ) {
18 m_strings.insert( str, name ); 18 m_strings.insert( str, name );
19 m_termFact.insert( str, wid ); 19 m_termFact.insert( str, wid );
20} 20}
21void MetaFactory::addIOLayerFactory( const QCString& name, 21void MetaFactory::addIOLayerFactory( const QCString& name,
22 const QString& str, 22 const QString& str,
23 iolayer lay) { 23 iolayer lay) {
24 m_strings.insert( str, name ); 24 m_strings.insert( str, name );
25 m_layerFact.insert( str, lay ); 25 m_layerFact.insert( str, lay );
26} 26}
27void MetaFactory::addFileTransferLayer( const QCString& name, 27void MetaFactory::addFileTransferLayer( const QCString& name,
28 const QString& str, 28 const QString& str,
29 filelayer lay) { 29 filelayer lay) {
30 m_strings.insert(str, name ); 30 m_strings.insert(str, name );
31 m_fileFact.insert( str, lay ); 31 m_fileFact.insert( str, lay );
32} 32}
33void MetaFactory::addEmulationLayer( const QCString& name,
34 const QString& str,
35 emulationLayer em) {
36 m_strings.insert(str, name );
37 m_emu.insert( str, em );
38}
33QStringList MetaFactory::ioLayers()const { 39QStringList MetaFactory::ioLayers()const {
34 QStringList list; 40 QStringList list;
35 QMap<QString, iolayer>::ConstIterator it; 41 QMap<QString, iolayer>::ConstIterator it;
36 for (it = m_layerFact.begin(); it != m_layerFact.end(); ++it ) { 42 for (it = m_layerFact.begin(); it != m_layerFact.end(); ++it ) {
37 list << it.key(); 43 list << it.key();
38 } 44 }
39 return list; 45 return list;
40} 46}
41QStringList MetaFactory::connectionWidgets()const { 47QStringList MetaFactory::connectionWidgets()const {
42 QStringList list; 48 QStringList list;
43 QMap<QString, configWidget>::ConstIterator it; 49 QMap<QString, configWidget>::ConstIterator it;
44 for ( it = m_conFact.begin(); it != m_conFact.end(); ++it ) { 50 for ( it = m_conFact.begin(); it != m_conFact.end(); ++it ) {
45 list << it.key(); 51 list << it.key();
46 } 52 }
47 return list; 53 return list;
48} 54}
49QStringList MetaFactory::terminalWidgets()const { 55QStringList MetaFactory::terminalWidgets()const {
50 QStringList list; 56 QStringList list;
51 QMap<QString, configWidget>::ConstIterator it; 57 QMap<QString, configWidget>::ConstIterator it;
52 for ( it = m_termFact.begin(); it != m_termFact.end(); ++it ) { 58 for ( it = m_termFact.begin(); it != m_termFact.end(); ++it ) {
53 list << it.key(); 59 list << it.key();
54 } 60 }
55 return list; 61 return list;
56} 62}
57QStringList MetaFactory::fileTransferLayers()const { 63QStringList MetaFactory::fileTransferLayers()const {
58 QStringList list; 64 QStringList list;
59 QMap<QString, filelayer>::ConstIterator it; 65 QMap<QString, filelayer>::ConstIterator it;
60 for ( it = m_fileFact.begin(); it != m_fileFact.end(); ++it ) { 66 for ( it = m_fileFact.begin(); it != m_fileFact.end(); ++it ) {
61 list << it.key(); 67 list << it.key();
62 } 68 }
63 return list; 69 return list;
64} 70}
71QStringList MetaFactory::emulationLayers()const {
72 QStringList list;
73 QMap<QString, emulationLayer>::ConstIterator it;
74 for ( it = m_emu.begin(); it != m_emu.end(); ++it ) {
75 list << it.key();
76 }
77 return list;
78}
65 79
66IOLayer* MetaFactory::newIOLayer( const QString& str,const Profile& prof ) { 80IOLayer* MetaFactory::newIOLayer( const QString& str,const Profile& prof ) {
67 IOLayer* lay = 0l; 81 IOLayer* lay = 0l;
68 82
69 QMap<QString, iolayer>::Iterator it; 83 QMap<QString, iolayer>::Iterator it;
70 it = m_layerFact.find( str ); 84 it = m_layerFact.find( str );
71 if ( it != m_layerFact.end() ) { 85 if ( it != m_layerFact.end() ) {
72 lay = (*(it.data()))(prof); 86 lay = (*(it.data()))(prof);
73 /* 87 /*
74 iolayer laye = it.data(); 88 iolayer laye = it.data();
75 lay = (*laye )(conf);*/ 89 lay = (*laye )(conf);*/
76 } 90 }
77 91
78 return lay; 92 return lay;
79} 93}
80 94
81ProfileDialogWidget *MetaFactory::newConnectionPlugin ( const QString& str, QWidget *parent) { 95ProfileDialogWidget *MetaFactory::newConnectionPlugin ( const QString& str, QWidget *parent) {
82 ProfileDialogWidget* wid = 0l; 96 ProfileDialogWidget* wid = 0l;
83 97
84 QMap<QString, configWidget>::Iterator it; 98 QMap<QString, configWidget>::Iterator it;
85 it = m_conFact.find( str ); 99 it = m_conFact.find( str );
86 if ( it != m_conFact.end() ) { 100 if ( it != m_conFact.end() ) {
87 wid = (*(it.data() ) )(str,parent); 101 wid = (*(it.data() ) )(str,parent);
88 } 102 }
89 return wid; 103 return wid;
90} 104}
91ProfileDialogWidget *MetaFactory::newTerminalPlugin( const QString& str, QWidget *parent) { 105ProfileDialogWidget *MetaFactory::newTerminalPlugin( const QString& str, QWidget *parent) {
92 if (str.isEmpty() ) 106 if (str.isEmpty() )
93 return 0l; 107 return 0l;
94 ProfileDialogWidget* wid = 0l; 108 ProfileDialogWidget* wid = 0l;
95 qWarning("new terminalPlugin %s %l", str.latin1(), parent ); 109 qWarning("new terminalPlugin %s %l", str.latin1(), parent );
96 110
97 QMap<QString, configWidget>::Iterator it; 111 QMap<QString, configWidget>::Iterator it;
98 it = m_termFact.find( str ); 112 it = m_termFact.find( str );
99 if ( it != m_termFact.end() ) { 113 if ( it != m_termFact.end() ) {
100 wid = (*(it.data() ) )(str,parent); 114 wid = (*(it.data() ) )(str,parent);
101 } 115 }
102 return wid; 116 return wid;
103} 117}
118EmulationLayer* MetaFactory::newEmulationLayer( const QString& str, Widget* wid) {
119 EmulationLayer* lay = 0l;
120
121 QMap<QString, emulationLayer>::Iterator it;
122 it = m_emu.find( str );
123 if ( it != m_emu.end() ) {
124 lay = (*(it.data() ) )(wid);
125 }
126
127 return lay;
128}
104QCString MetaFactory::internal( const QString& str )const { 129QCString MetaFactory::internal( const QString& str )const {
105 return m_strings[str]; 130 return m_strings[str];
106} 131}
107QString MetaFactory::external( const QCString& str )const { 132QString MetaFactory::external( const QCString& str )const {
108 QMap<QString, QCString>::ConstIterator it; 133 QMap<QString, QCString>::ConstIterator it;
109 for ( it = m_strings.begin(); it != m_strings.end(); ++it ) { 134 for ( it = m_strings.begin(); it != m_strings.end(); ++it ) {
110 if ( it.data() == str ) 135 if ( it.data() == str )
111 return it.key(); 136 return it.key();
112 } 137 }
113 return QString::null; 138 return QString::null;
114} 139}
diff --git a/noncore/apps/opie-console/metafactory.h b/noncore/apps/opie-console/metafactory.h
index 3f7ddce..71c35a2 100644
--- a/noncore/apps/opie-console/metafactory.h
+++ b/noncore/apps/opie-console/metafactory.h
@@ -1,85 +1,106 @@
1#ifndef OPIE_META_FACTORY_H 1#ifndef OPIE_META_FACTORY_H
2#define OPIE_META_FACTORY_H 2#define OPIE_META_FACTORY_H
3 3
4/** 4/**
5 * The MetaFactory is used to keep track of all IOLayers, FileTransferLayers and ConfigWidgets 5 * The MetaFactory is used to keep track of all IOLayers, FileTransferLayers and ConfigWidgets
6 * and to instantiate these implementations on demand 6 * and to instantiate these implementations on demand
7 */ 7 */
8 8
9#include <qwidget.h> 9#include <qwidget.h>
10#include <qmap.h> 10#include <qmap.h>
11 11
12#include <qpe/config.h> 12#include <qpe/config.h>
13 13
14#include "io_layer.h" 14#include "io_layer.h"
15#include "file_layer.h" 15#include "file_layer.h"
16#include "profile.h" 16#include "profile.h"
17#include "profiledialogwidget.h" 17#include "profiledialogwidget.h"
18#include "emulation_layer.h"
18 19
20class Widget;
19class MetaFactory { 21class MetaFactory {
20public: 22public:
21 typedef ProfileDialogWidget* (*configWidget)(const QString&, QWidget* parent); 23 typedef ProfileDialogWidget* (*configWidget)(const QString&, QWidget* parent);
22 typedef IOLayer* (*iolayer)(const Profile& ); 24 typedef IOLayer* (*iolayer)(const Profile& );
23 typedef FileTransferLayer* (*filelayer)(IOLayer*); 25 typedef FileTransferLayer* (*filelayer)(IOLayer*);
26 typedef EmulationLayer* (*emulationLayer)(Widget* );
24 27
25 MetaFactory(); 28 MetaFactory();
26 ~MetaFactory(); 29 ~MetaFactory();
27 30
28 /** 31 /**
29 * add a ProfileDialogWidget to the factory 32 * add a ProfileDialogWidget to the factory
30 * name is the name shown to the user 33 * name is the name shown to the user
31 */ 34 */
32 void addConnectionWidgetFactory( const QCString& internalName, 35 void addConnectionWidgetFactory( const QCString& internalName,
33 const QString& uiString, 36 const QString& uiString,
34 configWidget ); 37 configWidget );
35 void addTerminalWidgetFactory ( const QCString& internalName, 38 void addTerminalWidgetFactory ( const QCString& internalName,
36 const QString& name, 39 const QString& name,
37 configWidget ); 40 configWidget );
38 41
39 /** 42 /**
40 * adds an IOLayer factory 43 * adds an IOLayer factory
41 */ 44 */
42 void addIOLayerFactory( const QCString&, 45 void addIOLayerFactory( const QCString&,
43 const QString&, 46 const QString&,
44 iolayer ); 47 iolayer );
45 48
46 /** 49 /**
47 * adds a FileTransfer Layer 50 * adds a FileTransfer Layer
48 */ 51 */
49 void addFileTransferLayer( const QCString& name, 52 void addFileTransferLayer( const QCString& name,
50 const QString&, 53 const QString&,
51 filelayer ); 54 filelayer );
52 55
56 /**
57 * adds a Factory for Emulation to the Layer..
58 */
59 void addEmulationLayer ( const QCString& name,
60 const QString& uiString,
61 emulationLayer );
62
53 /* translated UI Strings */ 63 /* translated UI Strings */
54 QStringList ioLayers()const; 64 QStringList ioLayers()const;
55 QStringList connectionWidgets()const; 65 QStringList connectionWidgets()const;
66
67 /**
68 * Terminal Configuration widgets
69 */
56 QStringList terminalWidgets()const; 70 QStringList terminalWidgets()const;
57 QStringList fileTransferLayers()const; 71 QStringList fileTransferLayers()const;
72 QStringList emulationLayers()const;
73
74 /**
75 * the generation...
76 */
58 IOLayer* newIOLayer( const QString&,const Profile& ); 77 IOLayer* newIOLayer( const QString&,const Profile& );
59 ProfileDialogWidget *newConnectionPlugin ( const QString&, QWidget* ); 78 ProfileDialogWidget *newConnectionPlugin ( const QString&, QWidget* );
60 ProfileDialogWidget* newTerminalPlugin( const QString&, QWidget* ); 79 ProfileDialogWidget* newTerminalPlugin( const QString&, QWidget* );
80 EmulationLayer* newEmulationLayer(const QString&, Widget* );
61 81
62 /* 82 /*
63 * internal takes the maybe translated 83 * internal takes the maybe translated
64 * public QString and maps it to the internal 84 * public QString and maps it to the internal
65 * not translatable QCString 85 * not translatable QCString
66 */ 86 */
67 QCString internal( const QString& )const; 87 QCString internal( const QString& )const;
68 88
69 /* 89 /*
70 * external takes the internal name 90 * external takes the internal name
71 * it returns a translated name 91 * it returns a translated name
72 */ 92 */
73 QString external( const QCString& )const; 93 QString external( const QCString& )const;
74 94
75 95
76private: 96private:
77 QMap<QString, QCString> m_strings; 97 QMap<QString, QCString> m_strings;
78 QMap<QString, configWidget> m_conFact; 98 QMap<QString, configWidget> m_conFact;
79 QMap<QString, configWidget> m_termFact; 99 QMap<QString, configWidget> m_termFact;
80 QMap<QString, iolayer> m_layerFact; 100 QMap<QString, iolayer> m_layerFact;
81 QMap<QString, filelayer> m_fileFact; 101 QMap<QString, filelayer> m_fileFact;
102 QMap<QString, emulationLayer> m_emu;
82}; 103};
83 104
84 105
85#endif 106#endif
diff --git a/noncore/apps/opie-console/profilemanager.cpp b/noncore/apps/opie-console/profilemanager.cpp
index e66ebcc..dcf3cbd 100644
--- a/noncore/apps/opie-console/profilemanager.cpp
+++ b/noncore/apps/opie-console/profilemanager.cpp
@@ -1,100 +1,126 @@
1#include <stdio.h> 1#include <stdio.h>
2#include <stdlib.h> 2#include <stdlib.h>
3 3
4#include <qfile.h> 4#include <qfile.h>
5#include <qlayout.h>
6#include <qwidgetstack.h>
5 7
6#include <qpe/config.h> 8#include <qpe/config.h>
7 9
10#include "widget.h"
8#include "metafactory.h" 11#include "metafactory.h"
9#include "profileconfig.h" 12#include "profileconfig.h"
10#include "profilemanager.h" 13#include "profilemanager.h"
11 14
12ProfileManager::ProfileManager( MetaFactory* fact ) 15ProfileManager::ProfileManager( MetaFactory* fact )
13 : m_fact( fact ) 16 : m_fact( fact )
14{ 17{
15 18
16} 19}
17ProfileManager::~ProfileManager() { 20ProfileManager::~ProfileManager() {
18 21
19} 22}
20void ProfileManager::load() { 23void ProfileManager::load() {
21 m_list.clear(); 24 m_list.clear();
22 qWarning("load"); 25 qWarning("load");
23 ProfileConfig conf("opie-console-profiles"); 26 ProfileConfig conf("opie-console-profiles");
24 QStringList groups = conf.groups(); 27 QStringList groups = conf.groups();
25 QStringList::Iterator it; 28 QStringList::Iterator it;
26 29
27 /* 30 /*
28 * for each profile 31 * for each profile
29 */ 32 */
30 for ( it = groups.begin(); it != groups.end(); ++it ) { 33 for ( it = groups.begin(); it != groups.end(); ++it ) {
31 qWarning("group " + (*it) ); 34 qWarning("group " + (*it) );
32 conf.setGroup( (*it) ); 35 conf.setGroup( (*it) );
33 Profile prof; 36 Profile prof;
34 prof.setName( conf.readEntry("name") ); 37 prof.setName( conf.readEntry("name") );
35 prof.setIOLayer( conf.readEntry("iolayer").utf8() ); 38 prof.setIOLayer( conf.readEntry("iolayer").utf8() );
36 prof.setTerminalName( conf.readEntry("term").utf8() ); 39 prof.setTerminalName( conf.readEntry("term").utf8() );
37 qWarning(" %s %s", conf.readEntry("iolayer").latin1(), prof.ioLayerName().data() ); 40 qWarning(" %s %s", conf.readEntry("iolayer").latin1(), prof.ioLayerName().data() );
38 prof.setBackground( conf.readNumEntry("back") ); 41 prof.setBackground( conf.readNumEntry("back") );
39 prof.setForeground( conf.readNumEntry("fore") ); 42 prof.setForeground( conf.readNumEntry("fore") );
40 prof.setTerminal( conf.readNumEntry("terminal") ); 43 prof.setTerminal( conf.readNumEntry("terminal") );
41 prof.setConf( conf.items( (*it) ) ); 44 prof.setConf( conf.items( (*it) ) );
42 45
43 /* now add it */ 46 /* now add it */
44 m_list.append( prof ); 47 m_list.append( prof );
45 } 48 }
46 49
47} 50}
48void ProfileManager::clear() { 51void ProfileManager::clear() {
49 m_list.clear(); 52 m_list.clear();
50} 53}
51Profile::ValueList ProfileManager::all()const { 54Profile::ValueList ProfileManager::all()const {
52 return m_list; 55 return m_list;
53} 56}
54Session* ProfileManager::fromProfile( const Profile& prof) { 57/*
58 * Our goal is to create a Session
59 * We will load the the IOLayer and EmulationLayer
60 * from the factory
61 * we will generate a QWidgetStack
62 * add a dummy widget with layout
63 * add "Widget" to the layout
64 * add the dummy to the stack
65 * raise the dummy
66 * call session->connect(=
67 * this way we only need to reparent
68 * in TabWidget
69 */
70Session* ProfileManager::fromProfile( const Profile& prof, QWidget* parent) {
55 Session* session = new Session(); 71 Session* session = new Session();
56 session->setName( prof.name() ); 72 session->setName( prof.name() );
57 session->setIOLayer(m_fact->newIOLayer(prof.ioLayerName(), 73 /* translate the internal name to the external */
58 prof) ); 74 session->setIOLayer(m_fact->newIOLayer( m_fact->external(prof.ioLayerName()) ,
59 /* 75 prof) );
60 * FIXME 76
61 * load emulation 77 QWidgetStack *stack = new QWidgetStack(parent);
62 * load widget? 78 session->setWidgetStack( stack );
63 * set colors + fonts 79 QWidget* dummy = new QWidget(stack );
64 */ 80 QHBoxLayout* lay = new QHBoxLayout(dummy );
81 stack->addWidget( dummy, 0 );
82 stack->raiseWidget( 0 );
83 Widget* wid = new Widget(dummy );
84 lay->addWidget( wid );
85
86 session->setEmulationWidget( wid );
87 session->setEmulationLayer( m_fact->newEmulationLayer( m_fact->external( prof.terminalName() ),
88 wid ) );
89 session->connect();
90
65 return session; 91 return session;
66} 92}
67void ProfileManager::save( ) { 93void ProfileManager::save( ) {
68 QFile::remove( (QString(getenv("HOME") )+ "/Settings/opie-console-profiles.conf" ) ); 94 QFile::remove( (QString(getenv("HOME") )+ "/Settings/opie-console-profiles.conf" ) );
69 ProfileConfig conf("opie-console-profiles"); 95 ProfileConfig conf("opie-console-profiles");
70 Profile::ValueList::Iterator it; 96 Profile::ValueList::Iterator it;
71 for (it = m_list.begin(); it != m_list.end(); ++it ) { 97 for (it = m_list.begin(); it != m_list.end(); ++it ) {
72 conf.setGroup( (*it).name() ); 98 conf.setGroup( (*it).name() );
73 conf.writeEntry( "name", (*it).name() ); 99 conf.writeEntry( "name", (*it).name() );
74 conf.writeEntry( "iolayer", QString::fromUtf8( (*it).ioLayerName() ) ); 100 conf.writeEntry( "iolayer", QString::fromUtf8( (*it).ioLayerName() ) );
75 conf.writeEntry( "term", QString::fromUtf8( (*it).terminalName() ) ); 101 conf.writeEntry( "term", QString::fromUtf8( (*it).terminalName() ) );
76 conf.writeEntry( "back", (*it).background() ); 102 conf.writeEntry( "back", (*it).background() );
77 conf.writeEntry( "fore", (*it).foreground() ); 103 conf.writeEntry( "fore", (*it).foreground() );
78 conf.writeEntry( "terminal", (*it).terminal() ); 104 conf.writeEntry( "terminal", (*it).terminal() );
79 /* now the config stuff */ 105 /* now the config stuff */
80 QMap<QString, QString> map = (*it).conf(); 106 QMap<QString, QString> map = (*it).conf();
81 QMap<QString, QString>::Iterator it; 107 QMap<QString, QString>::Iterator it;
82 for ( it = map.begin(); it != map.end(); ++it ) { 108 for ( it = map.begin(); it != map.end(); ++it ) {
83 conf.writeEntry( it.key(), it.data() ); 109 conf.writeEntry( it.key(), it.data() );
84 } 110 }
85 } 111 }
86} 112}
87void ProfileManager::setProfiles( const Profile::ValueList& list ) { 113void ProfileManager::setProfiles( const Profile::ValueList& list ) {
88 m_list = list; 114 m_list = list;
89}; 115};
90Profile ProfileManager::profile( const QString& name )const { 116Profile ProfileManager::profile( const QString& name )const {
91 Profile prof; 117 Profile prof;
92 Profile::ValueList::ConstIterator it; 118 Profile::ValueList::ConstIterator it;
93 for ( it = m_list.begin(); it != m_list.end(); ++it ) { 119 for ( it = m_list.begin(); it != m_list.end(); ++it ) {
94 if ( name == (*it).name() ) { 120 if ( name == (*it).name() ) {
95 prof = (*it); 121 prof = (*it);
96 break; 122 break;
97 } 123 }
98 } 124 }
99 return prof; 125 return prof;
100} 126}
diff --git a/noncore/apps/opie-console/profilemanager.h b/noncore/apps/opie-console/profilemanager.h
index 1387247..33b7095 100644
--- a/noncore/apps/opie-console/profilemanager.h
+++ b/noncore/apps/opie-console/profilemanager.h
@@ -1,32 +1,32 @@
1#ifndef OPIE_PROFILE_MANAGER_H 1#ifndef OPIE_PROFILE_MANAGER_H
2#define OPIE_PROFILE_MANAGER_H 2#define OPIE_PROFILE_MANAGER_H
3 3
4#include <qlist.h> 4#include <qlist.h>
5 5
6#include "session.h" 6#include "session.h"
7#include "profile.h" 7#include "profile.h"
8 8
9class MetaFactory; 9class MetaFactory;
10class ConfigWidget; 10class ConfigWidget;
11class ProfileManager { 11class ProfileManager {
12public: 12public:
13 ProfileManager(MetaFactory*); 13 ProfileManager(MetaFactory*);
14 ~ProfileManager(); 14 ~ProfileManager();
15 15
16 void load(); 16 void load();
17 Profile::ValueList all()const; 17 Profile::ValueList all()const;
18 void clear(); 18 void clear();
19 /** 19 /**
20 * also replaces the item 20 * also replaces the item
21 */ 21 */
22 void add( const Profile& prof ); 22 void add( const Profile& prof );
23 void remove( const Profile& prof ); 23 void remove( const Profile& prof );
24 Profile profile(const QString& name )const; 24 Profile profile(const QString& name )const;
25 Session* fromProfile( const Profile& ); 25 Session* fromProfile( const Profile& , QWidget* parent = 0l);
26 void setProfiles( const Profile::ValueList& ); 26 void setProfiles( const Profile::ValueList& );
27 void save(); 27 void save();
28private: 28private:
29 MetaFactory* m_fact; 29 MetaFactory* m_fact;
30 Profile::ValueList m_list; 30 Profile::ValueList m_list;
31}; 31};
32#endif 32#endif
diff --git a/noncore/apps/opie-console/session.cpp b/noncore/apps/opie-console/session.cpp
index d32b340..42b0583 100644
--- a/noncore/apps/opie-console/session.cpp
+++ b/noncore/apps/opie-console/session.cpp
@@ -1,38 +1,81 @@
1 1
2 2
3#include "io_layer.h" 3#include "io_layer.h"
4#include "file_layer.h" 4#include "file_layer.h"
5#include "widget.h"
6#include "emulation_layer.h"
5#include "session.h" 7#include "session.h"
6 8
9
7Session::Session() { 10Session::Session() {
8 m_widget = 0l; 11 m_widget = 0l;
9 m_layer = 0l; 12 m_layer = 0l;
13 m_widLay = 0l;
14 m_emLay = 0l;
10} 15}
11Session::Session( const QString& na, QWidget* widget, IOLayer* lay) 16Session::Session( const QString& na, QWidgetStack* widget, IOLayer* lay)
12 : m_name( na ), m_widget( widget ), m_layer( lay ) 17 : m_name( na ), m_widget( widget ), m_layer( lay )
13{ 18{
19 m_widLay = 0l;
20 m_emLay = 0l;
14} 21}
15Session::~Session() { 22Session::~Session() {
16 delete m_layer; 23 delete m_layer;
24 delete m_emLay;
17 delete m_widget; 25 delete m_widget;
26 /* the widget layer should be deleted by the m_widget */
18} 27}
19QString Session::name()const { 28QString Session::name()const {
20 return m_name; 29 return m_name;
21} 30}
22QWidget* Session::widget() { 31QWidgetStack* Session::widgetStack() {
23 return m_widget; 32 return m_widget;
24} 33}
25IOLayer* Session::layer() { 34IOLayer* Session::layer() {
26 return m_layer; 35 return m_layer;
27} 36}
37EmulationLayer* Session::emulationLayer() {
38 return m_emLay;
39}
40Widget* Session::emulationWidget() {
41 return m_widLay;
42}
43void Session::connect() {
44 if ( !m_layer || !m_emLay )
45 return;
46
47 QObject::connect(m_layer, SIGNAL(received(const QByteArray&) ),
48 m_emLay, SLOT(onRcvBlock(const QByteArray&) ) );
49 QObject::connect(m_emLay, SIGNAL(sndBlock(const QByteArray&) ),
50 m_layer, SLOT(send(const QByteArray&) ) );
51}
52void Session::disconnect() {
53 if ( !m_layer || !m_emLay )
54 return;
55
56 QObject::disconnect(m_layer, SIGNAL(received(const QByteArray&) ),
57 m_emLay, SLOT(onRcvBlock(const QByteArray&) ) );
58 QObject::disconnect(m_emLay, SIGNAL(sndBlock(const QByteArray&) ),
59 m_layer, SLOT(send(const QByteArray&) ) );
60}
28void Session::setName( const QString& na){ 61void Session::setName( const QString& na){
29 m_name = na; 62 m_name = na;
30} 63}
31void Session::setWidget( QWidget* wid ) { 64void Session::setWidgetStack( QWidgetStack* wid ) {
32 delete m_widget; 65 delete m_widget;
66 /* the EmulationLayer was destroyed... */
67 delete m_emLay;
33 m_widget = wid; 68 m_widget = wid;
34} 69}
35void Session::setIOLayer( IOLayer* lay ) { 70void Session::setIOLayer( IOLayer* lay ) {
36 delete m_layer; 71 delete m_layer;
37 m_layer = lay; 72 m_layer = lay;
38} 73}
74void Session::setEmulationLayer( EmulationLayer* lay ) {
75 delete m_emLay;
76 m_emLay = lay;
77}
78void Session::setEmulationWidget( Widget* lay ) {
79 delete m_widLay;
80 m_widLay = lay;
81}
diff --git a/noncore/apps/opie-console/session.h b/noncore/apps/opie-console/session.h
index 44b5fc8..c3673fc 100644
--- a/noncore/apps/opie-console/session.h
+++ b/noncore/apps/opie-console/session.h
@@ -1,48 +1,74 @@
1#ifndef OPIE_SESSION_H 1#ifndef OPIE_SESSION_H
2#define OPIE_SESSION_H 2#define OPIE_SESSION_H
3 3
4#include <qwidget.h> 4#include <qwidgetstack.h>
5 5
6class IOLayer; 6class IOLayer;
7class EmulationLayer;
8class Widget;
7/** 9/**
8 * This is a Session. A session contains 10 * This is a Session. A session contains
9 * a QWidget pointer and a IOLayer 11 * a QWidget pointer and a IOLayer
10 * Imagine a session like a collection of what 12 * Imagine a session like a collection of what
11 * is needed to show your widget in a tab ;) 13 * is needed to show your widget in a tab ;)
12 */ 14 */
13class Session { 15class Session {
14public: 16public:
15 /** 17 /**
16 * c'tor with widget and layer 18 * c'tor with widget and layer
17 * ownership get's transfered 19 * ownership get's transfered
18 */ 20 */
19 Session(); 21 Session();
20 Session( const QString&, QWidget* widget, IOLayer* ); 22 Session( const QString&, QWidgetStack* widget, IOLayer* );
21 ~Session(); 23 ~Session();
22 24
23 /** 25 /**
24 * return the name of the session 26 * return the name of the session
25 */ 27 */
26 QString name()const; 28 QString name()const;
27 29
28 /** 30 /**
29 * return the widget 31 * return the widgetstack
32 * this is used to be semi modal
33 * for FileTransfer
34 *
35 * semi modal == SessionModal
30 */ 36 */
31 QWidget* widget(); 37 QWidgetStack* widgetStack();
32 38
33 /** 39 /**
34 * return the layer 40 * return the layer
35 */ 41 */
36 IOLayer* layer(); 42 IOLayer* layer();
37 void setWidget( QWidget* widget ); 43
44 EmulationLayer* emulationLayer();
45 Widget* emulationWidget();
46
47 /*
48 * connects the data flow from
49 * the IOLayer to the EmulationLayer
50 */
51 void connect();
52
53 /*
54 * disconnect the dataflow
55 * this will be done for ft
56 */
57 void disconnect();
58
59 void setWidgetStack( QWidgetStack* widget );
60 void setEmulationLayer( EmulationLayer* lay );
61 void setEmulationWidget( Widget* lay );
38 void setIOLayer( IOLayer* ); 62 void setIOLayer( IOLayer* );
39 void setName( const QString& ); 63 void setName( const QString& );
40 64
41private: 65private:
42 QString m_name; 66 QString m_name;
43 QWidget* m_widget; 67 QWidgetStack* m_widget;
44 IOLayer* m_layer; 68 IOLayer* m_layer;
69 EmulationLayer* m_emLay;
70 Widget* m_widLay;
45 71
46}; 72};
47 73
48#endif 74#endif
diff --git a/noncore/apps/opie-console/tabwidget.cpp b/noncore/apps/opie-console/tabwidget.cpp
index 783bf13..cfaef91 100644
--- a/noncore/apps/opie-console/tabwidget.cpp
+++ b/noncore/apps/opie-console/tabwidget.cpp
@@ -1,34 +1,43 @@
1 1
2#include "tabwidget.h" 2#include "tabwidget.h"
3 3
4TabWidget::TabWidget( QWidget* parent, const char* name ) 4TabWidget::TabWidget( QWidget* parent, const char* name )
5 : OTabWidget( parent, name ) { 5 : QTabWidget( parent, name ) {
6 connect(this, SIGNAL( currentChanged(QWidget*) ), 6 connect(this, SIGNAL( currentChanged(QWidget*) ),
7 this, SLOT( slotCurChanged(QWidget*) ) ); 7 this, SLOT( slotCurChanged(QWidget*) ) );
8} 8}
9 9
10TabWidget::~TabWidget() { 10TabWidget::~TabWidget() {
11} 11}
12 12
13void TabWidget::add( Session* ses ) { 13void TabWidget::add( Session* ses ) {
14 if ( !ses->widget() ) return; 14 if ( !ses->widgetStack() ) return;
15 addTab( ses->widget(), "console/konsole", ses->name() ); 15 qWarning("going to add it");
16 m_map.insert( ses->widget(), ses ); 16 //reparent( ses->widgetStack(), QPoint() );
17 //addTab( ses->widgetStack(), "console/konsole", ses->name() );
18 addTab( ses->widgetStack(), ses->name() );
19 m_map.insert( ses->widgetStack(), ses );
17} 20}
18 21
19void TabWidget::remove( Session* ses ) { 22void TabWidget::remove( Session* ses ) {
20 m_map.remove( ses->widget() ); 23 m_map.remove( ses->widgetStack() );
21 removePage( ses->widget() ); 24 removePage( ses->widgetStack() );
22} 25}
23 26
24void TabWidget::slotCurChanged( QWidget* wid ) { 27void TabWidget::slotCurChanged( QWidget* wid ) {
25 QMap<QWidget*, Session*>::Iterator it; 28 QMap<QWidget*, Session*>::Iterator it;
26 it = m_map.find( wid ); 29 it = m_map.find( wid );
27 if ( it == m_map.end() ) { 30 if ( it == m_map.end() ) {
28 return; 31 return;
29 } 32 }
30 33
31 emit activated( it.data() ); 34 emit activated( it.data() );
32} 35}
36void TabWidget::setCurrent( Session* ses ) {
37 if (!ses )
38 return;
39
40 showPage( ses->widgetStack() );
41}
33 42
34 43
diff --git a/noncore/apps/opie-console/tabwidget.h b/noncore/apps/opie-console/tabwidget.h
index a701488..42a00ec 100644
--- a/noncore/apps/opie-console/tabwidget.h
+++ b/noncore/apps/opie-console/tabwidget.h
@@ -1,28 +1,29 @@
1#ifndef OPIE_TAB_WIDGET_H 1#ifndef OPIE_TAB_WIDGET_H
2#define OPIE_TAB_WIDGET_H 2#define OPIE_TAB_WIDGET_H
3 3
4#include <qmap.h> 4#include <qmap.h>
5#include <opie/otabwidget.h> 5#include <qtabwidget.h>
6 6
7#include "session.h" 7#include "session.h"
8/** 8/**
9 * This is our central tab widget 9 * This is our central tab widget
10 * we can add sessions here 10 * we can add sessions here
11 */ 11 */
12class TabWidget : public OTabWidget{ 12class TabWidget : public QTabWidget{
13 Q_OBJECT 13 Q_OBJECT
14public: 14public:
15 TabWidget(QWidget *parent, const char* name ); 15 TabWidget(QWidget *parent, const char* name );
16 ~TabWidget(); 16 ~TabWidget();
17 void add( Session* ); 17 void add( Session* );
18 void remove( Session* ); 18 void remove( Session* );
19 void setCurrent( Session* );
19 20
20signals: 21signals:
21 void activated(Session* ses ); 22 void activated(Session* ses );
22private slots: 23private slots:
23 void slotCurChanged( QWidget* wid ); 24 void slotCurChanged( QWidget* wid );
24private: 25private:
25 QMap<QWidget*, Session*> m_map; 26 QMap<QWidget*, Session*> m_map;
26}; 27};
27 28
28#endif 29#endif
diff --git a/noncore/apps/opie-console/vt102emulation.cpp b/noncore/apps/opie-console/vt102emulation.cpp
index dc977f5..2220f4e 100644
--- a/noncore/apps/opie-console/vt102emulation.cpp
+++ b/noncore/apps/opie-console/vt102emulation.cpp
@@ -529,193 +529,193 @@ void Vt102Emulation::tau( int token, int p, int q )
529 case TY_CSI_PR('h', 6) : scr-> setMode (MODE_Origin ); break; //VT100 529 case TY_CSI_PR('h', 6) : scr-> setMode (MODE_Origin ); break; //VT100
530 case TY_CSI_PR('l', 6) : scr-> resetMode (MODE_Origin ); break; //VT100 530 case TY_CSI_PR('l', 6) : scr-> resetMode (MODE_Origin ); break; //VT100
531 case TY_CSI_PR('s', 6) : scr-> saveMode (MODE_Origin ); break; //FIXME 531 case TY_CSI_PR('s', 6) : scr-> saveMode (MODE_Origin ); break; //FIXME
532 case TY_CSI_PR('r', 6) : scr->restoreMode (MODE_Origin ); break; //FIXME 532 case TY_CSI_PR('r', 6) : scr->restoreMode (MODE_Origin ); break; //FIXME
533 533
534 case TY_CSI_PR('h', 7) : scr-> setMode (MODE_Wrap ); break; //VT100 534 case TY_CSI_PR('h', 7) : scr-> setMode (MODE_Wrap ); break; //VT100
535 case TY_CSI_PR('l', 7) : scr-> resetMode (MODE_Wrap ); break; //VT100 535 case TY_CSI_PR('l', 7) : scr-> resetMode (MODE_Wrap ); break; //VT100
536 case TY_CSI_PR('s', 7) : scr-> saveMode (MODE_Wrap ); break; //FIXME 536 case TY_CSI_PR('s', 7) : scr-> saveMode (MODE_Wrap ); break; //FIXME
537 case TY_CSI_PR('r', 7) : scr->restoreMode (MODE_Wrap ); break; //FIXME 537 case TY_CSI_PR('r', 7) : scr->restoreMode (MODE_Wrap ); break; //FIXME
538 538
539 case TY_CSI_PR('h', 8) : /* IGNORED: autorepeat on */ break; //VT100 539 case TY_CSI_PR('h', 8) : /* IGNORED: autorepeat on */ break; //VT100
540 case TY_CSI_PR('l', 8) : /* IGNORED: autorepeat off */ break; //VT100 540 case TY_CSI_PR('l', 8) : /* IGNORED: autorepeat off */ break; //VT100
541 541
542 case TY_CSI_PR('h', 9) : /* IGNORED: interlace */ break; //VT100 542 case TY_CSI_PR('h', 9) : /* IGNORED: interlace */ break; //VT100
543 case TY_CSI_PR('l', 9) : /* IGNORED: interlace */ break; //VT100 543 case TY_CSI_PR('l', 9) : /* IGNORED: interlace */ break; //VT100
544 544
545 case TY_CSI_PR('h', 25) : setMode (MODE_Cursor ); break; //VT100 545 case TY_CSI_PR('h', 25) : setMode (MODE_Cursor ); break; //VT100
546 case TY_CSI_PR('l', 25) : resetMode (MODE_Cursor ); break; //VT100 546 case TY_CSI_PR('l', 25) : resetMode (MODE_Cursor ); break; //VT100
547 547
548 case TY_CSI_PR('h', 41) : /* IGNORED: obsolete more(1) fix */ break; //XTERM 548 case TY_CSI_PR('h', 41) : /* IGNORED: obsolete more(1) fix */ break; //XTERM
549 case TY_CSI_PR('l', 41) : /* IGNORED: obsolete more(1) fix */ break; //XTERM 549 case TY_CSI_PR('l', 41) : /* IGNORED: obsolete more(1) fix */ break; //XTERM
550 case TY_CSI_PR('s', 41) : /* IGNORED: obsolete more(1) fix */ break; //XTERM 550 case TY_CSI_PR('s', 41) : /* IGNORED: obsolete more(1) fix */ break; //XTERM
551 case TY_CSI_PR('r', 41) : /* IGNORED: obsolete more(1) fix */ break; //XTERM 551 case TY_CSI_PR('r', 41) : /* IGNORED: obsolete more(1) fix */ break; //XTERM
552 552
553 case TY_CSI_PR('h', 47) : setMode (MODE_AppScreen); break; //VT100 553 case TY_CSI_PR('h', 47) : setMode (MODE_AppScreen); break; //VT100
554 case TY_CSI_PR('l', 47) : resetMode (MODE_AppScreen); break; //VT100 554 case TY_CSI_PR('l', 47) : resetMode (MODE_AppScreen); break; //VT100
555 555
556 case TY_CSI_PR('h', 1000) : setMode (MODE_Mouse1000); break; //XTERM 556 case TY_CSI_PR('h', 1000) : setMode (MODE_Mouse1000); break; //XTERM
557 case TY_CSI_PR('l', 1000) : resetMode (MODE_Mouse1000); break; //XTERM 557 case TY_CSI_PR('l', 1000) : resetMode (MODE_Mouse1000); break; //XTERM
558 case TY_CSI_PR('s', 1000) : saveMode (MODE_Mouse1000); break; //XTERM 558 case TY_CSI_PR('s', 1000) : saveMode (MODE_Mouse1000); break; //XTERM
559 case TY_CSI_PR('r', 1000) : restoreMode (MODE_Mouse1000); break; //XTERM 559 case TY_CSI_PR('r', 1000) : restoreMode (MODE_Mouse1000); break; //XTERM
560 560
561 case TY_CSI_PR('h', 1001) : /* IGNORED: hilite mouse tracking */ break; //XTERM 561 case TY_CSI_PR('h', 1001) : /* IGNORED: hilite mouse tracking */ break; //XTERM
562 case TY_CSI_PR('l', 1001) : /* IGNORED: hilite mouse tracking */ break; //XTERM 562 case TY_CSI_PR('l', 1001) : /* IGNORED: hilite mouse tracking */ break; //XTERM
563 case TY_CSI_PR('s', 1001) : /* IGNORED: hilite mouse tracking */ break; //XTERM 563 case TY_CSI_PR('s', 1001) : /* IGNORED: hilite mouse tracking */ break; //XTERM
564 case TY_CSI_PR('r', 1001) : /* IGNORED: hilite mouse tracking */ break; //XTERM 564 case TY_CSI_PR('r', 1001) : /* IGNORED: hilite mouse tracking */ break; //XTERM
565 565
566 case TY_CSI_PR('h', 1047) : setMode (MODE_AppScreen); break; //XTERM 566 case TY_CSI_PR('h', 1047) : setMode (MODE_AppScreen); break; //XTERM
567 case TY_CSI_PR('l', 1047) : resetMode (MODE_AppScreen); break; //XTERM 567 case TY_CSI_PR('l', 1047) : resetMode (MODE_AppScreen); break; //XTERM
568 568
569 //FIXME: Unitoken: save translations 569 //FIXME: Unitoken: save translations
570 case TY_CSI_PR('h', 1048) : saveCursor ( ); break; //XTERM 570 case TY_CSI_PR('h', 1048) : saveCursor ( ); break; //XTERM
571 case TY_CSI_PR('l', 1048) : restoreCursor ( ); break; //XTERM 571 case TY_CSI_PR('l', 1048) : restoreCursor ( ); break; //XTERM
572 572
573 //FIXME: every once new sequences like this pop up in xterm. 573 //FIXME: every once new sequences like this pop up in xterm.
574 // Here's a guess of what they could mean. 574 // Here's a guess of what they could mean.
575 case TY_CSI_PR('h', 1049) : setMode (MODE_AppScreen); break; //XTERM 575 case TY_CSI_PR('h', 1049) : setMode (MODE_AppScreen); break; //XTERM
576 case TY_CSI_PR('l', 1049) : resetMode (MODE_AppScreen); break; //XTERM 576 case TY_CSI_PR('l', 1049) : resetMode (MODE_AppScreen); break; //XTERM
577 577
578 //FIXME: when changing between vt52 and ansi mode evtl do some resetting. 578 //FIXME: when changing between vt52 and ansi mode evtl do some resetting.
579 case TY_VT52__('A' ) : scr->cursorUp ( 1); break; //VT52 579 case TY_VT52__('A' ) : scr->cursorUp ( 1); break; //VT52
580 case TY_VT52__('B' ) : scr->cursorDown ( 1); break; //VT52 580 case TY_VT52__('B' ) : scr->cursorDown ( 1); break; //VT52
581 case TY_VT52__('C' ) : scr->cursorRight ( 1); break; //VT52 581 case TY_VT52__('C' ) : scr->cursorRight ( 1); break; //VT52
582 case TY_VT52__('D' ) : scr->cursorLeft ( 1); break; //VT52 582 case TY_VT52__('D' ) : scr->cursorLeft ( 1); break; //VT52
583 583
584 case TY_VT52__('F' ) : setAndUseCharset (0, '0'); break; //VT52 584 case TY_VT52__('F' ) : setAndUseCharset (0, '0'); break; //VT52
585 case TY_VT52__('G' ) : setAndUseCharset (0, 'B'); break; //VT52 585 case TY_VT52__('G' ) : setAndUseCharset (0, 'B'); break; //VT52
586 586
587 case TY_VT52__('H' ) : scr->setCursorYX (1,1 ); break; //VT52 587 case TY_VT52__('H' ) : scr->setCursorYX (1,1 ); break; //VT52
588 case TY_VT52__('I' ) : scr->reverseIndex ( ); break; //VT52 588 case TY_VT52__('I' ) : scr->reverseIndex ( ); break; //VT52
589 case TY_VT52__('J' ) : scr->clearToEndOfScreen ( ); break; //VT52 589 case TY_VT52__('J' ) : scr->clearToEndOfScreen ( ); break; //VT52
590 case TY_VT52__('K' ) : scr->clearToEndOfLine ( ); break; //VT52 590 case TY_VT52__('K' ) : scr->clearToEndOfLine ( ); break; //VT52
591 case TY_VT52__('Y' ) : scr->setCursorYX (p-31,q-31 ); break; //VT52 591 case TY_VT52__('Y' ) : scr->setCursorYX (p-31,q-31 ); break; //VT52
592 case TY_VT52__('Z' ) : reportTerminalType ( ); break; //VT52 592 case TY_VT52__('Z' ) : reportTerminalType ( ); break; //VT52
593 case TY_VT52__('<' ) : setMode (MODE_Ansi ); break; //VT52 593 case TY_VT52__('<' ) : setMode (MODE_Ansi ); break; //VT52
594 case TY_VT52__('=' ) : setMode (MODE_AppKeyPad); break; //VT52 594 case TY_VT52__('=' ) : setMode (MODE_AppKeyPad); break; //VT52
595 case TY_VT52__('>' ) : resetMode (MODE_AppKeyPad); break; //VT52 595 case TY_VT52__('>' ) : resetMode (MODE_AppKeyPad); break; //VT52
596 596
597 default : ReportErrorToken(); break; 597 default : ReportErrorToken(); break;
598 }; 598 };
599} 599}
600 600
601/* ------------------------------------------------------------------------- */ 601/* ------------------------------------------------------------------------- */
602/* */ 602/* */
603/* Terminal to Host protocol */ 603/* Terminal to Host protocol */
604/* */ 604/* */
605/* ------------------------------------------------------------------------- */ 605/* ------------------------------------------------------------------------- */
606 606
607/* 607/*
608 Outgoing bytes originate from several sources: 608 Outgoing bytes originate from several sources:
609 609
610 - Replies to Enquieries. 610 - Replies to Enquieries.
611 - Mouse Events 611 - Mouse Events
612 - Keyboard Events 612 - Keyboard Events
613*/ 613*/
614 614
615/*! 615/*!
616*/ 616*/
617 617
618void Vt102Emulation::sendString(const char* s) 618void Vt102Emulation::sendString(const char* s)
619{ 619{
620 QByteArray tmp; 620 QByteArray tmp;
621 tmp.setRawData( s, strlen( s )); 621 tmp.setRawData( s, strlen( s ));
622 emit sndBlock( tmp); 622 emit sndBlock( tmp);
623} 623}
624 624
625void Vt102Emulation::sendString(const QByteArray s) 625void Vt102Emulation::sendString(const QByteArray& s)
626{ 626{
627 emit sndBlock( s ); 627 emit sndBlock( s );
628} 628}
629 629
630// Replies ----------------------------------------------------------------- -- 630// Replies ----------------------------------------------------------------- --
631 631
632// This section copes with replies send as response to an enquiery control code. 632// This section copes with replies send as response to an enquiery control code.
633 633
634/*! 634/*!
635*/ 635*/
636 636
637void Vt102Emulation::reportCursorPosition() 637void Vt102Emulation::reportCursorPosition()
638{ char tmp[20]; 638{ char tmp[20];
639 sprintf(tmp,"\033[%d;%dR",scr->getCursorY()+1,scr->getCursorX()+1); 639 sprintf(tmp,"\033[%d;%dR",scr->getCursorY()+1,scr->getCursorX()+1);
640 sendString(tmp); 640 sendString(tmp);
641} 641}
642 642
643/* 643/*
644 What follows here is rather obsolete and faked stuff. 644 What follows here is rather obsolete and faked stuff.
645 The correspondent enquieries are neverthenless issued. 645 The correspondent enquieries are neverthenless issued.
646*/ 646*/
647 647
648/*! 648/*!
649*/ 649*/
650 650
651void Vt102Emulation::reportTerminalType() 651void Vt102Emulation::reportTerminalType()
652{ 652{
653//FIXME: should change? 653//FIXME: should change?
654 if (getMode(MODE_Ansi)) 654 if (getMode(MODE_Ansi))
655// sendString("\033[?1;2c"); // I'm a VT100 with AP0 //FIXME: send only in response to ^[[0c 655// sendString("\033[?1;2c"); // I'm a VT100 with AP0 //FIXME: send only in response to ^[[0c
656 sendString("\033[>0;115;0c"); // I'm a VT220 //FIXME: send only in response to ^[[>c 656 sendString("\033[>0;115;0c"); // I'm a VT220 //FIXME: send only in response to ^[[>c
657 else 657 else
658 sendString("\033/Z"); // I'm a VT52 658 sendString("\033/Z"); // I'm a VT52
659} 659}
660 660
661void Vt102Emulation::reportTerminalParms(int p) 661void Vt102Emulation::reportTerminalParms(int p)
662// DECREPTPARM 662// DECREPTPARM
663{ char tmp[100]; 663{ char tmp[100];
664 sprintf(tmp,"\033[%d;1;1;112;112;1;0x",p); // not really true. 664 sprintf(tmp,"\033[%d;1;1;112;112;1;0x",p); // not really true.
665 sendString(tmp); 665 sendString(tmp);
666} 666}
667 667
668/*! 668/*!
669*/ 669*/
670 670
671void Vt102Emulation::reportStatus() 671void Vt102Emulation::reportStatus()
672{ 672{
673 sendString("\033[0n"); //VT100. Device status report. 0 = Ready. 673 sendString("\033[0n"); //VT100. Device status report. 0 = Ready.
674} 674}
675 675
676/*! 676/*!
677*/ 677*/
678 678
679#define ANSWER_BACK "" // This is really obsolete VT100 stuff. 679#define ANSWER_BACK "" // This is really obsolete VT100 stuff.
680 680
681void Vt102Emulation::reportAnswerBack() 681void Vt102Emulation::reportAnswerBack()
682{ 682{
683 sendString(ANSWER_BACK); 683 sendString(ANSWER_BACK);
684} 684}
685 685
686// Mouse Handling ---------------------------------------------------------- -- 686// Mouse Handling ---------------------------------------------------------- --
687 687
688/*! 688/*!
689 Mouse clicks are possibly reported to the client 689 Mouse clicks are possibly reported to the client
690 application if it has issued interest in them. 690 application if it has issued interest in them.
691 They are normally consumed by the widget for copy 691 They are normally consumed by the widget for copy
692 and paste, but may be propagated from the widget 692 and paste, but may be propagated from the widget
693 when gui->setMouseMarks is set via setMode(MODE_Mouse1000). 693 when gui->setMouseMarks is set via setMode(MODE_Mouse1000).
694 694
695 `x',`y' are 1-based. 695 `x',`y' are 1-based.
696 `ev' (event) indicates the button pressed (0-2) 696 `ev' (event) indicates the button pressed (0-2)
697 or a general mouse release (3). 697 or a general mouse release (3).
698*/ 698*/
699 699
700void Vt102Emulation::onMouse( int cb, int cx, int cy ) 700void Vt102Emulation::onMouse( int cb, int cx, int cy )
701{ char tmp[20]; 701{ char tmp[20];
702 if (!connected) return; 702 if (!connected) return;
703 sprintf(tmp,"\033[M%c%c%c",cb+040,cx+040,cy+040); 703 sprintf(tmp,"\033[M%c%c%c",cb+040,cx+040,cy+040);
704 sendString(tmp); 704 sendString(tmp);
705} 705}
706 706
707// Keyboard Handling ------------------------------------------------------- -- 707// Keyboard Handling ------------------------------------------------------- --
708 708
709#define encodeMode(M,B) BITS(B,getMode(M)) 709#define encodeMode(M,B) BITS(B,getMode(M))
710#define encodeStat(M,B) BITS(B,((ev->state() & (M)) == (M))) 710#define encodeStat(M,B) BITS(B,((ev->state() & (M)) == (M)))
711 711
712/* 712/*
713 Keyboard event handling has been simplified somewhat by pushing 713 Keyboard event handling has been simplified somewhat by pushing
714 the complications towards a configuration file [see KeyTrans class]. 714 the complications towards a configuration file [see KeyTrans class].
715*/ 715*/
716 716
717void Vt102Emulation::onKeyPress( QKeyEvent* ev ) 717void Vt102Emulation::onKeyPress( QKeyEvent* ev )
718{ 718{
719 if (!connected) return; // someone else gets the keys 719 if (!connected) return; // someone else gets the keys
720 720
721//printf("State/Key: 0x%04x 0x%04x (%d,%d)\n",ev->state(),ev->key(),ev->text().length(),ev->text().length()?ev->text().ascii()[0]:0); 721//printf("State/Key: 0x%04x 0x%04x (%d,%d)\n",ev->state(),ev->key(),ev->text().length(),ev->text().length()?ev->text().ascii()[0]:0);
diff --git a/noncore/apps/opie-console/vt102emulation.h b/noncore/apps/opie-console/vt102emulation.h
index 018835e..a3d0ae6 100644
--- a/noncore/apps/opie-console/vt102emulation.h
+++ b/noncore/apps/opie-console/vt102emulation.h
@@ -1,153 +1,153 @@
1/* -------------------------------------------------------------------------- */ 1/* -------------------------------------------------------------------------- */
2/* */ 2/* */
3/* [TEmuVt102.h] X Terminal Emulation */ 3/* [TEmuVt102.h] X Terminal Emulation */
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/* Ported embedded-konsole to opie-terminal */ 18/* Ported embedded-konsole to opie-terminal */
19 /* */ 19 /* */
20/* Copyright (C) 2002 by opie developers <opie@handhelds.org> */ 20/* Copyright (C) 2002 by opie developers <opie@handhelds.org> */
21 /* */ 21 /* */
22/* -------------------------------------------------------------------------- */ 22/* -------------------------------------------------------------------------- */
23 23
24#ifndef VT102EMU_H 24#ifndef VT102EMU_H
25#define VT102EMU_H 25#define VT102EMU_H
26 26
27#include "widget.h" 27#include "widget.h"
28#include "screen.h" 28#include "screen.h"
29#include "emulation_layer.h" 29#include "emulation_layer.h"
30#include <qtimer.h> 30#include <qtimer.h>
31#include <stdio.h> 31#include <stdio.h>
32 32
33// 33//
34 34
35#define MODE_AppScreen (MODES_SCREEN+0) 35#define MODE_AppScreen (MODES_SCREEN+0)
36#define MODE_AppCuKeys (MODES_SCREEN+1) 36#define MODE_AppCuKeys (MODES_SCREEN+1)
37#define MODE_AppKeyPad (MODES_SCREEN+2) 37#define MODE_AppKeyPad (MODES_SCREEN+2)
38#define MODE_Mouse1000 (MODES_SCREEN+3) 38#define MODE_Mouse1000 (MODES_SCREEN+3)
39#define MODE_Ansi (MODES_SCREEN+4) 39#define MODE_Ansi (MODES_SCREEN+4)
40#define MODE_total (MODES_SCREEN+5) 40#define MODE_total (MODES_SCREEN+5)
41 41
42struct DECpar 42struct DECpar
43{ 43{
44 BOOL mode[MODE_total]; 44 BOOL mode[MODE_total];
45}; 45};
46 46
47struct CharCodes 47struct CharCodes
48{ 48{
49 // coding info 49 // coding info
50 char charset[4]; // 50 char charset[4]; //
51 int cu_cs; // actual charset. 51 int cu_cs; // actual charset.
52 bool graphic; // Some VT100 tricks 52 bool graphic; // Some VT100 tricks
53 bool pound ; // Some VT100 tricks 53 bool pound ; // Some VT100 tricks
54 bool sa_graphic; // saved graphic 54 bool sa_graphic; // saved graphic
55 bool sa_pound; // saved pound 55 bool sa_pound; // saved pound
56}; 56};
57 57
58class Vt102Emulation: public EmulationLayer 58class Vt102Emulation: public EmulationLayer
59{ Q_OBJECT 59{ Q_OBJECT
60 60
61public: 61public:
62 62
63 Vt102Emulation(Widget* gui); 63 Vt102Emulation(Widget* gui);
64 ~Vt102Emulation(); 64 ~Vt102Emulation();
65 65
66public slots: // signals incoming from Widget 66public slots: // signals incoming from Widget
67 67
68 void onKeyPress(QKeyEvent*); 68 void onKeyPress(QKeyEvent*);
69 void onMouse(int cb, int cx, int cy); 69 void onMouse(int cb, int cx, int cy);
70 70
71signals: 71signals:
72 72
73 void changeTitle(int,const QString&); 73 void changeTitle(int,const QString&);
74 void prevSession(); 74 void prevSession();
75 void nextSession(); 75 void nextSession();
76 76
77public: 77public:
78 78
79 void reset(); 79 void reset();
80 80
81 /** 81 /**
82 * receive a char from IOLayer 82 * receive a char from IOLayer
83 */ 83 */
84 void onRcvChar(int cc); 84 void onRcvChar(int cc);
85 85
86 /** 86 /**
87 * sends a list of bytes to the IOLayer 87 * sends a list of bytes to the IOLayer
88 */ 88 */
89 void sendString(const QByteArray); 89 void sendString(const QByteArray&);
90 90
91 /** 91 /**
92 * @deprecated use QByteArray instead 92 * @deprecated use QByteArray instead
93 * see sendString() above 93 * see sendString() above
94 */ 94 */
95 void sendString(const char *); 95 void sendString(const char *);
96 96
97public: 97public:
98 98
99 BOOL getMode (int m); 99 BOOL getMode (int m);
100 100
101 void setMode (int m); 101 void setMode (int m);
102 void resetMode (int m); 102 void resetMode (int m);
103 void saveMode (int m); 103 void saveMode (int m);
104 void restoreMode(int m); 104 void restoreMode(int m);
105 void resetModes(); 105 void resetModes();
106 106
107 void setConnect(bool r); 107 void setConnect(bool r);
108 108
109private: 109private:
110 110
111 void resetToken(); 111 void resetToken();
112#define MAXPBUF 80 112#define MAXPBUF 80
113 void pushToToken(int cc); 113 void pushToToken(int cc);
114 int pbuf[MAXPBUF]; //FIXME: overflow? 114 int pbuf[MAXPBUF]; //FIXME: overflow?
115 int ppos; 115 int ppos;
116#define MAXARGS 15 116#define MAXARGS 15
117 void addDigit(int dig); 117 void addDigit(int dig);
118 void addArgument(); 118 void addArgument();
119 int argv[MAXARGS]; 119 int argv[MAXARGS];
120 int argc; 120 int argc;
121 void initTokenizer(); 121 void initTokenizer();
122 int tbl[256]; 122 int tbl[256];
123 123
124 void scan_buffer_report(); //FIXME: rename 124 void scan_buffer_report(); //FIXME: rename
125 void ReportErrorToken(); //FIXME: rename 125 void ReportErrorToken(); //FIXME: rename
126 126
127 void tau(int code, int p, int q); 127 void tau(int code, int p, int q);
128 void XtermHack(); 128 void XtermHack();
129 129
130 // 130 //
131 131
132 void reportTerminalType(); 132 void reportTerminalType();
133 void reportStatus(); 133 void reportStatus();
134 void reportAnswerBack(); 134 void reportAnswerBack();
135 void reportCursorPosition(); 135 void reportCursorPosition();
136 void reportTerminalParms(int p); 136 void reportTerminalParms(int p);
137 137
138protected: 138protected:
139 139
140 unsigned short applyCharset(unsigned short c); 140 unsigned short applyCharset(unsigned short c);
141 void setCharset(int n, int cs); 141 void setCharset(int n, int cs);
142 void useCharset(int n); 142 void useCharset(int n);
143 void setAndUseCharset(int n, int cs); 143 void setAndUseCharset(int n, int cs);
144 void saveCursor(); 144 void saveCursor();
145 void restoreCursor(); 145 void restoreCursor();
146 void resetCharset(int scrno); 146 void resetCharset(int scrno);
147 CharCodes charset[2]; 147 CharCodes charset[2];
148 148
149 DECpar currParm; 149 DECpar currParm;
150 DECpar saveParm; 150 DECpar saveParm;
151}; 151};
152 152
153#endif // ifndef ANSIEMU_H 153#endif // ifndef ANSIEMU_H