summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/TEScreen.cpp17
-rw-r--r--noncore/apps/opie-console/TEScreen.h2
-rw-r--r--noncore/apps/opie-console/TEmulation.cpp4
-rw-r--r--noncore/apps/opie-console/TEmulation.h7
-rw-r--r--noncore/apps/opie-console/emulation_handler.cpp3
-rw-r--r--noncore/apps/opie-console/emulation_handler.h1
-rw-r--r--noncore/apps/opie-console/mainwindow.cpp35
-rw-r--r--noncore/apps/opie-console/mainwindow.h1
-rw-r--r--noncore/apps/opie-console/metafactory.cpp25
-rw-r--r--noncore/apps/opie-console/metafactory.h11
10 files changed, 64 insertions, 42 deletions
diff --git a/noncore/apps/opie-console/TEScreen.cpp b/noncore/apps/opie-console/TEScreen.cpp
index a3d115d..2675d31 100644
--- a/noncore/apps/opie-console/TEScreen.cpp
+++ b/noncore/apps/opie-console/TEScreen.cpp
@@ -986,5 +986,5 @@ void TEScreen::setSelExtentXY(const int x, const int y)
QString TEScreen::getSelText(const BOOL preserve_line_breaks)
{
- if (sel_begin == -1)
+ if (sel_begin == -1)
return QString::null; // Selection got clear while selecting.
@@ -1016,5 +1016,5 @@ QString TEScreen::getSelText(const BOOL preserve_line_breaks)
eol = sel_BR % columns + 1;
}
-
+
while (hX < eol)
{
@@ -1113,5 +1113,5 @@ QString TEScreen::getSelText(const BOOL preserve_line_breaks)
qc[i] = m[i];
}
-
+
QString res(qc, d);
@@ -1121,4 +1121,15 @@ QString TEScreen::getSelText(const BOOL preserve_line_breaks)
return res;
}
+QString TEScreen::getHistory() {
+ sel_begin = 0;
+ sel_BR = sel_begin;
+ sel_TL = sel_begin;
+ setSelExtentXY(columns-1,lines-1);
+ QString tmp=getSelText(true);
+ while (tmp.at(tmp.length()-2).unicode()==10 && tmp.at(tmp.length()-1).unicode()==10)
+ tmp.truncate(tmp.length()-1);
+
+ return tmp;
+}
/* above ... end of line processing for selection -- psilva
cases:
diff --git a/noncore/apps/opie-console/TEScreen.h b/noncore/apps/opie-console/TEScreen.h
index 473ce79..a840b44 100644
--- a/noncore/apps/opie-console/TEScreen.h
+++ b/noncore/apps/opie-console/TEScreen.h
@@ -163,4 +163,6 @@ public: // these are all `Screen' operations
void checkSelection(int from, int to);
+ QString getHistory();
+
private: // helper
diff --git a/noncore/apps/opie-console/TEmulation.cpp b/noncore/apps/opie-console/TEmulation.cpp
index 7a0c624..3b1b9e1 100644
--- a/noncore/apps/opie-console/TEmulation.cpp
+++ b/noncore/apps/opie-console/TEmulation.cpp
@@ -272,5 +272,7 @@ void TEmulation::clearSelection() {
showBulk();
}
-
+void TEmulation::streamHistory(QTextStream* stream) {
+ *stream << scr->getHistory();
+}
// Refreshing -------------------------------------------------------------- --
diff --git a/noncore/apps/opie-console/TEmulation.h b/noncore/apps/opie-console/TEmulation.h
index ec15e7a..d7b3d6d 100644
--- a/noncore/apps/opie-console/TEmulation.h
+++ b/noncore/apps/opie-console/TEmulation.h
@@ -25,4 +25,6 @@
#include <stdio.h>
#include <qtextcodec.h>
+#include <qtextstream.h>
+
#include "keytrans.h"
@@ -38,4 +40,5 @@ public:
virtual void setHistory(bool on);
virtual bool history();
+ virtual void streamHistory( QTextStream* );
public slots: // signals incoming from TEWidget
@@ -44,5 +47,5 @@ public slots: // signals incoming from TEWidget
virtual void onHistoryCursorChange(int cursor);
virtual void onKeyPress(QKeyEvent*);
-
+
virtual void clearSelection();
virtual void onSelectionBegin(const int x, const int y);
@@ -76,4 +79,6 @@ public:
void setKeytrans(const char * no);
+
+
protected:
diff --git a/noncore/apps/opie-console/emulation_handler.cpp b/noncore/apps/opie-console/emulation_handler.cpp
index 7924568..235facb 100644
--- a/noncore/apps/opie-console/emulation_handler.cpp
+++ b/noncore/apps/opie-console/emulation_handler.cpp
@@ -32,4 +32,7 @@ EmulationHandler::EmulationHandler( const Profile& prof, QWidget* parent,const c
}
+TEmulation* EmulationHandler::emulation() {
+ return m_teEmu;
+}
EmulationHandler::~EmulationHandler() {
if (isRecording())
diff --git a/noncore/apps/opie-console/emulation_handler.h b/noncore/apps/opie-console/emulation_handler.h
index 7bc6f16..1338525 100644
--- a/noncore/apps/opie-console/emulation_handler.h
+++ b/noncore/apps/opie-console/emulation_handler.h
@@ -48,4 +48,5 @@ public:
void load( const Profile& );
QWidget* widget();
+ TEmulation *emulation();
void setColor( const QColor& fore, const QColor& back );
QPushButton* cornerButton();
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();
+}
diff --git a/noncore/apps/opie-console/mainwindow.h b/noncore/apps/opie-console/mainwindow.h
index 37219c5..0fac38b 100644
--- a/noncore/apps/opie-console/mainwindow.h
+++ b/noncore/apps/opie-console/mainwindow.h
@@ -71,4 +71,5 @@ private slots:
void slotSessionChanged( Session* );
void slotKeyReceived(FKey, ushort, ushort, bool);
+ void slotSaveHistory();
/* what could these both slot do? */
diff --git a/noncore/apps/opie-console/metafactory.cpp b/noncore/apps/opie-console/metafactory.cpp
index 0b43e17..24928e7 100644
--- a/noncore/apps/opie-console/metafactory.cpp
+++ b/noncore/apps/opie-console/metafactory.cpp
@@ -44,10 +44,4 @@ void MetaFactory::addReceiveLayer( const QCString& name,
m_receiveFact.insert( str, lay );
}
-void MetaFactory::addEmulationLayer( const QCString& name,
- const QString& str,
- emulationLayer em) {
- m_strings.insert(str, name );
- m_emu.insert( str, em );
-}
QStringList MetaFactory::ioLayers()const {
QStringList list;
@@ -90,12 +84,4 @@ QStringList MetaFactory::receiveLayers()const {
return list;
}
-QStringList MetaFactory::emulationLayers()const {
- QStringList list;
- QMap<QString, emulationLayer>::ConstIterator it;
- for ( it = m_emu.begin(); it != m_emu.end(); ++it ) {
- list << it.key();
- }
- return list;
-}
IOLayer* MetaFactory::newIOLayer( const QString& str,const Profile& prof ) {
@@ -149,15 +135,4 @@ ProfileDialogWidget *MetaFactory::newKeyboardPlugin( const QString& str, QWidget
return wid;
}
-EmulationLayer* MetaFactory::newEmulationLayer( const QString& str, WidgetLayer* wid) {
- EmulationLayer* lay = 0l;
-
- QMap<QString, emulationLayer>::Iterator it;
- it = m_emu.find( str );
- if ( it != m_emu.end() ) {
- lay = (*(it.data() ) )(wid);
- }
-
- return lay;
-}
FileTransferLayer* MetaFactory::newFileTransfer(const QString& str, IOLayer* lay ) {
FileTransferLayer* file = 0l;
diff --git a/noncore/apps/opie-console/metafactory.h b/noncore/apps/opie-console/metafactory.h
index f89136c..bcc40db 100644
--- a/noncore/apps/opie-console/metafactory.h
+++ b/noncore/apps/opie-console/metafactory.h
@@ -17,5 +17,4 @@
#include "profile.h"
#include "profiledialogwidget.h"
-#include "emulation_layer.h"
class WidgetLayer;
@@ -26,5 +25,4 @@ public:
typedef FileTransferLayer* (*filelayer)(IOLayer*);
typedef ReceiveLayer* (*receivelayer)(IOLayer*);
- typedef EmulationLayer* (*emulationLayer)(WidgetLayer* );
MetaFactory();
@@ -62,10 +60,4 @@ public:
receivelayer);
- /**
- * adds a Factory for Emulation to the Layer..
- */
- void addEmulationLayer ( const QCString& name,
- const QString& uiString,
- emulationLayer );
/* translated UI Strings */
@@ -79,5 +71,4 @@ public:
QStringList fileTransferLayers()const;
QStringList receiveLayers()const;
- QStringList emulationLayers()const;
/**
@@ -88,5 +79,4 @@ public:
ProfileDialogWidget* newTerminalPlugin( const QString&, QWidget* );
ProfileDialogWidget* newKeyboardPlugin( const QString&, QWidget* );
- EmulationLayer* newEmulationLayer(const QString&, WidgetLayer* );
FileTransferLayer* newFileTransfer(const QString&, IOLayer* );
ReceiveLayer* newReceive(const QString&, IOLayer* );
@@ -114,5 +104,4 @@ private:
QMap<QString, filelayer> m_fileFact;
QMap<QString, receivelayer> m_receiveFact;
- QMap<QString, emulationLayer> m_emu;
};