summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-console/mainwindow.cpp
Side-by-side diff
Diffstat (limited to 'noncore/apps/opie-console/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/mainwindow.cpp35
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
@@ -1,31 +1,33 @@
#include <assert.h>
#include <qaction.h>
#include <qmenubar.h>
#include <qlabel.h>
#include <qpopupmenu.h>
#include <qtoolbar.h>
#include <qmessagebox.h>
#include <qpushbutton.h>
#include <qwhatsthis.h>
#include <qfileinfo.h>
+#include <qtextstream.h>
#include <qpe/resource.h>
#include <qpe/qpeapplication.h>
#include <qpe/filemanager.h>
#include <qpe/mimetype.h>
#include <opie/ofiledialog.h>
+#include "TEmulation.h"
#include "keytrans.h"
#include "profileeditordialog.h"
#include "configdialog.h"
#include "default.h"
#include "metafactory.h"
#include "profile.h"
#include "profilemanager.h"
#include "mainwindow.h"
#include "tabwidget.h"
#include "transferdialog.h"
#include "function_keyboard.h"
#include "emulation_handler.h"
@@ -232,24 +234,30 @@ 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();
+
+ 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() ),
this, SLOT(slotTerminate() ) );
m_closewindow = new QAction();
m_closewindow->setText( tr("Close Window") );
m_closewindow->addTo( m_console );
@@ -293,25 +301,25 @@ void MainWindow::initUI() {
/* and the keyboard */
m_keyBar = new QToolBar(this);
addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE );
m_keyBar->setHorizontalStretchable( TRUE );
m_keyBar->hide();
m_kb = new FunctionKeyboard(m_keyBar);
connect(m_kb, SIGNAL(keyPressed(FKey, ushort, ushort, bool)),
this, SLOT(slotKeyReceived(FKey, ushort, ushort, bool)));
- QAction *a = new QAction(tr("Copy"),
+ a = new QAction(tr("Copy"),
Resource::loadPixmap("copy"), QString::null,
0, this, 0 );
//a->addTo( m_icons );
connect( a, SIGNAL(activated() ),
this, SLOT(slotCopy() ) );
QAction *paste = new QAction(tr("Paste"),
Resource::loadPixmap("paste"), QString::null,
0, this, 0 );
connect( paste, SIGNAL(activated() ),
this, SLOT(slotPaste() ) );
@@ -759,12 +767,37 @@ 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::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();
+}