Diffstat (limited to 'noncore/apps/opie-console/mainwindow.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 35 |
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 @@ | |||
1 | #include <assert.h> | 1 | #include <assert.h> |
2 | 2 | ||
3 | #include <qaction.h> | 3 | #include <qaction.h> |
4 | #include <qmenubar.h> | 4 | #include <qmenubar.h> |
5 | #include <qlabel.h> | 5 | #include <qlabel.h> |
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" |
26 | #include "profilemanager.h" | 28 | #include "profilemanager.h" |
27 | #include "mainwindow.h" | 29 | #include "mainwindow.h" |
28 | #include "tabwidget.h" | 30 | #include "tabwidget.h" |
29 | #include "transferdialog.h" | 31 | #include "transferdialog.h" |
30 | #include "function_keyboard.h" | 32 | #include "function_keyboard.h" |
31 | #include "emulation_handler.h" | 33 | #include "emulation_handler.h" |
@@ -232,24 +234,30 @@ void MainWindow::initUI() { | |||
232 | /* | 234 | /* |
233 | * fullscreen | 235 | * fullscreen |
234 | */ | 236 | */ |
235 | m_isFullscreen = false; | 237 | m_isFullscreen = false; |
236 | 238 | ||
237 | m_fullscreen = new QAction( tr("Full screen"), Resource::loadPixmap( "fullscreen" ) | 239 | m_fullscreen = new QAction( tr("Full screen"), Resource::loadPixmap( "fullscreen" ) |
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 ); |
250 | connect(m_terminate, SIGNAL(activated() ), | 258 | connect(m_terminate, SIGNAL(activated() ), |
251 | this, SLOT(slotTerminate() ) ); | 259 | this, SLOT(slotTerminate() ) ); |
252 | 260 | ||
253 | m_closewindow = new QAction(); | 261 | m_closewindow = new QAction(); |
254 | m_closewindow->setText( tr("Close Window") ); | 262 | m_closewindow->setText( tr("Close Window") ); |
255 | m_closewindow->addTo( m_console ); | 263 | m_closewindow->addTo( m_console ); |
@@ -293,25 +301,25 @@ void MainWindow::initUI() { | |||
293 | 301 | ||
294 | /* and the keyboard */ | 302 | /* and the keyboard */ |
295 | m_keyBar = new QToolBar(this); | 303 | m_keyBar = new QToolBar(this); |
296 | addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE ); | 304 | addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE ); |
297 | m_keyBar->setHorizontalStretchable( TRUE ); | 305 | m_keyBar->setHorizontalStretchable( TRUE ); |
298 | m_keyBar->hide(); | 306 | m_keyBar->hide(); |
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 | ||
312 | QAction *paste = new QAction(tr("Paste"), | 320 | QAction *paste = new QAction(tr("Paste"), |
313 | Resource::loadPixmap("paste"), QString::null, | 321 | Resource::loadPixmap("paste"), QString::null, |
314 | 0, this, 0 ); | 322 | 0, this, 0 ); |
315 | connect( paste, SIGNAL(activated() ), | 323 | connect( paste, SIGNAL(activated() ), |
316 | this, SLOT(slotPaste() ) ); | 324 | this, SLOT(slotPaste() ) ); |
317 | 325 | ||
@@ -759,12 +767,37 @@ void MainWindow::slotPaste() { | |||
759 | */ | 767 | */ |
760 | 768 | ||
761 | void MainWindow::slotSaveSession() { | 769 | void MainWindow::slotSaveSession() { |
762 | if (!currentSession() ) { | 770 | if (!currentSession() ) { |
763 | QMessageBox::information(this, tr("Save Connection"), | 771 | QMessageBox::information(this, tr("Save Connection"), |
764 | tr("<qt>There is no Connection.</qt>"), 1 ); | 772 | tr("<qt>There is no Connection.</qt>"), 1 ); |
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 | } |
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 | } | ||