summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-console/mainwindow.cpp
authorzecke <zecke>2002-11-07 18:31:52 (UTC)
committer zecke <zecke>2002-11-07 18:31:52 (UTC)
commitb89e9179db00b777e41bdd0c95885fb76b3f1a88 (patch) (unidiff)
tree6b0b6e33d5d084849ab8d7b17ba1c03b74d8a0c9 /noncore/apps/opie-console/mainwindow.cpp
parent8baa44cf756fc3767829983941fc64c9547b8cc0 (diff)
downloadopie-b89e9179db00b777e41bdd0c95885fb76b3f1a88.zip
opie-b89e9179db00b777e41bdd0c95885fb76b3f1a88.tar.gz
opie-b89e9179db00b777e41bdd0c95885fb76b3f1a88.tar.bz2
Renove Emulationhandler from MetaFactory
common.h clashed with TECommon.h Implement saving of history!
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
@@ -6,20 +6,22 @@
6#include <qpopupmenu.h> 6#include <qpopupmenu.h>
7#include <qtoolbar.h> 7#include <qtoolbar.h>
8#include <qmessagebox.h> 8#include <qmessagebox.h>
9#include <qpushbutton.h> 9#include <qpushbutton.h>
10#include <qwhatsthis.h> 10#include <qwhatsthis.h>
11#include <qfileinfo.h> 11#include <qfileinfo.h>
12#include <qtextstream.h>
12 13
13#include <qpe/resource.h> 14#include <qpe/resource.h>
14#include <qpe/qpeapplication.h> 15#include <qpe/qpeapplication.h>
15#include <qpe/filemanager.h> 16#include <qpe/filemanager.h>
16#include <qpe/mimetype.h> 17#include <qpe/mimetype.h>
17 18
18#include <opie/ofiledialog.h> 19#include <opie/ofiledialog.h>
19 20
21#include "TEmulation.h"
20#include "keytrans.h" 22#include "keytrans.h"
21#include "profileeditordialog.h" 23#include "profileeditordialog.h"
22#include "configdialog.h" 24#include "configdialog.h"
23#include "default.h" 25#include "default.h"
24#include "metafactory.h" 26#include "metafactory.h"
25#include "profile.h" 27#include "profile.h"
@@ -238,12 +240,18 @@ void MainWindow::initUI() {
238 , QString::null, 0, this, 0); 240 , QString::null, 0, this, 0);
239 m_fullscreen->addTo( m_console ); 241 m_fullscreen->addTo( m_console );
240 connect( m_fullscreen, SIGNAL( activated() ), 242 connect( m_fullscreen, SIGNAL( activated() ),
241 this, SLOT( slotFullscreen() ) ); 243 this, SLOT( slotFullscreen() ) );
242 244
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 /*
245 * terminate action 253 * terminate action
246 */ 254 */
247 m_terminate = new QAction(); 255 m_terminate = new QAction();
248 m_terminate->setText( tr("Terminate") ); 256 m_terminate->setText( tr("Terminate") );
249 m_terminate->addTo( m_console ); 257 m_terminate->addTo( m_console );
@@ -299,13 +307,13 @@ void MainWindow::initUI() {
299 307
300 m_kb = new FunctionKeyboard(m_keyBar); 308 m_kb = new FunctionKeyboard(m_keyBar);
301 connect(m_kb, SIGNAL(keyPressed(FKey, ushort, ushort, bool)), 309 connect(m_kb, SIGNAL(keyPressed(FKey, ushort, ushort, bool)),
302 this, SLOT(slotKeyReceived(FKey, ushort, ushort, bool))); 310 this, SLOT(slotKeyReceived(FKey, ushort, ushort, bool)));
303 311
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,
307 0, this, 0 ); 315 0, this, 0 );
308 //a->addTo( m_icons ); 316 //a->addTo( m_icons );
309 connect( a, SIGNAL(activated() ), 317 connect( a, SIGNAL(activated() ),
310 this, SLOT(slotCopy() ) ); 318 this, SLOT(slotCopy() ) );
311 319
@@ -765,6 +773,31 @@ void MainWindow::slotSaveSession() {
765 return; 773 return;
766 } 774 }
767 manager()->add( currentSession()->profile() ); 775 manager()->add( currentSession()->profile() );
768 manager()->save(); 776 manager()->save();
769 populateProfiles(); 777 populateProfiles();
770} 778}
779void 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}