Diffstat (limited to 'noncore/apps/opie-console/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 3 |
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 | |||
@@ -779,56 +779,57 @@ void MainWindow::slotSaveSession() { | |||
779 | 779 | ||
780 | void MainWindow::slotSaveLog() { | 780 | void 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 | ||
810 | void MainWindow::slotSaveHistory() { | 810 | void 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 | } |