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,43 +1,45 @@
#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"
#include "script.h"
static char * filesave_xpm[] = {
"16 16 78 1",
" c None",
". c #343434",
"+ c #A0A0A0",
"@ c #565656",
"# c #9E9E9E",
"$ c #525252",
"% c #929292",
"& c #676767",
@@ -220,48 +222,54 @@ void MainWindow::initUI() {
m_transfer->addTo( m_console );
connect(m_transfer, SIGNAL(activated() ),
this, SLOT(slotTransfer() ) );
/*
* immediate change of line wrap policy
*/
m_isWrapped = false;
m_wrap = new QAction( tr("Line wrap"), Resource::loadPixmap( "linewrap" ), QString::null, 0, this, 0 );
m_wrap->addTo( m_console );
connect( m_wrap, SIGNAL( activated() ), SLOT( slotWrap() ) );
/*
* 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 );
connect( m_closewindow, SIGNAL(activated() ),
this, SLOT(slotClose() ) );
/*
* script actions
*/
m_runScript_id = m_scripts->insertItem(tr("Run Script"), m_scriptsPop, -1, 0);
connect(m_scriptsPop, SIGNAL(activated(int)), this, SLOT(slotRunScript(int)));
m_recordScript = new QAction(tr("Record Script"), QString::null, 0, this, 0);
m_recordScript->addTo(m_scripts);
@@ -281,49 +289,49 @@ void MainWindow::initUI() {
m_openKeys->setToggleAction(true);
connect (m_openKeys, SIGNAL(toggled(bool)), this, SLOT(slotOpenKeb(bool)));
/* insert the submenu */
m_console->insertItem(tr("New from Profile"), m_sessionsPop,
-1, 0);
/* insert the connection menu */
m_bar->insertItem( tr("Connection"), m_console );
/* the scripts menu */
m_bar->insertItem( tr("Scripts"), m_scripts );
/* 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() ) );
newCon->addTo( m_icons );
m_setProfiles->addTo( m_icons );
paste->addTo( m_icons );
m_openKeys->addTo(m_icons);
m_fullscreen->addTo( m_icons );
m_connect->setEnabled( false );
m_disconnect->setEnabled( false );
m_terminate->setEnabled( false );
m_transfer->setEnabled( false );
m_scripts->setItemEnabled(m_runScript_id, false);
@@ -747,24 +755,49 @@ void MainWindow::slotKeyReceived(FKey k, ushort, ushort, bool pressed) {
}
void MainWindow::slotCopy() {
if (!currentSession() ) return;
currentSession()->emulationHandler()->copy();
}
void MainWindow::slotPaste() {
if (!currentSession() ) return;
currentSession()->emulationHandler()->paste();
}
/*
* Save the session
*/
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();
+}