Diffstat (limited to 'noncore/apps/opie-console/mainwindow.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 54 |
1 files changed, 49 insertions, 5 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 @@ -21,24 +21,25 @@ using namespace Opie::Ui; /* QT */ #include <qaction.h> #include <qmenubar.h> #include <qtoolbar.h> #include <qmessagebox.h> #include <qwhatsthis.h> #include <qfileinfo.h> /* STD */ #include <assert.h> MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) { + #ifdef FSCKED_DISTRI FixIt fix; fix.fixIt(); #endif setCaption(QObject::tr("Opie Console") ); KeyTrans::loadAll(); for (int i = 0; i < KeyTrans::count(); i++ ) { KeyTrans* s = KeyTrans::find(i ); assert( s ); } m_factory = new MetaFactory(); @@ -113,29 +114,30 @@ void MainWindow::initUI() { /* * disconnect action */ m_disconnect = new QAction( tr("Disconnect"), Resource::loadPixmap("console/notconnected"), QString::null, 0, this, 0 ); m_disconnect->addTo( m_console ); connect(m_disconnect, SIGNAL(activated() ), this, SLOT(slotDisconnect() ) ); m_console->insertSeparator(); - +#ifndef EAST m_quickLaunch = new QAction( tr("QuickLaunch"), Resource::loadPixmap("console/konsole_mini"), QString::null, 0, this, 0 ); m_quickLaunch->addTo( m_icons ); connect( m_quickLaunch, SIGNAL( activated() ), this, SLOT( slotQuickLaunch() ) ); +#endif QWhatsThis::add( m_icons, tr( "The shell button launches the \"default\" profile. If there is none default values are taken" ) ); m_transfer = new QAction( tr("Transfer file..."), Resource::loadPixmap("pass") , QString::null, 0, this, 0 ); m_transfer->addTo( m_console ); connect(m_transfer, SIGNAL(activated() ), this, SLOT(slotTransfer() ) ); /* @@ -151,24 +153,31 @@ void MainWindow::initUI() { * fullscreen */ m_isFullscreen = false; m_fullscreen = new QAction( tr("Full screen"), Resource::loadPixmap( "fullscreen" ) , QString::null, 0, this, 0 ); m_fullscreen->addTo( m_console ); connect( m_fullscreen, SIGNAL( activated() ), this, SLOT( slotFullscreen() ) ); m_console->insertSeparator(); + m_recordLog = new QAction(); + m_recordLog->setText( tr("Start log") ); + m_recordLog->addTo( m_console ); + connect(m_recordLog, SIGNAL(activated() ), + this, SLOT( slotSaveLog() ) ); + m_recordingLog = false; + QAction *a = new QAction(); a->setText( tr("Save history") ); a->addTo( m_console ); connect(a, SIGNAL(activated() ), this, SLOT(slotSaveHistory() ) ); /* * terminate action */ m_terminate = new QAction(); m_terminate->setText( tr("Terminate") ); m_terminate->addTo( m_console ); connect(m_terminate, SIGNAL(activated() ), @@ -413,38 +422,37 @@ void MainWindow::slotDisconnect() { } void MainWindow::slotTerminate() { if ( currentSession() ) currentSession()->layer()->close(); slotClose(); /* FIXME move to the next session */ } - - - void MainWindow::slotQuickLaunch() { + Profile prof = manager()->profile( "default" ); if ( prof.name() == "default" ) { create( prof ); } else { + #ifndef EAST Profile newProf = Profile( "default", "console", "default" , 0, 3, 0 ); newProf.setAutoConnect( true ); create( newProf ); slotSaveSession(); + #endif } - } void MainWindow::slotConfigure() { ConfigDialog conf( manager()->all(), factory() ); int ret = QPEApplication::execDialog( &conf ); if ( QDialog::Accepted == ret ) { manager()->setProfiles( conf.list() ); manager()->save(); populateProfiles(); } @@ -599,24 +607,30 @@ void MainWindow::slotSessionChanged( Session* ses ) { m_disconnect->setEnabled( true ); m_recordScript->setEnabled(!m_curSession->emulationHandler()->isRecording()); m_saveScript->setEnabled(m_curSession->emulationHandler()->isRecording()); m_scripts->setItemEnabled(m_runScript_id, true); } else { m_connect->setEnabled( true ); m_disconnect->setEnabled( false ); m_recordScript->setEnabled( false ); m_saveScript->setEnabled( false ); m_scripts->setItemEnabled(m_runScript_id, false); } + if ( ( currentSession()->emulationHandler()->isLogging() ) ) { + m_recordLog->setText( tr("Stop log") ); + } else { + m_recordLog->setText( tr("Start log") ); + } + if ( ( m_curSession->layer() )->supports()[1] == 0 ) { m_transfer->setEnabled( false ); } else { m_transfer->setEnabled( true ); } QWidget *w = m_curSession->widget(); if(w) w->setFocus(); if(currentSession()->profile().readNumEntry("Wrap", 80)){ m_isWrapped = true; } else { @@ -698,24 +712,54 @@ void MainWindow::slotPaste() { */ void MainWindow::slotSaveSession() { if (!currentSession() ) { QMessageBox::information(this, tr("Save Connection"), tr("<qt>There is no Connection.</qt>"), 1 ); return; } manager()->add( currentSession()->profile() ); manager()->save(); populateProfiles(); } + + + +void MainWindow::slotSaveLog() { + + if( currentSession()->emulationHandler()->isLogging() ) { + DocLnk nf; + QString m_logName = currentSession()->emulationHandler()->logFileName(); + QFileInfo info(m_logName); + nf.setType("text/plain"); + nf.setFile(m_logName); + nf.setName(info.fileName()); + nf.writeLink(); + m_recordLog->setText( tr("Start log") ); + m_recordingLog = false; + currentSession()->emulationHandler()->clearLog(); + } else { + QMap<QString, QStringList> map; + QStringList text; + text << "text/plain"; + map.insert(tr("Log"), text ); + QString m_logName = OFileDialog::getSaveFileName(2, QPEApplication::documentDir(), QString::null, map); + if (m_logName.isEmpty() ) return; + + m_recordLog->setText( tr("Stop log") ); + m_recordingLog = true; + currentSession()->emulationHandler()->startLogging(m_logName); + } +} + void MainWindow::slotSaveHistory() { QMap<QString, QStringList> map; QStringList text; text << "text/plain"; map.insert(tr("History"), text ); QString filename = OFileDialog::getSaveFileName(2, QPEApplication::documentDir(), QString::null, map); if (filename.isEmpty() ) return; QFileInfo info(filename); DocLnk nf; nf.setType("text/plain"); |