author | mickeyl <mickeyl> | 2004-09-07 21:08:46 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-09-07 21:08:46 (UTC) |
commit | 9c92eb6569b2b3bcb1ad4a2edb2ad263ec9feaa4 (patch) (unidiff) | |
tree | 4a67a2a2129060582f8b9f020e19199d18d1c173 | |
parent | 16d38d11f57750551530017e92ba267fa55ebbac (diff) | |
download | opie-9c92eb6569b2b3bcb1ad4a2edb2ad263ec9feaa4.zip opie-9c92eb6569b2b3bcb1ad4a2edb2ad263ec9feaa4.tar.gz opie-9c92eb6569b2b3bcb1ad4a2edb2ad263ec9feaa4.tar.bz2 |
an attempt to fix #1393 - line wrap issues - at least for the default profile.
i can't see a connectio from the emulation handler back to the GUI so it's probably
still broken for non-default profiles
-rw-r--r-- | noncore/apps/opie-console/emulation_handler.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 20 |
2 files changed, 7 insertions, 15 deletions
diff --git a/noncore/apps/opie-console/emulation_handler.cpp b/noncore/apps/opie-console/emulation_handler.cpp index c8022b9..956ac76 100644 --- a/noncore/apps/opie-console/emulation_handler.cpp +++ b/noncore/apps/opie-console/emulation_handler.cpp | |||
@@ -1,112 +1,112 @@ | |||
1 | #include "TEmuVt102.h" | 1 | #include "TEmuVt102.h" |
2 | #include "profile.h" | 2 | #include "profile.h" |
3 | #include "emulation_handler.h" | 3 | #include "emulation_handler.h" |
4 | #include "script.h" | 4 | #include "script.h" |
5 | 5 | ||
6 | /* OPIE */ | 6 | /* OPIE */ |
7 | #include <opie2/odebug.h> | 7 | #include <opie2/odebug.h> |
8 | using namespace Opie::Core; | 8 | using namespace Opie::Core; |
9 | 9 | ||
10 | EmulationHandler::EmulationHandler( const Profile& prof, QWidget* parent,const char* name ) | 10 | EmulationHandler::EmulationHandler( const Profile& prof, QWidget* parent,const char* name ) |
11 | : QObject(0, name ) | 11 | : QObject(0, name ) |
12 | { | 12 | { |
13 | m_teWid = new TEWidget( parent, "TerminalMain"); | 13 | m_teWid = new TEWidget( parent, "TerminalMain"); |
14 | // use setWrapAt(0) for classic behaviour (wrap at screen width, no scrollbar) | 14 | // use setWrapAt(0) for classic behaviour (wrap at screen width, no scrollbar) |
15 | // use setWrapAt(80) for normal console with scrollbar | 15 | // use setWrapAt(80) for normal console with scrollbar |
16 | setWrap(prof.readNumEntry("Wrap", 0) ? 0 : 80); | 16 | setWrap(prof.readNumEntry("Wrap", 80) ? 0 : 80); |
17 | m_teWid->setMinimumSize(150, 70 ); | 17 | m_teWid->setMinimumSize(150, 70 ); |
18 | m_script = 0; | 18 | m_script = 0; |
19 | parent->resize( m_teWid->calcSize(80, 24 ) ); | 19 | parent->resize( m_teWid->calcSize(80, 24 ) ); |
20 | m_teEmu = new TEmuVt102(m_teWid ); | 20 | m_teEmu = new TEmuVt102(m_teWid ); |
21 | 21 | ||
22 | connect(m_teEmu,SIGNAL(ImageSizeChanged(int,int) ), | 22 | connect(m_teEmu,SIGNAL(ImageSizeChanged(int,int) ), |
23 | this, SIGNAL(changeSize(int,int) ) ); | 23 | this, SIGNAL(changeSize(int,int) ) ); |
24 | connect(m_teEmu, SIGNAL(sndBlock(const char*,int) ), | 24 | connect(m_teEmu, SIGNAL(sndBlock(const char*,int) ), |
25 | this, SLOT(recvEmulation(const char*,int) ) ); | 25 | this, SLOT(recvEmulation(const char*,int) ) ); |
26 | m_teEmu->setConnect( true ); | 26 | m_teEmu->setConnect( true ); |
27 | m_teEmu->setHistory( TRUE ); | 27 | m_teEmu->setHistory( TRUE ); |
28 | load( prof ); | 28 | load( prof ); |
29 | 29 | ||
30 | 30 | ||
31 | 31 | ||
32 | } | 32 | } |
33 | TEmulation* EmulationHandler::emulation() { | 33 | TEmulation* EmulationHandler::emulation() { |
34 | return m_teEmu; | 34 | return m_teEmu; |
35 | } | 35 | } |
36 | EmulationHandler::~EmulationHandler() { | 36 | EmulationHandler::~EmulationHandler() { |
37 | if (isRecording()) | 37 | if (isRecording()) |
38 | clearScript(); | 38 | clearScript(); |
39 | delete m_teEmu; | 39 | delete m_teEmu; |
40 | delete m_teWid; | 40 | delete m_teWid; |
41 | } | 41 | } |
42 | 42 | ||
43 | void EmulationHandler::load( const Profile& prof) { | 43 | void EmulationHandler::load( const Profile& prof) { |
44 | 44 | ||
45 | // m_teWid->setVTFont( font( prof.readNumEntry("Font") ) ); | 45 | // m_teWid->setVTFont( font( prof.readNumEntry("Font") ) ); |
46 | QFont font( prof.readEntry("Font"), prof.readNumEntry( "FontSize" ), QFont::Normal ); | 46 | QFont font( prof.readEntry("Font"), prof.readNumEntry( "FontSize" ), QFont::Normal ); |
47 | font.setFixedPitch( TRUE ); | 47 | font.setFixedPitch( TRUE ); |
48 | m_teWid->setVTFont( font ); | 48 | m_teWid->setVTFont( font ); |
49 | 49 | ||
50 | int num = prof.readNumEntry("Color"); | 50 | int num = prof.readNumEntry("Color"); |
51 | setColor( foreColor(num), backColor(num) ); | 51 | setColor( foreColor(num), backColor(num) ); |
52 | m_teWid->setBackgroundColor(backColor(num) ); | 52 | m_teWid->setBackgroundColor(backColor(num) ); |
53 | 53 | ||
54 | int term = prof.readNumEntry("Terminal", 0) ; | 54 | int term = prof.readNumEntry("Terminal", 0) ; |
55 | switch(term) { | 55 | switch(term) { |
56 | default: | 56 | default: |
57 | case Profile::VT102: | 57 | case Profile::VT102: |
58 | case Profile::VT100: | 58 | case Profile::VT100: |
59 | m_teEmu->setKeytrans("vt100.keytab"); | 59 | m_teEmu->setKeytrans("vt100.keytab"); |
60 | break; | 60 | break; |
61 | case Profile::Linux: | 61 | case Profile::Linux: |
62 | m_teEmu->setKeytrans("linux.keytab"); | 62 | m_teEmu->setKeytrans("linux.keytab"); |
63 | break; | 63 | break; |
64 | case Profile::XTerm: | 64 | case Profile::XTerm: |
65 | m_teEmu->setKeytrans("default.Keytab"); | 65 | m_teEmu->setKeytrans("default.Keytab"); |
66 | break; | 66 | break; |
67 | } | 67 | } |
68 | } | 68 | } |
69 | void EmulationHandler::recv( const QByteArray& ar) { | 69 | void EmulationHandler::recv( const QByteArray& ar) { |
70 | m_teEmu->onRcvBlock(ar.data(), ar.count() ); | 70 | m_teEmu->onRcvBlock(ar.data(), ar.count() ); |
71 | } | 71 | } |
72 | void EmulationHandler::recvEmulation(const char* src, int len ) { | 72 | void EmulationHandler::recvEmulation(const char* src, int len ) { |
73 | QByteArray ar(len); | 73 | QByteArray ar(len); |
74 | 74 | ||
75 | memcpy(ar.data(), src, sizeof(char) * len ); | 75 | memcpy(ar.data(), src, sizeof(char) * len ); |
76 | if (isRecording()) | 76 | if (isRecording()) |
77 | m_script->append(ar); | 77 | m_script->append(ar); |
78 | emit send(ar); | 78 | emit send(ar); |
79 | } | 79 | } |
80 | QWidget* EmulationHandler::widget() { | 80 | QWidget* EmulationHandler::widget() { |
81 | return m_teWid; | 81 | return m_teWid; |
82 | } | 82 | } |
83 | /* | 83 | /* |
84 | * allocate a new table of colors | 84 | * allocate a new table of colors |
85 | */ | 85 | */ |
86 | void EmulationHandler::setColor( const QColor& fore, const QColor& back ) { | 86 | void EmulationHandler::setColor( const QColor& fore, const QColor& back ) { |
87 | ColorEntry table[TABLE_COLORS]; | 87 | ColorEntry table[TABLE_COLORS]; |
88 | const ColorEntry *defaultCt = m_teWid->getdefaultColorTable(); | 88 | const ColorEntry *defaultCt = m_teWid->getdefaultColorTable(); |
89 | 89 | ||
90 | for (int i = 0; i < TABLE_COLORS; i++ ) { | 90 | for (int i = 0; i < TABLE_COLORS; i++ ) { |
91 | if ( i == 0 || i == 10 ) { | 91 | if ( i == 0 || i == 10 ) { |
92 | table[i].color = fore; | 92 | table[i].color = fore; |
93 | }else if ( i == 1 || i == 11 ) { | 93 | }else if ( i == 1 || i == 11 ) { |
94 | table[i].color = back; | 94 | table[i].color = back; |
95 | table[i].transparent = 0; | 95 | table[i].transparent = 0; |
96 | }else { | 96 | }else { |
97 | table[i].color = defaultCt[i].color; | 97 | table[i].color = defaultCt[i].color; |
98 | } | 98 | } |
99 | } | 99 | } |
100 | m_teWid->setColorTable(table ); | 100 | m_teWid->setColorTable(table ); |
101 | m_teWid->update(); | 101 | m_teWid->update(); |
102 | } | 102 | } |
103 | QFont EmulationHandler::font( int id ) { | 103 | QFont EmulationHandler::font( int id ) { |
104 | QString name; | 104 | QString name; |
105 | int size = 0; | 105 | int size = 0; |
106 | switch(id ) { | 106 | switch(id ) { |
107 | default: // fall through | 107 | default: // fall through |
108 | case 0: | 108 | case 0: |
109 | name = QString::fromLatin1("Micro"); | 109 | name = QString::fromLatin1("Micro"); |
110 | size = 4; | 110 | size = 4; |
111 | break; | 111 | break; |
112 | case 1: | 112 | case 1: |
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp index b160604..15290ce 100644 --- a/noncore/apps/opie-console/mainwindow.cpp +++ b/noncore/apps/opie-console/mainwindow.cpp | |||
@@ -48,204 +48,205 @@ MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow( | |||
48 | m_manager = new ProfileManager( m_factory ); | 48 | m_manager = new ProfileManager( m_factory ); |
49 | m_manager->load(); | 49 | m_manager->load(); |
50 | m_scriptsData.setAutoDelete(TRUE); | 50 | m_scriptsData.setAutoDelete(TRUE); |
51 | 51 | ||
52 | initUI(); | 52 | initUI(); |
53 | populateProfiles(); | 53 | populateProfiles(); |
54 | populateScripts(); | 54 | populateScripts(); |
55 | } | 55 | } |
56 | 56 | ||
57 | void MainWindow::initUI() { | 57 | void MainWindow::initUI() { |
58 | 58 | ||
59 | setToolBarsMovable( FALSE ); | 59 | setToolBarsMovable( FALSE ); |
60 | 60 | ||
61 | /* tool bar for the menu */ | 61 | /* tool bar for the menu */ |
62 | m_tool = new QToolBar( this ); | 62 | m_tool = new QToolBar( this ); |
63 | m_tool->setHorizontalStretchable( TRUE ); | 63 | m_tool->setHorizontalStretchable( TRUE ); |
64 | 64 | ||
65 | m_bar = new QMenuBar( m_tool ); | 65 | m_bar = new QMenuBar( m_tool ); |
66 | m_console = new QPopupMenu( this ); | 66 | m_console = new QPopupMenu( this ); |
67 | m_scripts = new QPopupMenu( this ); | 67 | m_scripts = new QPopupMenu( this ); |
68 | m_sessionsPop= new QPopupMenu( this ); | 68 | m_sessionsPop= new QPopupMenu( this ); |
69 | m_scriptsPop = new QPopupMenu( this ); | 69 | m_scriptsPop = new QPopupMenu( this ); |
70 | 70 | ||
71 | /* add a toolbar for icons */ | 71 | /* add a toolbar for icons */ |
72 | m_icons = new QToolBar(this); | 72 | m_icons = new QToolBar(this); |
73 | 73 | ||
74 | /* | 74 | /* |
75 | * the settings action | 75 | * the settings action |
76 | */ | 76 | */ |
77 | m_setProfiles = new QAction(tr("Configure Profiles"), | 77 | m_setProfiles = new QAction(tr("Configure Profiles"), |
78 | Resource::loadPixmap( "SettingsIcon" ), | 78 | Resource::loadPixmap( "SettingsIcon" ), |
79 | QString::null, 0, this, 0); | 79 | QString::null, 0, this, 0); |
80 | m_setProfiles->addTo( m_console ); | 80 | m_setProfiles->addTo( m_console ); |
81 | connect( m_setProfiles, SIGNAL(activated() ), | 81 | connect( m_setProfiles, SIGNAL(activated() ), |
82 | this, SLOT(slotConfigure() ) ); | 82 | this, SLOT(slotConfigure() ) ); |
83 | 83 | ||
84 | m_console->insertSeparator(); | 84 | m_console->insertSeparator(); |
85 | /* | 85 | /* |
86 | * new Action for new sessions | 86 | * new Action for new sessions |
87 | */ | 87 | */ |
88 | QAction* newCon = new QAction(tr("New Profile"), | 88 | QAction* newCon = new QAction(tr("New Profile"), |
89 | Resource::loadPixmap( "new" ), | 89 | Resource::loadPixmap( "new" ), |
90 | QString::null, 0, this, 0); | 90 | QString::null, 0, this, 0); |
91 | newCon->addTo( m_console ); | 91 | newCon->addTo( m_console ); |
92 | connect( newCon, SIGNAL(activated() ), | 92 | connect( newCon, SIGNAL(activated() ), |
93 | this, SLOT(slotNew() ) ); | 93 | this, SLOT(slotNew() ) ); |
94 | 94 | ||
95 | m_console->insertSeparator(); | 95 | m_console->insertSeparator(); |
96 | 96 | ||
97 | QAction *saveCon = new QAction( tr("Save Profile" ), | 97 | QAction *saveCon = new QAction( tr("Save Profile" ), |
98 | Resource::loadPixmap( "save" ), QString::null, | 98 | Resource::loadPixmap( "save" ), QString::null, |
99 | 0, this, 0 ); | 99 | 0, this, 0 ); |
100 | saveCon->addTo( m_console ); | 100 | saveCon->addTo( m_console ); |
101 | connect( saveCon, SIGNAL(activated() ), | 101 | connect( saveCon, SIGNAL(activated() ), |
102 | this, SLOT(slotSaveSession() ) ); | 102 | this, SLOT(slotSaveSession() ) ); |
103 | m_console->insertSeparator(); | 103 | m_console->insertSeparator(); |
104 | 104 | ||
105 | /* | 105 | /* |
106 | * connect action | 106 | * connect action |
107 | */ | 107 | */ |
108 | m_connect = new QAction( tr("Connect"), Resource::loadPixmap("console/connected"), | 108 | m_connect = new QAction( tr("Connect"), Resource::loadPixmap("console/connected"), |
109 | QString::null, 0, this, 0 ); | 109 | QString::null, 0, this, 0 ); |
110 | m_connect->addTo( m_console ); | 110 | m_connect->addTo( m_console ); |
111 | connect(m_connect, SIGNAL(activated() ), | 111 | connect(m_connect, SIGNAL(activated() ), |
112 | this, SLOT(slotConnect() ) ); | 112 | this, SLOT(slotConnect() ) ); |
113 | 113 | ||
114 | /* | 114 | /* |
115 | * disconnect action | 115 | * disconnect action |
116 | */ | 116 | */ |
117 | m_disconnect = new QAction( tr("Disconnect"), Resource::loadPixmap("console/notconnected"), | 117 | m_disconnect = new QAction( tr("Disconnect"), Resource::loadPixmap("console/notconnected"), |
118 | QString::null, 0, this, 0 ); | 118 | QString::null, 0, this, 0 ); |
119 | m_disconnect->addTo( m_console ); | 119 | m_disconnect->addTo( m_console ); |
120 | connect(m_disconnect, SIGNAL(activated() ), | 120 | connect(m_disconnect, SIGNAL(activated() ), |
121 | this, SLOT(slotDisconnect() ) ); | 121 | this, SLOT(slotDisconnect() ) ); |
122 | 122 | ||
123 | m_console->insertSeparator(); | 123 | m_console->insertSeparator(); |
124 | 124 | ||
125 | 125 | ||
126 | m_quickLaunch = new QAction( tr("QuickLaunch"), Resource::loadPixmap("console/konsole_mini"), QString::null, 0, this, 0 ); | 126 | m_quickLaunch = new QAction( tr("QuickLaunch"), Resource::loadPixmap("console/konsole_mini"), QString::null, 0, this, 0 ); |
127 | m_quickLaunch->addTo( m_icons ); | 127 | m_quickLaunch->addTo( m_icons ); |
128 | connect( m_quickLaunch, SIGNAL( activated() ), | 128 | connect( m_quickLaunch, SIGNAL( activated() ), |
129 | this, SLOT( slotQuickLaunch() ) ); | 129 | this, SLOT( slotQuickLaunch() ) ); |
130 | 130 | ||
131 | QWhatsThis::add( m_icons, tr( "The shell button launches the \"default\" profile. If there is none default values are taken" ) ); | 131 | QWhatsThis::add( m_icons, tr( "The shell button launches the \"default\" profile. If there is none default values are taken" ) ); |
132 | 132 | ||
133 | m_transfer = new QAction( tr("Transfer file..."), Resource::loadPixmap("pass") , QString::null, | 133 | m_transfer = new QAction( tr("Transfer file..."), Resource::loadPixmap("pass") , QString::null, |
134 | 0, this, 0 ); | 134 | 0, this, 0 ); |
135 | m_transfer->addTo( m_console ); | 135 | m_transfer->addTo( m_console ); |
136 | connect(m_transfer, SIGNAL(activated() ), | 136 | connect(m_transfer, SIGNAL(activated() ), |
137 | this, SLOT(slotTransfer() ) ); | 137 | this, SLOT(slotTransfer() ) ); |
138 | 138 | ||
139 | 139 | ||
140 | 140 | ||
141 | /* | 141 | /* |
142 | * immediate change of line wrap policy | 142 | * immediate change of line wrap policy |
143 | */ | 143 | */ |
144 | m_isWrapped = false; | 144 | m_isWrapped = true; |
145 | m_wrap = new QAction( tr("Line wrap"), Resource::loadPixmap( "linewrap" ), QString::null, 0, this, 0 ); | 145 | m_wrap = new QAction( tr("Line wrap"), Resource::loadPixmap( "linewrap" ), QString::null, 0, this, 0, true ); |
146 | m_wrap->addTo( m_console ); | 146 | m_wrap->addTo( m_console ); |
147 | m_wrap->setOn( true ); | ||
147 | connect( m_wrap, SIGNAL( activated() ), SLOT( slotWrap() ) ); | 148 | connect( m_wrap, SIGNAL( activated() ), SLOT( slotWrap() ) ); |
148 | 149 | ||
149 | /* | 150 | /* |
150 | * fullscreen | 151 | * fullscreen |
151 | */ | 152 | */ |
152 | m_isFullscreen = false; | 153 | m_isFullscreen = false; |
153 | 154 | ||
154 | m_fullscreen = new QAction( tr("Full screen"), Resource::loadPixmap( "fullscreen" ) | 155 | m_fullscreen = new QAction( tr("Full screen"), Resource::loadPixmap( "fullscreen" ) |
155 | , QString::null, 0, this, 0); | 156 | , QString::null, 0, this, 0, true ); |
156 | m_fullscreen->addTo( m_console ); | 157 | m_fullscreen->addTo( m_console ); |
157 | connect( m_fullscreen, SIGNAL( activated() ), | 158 | connect( m_fullscreen, SIGNAL( activated() ), |
158 | this, SLOT( slotFullscreen() ) ); | 159 | this, SLOT( slotFullscreen() ) ); |
159 | 160 | ||
160 | m_console->insertSeparator(); | 161 | m_console->insertSeparator(); |
161 | 162 | ||
162 | QAction *a = new QAction(); | 163 | QAction *a = new QAction(); |
163 | a->setText( tr("Save history") ); | 164 | a->setText( tr("Save history") ); |
164 | a->addTo( m_console ); | 165 | a->addTo( m_console ); |
165 | connect(a, SIGNAL(activated() ), | 166 | connect(a, SIGNAL(activated() ), |
166 | this, SLOT(slotSaveHistory() ) ); | 167 | this, SLOT(slotSaveHistory() ) ); |
167 | /* | 168 | /* |
168 | * terminate action | 169 | * terminate action |
169 | */ | 170 | */ |
170 | m_terminate = new QAction(); | 171 | m_terminate = new QAction(); |
171 | m_terminate->setText( tr("Terminate") ); | 172 | m_terminate->setText( tr("Terminate") ); |
172 | m_terminate->addTo( m_console ); | 173 | m_terminate->addTo( m_console ); |
173 | connect(m_terminate, SIGNAL(activated() ), | 174 | connect(m_terminate, SIGNAL(activated() ), |
174 | this, SLOT(slotTerminate() ) ); | 175 | this, SLOT(slotTerminate() ) ); |
175 | 176 | ||
176 | m_closewindow = new QAction(); | 177 | m_closewindow = new QAction(); |
177 | m_closewindow->setText( tr("Close Window") ); | 178 | m_closewindow->setText( tr("Close Window") ); |
178 | m_closewindow->addTo( m_console ); | 179 | m_closewindow->addTo( m_console ); |
179 | connect( m_closewindow, SIGNAL(activated() ), | 180 | connect( m_closewindow, SIGNAL(activated() ), |
180 | this, SLOT(slotClose() ) ); | 181 | this, SLOT(slotClose() ) ); |
181 | 182 | ||
182 | 183 | ||
183 | /* | 184 | /* |
184 | * script actions | 185 | * script actions |
185 | */ | 186 | */ |
186 | m_runScript_id = m_scripts->insertItem(tr("Run Script"), m_scriptsPop, -1, 0); | 187 | m_runScript_id = m_scripts->insertItem(tr("Run Script"), m_scriptsPop, -1, 0); |
187 | connect(m_scriptsPop, SIGNAL(activated(int)), this, SLOT(slotRunScript(int))); | 188 | connect(m_scriptsPop, SIGNAL(activated(int)), this, SLOT(slotRunScript(int))); |
188 | 189 | ||
189 | m_recordScript = new QAction(tr("Record Script"), QString::null, 0, this, 0); | 190 | m_recordScript = new QAction(tr("Record Script"), QString::null, 0, this, 0); |
190 | m_recordScript->addTo(m_scripts); | 191 | m_recordScript->addTo(m_scripts); |
191 | connect(m_recordScript, SIGNAL(activated()), this, SLOT(slotRecordScript())); | 192 | connect(m_recordScript, SIGNAL(activated()), this, SLOT(slotRecordScript())); |
192 | 193 | ||
193 | m_saveScript = new QAction(tr("Save Script"), QString::null, 0, this, 0); | 194 | m_saveScript = new QAction(tr("Save Script"), QString::null, 0, this, 0); |
194 | m_saveScript->addTo(m_scripts); | 195 | m_saveScript->addTo(m_scripts); |
195 | connect(m_saveScript, SIGNAL(activated()), this, SLOT(slotSaveScript())); | 196 | connect(m_saveScript, SIGNAL(activated()), this, SLOT(slotSaveScript())); |
196 | 197 | ||
197 | 198 | ||
198 | /* | 199 | /* |
199 | * action that open/closes the keyboard | 200 | * action that open/closes the keyboard |
200 | */ | 201 | */ |
201 | m_openKeys = new QAction (tr("Open Keyboard..."), | 202 | m_openKeys = new QAction (tr("Open Keyboard..."), |
202 | Resource::loadPixmap( "console/keys/keyboard_icon" ), | 203 | Resource::loadPixmap( "console/keys/keyboard_icon" ), |
203 | QString::null, 0, this, 0); | 204 | QString::null, 0, this, 0); |
204 | m_openKeys->setToggleAction(true); | 205 | m_openKeys->setToggleAction(true); |
205 | connect (m_openKeys, SIGNAL(toggled(bool)), this, SLOT(slotOpenKeb(bool))); | 206 | connect (m_openKeys, SIGNAL(toggled(bool)), this, SLOT(slotOpenKeb(bool))); |
206 | 207 | ||
207 | /* insert the submenu */ | 208 | /* insert the submenu */ |
208 | m_console->insertItem(tr("New from Profile"), m_sessionsPop, | 209 | m_console->insertItem(tr("New from Profile"), m_sessionsPop, |
209 | -1, 0); | 210 | -1, 0); |
210 | 211 | ||
211 | /* insert the connection menu */ | 212 | /* insert the connection menu */ |
212 | m_bar->insertItem( tr("Connection"), m_console ); | 213 | m_bar->insertItem( tr("Connection"), m_console ); |
213 | 214 | ||
214 | /* the scripts menu */ | 215 | /* the scripts menu */ |
215 | m_bar->insertItem( tr("Scripts"), m_scripts ); | 216 | m_bar->insertItem( tr("Scripts"), m_scripts ); |
216 | 217 | ||
217 | /* and the keyboard */ | 218 | /* and the keyboard */ |
218 | m_keyBar = new QToolBar(this); | 219 | m_keyBar = new QToolBar(this); |
219 | addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE ); | 220 | addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE ); |
220 | m_keyBar->setHorizontalStretchable( TRUE ); | 221 | m_keyBar->setHorizontalStretchable( TRUE ); |
221 | m_keyBar->hide(); | 222 | m_keyBar->hide(); |
222 | 223 | ||
223 | m_kb = new FunctionKeyboard(m_keyBar); | 224 | m_kb = new FunctionKeyboard(m_keyBar); |
224 | connect(m_kb, SIGNAL(keyPressed(FKey,ushort,ushort,bool)), | 225 | connect(m_kb, SIGNAL(keyPressed(FKey,ushort,ushort,bool)), |
225 | this, SLOT(slotKeyReceived(FKey,ushort,ushort,bool))); | 226 | this, SLOT(slotKeyReceived(FKey,ushort,ushort,bool))); |
226 | 227 | ||
227 | 228 | ||
228 | a = new QAction(tr("Copy"), | 229 | a = new QAction(tr("Copy"), |
229 | Resource::loadPixmap("copy"), QString::null, | 230 | Resource::loadPixmap("copy"), QString::null, |
230 | 0, this, 0 ); | 231 | 0, this, 0 ); |
231 | //a->addTo( m_icons ); | 232 | //a->addTo( m_icons ); |
232 | connect( a, SIGNAL(activated() ), | 233 | connect( a, SIGNAL(activated() ), |
233 | this, SLOT(slotCopy() ) ); | 234 | this, SLOT(slotCopy() ) ); |
234 | 235 | ||
235 | QAction *paste = new QAction(tr("Paste"), | 236 | QAction *paste = new QAction(tr("Paste"), |
236 | Resource::loadPixmap("paste"), QString::null, | 237 | Resource::loadPixmap("paste"), QString::null, |
237 | 0, this, 0 ); | 238 | 0, this, 0 ); |
238 | connect( paste, SIGNAL(activated() ), | 239 | connect( paste, SIGNAL(activated() ), |
239 | this, SLOT(slotPaste() ) ); | 240 | this, SLOT(slotPaste() ) ); |
240 | 241 | ||
241 | 242 | ||
242 | newCon->addTo( m_icons ); | 243 | newCon->addTo( m_icons ); |
243 | //m_setProfiles->addTo( m_icons ); | 244 | //m_setProfiles->addTo( m_icons ); |
244 | paste->addTo( m_icons ); | 245 | paste->addTo( m_icons ); |
245 | m_openKeys->addTo(m_icons); | 246 | m_openKeys->addTo(m_icons); |
246 | m_fullscreen->addTo( m_icons ); | 247 | m_fullscreen->addTo( m_icons ); |
247 | 248 | ||
248 | m_connect->setEnabled( false ); | 249 | m_connect->setEnabled( false ); |
249 | m_disconnect->setEnabled( false ); | 250 | m_disconnect->setEnabled( false ); |
250 | m_terminate->setEnabled( false ); | 251 | m_terminate->setEnabled( false ); |
251 | m_transfer->setEnabled( false ); | 252 | m_transfer->setEnabled( false ); |
@@ -441,302 +442,293 @@ void MainWindow::slotConfigure() { | |||
441 | ConfigDialog conf( manager()->all(), factory() ); | 442 | ConfigDialog conf( manager()->all(), factory() ); |
442 | 443 | ||
443 | int ret = QPEApplication::execDialog( &conf ); | 444 | int ret = QPEApplication::execDialog( &conf ); |
444 | 445 | ||
445 | if ( QDialog::Accepted == ret ) { | 446 | if ( QDialog::Accepted == ret ) { |
446 | manager()->setProfiles( conf.list() ); | 447 | manager()->setProfiles( conf.list() ); |
447 | manager()->save(); | 448 | manager()->save(); |
448 | populateProfiles(); | 449 | populateProfiles(); |
449 | } | 450 | } |
450 | } | 451 | } |
451 | /* | 452 | /* |
452 | * we will remove | 453 | * we will remove |
453 | * this window from the tabwidget | 454 | * this window from the tabwidget |
454 | * remove it from the list | 455 | * remove it from the list |
455 | * delete it | 456 | * delete it |
456 | * and set the currentSession() | 457 | * and set the currentSession() |
457 | */ | 458 | */ |
458 | void MainWindow::slotClose() { | 459 | void MainWindow::slotClose() { |
459 | if (!currentSession() ) | 460 | if (!currentSession() ) |
460 | return; | 461 | return; |
461 | 462 | ||
462 | Session* ses = currentSession(); | 463 | Session* ses = currentSession(); |
463 | owarn << "removing! currentSession " << currentSession()->name().latin1() << "" << oendl; | 464 | owarn << "removing! currentSession " << currentSession()->name().latin1() << "" << oendl; |
464 | /* set to NULL to be safe, if its needed slotSessionChanged resets it automatically */ | 465 | /* set to NULL to be safe, if its needed slotSessionChanged resets it automatically */ |
465 | m_curSession = NULL; | 466 | m_curSession = NULL; |
466 | tabWidget()->remove( /*currentSession()*/ses ); | 467 | tabWidget()->remove( /*currentSession()*/ses ); |
467 | /*it's autodelete */ | 468 | /*it's autodelete */ |
468 | m_sessions.remove( ses ); | 469 | m_sessions.remove( ses ); |
469 | owarn << "after remove!!" << oendl; | 470 | owarn << "after remove!!" << oendl; |
470 | 471 | ||
471 | if (!currentSession() ) { | 472 | if (!currentSession() ) { |
472 | m_connect->setEnabled( false ); | 473 | m_connect->setEnabled( false ); |
473 | m_disconnect->setEnabled( false ); | 474 | m_disconnect->setEnabled( false ); |
474 | m_terminate->setEnabled( false ); | 475 | m_terminate->setEnabled( false ); |
475 | m_transfer->setEnabled( false ); | 476 | m_transfer->setEnabled( false ); |
476 | m_recordScript->setEnabled( false ); | 477 | m_recordScript->setEnabled( false ); |
477 | m_saveScript->setEnabled( false ); | 478 | m_saveScript->setEnabled( false ); |
478 | m_scripts->setItemEnabled(m_runScript_id, false); | 479 | m_scripts->setItemEnabled(m_runScript_id, false); |
479 | m_fullscreen->setEnabled( false ); | 480 | m_fullscreen->setEnabled( false ); |
480 | m_wrap->setEnabled( false ); | 481 | m_wrap->setEnabled( false ); |
481 | m_closewindow->setEnabled( false ); | 482 | m_closewindow->setEnabled( false ); |
482 | } | 483 | } |
483 | 484 | ||
484 | m_kb->loadDefaults(); | 485 | m_kb->loadDefaults(); |
485 | } | 486 | } |
486 | 487 | ||
487 | /* | 488 | /* |
488 | * We will get the name | 489 | * We will get the name |
489 | * Then the profile | 490 | * Then the profile |
490 | * and then we will make a profile | 491 | * and then we will make a profile |
491 | */ | 492 | */ |
492 | void MainWindow::slotProfile( int id) { | 493 | void MainWindow::slotProfile( int id) { |
493 | Profile prof = manager()->profile( m_sessionsPop->text( id) ); | 494 | Profile prof = manager()->profile( m_sessionsPop->text( id) ); |
494 | create( prof ); | 495 | create( prof ); |
495 | } | 496 | } |
496 | 497 | ||
497 | 498 | ||
498 | 499 | ||
499 | void MainWindow::create( const Profile& prof ) { | 500 | void MainWindow::create( const Profile& prof ) { |
500 | if(m_curSession) | 501 | if(m_curSession) |
501 | if(m_curSession->transferDialog()) m_curSession->transferDialog()->hide(); | 502 | if(m_curSession->transferDialog()) m_curSession->transferDialog()->hide(); |
502 | 503 | ||
503 | Session *ses = manager()->fromProfile( prof, tabWidget() ); | 504 | Session *ses = manager()->fromProfile( prof, tabWidget() ); |
504 | 505 | ||
505 | if((!ses) || (!ses->layer()) || (!ses->widgetStack())) | 506 | if((!ses) || (!ses->layer()) || (!ses->widgetStack())) |
506 | { | 507 | { |
507 | QMessageBox::warning(this, | 508 | QMessageBox::warning(this, |
508 | QObject::tr("Session failed"), | 509 | QObject::tr("Session failed"), |
509 | QObject::tr("<qt>Cannot open session: Not all components were found.</qt>")); | 510 | QObject::tr("<qt>Cannot open session: Not all components were found.</qt>")); |
510 | //if(ses) delete ses; | 511 | //if(ses) delete ses; |
511 | return; | 512 | return; |
512 | } | 513 | } |
513 | 514 | ||
514 | m_sessions.append( ses ); | 515 | m_sessions.append( ses ); |
515 | tabWidget()->add( ses ); | 516 | tabWidget()->add( ses ); |
516 | tabWidget()->repaint(); | 517 | tabWidget()->repaint(); |
517 | m_curSession = ses; | 518 | m_curSession = ses; |
518 | 519 | ||
519 | // dicide if its a local term ( then no connction and no tranfer), maybe make a wrapper method out of it | 520 | // dicide if its a local term ( then no connction and no tranfer), maybe make a wrapper method out of it |
520 | m_connect->setEnabled( true ); | 521 | m_connect->setEnabled( true ); |
521 | m_disconnect->setEnabled( false ); | 522 | m_disconnect->setEnabled( false ); |
522 | m_terminate->setEnabled( true ); | 523 | m_terminate->setEnabled( true ); |
523 | m_fullscreen->setEnabled( true ); | 524 | m_fullscreen->setEnabled( true ); |
524 | m_wrap->setEnabled( true ); | 525 | m_wrap->setEnabled( true ); |
525 | m_closewindow->setEnabled( true ); | 526 | m_closewindow->setEnabled( true ); |
526 | m_transfer->setEnabled( false ); | 527 | m_transfer->setEnabled( false ); |
527 | m_recordScript->setEnabled( false ); | 528 | m_recordScript->setEnabled( false ); |
528 | m_saveScript->setEnabled( false ); | 529 | m_saveScript->setEnabled( false ); |
529 | m_scripts->setItemEnabled(m_runScript_id, false); | 530 | m_scripts->setItemEnabled(m_runScript_id, false); |
530 | 531 | ||
531 | // is io_layer wants direct connection, then autoconnect | 532 | // is io_layer wants direct connection, then autoconnect |
532 | //if ( ( m_curSession->layer() )->supports()[0] == 1 ) { | 533 | //if ( ( m_curSession->layer() )->supports()[0] == 1 ) { |
533 | if (prof.autoConnect()) { | 534 | if (prof.autoConnect()) { |
534 | slotConnect(); | 535 | slotConnect(); |
535 | } | 536 | } |
536 | 537 | ||
537 | |||
538 | QWidget *w = currentSession()->widget(); | 538 | QWidget *w = currentSession()->widget(); |
539 | if(w) w->setFocus(); | 539 | if(w) w->setFocus(); |
540 | 540 | ||
541 | if(currentSession()->profile().readNumEntry("Wrap", 80)){ | 541 | if(currentSession()->profile().readNumEntry("Wrap", 80)){ |
542 | m_isWrapped = true; | 542 | m_isWrapped = true; |
543 | } else { | 543 | } else { |
544 | m_isWrapped = false; | 544 | m_isWrapped = false; |
545 | } | 545 | } |
546 | 546 | ||
547 | m_kb->load(currentSession()->profile()); | 547 | m_kb->load(currentSession()->profile()); |
548 | } | 548 | } |
549 | 549 | ||
550 | void MainWindow::slotTransfer() | 550 | void MainWindow::slotTransfer() |
551 | { | 551 | { |
552 | if ( currentSession() ) { | 552 | if ( currentSession() ) { |
553 | Session *mysession = currentSession(); | 553 | Session *mysession = currentSession(); |
554 | TransferDialog dlg(/*mysession->widgetStack()*/this, this); | 554 | TransferDialog dlg(/*mysession->widgetStack()*/this, this); |
555 | mysession->setTransferDialog(&dlg); | 555 | mysession->setTransferDialog(&dlg); |
556 | //dlg.reparent(mysession->widgetStack(), QPoint(0, 0)); | 556 | //dlg.reparent(mysession->widgetStack(), QPoint(0, 0)); |
557 | //dlg.showMaximized(); | 557 | //dlg.showMaximized(); |
558 | currentSession()->widgetStack()->addWidget(&dlg, -1); | 558 | currentSession()->widgetStack()->addWidget(&dlg, -1); |
559 | dlg.show(); | 559 | dlg.show(); |
560 | //dlg.exec(); | 560 | //dlg.exec(); |
561 | while(dlg.isRunning()) qApp->processEvents(); | 561 | while(dlg.isRunning()) qApp->processEvents(); |
562 | mysession->setTransferDialog(0l); | 562 | mysession->setTransferDialog(0l); |
563 | } | 563 | } |
564 | } | 564 | } |
565 | 565 | ||
566 | 566 | ||
567 | void MainWindow::slotOpenKeb(bool state) { | 567 | void MainWindow::slotOpenKeb(bool state) { |
568 | 568 | ||
569 | if (state) m_keyBar->show(); | 569 | if (state) m_keyBar->show(); |
570 | else m_keyBar->hide(); | 570 | else m_keyBar->hide(); |
571 | 571 | ||
572 | } | 572 | } |
573 | 573 | ||
574 | 574 | ||
575 | void MainWindow::slotOpenButtons( bool state ) { | 575 | void MainWindow::slotOpenButtons( bool state ) { |
576 | 576 | ||
577 | if ( state ) { | 577 | if ( state ) { |
578 | m_buttonBar->show(); | 578 | m_buttonBar->show(); |
579 | } else { | 579 | } else { |
580 | m_buttonBar->hide(); | 580 | m_buttonBar->hide(); |
581 | } | 581 | } |
582 | } | 582 | } |
583 | 583 | ||
584 | 584 | ||
585 | 585 | ||
586 | void MainWindow::slotSessionChanged( Session* ses ) { | 586 | void MainWindow::slotSessionChanged( Session* ses ) { |
587 | owarn << "changed!" << oendl; | 587 | owarn << "changed!" << oendl; |
588 | 588 | ||
589 | if(m_curSession) | 589 | if(m_curSession) |
590 | if(m_curSession->transferDialog()) m_curSession->transferDialog()->hide(); | 590 | if(m_curSession->transferDialog()) m_curSession->transferDialog()->hide(); |
591 | if(ses) | 591 | if(ses) |
592 | if(ses->transferDialog()) ses->transferDialog()->show(); | 592 | if(ses->transferDialog()) ses->transferDialog()->show(); |
593 | 593 | ||
594 | if ( ses ) { | 594 | if ( ses ) { |
595 | m_curSession = ses; | 595 | m_curSession = ses; |
596 | odebug << QString("is connected : %1").arg( m_curSession->layer()->isConnected() ) << oendl; | 596 | odebug << QString("is connected : %1").arg( m_curSession->layer()->isConnected() ) << oendl; |
597 | if ( m_curSession->layer()->isConnected() ) { | 597 | if ( m_curSession->layer()->isConnected() ) { |
598 | m_connect->setEnabled( false ); | 598 | m_connect->setEnabled( false ); |
599 | m_disconnect->setEnabled( true ); | 599 | m_disconnect->setEnabled( true ); |
600 | m_recordScript->setEnabled(!m_curSession->emulationHandler()->isRecording()); | 600 | m_recordScript->setEnabled(!m_curSession->emulationHandler()->isRecording()); |
601 | m_saveScript->setEnabled(m_curSession->emulationHandler()->isRecording()); | 601 | m_saveScript->setEnabled(m_curSession->emulationHandler()->isRecording()); |
602 | m_scripts->setItemEnabled(m_runScript_id, true); | 602 | m_scripts->setItemEnabled(m_runScript_id, true); |
603 | } else { | 603 | } else { |
604 | m_connect->setEnabled( true ); | 604 | m_connect->setEnabled( true ); |
605 | m_disconnect->setEnabled( false ); | 605 | m_disconnect->setEnabled( false ); |
606 | m_recordScript->setEnabled( false ); | 606 | m_recordScript->setEnabled( false ); |
607 | m_saveScript->setEnabled( false ); | 607 | m_saveScript->setEnabled( false ); |
608 | m_scripts->setItemEnabled(m_runScript_id, false); | 608 | m_scripts->setItemEnabled(m_runScript_id, false); |
609 | } | 609 | } |
610 | 610 | ||
611 | if ( ( m_curSession->layer() )->supports()[1] == 0 ) { | 611 | if ( ( m_curSession->layer() )->supports()[1] == 0 ) { |
612 | m_transfer->setEnabled( false ); | 612 | m_transfer->setEnabled( false ); |
613 | } else { | 613 | } else { |
614 | m_transfer->setEnabled( true ); | 614 | m_transfer->setEnabled( true ); |
615 | } | 615 | } |
616 | 616 | ||
617 | QWidget *w = m_curSession->widget(); | 617 | QWidget *w = m_curSession->widget(); |
618 | if(w) w->setFocus(); | 618 | if(w) w->setFocus(); |
619 | 619 | ||
620 | if(currentSession()->profile().readNumEntry("Wrap", 80)){ | 620 | if(currentSession()->profile().readNumEntry("Wrap", 80)){ |
621 | m_isWrapped = true; | 621 | m_isWrapped = true; |
622 | } else { | 622 | } else { |
623 | m_isWrapped = false; | 623 | m_isWrapped = false; |
624 | } | 624 | } |
625 | 625 | ||
626 | m_kb->load(currentSession()->profile()); | 626 | m_kb->load(currentSession()->profile()); |
627 | } | 627 | } |
628 | } | 628 | } |
629 | 629 | ||
630 | void MainWindow::slotWrap() | 630 | void MainWindow::slotWrap() |
631 | { | 631 | { |
632 | if(m_curSession) | 632 | if(m_curSession) |
633 | { | 633 | { |
634 | EmulationHandler *e = m_curSession->emulationHandler(); | 634 | EmulationHandler *e = m_curSession->emulationHandler(); |
635 | if(e) | 635 | if(e) |
636 | { | 636 | { |
637 | if(m_isWrapped) | 637 | e->setWrap( m_isWrapped ? 80:0 ); |
638 | { | 638 | m_isWrapped = !m_isWrapped; |
639 | e->setWrap(80); | ||
640 | m_isWrapped = false; | ||
641 | } | ||
642 | else | ||
643 | { | ||
644 | e->setWrap(0); | ||
645 | m_isWrapped = true; | ||
646 | } | ||
647 | } | 639 | } |
648 | } | 640 | } |
649 | } | 641 | } |
650 | 642 | ||
651 | void MainWindow::slotFullscreen() { | 643 | void MainWindow::slotFullscreen() { |
652 | 644 | ||
653 | 645 | ||
654 | 646 | ||
655 | if ( m_isFullscreen ) { | 647 | if ( m_isFullscreen ) { |
656 | ( m_curSession->widgetStack() )->reparent( savedParentFullscreen, 0, QPoint(0,0), true ); | 648 | ( m_curSession->widgetStack() )->reparent( savedParentFullscreen, 0, QPoint(0,0), true ); |
657 | ( m_curSession->widgetStack() )->resize( savedParentFullscreen->width(), savedParentFullscreen->height() ); | 649 | ( m_curSession->widgetStack() )->resize( savedParentFullscreen->width(), savedParentFullscreen->height() ); |
658 | ( m_curSession->emulationHandler() )->cornerButton()->hide(); | 650 | ( m_curSession->emulationHandler() )->cornerButton()->hide(); |
659 | disconnect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) ); | 651 | disconnect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) ); |
660 | 652 | ||
661 | } else { | 653 | } else { |
662 | savedParentFullscreen = ( m_curSession->widgetStack() )->parentWidget(); | 654 | savedParentFullscreen = ( m_curSession->widgetStack() )->parentWidget(); |
663 | ( m_curSession->widgetStack() )->setFrameStyle( QFrame::NoFrame ); | 655 | ( m_curSession->widgetStack() )->setFrameStyle( QFrame::NoFrame ); |
664 | ( m_curSession->widgetStack() )->reparent( 0, WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop | 656 | ( m_curSession->widgetStack() )->reparent( 0, WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop |
665 | , QPoint(0,0), false ); | 657 | , QPoint(0,0), false ); |
666 | ( m_curSession->widgetStack() )->resize( qApp->desktop()->width(), qApp->desktop()->height() ); | 658 | ( m_curSession->widgetStack() )->resize( qApp->desktop()->width(), qApp->desktop()->height() ); |
667 | ( m_curSession->widgetStack() )->setFocus(); | 659 | ( m_curSession->widgetStack() )->setFocus(); |
668 | ( m_curSession->widgetStack() )->show(); | 660 | ( m_curSession->widgetStack() )->show(); |
669 | 661 | ||
670 | ( ( m_curSession->emulationHandler() )->cornerButton() )->show(); | 662 | ( ( m_curSession->emulationHandler() )->cornerButton() )->show(); |
671 | 663 | ||
672 | connect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) ); | 664 | connect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) ); |
673 | } | 665 | } |
674 | 666 | ||
675 | m_isFullscreen = !m_isFullscreen; | 667 | m_isFullscreen = !m_isFullscreen; |
676 | } | 668 | } |
677 | 669 | ||
678 | 670 | ||
679 | void MainWindow::slotKeyReceived(FKey k, ushort, ushort, bool pressed) { | 671 | void MainWindow::slotKeyReceived(FKey k, ushort, ushort, bool pressed) { |
680 | 672 | ||
681 | if ( m_curSession ) { | 673 | if ( m_curSession ) { |
682 | 674 | ||
683 | QEvent::Type state; | 675 | QEvent::Type state; |
684 | 676 | ||
685 | if (pressed) state = QEvent::KeyPress; | 677 | if (pressed) state = QEvent::KeyPress; |
686 | else state = QEvent::KeyRelease; | 678 | else state = QEvent::KeyRelease; |
687 | 679 | ||
688 | QKeyEvent ke(state, k.qcode, k.unicode, 0, QString(QChar(k.unicode))); | 680 | QKeyEvent ke(state, k.qcode, k.unicode, 0, QString(QChar(k.unicode))); |
689 | 681 | ||
690 | // is this the best way to do this? cant figure out any other way to work | 682 | // is this the best way to do this? cant figure out any other way to work |
691 | QApplication::sendEvent((QObject *)m_curSession->widget(), &ke); | 683 | QApplication::sendEvent((QObject *)m_curSession->widget(), &ke); |
692 | ke.ignore(); | 684 | ke.ignore(); |
693 | } | 685 | } |
694 | } | 686 | } |
695 | void MainWindow::slotCopy() { | 687 | void MainWindow::slotCopy() { |
696 | if (!currentSession() ) return; | 688 | if (!currentSession() ) return; |
697 | currentSession()->emulationHandler()->copy(); | 689 | currentSession()->emulationHandler()->copy(); |
698 | } | 690 | } |
699 | void MainWindow::slotPaste() { | 691 | void MainWindow::slotPaste() { |
700 | if (!currentSession() ) return; | 692 | if (!currentSession() ) return; |
701 | currentSession()->emulationHandler()->paste(); | 693 | currentSession()->emulationHandler()->paste(); |
702 | } | 694 | } |
703 | 695 | ||
704 | /* | 696 | /* |
705 | * Save the session | 697 | * Save the session |
706 | */ | 698 | */ |
707 | 699 | ||
708 | void MainWindow::slotSaveSession() { | 700 | void MainWindow::slotSaveSession() { |
709 | if (!currentSession() ) { | 701 | if (!currentSession() ) { |
710 | QMessageBox::information(this, tr("Save Connection"), | 702 | QMessageBox::information(this, tr("Save Connection"), |
711 | tr("<qt>There is no Connection.</qt>"), 1 ); | 703 | tr("<qt>There is no Connection.</qt>"), 1 ); |
712 | return; | 704 | return; |
713 | } | 705 | } |
714 | manager()->add( currentSession()->profile() ); | 706 | manager()->add( currentSession()->profile() ); |
715 | manager()->save(); | 707 | manager()->save(); |
716 | populateProfiles(); | 708 | populateProfiles(); |
717 | } | 709 | } |
718 | void MainWindow::slotSaveHistory() { | 710 | void MainWindow::slotSaveHistory() { |
719 | QMap<QString, QStringList> map; | 711 | QMap<QString, QStringList> map; |
720 | QStringList text; | 712 | QStringList text; |
721 | text << "text/plain"; | 713 | text << "text/plain"; |
722 | map.insert(tr("History"), text ); | 714 | map.insert(tr("History"), text ); |
723 | QString filename = OFileDialog::getSaveFileName(2, QPEApplication::documentDir(), QString::null, map); | 715 | QString filename = OFileDialog::getSaveFileName(2, QPEApplication::documentDir(), QString::null, map); |
724 | if (filename.isEmpty() ) return; | 716 | if (filename.isEmpty() ) return; |
725 | 717 | ||
726 | QFileInfo info(filename); | 718 | QFileInfo info(filename); |
727 | 719 | ||
728 | DocLnk nf; | 720 | DocLnk nf; |
729 | nf.setType("text/plain"); | 721 | nf.setType("text/plain"); |
730 | nf.setFile(filename); | 722 | nf.setFile(filename); |
731 | nf.setName(info.fileName()); | 723 | nf.setName(info.fileName()); |
732 | 724 | ||
733 | 725 | ||
734 | QFile file(filename); | 726 | QFile file(filename); |
735 | file.open(IO_WriteOnly ); | 727 | file.open(IO_WriteOnly ); |
736 | QTextStream str(&file ); | 728 | QTextStream str(&file ); |
737 | if ( currentSession() ) | 729 | if ( currentSession() ) |
738 | currentSession()->emulationHandler()->emulation()->streamHistory(&str); | 730 | currentSession()->emulationHandler()->emulation()->streamHistory(&str); |
739 | 731 | ||
740 | file.close(); | 732 | file.close(); |
741 | nf.writeLink(); | 733 | nf.writeLink(); |
742 | } | 734 | } |