summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/emulation_handler.cpp7
-rw-r--r--noncore/apps/opie-console/emulation_handler.h2
-rw-r--r--noncore/apps/opie-console/mainwindow.cpp43
-rw-r--r--noncore/apps/opie-console/mainwindow.h3
4 files changed, 54 insertions, 1 deletions
diff --git a/noncore/apps/opie-console/emulation_handler.cpp b/noncore/apps/opie-console/emulation_handler.cpp
index e0f63cd..7924568 100644
--- a/noncore/apps/opie-console/emulation_handler.cpp
+++ b/noncore/apps/opie-console/emulation_handler.cpp
@@ -1,41 +1,41 @@
1#include <qwidget.h> 1#include <qwidget.h>
2#include <qpushbutton.h> 2#include <qpushbutton.h>
3 3
4#include "TEWidget.h" 4#include "TEWidget.h"
5#include "TEmuVt102.h" 5#include "TEmuVt102.h"
6 6
7#include "profile.h" 7#include "profile.h"
8#include "emulation_handler.h" 8#include "emulation_handler.h"
9#include "script.h" 9#include "script.h"
10 10
11EmulationHandler::EmulationHandler( const Profile& prof, QWidget* parent,const char* name ) 11EmulationHandler::EmulationHandler( const Profile& prof, QWidget* parent,const char* name )
12 : QObject(0, name ) 12 : QObject(0, name )
13{ 13{
14 m_teWid = new TEWidget( parent, "TerminalMain"); 14 m_teWid = new TEWidget( parent, "TerminalMain");
15 // use setWrapAt(0) for classic behaviour (wrap at screen width, no scrollbar) 15 // use setWrapAt(0) for classic behaviour (wrap at screen width, no scrollbar)
16 // use setWrapAt(80) for normal console with scrollbar 16 // use setWrapAt(80) for normal console with scrollbar
17 m_teWid->setWrapAt(prof.readNumEntry("Wrap", 0) ? 0 : 80); 17 setWrap(prof.readNumEntry("Wrap", 0) ? 0 : 80);
18 m_teWid->setMinimumSize(150, 70 ); 18 m_teWid->setMinimumSize(150, 70 );
19 m_script = 0; 19 m_script = 0;
20 parent->resize( m_teWid->calcSize(80, 24 ) ); 20 parent->resize( m_teWid->calcSize(80, 24 ) );
21 m_teEmu = new TEmuVt102(m_teWid ); 21 m_teEmu = new TEmuVt102(m_teWid );
22 22
23 connect(m_teEmu,SIGNAL(ImageSizeChanged(int, int) ), 23 connect(m_teEmu,SIGNAL(ImageSizeChanged(int, int) ),
24 this, SIGNAL(changeSize(int, int) ) ); 24 this, SIGNAL(changeSize(int, int) ) );
25 connect(m_teEmu, SIGNAL(sndBlock(const char*, int) ), 25 connect(m_teEmu, SIGNAL(sndBlock(const char*, int) ),
26 this, SLOT(recvEmulation(const char*, int) ) ); 26 this, SLOT(recvEmulation(const char*, int) ) );
27 m_teEmu->setConnect( true ); 27 m_teEmu->setConnect( true );
28 m_teEmu->setHistory( TRUE ); 28 m_teEmu->setHistory( TRUE );
29 load( prof ); 29 load( prof );
30 30
31 31
32 32
33} 33}
34EmulationHandler::~EmulationHandler() { 34EmulationHandler::~EmulationHandler() {
35 if (isRecording()) 35 if (isRecording())
36 clearScript(); 36 clearScript();
37 delete m_teEmu; 37 delete m_teEmu;
38 delete m_teWid; 38 delete m_teWid;
39} 39}
40 40
41void EmulationHandler::load( const Profile& prof) { 41void EmulationHandler::load( const Profile& prof) {
@@ -178,24 +178,29 @@ bool EmulationHandler::isRecording() {
178} 178}
179 179
180void EmulationHandler::startRecording() { 180void EmulationHandler::startRecording() {
181 if (!isRecording()) 181 if (!isRecording())
182 m_script = new Script(); 182 m_script = new Script();
183} 183}
184 184
185void EmulationHandler::clearScript() { 185void EmulationHandler::clearScript() {
186 if (isRecording()) { 186 if (isRecording()) {
187 delete m_script; 187 delete m_script;
188 m_script = 0; 188 m_script = 0;
189 } 189 }
190} 190}
191 191
192void EmulationHandler::runScript(const Script *script) { 192void EmulationHandler::runScript(const Script *script) {
193 emit send(script->script()); 193 emit send(script->script());
194} 194}
195 195
196void EmulationHandler::copy() { 196void EmulationHandler::copy() {
197 m_teWid->emitSelection(); 197 m_teWid->emitSelection();
198} 198}
199void EmulationHandler::paste() { 199void EmulationHandler::paste() {
200 m_teWid->pasteClipboard(); 200 m_teWid->pasteClipboard();
201} 201}
202
203void EmulationHandler::setWrap(int columns) {
204 m_teWid->setWrapAt(columns);
205}
206
diff --git a/noncore/apps/opie-console/emulation_handler.h b/noncore/apps/opie-console/emulation_handler.h
index 12abbc5..7bc6f16 100644
--- a/noncore/apps/opie-console/emulation_handler.h
+++ b/noncore/apps/opie-console/emulation_handler.h
@@ -45,48 +45,50 @@ public:
45 */ 45 */
46 ~EmulationHandler(); 46 ~EmulationHandler();
47 47
48 void load( const Profile& ); 48 void load( const Profile& );
49 QWidget* widget(); 49 QWidget* widget();
50 void setColor( const QColor& fore, const QColor& back ); 50 void setColor( const QColor& fore, const QColor& back );
51 QPushButton* cornerButton(); 51 QPushButton* cornerButton();
52 52
53 /* Scripts */ 53 /* Scripts */
54 /* Create a new script and record all typed characters */ 54 /* Create a new script and record all typed characters */
55 void startRecording(); 55 void startRecording();
56 56
57 /* Return whether we are currently recording a script */ 57 /* Return whether we are currently recording a script */
58 bool isRecording(); 58 bool isRecording();
59 59
60 /* Return the current script (or NULL) */ 60 /* Return the current script (or NULL) */
61 Script *script(); 61 Script *script();
62 62
63 /* Stop recording and remove the current script from memory */ 63 /* Stop recording and remove the current script from memory */
64 void clearScript(); 64 void clearScript();
65 65
66 /* Run a script by forwarding its keys to the EmulationLayer */ 66 /* Run a script by forwarding its keys to the EmulationLayer */
67 void runScript(const Script *); 67 void runScript(const Script *);
68 68
69 /* Propagate change to widget */
70 void setWrap(int columns);
69signals: 71signals:
70 void send( const QByteArray& ); 72 void send( const QByteArray& );
71 void changeSize(int rows, int cols ); 73 void changeSize(int rows, int cols );
72 74
73 75
74public slots: 76public slots:
75 void recv( const QByteArray& ); 77 void recv( const QByteArray& );
76 void paste(); 78 void paste();
77 void copy(); 79 void copy();
78 80
79private slots: 81private slots:
80 void recvEmulation( const char*, int len ); 82 void recvEmulation( const char*, int len );
81private: 83private:
82 QFont font( int ); 84 QFont font( int );
83 QColor foreColor(int ); 85 QColor foreColor(int );
84 QColor backColor(int ); 86 QColor backColor(int );
85 87
86private: 88private:
87 TEWidget* m_teWid; 89 TEWidget* m_teWid;
88 TEmulation* m_teEmu; 90 TEmulation* m_teEmu;
89 Script * m_script; 91 Script * m_script;
90}; 92};
91 93
92#endif 94#endif
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp
index 936b1b2..d221715 100644
--- a/noncore/apps/opie-console/mainwindow.cpp
+++ b/noncore/apps/opie-console/mainwindow.cpp
@@ -200,48 +200,55 @@ void MainWindow::initUI() {
200 */ 200 */
201 m_connect = new QAction( tr("Connect"), Resource::loadPixmap("console/connected"), 201 m_connect = new QAction( tr("Connect"), Resource::loadPixmap("console/connected"),
202 QString::null, 0, this, 0 ); 202 QString::null, 0, this, 0 );
203 m_connect->addTo( m_console ); 203 m_connect->addTo( m_console );
204 connect(m_connect, SIGNAL(activated() ), 204 connect(m_connect, SIGNAL(activated() ),
205 this, SLOT(slotConnect() ) ); 205 this, SLOT(slotConnect() ) );
206 206
207 /* 207 /*
208 * disconnect action 208 * disconnect action
209 */ 209 */
210 m_disconnect = new QAction( tr("Disconnect"), Resource::loadPixmap("console/notconnected"), 210 m_disconnect = new QAction( tr("Disconnect"), Resource::loadPixmap("console/notconnected"),
211 QString::null, 0, this, 0 ); 211 QString::null, 0, this, 0 );
212 m_disconnect->addTo( m_console ); 212 m_disconnect->addTo( m_console );
213 connect(m_disconnect, SIGNAL(activated() ), 213 connect(m_disconnect, SIGNAL(activated() ),
214 this, SLOT(slotDisconnect() ) ); 214 this, SLOT(slotDisconnect() ) );
215 215
216 m_console->insertSeparator(); 216 m_console->insertSeparator();
217 217
218 m_transfer = new QAction( tr("Transfer file..."), Resource::loadPixmap("pass") , QString::null, 218 m_transfer = new QAction( tr("Transfer file..."), Resource::loadPixmap("pass") , QString::null,
219 0, this, 0 ); 219 0, this, 0 );
220 m_transfer->addTo( m_console ); 220 m_transfer->addTo( m_console );
221 connect(m_transfer, SIGNAL(activated() ), 221 connect(m_transfer, SIGNAL(activated() ),
222 this, SLOT(slotTransfer() ) ); 222 this, SLOT(slotTransfer() ) );
223 223
224 /*
225 * immediate change of line wrap policy
226 */
227 m_isWrapped = false;
228 m_wrap = new QAction( tr("Line wrap"), Resource::loadPixmap( "linewrap" ), QString::null, 0, this, 0 );
229 m_wrap->addTo( m_console );
230 connect( m_wrap, SIGNAL( activated() ), SLOT( slotWrap() ) );
224 231
225 /* 232 /*
226 * fullscreen 233 * fullscreen
227 */ 234 */
228 m_isFullscreen = false; 235 m_isFullscreen = false;
229 236
230 m_fullscreen = new QAction( tr("Full screen"), Resource::loadPixmap( "fullscreen" ) 237 m_fullscreen = new QAction( tr("Full screen"), Resource::loadPixmap( "fullscreen" )
231 , QString::null, 0, this, 0); 238 , QString::null, 0, this, 0);
232 m_fullscreen->addTo( m_console ); 239 m_fullscreen->addTo( m_console );
233 connect( m_fullscreen, SIGNAL( activated() ), 240 connect( m_fullscreen, SIGNAL( activated() ),
234 this, SLOT( slotFullscreen() ) ); 241 this, SLOT( slotFullscreen() ) );
235 242
236 m_console->insertSeparator(); 243 m_console->insertSeparator();
237 /* 244 /*
238 * terminate action 245 * terminate action
239 */ 246 */
240 m_terminate = new QAction(); 247 m_terminate = new QAction();
241 m_terminate->setText( tr("Terminate") ); 248 m_terminate->setText( tr("Terminate") );
242 m_terminate->addTo( m_console ); 249 m_terminate->addTo( m_console );
243 connect(m_terminate, SIGNAL(activated() ), 250 connect(m_terminate, SIGNAL(activated() ),
244 this, SLOT(slotTerminate() ) ); 251 this, SLOT(slotTerminate() ) );
245 252
246 m_closewindow = new QAction(); 253 m_closewindow = new QAction();
247 m_closewindow->setText( tr("Close Window") ); 254 m_closewindow->setText( tr("Close Window") );
@@ -303,48 +310,49 @@ void MainWindow::initUI() {
303 this, SLOT(slotCopy() ) ); 310 this, SLOT(slotCopy() ) );
304 311
305 QAction *paste = new QAction(tr("Paste"), 312 QAction *paste = new QAction(tr("Paste"),
306 Resource::loadPixmap("paste"), QString::null, 313 Resource::loadPixmap("paste"), QString::null,
307 0, this, 0 ); 314 0, this, 0 );
308 connect( paste, SIGNAL(activated() ), 315 connect( paste, SIGNAL(activated() ),
309 this, SLOT(slotPaste() ) ); 316 this, SLOT(slotPaste() ) );
310 317
311 318
312 newCon->addTo( m_icons ); 319 newCon->addTo( m_icons );
313 m_setProfiles->addTo( m_icons ); 320 m_setProfiles->addTo( m_icons );
314 paste->addTo( m_icons ); 321 paste->addTo( m_icons );
315 m_openKeys->addTo(m_icons); 322 m_openKeys->addTo(m_icons);
316 m_fullscreen->addTo( m_icons ); 323 m_fullscreen->addTo( m_icons );
317 324
318 m_connect->setEnabled( false ); 325 m_connect->setEnabled( false );
319 m_disconnect->setEnabled( false ); 326 m_disconnect->setEnabled( false );
320 m_terminate->setEnabled( false ); 327 m_terminate->setEnabled( false );
321 m_transfer->setEnabled( false ); 328 m_transfer->setEnabled( false );
322 m_scripts->setItemEnabled(m_runScript_id, false); 329 m_scripts->setItemEnabled(m_runScript_id, false);
323 m_recordScript->setEnabled( false ); 330 m_recordScript->setEnabled( false );
324 m_saveScript->setEnabled( false ); 331 m_saveScript->setEnabled( false );
325 m_fullscreen->setEnabled( false ); 332 m_fullscreen->setEnabled( false );
326 m_closewindow->setEnabled( false ); 333 m_closewindow->setEnabled( false );
334 m_wrap->setEnabled( false );
327 335
328 /* 336 /*
329 * connect to the menu activation 337 * connect to the menu activation
330 */ 338 */
331 connect( m_sessionsPop, SIGNAL(activated( int ) ), 339 connect( m_sessionsPop, SIGNAL(activated( int ) ),
332 this, SLOT(slotProfile( int ) ) ); 340 this, SLOT(slotProfile( int ) ) );
333 341
334 m_consoleWindow = new TabWidget( this, "blah"); 342 m_consoleWindow = new TabWidget( this, "blah");
335 connect(m_consoleWindow, SIGNAL(activated(Session*) ), 343 connect(m_consoleWindow, SIGNAL(activated(Session*) ),
336 this, SLOT(slotSessionChanged(Session*) ) ); 344 this, SLOT(slotSessionChanged(Session*) ) );
337 setCentralWidget( m_consoleWindow ); 345 setCentralWidget( m_consoleWindow );
338 346
339} 347}
340 348
341ProfileManager* MainWindow::manager() { 349ProfileManager* MainWindow::manager() {
342 return m_manager; 350 return m_manager;
343} 351}
344TabWidget* MainWindow::tabWidget() { 352TabWidget* MainWindow::tabWidget() {
345 return m_consoleWindow; 353 return m_consoleWindow;
346} 354}
347void MainWindow::populateProfiles() { 355void MainWindow::populateProfiles() {
348 m_sessionsPop->clear(); 356 m_sessionsPop->clear();
349 Profile::ValueList list = manager()->all(); 357 Profile::ValueList list = manager()->all();
350 for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) { 358 for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) {
@@ -504,104 +512,112 @@ void MainWindow::slotConfigure() {
504 * and set the currentSession() 512 * and set the currentSession()
505 */ 513 */
506void MainWindow::slotClose() { 514void MainWindow::slotClose() {
507 if (!currentSession() ) 515 if (!currentSession() )
508 return; 516 return;
509 517
510 Session* ses = currentSession(); 518 Session* ses = currentSession();
511 qWarning("removing! currentSession %s", currentSession()->name().latin1() ); 519 qWarning("removing! currentSession %s", currentSession()->name().latin1() );
512 /* set to NULL to be safe, if its needed slotSessionChanged resets it automatically */ 520 /* set to NULL to be safe, if its needed slotSessionChanged resets it automatically */
513 m_curSession = NULL; 521 m_curSession = NULL;
514 tabWidget()->remove( /*currentSession()*/ses ); 522 tabWidget()->remove( /*currentSession()*/ses );
515 /*it's autodelete */ 523 /*it's autodelete */
516 m_sessions.remove( ses ); 524 m_sessions.remove( ses );
517 qWarning("after remove!!"); 525 qWarning("after remove!!");
518 526
519 if (!currentSession() ) { 527 if (!currentSession() ) {
520 m_connect->setEnabled( false ); 528 m_connect->setEnabled( false );
521 m_disconnect->setEnabled( false ); 529 m_disconnect->setEnabled( false );
522 m_terminate->setEnabled( false ); 530 m_terminate->setEnabled( false );
523 m_transfer->setEnabled( false ); 531 m_transfer->setEnabled( false );
524 m_recordScript->setEnabled( false ); 532 m_recordScript->setEnabled( false );
525 m_saveScript->setEnabled( false ); 533 m_saveScript->setEnabled( false );
526 m_scripts->setItemEnabled(m_runScript_id, false); 534 m_scripts->setItemEnabled(m_runScript_id, false);
527 m_fullscreen->setEnabled( false ); 535 m_fullscreen->setEnabled( false );
536 m_wrap->setEnabled( false );
528 m_closewindow->setEnabled( false ); 537 m_closewindow->setEnabled( false );
529 } 538 }
530 539
531 m_kb->loadDefaults(); 540 m_kb->loadDefaults();
532} 541}
533 542
534/* 543/*
535 * We will get the name 544 * We will get the name
536 * Then the profile 545 * Then the profile
537 * and then we will make a profile 546 * and then we will make a profile
538 */ 547 */
539void MainWindow::slotProfile( int id) { 548void MainWindow::slotProfile( int id) {
540 Profile prof = manager()->profile( m_sessionsPop->text( id) ); 549 Profile prof = manager()->profile( m_sessionsPop->text( id) );
541 create( prof ); 550 create( prof );
542} 551}
543void MainWindow::create( const Profile& prof ) { 552void MainWindow::create( const Profile& prof ) {
544 if(m_curSession) 553 if(m_curSession)
545 if(m_curSession->transferDialog()) m_curSession->transferDialog()->hide(); 554 if(m_curSession->transferDialog()) m_curSession->transferDialog()->hide();
546 555
547 Session *ses = manager()->fromProfile( prof, tabWidget() ); 556 Session *ses = manager()->fromProfile( prof, tabWidget() );
548 557
549 if((!ses) || (!ses->layer()) || (!ses->widgetStack())) 558 if((!ses) || (!ses->layer()) || (!ses->widgetStack()))
550 { 559 {
551 QMessageBox::warning(this, 560 QMessageBox::warning(this,
552 QObject::tr("Session failed"), 561 QObject::tr("Session failed"),
553 QObject::tr("<qt>Cannot open session: Not all components were found.</qt>")); 562 QObject::tr("<qt>Cannot open session: Not all components were found.</qt>"));
554 //if(ses) delete ses; 563 //if(ses) delete ses;
555 return; 564 return;
556 } 565 }
557 566
558 m_sessions.append( ses ); 567 m_sessions.append( ses );
559 tabWidget()->add( ses ); 568 tabWidget()->add( ses );
560 tabWidget()->repaint(); 569 tabWidget()->repaint();
561 m_curSession = ses; 570 m_curSession = ses;
562 571
563 // dicide if its a local term ( then no connction and no tranfer), maybe make a wrapper method out of it 572 // dicide if its a local term ( then no connction and no tranfer), maybe make a wrapper method out of it
564 m_connect->setEnabled( true ); 573 m_connect->setEnabled( true );
565 m_disconnect->setEnabled( false ); 574 m_disconnect->setEnabled( false );
566 m_terminate->setEnabled( true ); 575 m_terminate->setEnabled( true );
567 m_fullscreen->setEnabled( true ); 576 m_fullscreen->setEnabled( true );
577 m_wrap->setEnabled( true );
568 m_closewindow->setEnabled( true ); 578 m_closewindow->setEnabled( true );
569 m_transfer->setEnabled( false ); 579 m_transfer->setEnabled( false );
570 m_recordScript->setEnabled( false ); 580 m_recordScript->setEnabled( false );
571 m_saveScript->setEnabled( false ); 581 m_saveScript->setEnabled( false );
572 m_scripts->setItemEnabled(m_runScript_id, false); 582 m_scripts->setItemEnabled(m_runScript_id, false);
573 583
574 // is io_layer wants direct connection, then autoconnect 584 // is io_layer wants direct connection, then autoconnect
575 //if ( ( m_curSession->layer() )->supports()[0] == 1 ) { 585 //if ( ( m_curSession->layer() )->supports()[0] == 1 ) {
576 if (prof.autoConnect()) { 586 if (prof.autoConnect()) {
577 slotConnect(); 587 slotConnect();
578 } 588 }
579 589
580 590
581 QWidget *w = currentSession()->widget(); 591 QWidget *w = currentSession()->widget();
582 if(w) w->setFocus(); 592 if(w) w->setFocus();
583 593
594 if(currentSession()->profile().readNumEntry("Wrap", 80)){
595 m_isWrapped = true;
596 } else {
597 m_isWrapped = false;
598 }
599
584 m_kb->load(currentSession()->profile()); 600 m_kb->load(currentSession()->profile());
585} 601}
586 602
587void MainWindow::slotTransfer() 603void MainWindow::slotTransfer()
588{ 604{
589 if ( currentSession() ) { 605 if ( currentSession() ) {
590 Session *mysession = currentSession(); 606 Session *mysession = currentSession();
591 TransferDialog dlg(/*mysession->widgetStack()*/this, this); 607 TransferDialog dlg(/*mysession->widgetStack()*/this, this);
592 mysession->setTransferDialog(&dlg); 608 mysession->setTransferDialog(&dlg);
593 //dlg.reparent(mysession->widgetStack(), QPoint(0, 0)); 609 //dlg.reparent(mysession->widgetStack(), QPoint(0, 0));
594 //dlg.showMaximized(); 610 //dlg.showMaximized();
595 currentSession()->widgetStack()->addWidget(&dlg, -1); 611 currentSession()->widgetStack()->addWidget(&dlg, -1);
596 dlg.show(); 612 dlg.show();
597 //dlg.exec(); 613 //dlg.exec();
598 while(dlg.isRunning()) qApp->processEvents(); 614 while(dlg.isRunning()) qApp->processEvents();
599 mysession->setTransferDialog(0l); 615 mysession->setTransferDialog(0l);
600 } 616 }
601} 617}
602 618
603 619
604void MainWindow::slotOpenKeb(bool state) { 620void MainWindow::slotOpenKeb(bool state) {
605 621
606 if (state) m_keyBar->show(); 622 if (state) m_keyBar->show();
607 else m_keyBar->hide(); 623 else m_keyBar->hide();
@@ -633,52 +649,79 @@ void MainWindow::slotSessionChanged( Session* ses ) {
633 qDebug(QString("is connected : %1").arg( m_curSession->layer()->isConnected() ) ); 649 qDebug(QString("is connected : %1").arg( m_curSession->layer()->isConnected() ) );
634 if ( m_curSession->layer()->isConnected() ) { 650 if ( m_curSession->layer()->isConnected() ) {
635 m_connect->setEnabled( false ); 651 m_connect->setEnabled( false );
636 m_disconnect->setEnabled( true ); 652 m_disconnect->setEnabled( true );
637 m_recordScript->setEnabled(!m_curSession->emulationHandler()->isRecording()); 653 m_recordScript->setEnabled(!m_curSession->emulationHandler()->isRecording());
638 m_saveScript->setEnabled(m_curSession->emulationHandler()->isRecording()); 654 m_saveScript->setEnabled(m_curSession->emulationHandler()->isRecording());
639 m_scripts->setItemEnabled(m_runScript_id, true); 655 m_scripts->setItemEnabled(m_runScript_id, true);
640 } else { 656 } else {
641 m_connect->setEnabled( true ); 657 m_connect->setEnabled( true );
642 m_disconnect->setEnabled( false ); 658 m_disconnect->setEnabled( false );
643 m_recordScript->setEnabled( false ); 659 m_recordScript->setEnabled( false );
644 m_saveScript->setEnabled( false ); 660 m_saveScript->setEnabled( false );
645 m_scripts->setItemEnabled(m_runScript_id, false); 661 m_scripts->setItemEnabled(m_runScript_id, false);
646 } 662 }
647 663
648 if ( ( m_curSession->layer() )->supports()[1] == 0 ) { 664 if ( ( m_curSession->layer() )->supports()[1] == 0 ) {
649 m_transfer->setEnabled( false ); 665 m_transfer->setEnabled( false );
650 } else { 666 } else {
651 m_transfer->setEnabled( true ); 667 m_transfer->setEnabled( true );
652 } 668 }
653 669
654 QWidget *w = m_curSession->widget(); 670 QWidget *w = m_curSession->widget();
655 if(w) w->setFocus(); 671 if(w) w->setFocus();
656 672
673 if(currentSession()->profile().readNumEntry("Wrap", 80)){
674 m_isWrapped = true;
675 } else {
676 m_isWrapped = false;
677 }
678
657 m_kb->load(currentSession()->profile()); 679 m_kb->load(currentSession()->profile());
658 } 680 }
659} 681}
660 682
683void MainWindow::slotWrap()
684{
685 if(m_curSession)
686 {
687 EmulationHandler *e = m_curSession->emulationHandler();
688 if(e)
689 {
690 if(m_isWrapped)
691 {
692 e->setWrap(80);
693 m_isWrapped = false;
694 }
695 else
696 {
697 e->setWrap(0);
698 m_isWrapped = true;
699 }
700 }
701 }
702}
703
661void MainWindow::slotFullscreen() { 704void MainWindow::slotFullscreen() {
662 705
663 706
664 707
665 if ( m_isFullscreen ) { 708 if ( m_isFullscreen ) {
666 ( m_curSession->widgetStack() )->reparent( savedParentFullscreen, 0, QPoint(0,0), true ); 709 ( m_curSession->widgetStack() )->reparent( savedParentFullscreen, 0, QPoint(0,0), true );
667 ( m_curSession->widgetStack() )->resize( savedParentFullscreen->width(), savedParentFullscreen->height() ); 710 ( m_curSession->widgetStack() )->resize( savedParentFullscreen->width(), savedParentFullscreen->height() );
668 ( m_curSession->emulationHandler() )->cornerButton()->hide(); 711 ( m_curSession->emulationHandler() )->cornerButton()->hide();
669 disconnect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) ); 712 disconnect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) );
670 713
671 } else { 714 } else {
672 savedParentFullscreen = ( m_curSession->widgetStack() )->parentWidget(); 715 savedParentFullscreen = ( m_curSession->widgetStack() )->parentWidget();
673 ( m_curSession->widgetStack() )->setFrameStyle( QFrame::NoFrame ); 716 ( m_curSession->widgetStack() )->setFrameStyle( QFrame::NoFrame );
674 ( m_curSession->widgetStack() )->reparent( 0, WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop 717 ( m_curSession->widgetStack() )->reparent( 0, WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop
675 , QPoint(0,0), false ); 718 , QPoint(0,0), false );
676 ( m_curSession->widgetStack() )->resize( qApp->desktop()->width(), qApp->desktop()->height() ); 719 ( m_curSession->widgetStack() )->resize( qApp->desktop()->width(), qApp->desktop()->height() );
677 ( m_curSession->widgetStack() )->setFocus(); 720 ( m_curSession->widgetStack() )->setFocus();
678 ( m_curSession->widgetStack() )->show(); 721 ( m_curSession->widgetStack() )->show();
679 722
680 ( ( m_curSession->emulationHandler() )->cornerButton() )->show(); 723 ( ( m_curSession->emulationHandler() )->cornerButton() )->show();
681 724
682 connect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) ); 725 connect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) );
683 } 726 }
684 727
diff --git a/noncore/apps/opie-console/mainwindow.h b/noncore/apps/opie-console/mainwindow.h
index 3b16f0a..37219c5 100644
--- a/noncore/apps/opie-console/mainwindow.h
+++ b/noncore/apps/opie-console/mainwindow.h
@@ -46,48 +46,49 @@ public:
46 */ 46 */
47 QList<Session> sessions(); 47 QList<Session> sessions();
48 48
49 /** 49 /**
50 * 50 *
51 */ 51 */
52 ProfileManager* manager(); 52 ProfileManager* manager();
53 TabWidget* tabWidget(); 53 TabWidget* tabWidget();
54 54
55private slots: 55private slots:
56 void slotNew(); 56 void slotNew();
57 void slotConnect(); 57 void slotConnect();
58 void slotDisconnect(); 58 void slotDisconnect();
59 void slotTerminate(); 59 void slotTerminate();
60 void slotConfigure(); 60 void slotConfigure();
61 void slotClose(); 61 void slotClose();
62 void slotProfile(int); 62 void slotProfile(int);
63 void slotTransfer(); 63 void slotTransfer();
64 void slotOpenKeb(bool); 64 void slotOpenKeb(bool);
65 void slotOpenButtons(bool); 65 void slotOpenButtons(bool);
66 void slotRecordScript(); 66 void slotRecordScript();
67 void slotSaveScript(); 67 void slotSaveScript();
68 void slotRunScript(int); 68 void slotRunScript(int);
69 void slotFullscreen(); 69 void slotFullscreen();
70 void slotWrap();
70 void slotSessionChanged( Session* ); 71 void slotSessionChanged( Session* );
71 void slotKeyReceived(FKey, ushort, ushort, bool); 72 void slotKeyReceived(FKey, ushort, ushort, bool);
72 73
73 /* what could these both slot do? */ 74 /* what could these both slot do? */
74 void slotCopy(); 75 void slotCopy();
75 void slotPaste(); 76 void slotPaste();
76 77
77 /* save the currentSession() to Profiles */ 78 /* save the currentSession() to Profiles */
78 void slotSaveSession(); 79 void slotSaveSession();
79 80
80private: 81private:
81 void initUI(); 82 void initUI();
82 void populateProfiles(); 83 void populateProfiles();
83 void populateScripts(); 84 void populateScripts();
84 void create( const Profile& ); 85 void create( const Profile& );
85 /** 86 /**
86 * the current session 87 * the current session
87 */ 88 */
88 Session* m_curSession; 89 Session* m_curSession;
89 90
90 /** 91 /**
91 * the session list 92 * the session list
92 */ 93 */
93 QList<Session> m_sessions; 94 QList<Session> m_sessions;
@@ -98,35 +99,37 @@ private:
98 */ 99 */
99 MetaFactory* m_factory; 100 MetaFactory* m_factory;
100 ProfileManager* m_manager; 101 ProfileManager* m_manager;
101 102
102 TabWidget* m_consoleWindow; 103 TabWidget* m_consoleWindow;
103 QToolBar* m_tool; 104 QToolBar* m_tool;
104 QToolBar* m_icons; 105 QToolBar* m_icons;
105 QToolBar* m_keyBar; 106 QToolBar* m_keyBar;
106 QToolBar* m_buttonBar; 107 QToolBar* m_buttonBar;
107 QMenuBar* m_bar; 108 QMenuBar* m_bar;
108 QPopupMenu* m_console; 109 QPopupMenu* m_console;
109 QPopupMenu* m_sessionsPop; 110 QPopupMenu* m_sessionsPop;
110 QPopupMenu* m_scriptsPop; 111 QPopupMenu* m_scriptsPop;
111 QPopupMenu* m_scripts; 112 QPopupMenu* m_scripts;
112 QAction* m_connect; 113 QAction* m_connect;
113 QAction* m_disconnect; 114 QAction* m_disconnect;
114 QAction* m_terminate; 115 QAction* m_terminate;
115 QAction* m_transfer; 116 QAction* m_transfer;
116 QAction* m_setProfiles; 117 QAction* m_setProfiles;
117 QAction* m_openKeys; 118 QAction* m_openKeys;
118 QAction* m_openButtons; 119 QAction* m_openButtons;
119 QAction* m_recordScript; 120 QAction* m_recordScript;
120 QAction* m_saveScript; 121 QAction* m_saveScript;
121 QAction* m_fullscreen; 122 QAction* m_fullscreen;
123 QAction* m_wrap;
122 QAction* m_closewindow; 124 QAction* m_closewindow;
123 125
124 FunctionKeyboard *m_kb; 126 FunctionKeyboard *m_kb;
125 int m_runScript_id; 127 int m_runScript_id;
126 bool m_isFullscreen; 128 bool m_isFullscreen;
129 bool m_isWrapped;
127 130
128 QWidget* savedParentFullscreen; 131 QWidget* savedParentFullscreen;
129}; 132};
130 133
131 134
132#endif 135#endif