summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-console/mainwindow.cpp
Unidiff
Diffstat (limited to 'noncore/apps/opie-console/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/mainwindow.cpp60
1 files changed, 52 insertions, 8 deletions
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp
index 1a5a59f..a0622d4 100644
--- a/noncore/apps/opie-console/mainwindow.cpp
+++ b/noncore/apps/opie-console/mainwindow.cpp
@@ -30,9 +30,10 @@ using namespace Opie::Ui;
30#include <assert.h> 30#include <assert.h>
31 31
32MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) { 32MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) {
33
33#ifdef FSCKED_DISTRI 34#ifdef FSCKED_DISTRI
34 FixIt fix; 35 FixIt fix;
35 fix.fixIt(); 36 fix.fixIt();
36#endif 37#endif
37 38
38 setCaption(QObject::tr("Opie Console") ); 39 setCaption(QObject::tr("Opie Console") );
@@ -122,11 +123,12 @@ void MainWindow::initUI() {
122 123
123 m_console->insertSeparator(); 124 m_console->insertSeparator();
124 125
125 126#ifndef EAST
126 m_quickLaunch = new QAction( tr("QuickLaunch"), Resource::loadPixmap("console/konsole_mini"), QString::null, 0, this, 0 ); 127 m_quickLaunch = new QAction( tr("QuickLaunch"), Resource::loadPixmap("console/konsole_mini"), QString::null, 0, this, 0 );
127 m_quickLaunch->addTo( m_icons ); 128 m_quickLaunch->addTo( m_icons );
128 connect( m_quickLaunch, SIGNAL( activated() ), 129 connect( m_quickLaunch, SIGNAL( activated() ),
129 this, SLOT( slotQuickLaunch() ) ); 130 this, SLOT( slotQuickLaunch() ) );
131#endif
130 132
131 QWhatsThis::add( m_icons, tr( "The shell button launches the \"default\" profile. If there is none default values are taken" ) ); 133 QWhatsThis::add( m_icons, tr( "The shell button launches the \"default\" profile. If there is none default values are taken" ) );
132 134
@@ -160,6 +162,13 @@ void MainWindow::initUI() {
160 162
161 m_console->insertSeparator(); 163 m_console->insertSeparator();
162 164
165 m_recordLog = new QAction();
166 m_recordLog->setText( tr("Start log") );
167 m_recordLog->addTo( m_console );
168 connect(m_recordLog, SIGNAL(activated() ),
169 this, SLOT( slotSaveLog() ) );
170 m_recordingLog = false;
171
163 QAction *a = new QAction(); 172 QAction *a = new QAction();
164 a->setText( tr("Save history") ); 173 a->setText( tr("Save history") );
165 a->addTo( m_console ); 174 a->addTo( m_console );
@@ -422,20 +431,19 @@ void MainWindow::slotTerminate() {
422 431
423 432
424 433
425
426
427
428void MainWindow::slotQuickLaunch() { 434void MainWindow::slotQuickLaunch() {
429 Profile prof = manager()->profile( "default" ); 435
436 Profile prof = manager()->profile( "default" );
430 if ( prof.name() == "default" ) { 437 if ( prof.name() == "default" ) {
431 create( prof ); 438 create( prof );
432 } else { 439 } else {
440 #ifndef EAST
433 Profile newProf = Profile( "default", "console", "default" , 0, 3, 0 ); 441 Profile newProf = Profile( "default", "console", "default" , 0, 3, 0 );
434 newProf.setAutoConnect( true ); 442 newProf.setAutoConnect( true );
435 create( newProf ); 443 create( newProf );
436 slotSaveSession(); 444 slotSaveSession();
445 #endif
437 } 446 }
438
439} 447}
440 448
441void MainWindow::slotConfigure() { 449void MainWindow::slotConfigure() {
@@ -608,6 +616,12 @@ void MainWindow::slotSessionChanged( Session* ses ) {
608 m_scripts->setItemEnabled(m_runScript_id, false); 616 m_scripts->setItemEnabled(m_runScript_id, false);
609 } 617 }
610 618
619 if ( ( currentSession()->emulationHandler()->isLogging() ) ) {
620 m_recordLog->setText( tr("Stop log") );
621 } else {
622 m_recordLog->setText( tr("Start log") );
623 }
624
611 if ( ( m_curSession->layer() )->supports()[1] == 0 ) { 625 if ( ( m_curSession->layer() )->supports()[1] == 0 ) {
612 m_transfer->setEnabled( false ); 626 m_transfer->setEnabled( false );
613 } else { 627 } else {
@@ -707,6 +721,36 @@ void MainWindow::slotSaveSession() {
707 manager()->save(); 721 manager()->save();
708 populateProfiles(); 722 populateProfiles();
709} 723}
724
725
726
727void MainWindow::slotSaveLog() {
728
729 if( currentSession()->emulationHandler()->isLogging() ) {
730 DocLnk nf;
731 QString m_logName = currentSession()->emulationHandler()->logFileName();
732 QFileInfo info(m_logName);
733 nf.setType("text/plain");
734 nf.setFile(m_logName);
735 nf.setName(info.fileName());
736 nf.writeLink();
737 m_recordLog->setText( tr("Start log") );
738 m_recordingLog = false;
739 currentSession()->emulationHandler()->clearLog();
740 } else {
741 QMap<QString, QStringList> map;
742 QStringList text;
743 text << "text/plain";
744 map.insert(tr("Log"), text );
745 QString m_logName = OFileDialog::getSaveFileName(2, QPEApplication::documentDir(), QString::null, map);
746 if (m_logName.isEmpty() ) return;
747
748 m_recordLog->setText( tr("Stop log") );
749 m_recordingLog = true;
750 currentSession()->emulationHandler()->startLogging(m_logName);
751 }
752}
753
710void MainWindow::slotSaveHistory() { 754void MainWindow::slotSaveHistory() {
711 QMap<QString, QStringList> map; 755 QMap<QString, QStringList> map;
712 QStringList text; 756 QStringList text;