summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-console/mainwindow.cpp
Unidiff
Diffstat (limited to 'noncore/apps/opie-console/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/mainwindow.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp
index 18c0434..aba7244 100644
--- a/noncore/apps/opie-console/mainwindow.cpp
+++ b/noncore/apps/opie-console/mainwindow.cpp
@@ -731,104 +731,105 @@ void MainWindow::slotScrollbarSelected(int index)
731 } 731 }
732 732
733 m_scrollbar->setItemChecked(sm_none, index == sm_none); 733 m_scrollbar->setItemChecked(sm_none, index == sm_none);
734 m_scrollbar->setItemChecked(sm_left, index == sm_left); 734 m_scrollbar->setItemChecked(sm_left, index == sm_left);
735 m_scrollbar->setItemChecked(sm_right, index == sm_right); 735 m_scrollbar->setItemChecked(sm_right, index == sm_right);
736} 736}
737 737
738void MainWindow::slotKeyReceived(FKey k, ushort, ushort, bool pressed) { 738void MainWindow::slotKeyReceived(FKey k, ushort, ushort, bool pressed) {
739 739
740 if ( m_curSession ) { 740 if ( m_curSession ) {
741 741
742 QEvent::Type state; 742 QEvent::Type state;
743 743
744 if (pressed) state = QEvent::KeyPress; 744 if (pressed) state = QEvent::KeyPress;
745 else state = QEvent::KeyRelease; 745 else state = QEvent::KeyRelease;
746 746
747 QKeyEvent ke(state, k.qcode, k.unicode, 0, QString(QChar(k.unicode))); 747 QKeyEvent ke(state, k.qcode, k.unicode, 0, QString(QChar(k.unicode)));
748 748
749 // is this the best way to do this? cant figure out any other way to work 749 // is this the best way to do this? cant figure out any other way to work
750 QApplication::sendEvent((QObject *)m_curSession->widget(), &ke); 750 QApplication::sendEvent((QObject *)m_curSession->widget(), &ke);
751 ke.ignore(); 751 ke.ignore();
752 } 752 }
753} 753}
754void MainWindow::slotCopy() { 754void MainWindow::slotCopy() {
755 if (!currentSession() ) return; 755 if (!currentSession() ) return;
756 currentSession()->emulationHandler()->copy(); 756 currentSession()->emulationHandler()->copy();
757} 757}
758void MainWindow::slotPaste() { 758void MainWindow::slotPaste() {
759 if (!currentSession() ) return; 759 if (!currentSession() ) return;
760 currentSession()->emulationHandler()->paste(); 760 currentSession()->emulationHandler()->paste();
761} 761}
762 762
763/* 763/*
764 * Save the session 764 * Save the session
765 */ 765 */
766 766
767void MainWindow::slotSaveSession() { 767void MainWindow::slotSaveSession() {
768 if (!currentSession() ) { 768 if (!currentSession() ) {
769 QMessageBox::information(this, tr("Save Connection"), 769 QMessageBox::information(this, tr("Save Connection"),
770 tr("<qt>There is no Connection.</qt>"), 1 ); 770 tr("<qt>There is no Connection.</qt>"), 1 );
771 return; 771 return;
772 } 772 }
773 manager()->add( currentSession()->profile() ); 773 manager()->add( currentSession()->profile() );
774 manager()->save(); 774 manager()->save();
775 populateProfiles(); 775 populateProfiles();
776} 776}
777 777
778 778
779 779
780void MainWindow::slotSaveLog() { 780void MainWindow::slotSaveLog() {
781 781
782 if( currentSession()->emulationHandler()->isLogging() ) { 782 if( currentSession()->emulationHandler()->isLogging() ) {
783 DocLnk nf; 783 DocLnk nf;
784 QString m_logName = currentSession()->emulationHandler()->logFileName(); 784 QString m_logName = currentSession()->emulationHandler()->logFileName();
785 QFileInfo info(m_logName); 785 QFileInfo info(m_logName);
786 nf.setType("text/plain"); 786 nf.setType("text/plain");
787 nf.setFile(m_logName); 787 nf.setFile(m_logName);
788 nf.setName(info.fileName()); 788 nf.setName(info.fileName());
789 nf.writeLink(); 789 nf.writeLink();
790 m_recordLog->setText( tr("Start log") ); 790 m_recordLog->setText( tr("Start log") );
791 m_recordingLog = false; 791 m_recordingLog = false;
792 currentSession()->emulationHandler()->clearLog(); 792 currentSession()->emulationHandler()->clearLog();
793 } else { 793 } else {
794 QMap<QString, QStringList> map; 794 QMap<QString, QStringList> map;
795 QStringList text; 795 QStringList text;
796 text << "text/plain"; 796 text << "text/plain";
797 map.insert(tr("Log"), text ); 797 map.insert(tr("Log"), text );
798 Opie::Core::OConfig cfg("opie-console"); 798 Opie::Core::OConfig cfg("opie-console");
799 cfg.setGroup("defaults"); 799 cfg.setGroup("defaults");
800 QString startDir = cfg.readEntry("defaultlogdir", QPEApplication::documentDir() ); 800 QString startDir = cfg.readEntry("defaultlogdir", QPEApplication::documentDir() );
801 QString m_logName = OFileDialog::getSaveFileName(2, startDir, QString::null, map, 0, startDir); 801 QString m_logName = OFileDialog::getSaveFileName(2, startDir, QString::null, map, 0, startDir);
802 if (m_logName.isEmpty() ) return; 802 if (m_logName.isEmpty() ) return;
803 803
804 m_recordLog->setText( tr("Stop log") ); 804 m_recordLog->setText( tr("Stop log") );
805 m_recordingLog = true; 805 m_recordingLog = true;
806 currentSession()->emulationHandler()->startLogging(m_logName); 806 currentSession()->emulationHandler()->startLogging(m_logName);
807 } 807 }
808} 808}
809 809
810void MainWindow::slotSaveHistory() { 810void MainWindow::slotSaveHistory() {
811 QMap<QString, QStringList> map; 811 QMap<QString, QStringList> map;
812 QStringList text; 812 QStringList text;
813 text << "text/plain"; 813 text << "text/plain";
814 map.insert(tr("History"), text ); 814 map.insert(tr("History"), text );
815 QString filename = OFileDialog::getSaveFileName(2, QPEApplication::documentDir(), QString::null, map); 815 QString filename = OFileDialog::getSaveFileName(2, QPEApplication::documentDir(), QString::null, map);
816 if (filename.isEmpty() ) return; 816 if (filename.isEmpty() ) return;
817 817
818 QFileInfo info(filename); 818 QFileInfo info(filename);
819 819
820 DocLnk nf; 820 DocLnk nf;
821 nf.setType("text/plain"); 821 nf.setType("text/plain");
822 nf.setFile(filename); 822 nf.setFile(filename);
823 nf.setName(info.fileName()); 823 nf.setName(info.fileName());
824 824
825 825
826 QFile file(filename); 826 QFile file(filename);
827 file.open(IO_WriteOnly ); 827 if ( !file.open(IO_WriteOnly ) ) return;
828
828 QTextStream str(&file ); 829 QTextStream str(&file );
829 if ( currentSession() ) 830 if ( currentSession() )
830 currentSession()->emulationHandler()->emulation()->streamHistory(&str); 831 currentSession()->emulationHandler()->emulation()->streamHistory(&str);
831 832
832 file.close(); 833 file.close();
833 nf.writeLink(); 834 nf.writeLink();
834} 835}