Diffstat (limited to 'noncore/apps/opie-console/mainwindow.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp index d221715..01468ca 100644 --- a/noncore/apps/opie-console/mainwindow.cpp +++ b/noncore/apps/opie-console/mainwindow.cpp @@ -10,4 +10,5 @@ #include <qwhatsthis.h> #include <qfileinfo.h> +#include <qtextstream.h> #include <qpe/resource.h> @@ -18,4 +19,5 @@ #include <opie/ofiledialog.h> +#include "TEmulation.h" #include "keytrans.h" #include "profileeditordialog.h" @@ -242,4 +244,10 @@ void MainWindow::initUI() { m_console->insertSeparator(); + + QAction *a = new QAction(); + a->setText( tr("Save history") ); + a->addTo( m_console ); + connect(a, SIGNAL(activated() ), + this, SLOT(slotSaveHistory() ) ); /* * terminate action @@ -303,5 +311,5 @@ void MainWindow::initUI() { - QAction *a = new QAction(tr("Copy"), + a = new QAction(tr("Copy"), Resource::loadPixmap("copy"), QString::null, 0, this, 0 ); @@ -769,2 +777,27 @@ void MainWindow::slotSaveSession() { populateProfiles(); } +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"); + nf.setFile(filename); + nf.setName(info.fileName()); + + + QFile file(filename); + file.open(IO_WriteOnly ); + QTextStream str(&file ); + if ( currentSession() ) + currentSession()->emulationHandler()->emulation()->streamHistory(&str); + + file.close(); + nf.writeLink(); +} |