author | zecke <zecke> | 2002-11-07 18:31:52 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-11-07 18:31:52 (UTC) |
commit | b89e9179db00b777e41bdd0c95885fb76b3f1a88 (patch) (unidiff) | |
tree | 6b0b6e33d5d084849ab8d7b17ba1c03b74d8a0c9 | |
parent | 8baa44cf756fc3767829983941fc64c9547b8cc0 (diff) | |
download | opie-b89e9179db00b777e41bdd0c95885fb76b3f1a88.zip opie-b89e9179db00b777e41bdd0c95885fb76b3f1a88.tar.gz opie-b89e9179db00b777e41bdd0c95885fb76b3f1a88.tar.bz2 |
Renove Emulationhandler from MetaFactory
common.h clashed with TECommon.h
Implement saving of history!
-rw-r--r-- | noncore/apps/opie-console/TEScreen.cpp | 17 | ||||
-rw-r--r-- | noncore/apps/opie-console/TEScreen.h | 2 | ||||
-rw-r--r-- | noncore/apps/opie-console/TEmulation.cpp | 4 | ||||
-rw-r--r-- | noncore/apps/opie-console/TEmulation.h | 7 | ||||
-rw-r--r-- | noncore/apps/opie-console/emulation_handler.cpp | 3 | ||||
-rw-r--r-- | noncore/apps/opie-console/emulation_handler.h | 1 | ||||
-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 35 | ||||
-rw-r--r-- | noncore/apps/opie-console/mainwindow.h | 1 | ||||
-rw-r--r-- | noncore/apps/opie-console/metafactory.cpp | 25 | ||||
-rw-r--r-- | noncore/apps/opie-console/metafactory.h | 11 |
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 | |||
@@ -987,3 +987,3 @@ QString TEScreen::getSelText(const BOOL preserve_line_breaks) | |||
987 | { | 987 | { |
988 | if (sel_begin == -1) | 988 | if (sel_begin == -1) |
989 | return QString::null; // Selection got clear while selecting. | 989 | return QString::null; // Selection got clear while selecting. |
@@ -1017,3 +1017,3 @@ QString TEScreen::getSelText(const BOOL preserve_line_breaks) | |||
1017 | } | 1017 | } |
1018 | 1018 | ||
1019 | while (hX < eol) | 1019 | while (hX < eol) |
@@ -1114,3 +1114,3 @@ QString TEScreen::getSelText(const BOOL preserve_line_breaks) | |||
1114 | } | 1114 | } |
1115 | 1115 | ||
1116 | QString res(qc, d); | 1116 | QString res(qc, d); |
@@ -1122,2 +1122,13 @@ QString TEScreen::getSelText(const BOOL preserve_line_breaks) | |||
1122 | } | 1122 | } |
1123 | QString TEScreen::getHistory() { | ||
1124 | sel_begin = 0; | ||
1125 | sel_BR = sel_begin; | ||
1126 | sel_TL = sel_begin; | ||
1127 | setSelExtentXY(columns-1,lines-1); | ||
1128 | QString tmp=getSelText(true); | ||
1129 | while (tmp.at(tmp.length()-2).unicode()==10 && tmp.at(tmp.length()-1).unicode()==10) | ||
1130 | tmp.truncate(tmp.length()-1); | ||
1131 | |||
1132 | return tmp; | ||
1133 | } | ||
1123 | /* above ... end of line processing for selection -- psilva | 1134 | /* above ... end of line processing for selection -- psilva |
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 | |||
@@ -164,2 +164,4 @@ public: // these are all `Screen' operations | |||
164 | 164 | ||
165 | QString getHistory(); | ||
166 | |||
165 | private: // helper | 167 | 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 | |||
@@ -273,3 +273,5 @@ void TEmulation::clearSelection() { | |||
273 | } | 273 | } |
274 | 274 | void TEmulation::streamHistory(QTextStream* stream) { | |
275 | *stream << scr->getHistory(); | ||
276 | } | ||
275 | // Refreshing -------------------------------------------------------------- -- | 277 | // 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 | |||
@@ -26,2 +26,4 @@ | |||
26 | #include <qtextcodec.h> | 26 | #include <qtextcodec.h> |
27 | #include <qtextstream.h> | ||
28 | |||
27 | #include "keytrans.h" | 29 | #include "keytrans.h" |
@@ -39,2 +41,3 @@ public: | |||
39 | virtual bool history(); | 41 | virtual bool history(); |
42 | virtual void streamHistory( QTextStream* ); | ||
40 | 43 | ||
@@ -45,3 +48,3 @@ public slots: // signals incoming from TEWidget | |||
45 | virtual void onKeyPress(QKeyEvent*); | 48 | virtual void onKeyPress(QKeyEvent*); |
46 | 49 | ||
47 | virtual void clearSelection(); | 50 | virtual void clearSelection(); |
@@ -77,2 +80,4 @@ public: | |||
77 | 80 | ||
81 | |||
82 | |||
78 | protected: | 83 | 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 | |||
@@ -33,2 +33,5 @@ EmulationHandler::EmulationHandler( const Profile& prof, QWidget* parent,const c | |||
33 | } | 33 | } |
34 | TEmulation* EmulationHandler::emulation() { | ||
35 | return m_teEmu; | ||
36 | } | ||
34 | EmulationHandler::~EmulationHandler() { | 37 | EmulationHandler::~EmulationHandler() { |
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 | |||
@@ -49,2 +49,3 @@ public: | |||
49 | QWidget* widget(); | 49 | QWidget* widget(); |
50 | TEmulation *emulation(); | ||
50 | void setColor( const QColor& fore, const QColor& back ); | 51 | void setColor( const QColor& fore, const QColor& back ); |
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 | |||
@@ -11,2 +11,3 @@ | |||
11 | #include <qfileinfo.h> | 11 | #include <qfileinfo.h> |
12 | #include <qtextstream.h> | ||
12 | 13 | ||
@@ -19,2 +20,3 @@ | |||
19 | 20 | ||
21 | #include "TEmulation.h" | ||
20 | #include "keytrans.h" | 22 | #include "keytrans.h" |
@@ -243,2 +245,8 @@ void MainWindow::initUI() { | |||
243 | m_console->insertSeparator(); | 245 | m_console->insertSeparator(); |
246 | |||
247 | QAction *a = new QAction(); | ||
248 | a->setText( tr("Save history") ); | ||
249 | a->addTo( m_console ); | ||
250 | connect(a, SIGNAL(activated() ), | ||
251 | this, SLOT(slotSaveHistory() ) ); | ||
244 | /* | 252 | /* |
@@ -304,3 +312,3 @@ void MainWindow::initUI() { | |||
304 | 312 | ||
305 | QAction *a = new QAction(tr("Copy"), | 313 | a = new QAction(tr("Copy"), |
306 | Resource::loadPixmap("copy"), QString::null, | 314 | Resource::loadPixmap("copy"), QString::null, |
@@ -770 +778,26 @@ void MainWindow::slotSaveSession() { | |||
770 | } | 778 | } |
779 | void MainWindow::slotSaveHistory() { | ||
780 | QMap<QString, QStringList> map; | ||
781 | QStringList text; | ||
782 | text << "text/plain"; | ||
783 | map.insert(tr("History"), text ); | ||
784 | QString filename = OFileDialog::getSaveFileName(2, QPEApplication::documentDir(), QString::null, map); | ||
785 | if (filename.isEmpty() ) return; | ||
786 | |||
787 | QFileInfo info(filename); | ||
788 | |||
789 | DocLnk nf; | ||
790 | nf.setType("text/plain"); | ||
791 | nf.setFile(filename); | ||
792 | nf.setName(info.fileName()); | ||
793 | |||
794 | |||
795 | QFile file(filename); | ||
796 | file.open(IO_WriteOnly ); | ||
797 | QTextStream str(&file ); | ||
798 | if ( currentSession() ) | ||
799 | currentSession()->emulationHandler()->emulation()->streamHistory(&str); | ||
800 | |||
801 | file.close(); | ||
802 | nf.writeLink(); | ||
803 | } | ||
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 | |||
@@ -72,2 +72,3 @@ private slots: | |||
72 | void slotKeyReceived(FKey, ushort, ushort, bool); | 72 | void slotKeyReceived(FKey, ushort, ushort, bool); |
73 | void slotSaveHistory(); | ||
73 | 74 | ||
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 | |||
@@ -45,8 +45,2 @@ void MetaFactory::addReceiveLayer( const QCString& name, | |||
45 | } | 45 | } |
46 | void MetaFactory::addEmulationLayer( const QCString& name, | ||
47 | const QString& str, | ||
48 | emulationLayer em) { | ||
49 | m_strings.insert(str, name ); | ||
50 | m_emu.insert( str, em ); | ||
51 | } | ||
52 | QStringList MetaFactory::ioLayers()const { | 46 | QStringList MetaFactory::ioLayers()const { |
@@ -91,10 +85,2 @@ QStringList MetaFactory::receiveLayers()const { | |||
91 | } | 85 | } |
92 | QStringList MetaFactory::emulationLayers()const { | ||
93 | QStringList list; | ||
94 | QMap<QString, emulationLayer>::ConstIterator it; | ||
95 | for ( it = m_emu.begin(); it != m_emu.end(); ++it ) { | ||
96 | list << it.key(); | ||
97 | } | ||
98 | return list; | ||
99 | } | ||
100 | 86 | ||
@@ -150,13 +136,2 @@ ProfileDialogWidget *MetaFactory::newKeyboardPlugin( const QString& str, QWidget | |||
150 | } | 136 | } |
151 | EmulationLayer* MetaFactory::newEmulationLayer( const QString& str, WidgetLayer* wid) { | ||
152 | EmulationLayer* lay = 0l; | ||
153 | |||
154 | QMap<QString, emulationLayer>::Iterator it; | ||
155 | it = m_emu.find( str ); | ||
156 | if ( it != m_emu.end() ) { | ||
157 | lay = (*(it.data() ) )(wid); | ||
158 | } | ||
159 | |||
160 | return lay; | ||
161 | } | ||
162 | FileTransferLayer* MetaFactory::newFileTransfer(const QString& str, IOLayer* lay ) { | 137 | FileTransferLayer* MetaFactory::newFileTransfer(const QString& str, IOLayer* lay ) { |
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 | |||
@@ -18,3 +18,2 @@ | |||
18 | #include "profiledialogwidget.h" | 18 | #include "profiledialogwidget.h" |
19 | #include "emulation_layer.h" | ||
20 | 19 | ||
@@ -27,3 +26,2 @@ public: | |||
27 | typedef ReceiveLayer* (*receivelayer)(IOLayer*); | 26 | typedef ReceiveLayer* (*receivelayer)(IOLayer*); |
28 | typedef EmulationLayer* (*emulationLayer)(WidgetLayer* ); | ||
29 | 27 | ||
@@ -63,8 +61,2 @@ public: | |||
63 | 61 | ||
64 | /** | ||
65 | * adds a Factory for Emulation to the Layer.. | ||
66 | */ | ||
67 | void addEmulationLayer ( const QCString& name, | ||
68 | const QString& uiString, | ||
69 | emulationLayer ); | ||
70 | 62 | ||
@@ -80,3 +72,2 @@ public: | |||
80 | QStringList receiveLayers()const; | 72 | QStringList receiveLayers()const; |
81 | QStringList emulationLayers()const; | ||
82 | 73 | ||
@@ -89,3 +80,2 @@ public: | |||
89 | ProfileDialogWidget* newKeyboardPlugin( const QString&, QWidget* ); | 80 | ProfileDialogWidget* newKeyboardPlugin( const QString&, QWidget* ); |
90 | EmulationLayer* newEmulationLayer(const QString&, WidgetLayer* ); | ||
91 | FileTransferLayer* newFileTransfer(const QString&, IOLayer* ); | 81 | FileTransferLayer* newFileTransfer(const QString&, IOLayer* ); |
@@ -115,3 +105,2 @@ private: | |||
115 | QMap<QString, receivelayer> m_receiveFact; | 105 | QMap<QString, receivelayer> m_receiveFact; |
116 | QMap<QString, emulationLayer> m_emu; | ||
117 | }; | 106 | }; |