[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdepim/certmanager/kwatchgnupg
From:       Steffen Hansen <hansen () kde ! org>
Date:       2004-03-24 17:07:08
Message-ID: 20040324170708.E80919098 () office ! kde ! org
[Download RAW message or body]

CVS commit by steffen: 

save log to file


  M +24 -0     kwatchgnupgmainwin.cpp   1.7
  M +1 -0      kwatchgnupgmainwin.h   1.5
  M +1 -0      kwatchgnupgui.rc   1.2


--- kdepim/certmanager/kwatchgnupg/kwatchgnupgmainwin.cpp  #1.6:1.7
@@ -46,4 +46,5 @@
 #include <kprocio.h>
 #include <kconfig.h>
+#include <kfiledialog.h>
 
 #include <qtextedit.h>
@@ -95,4 +96,5 @@ void KWatchGnuPGMainWindow::createAction
                                          this, SLOT( slotClear() ), 
                                          actionCollection(), "clear_log" );
+  (void)KStdAction::saveAs( this, SLOT(slotSaveAs()), actionCollection() );
   (void)KStdAction::close( this, SLOT(close()), actionCollection() );
   (void)KStdAction::quit( this, SLOT(slotQuit()), actionCollection() );  
@@ -196,4 +198,26 @@ void KWatchGnuPGMainWindow::show()
 }
 
+void KWatchGnuPGMainWindow::slotSaveAs()
+{
+  QString filename = KFileDialog::getSaveFileName( QString::null, QString::null, 
+                                                                                     \
this, i18n("Save log to file") ); +  if( filename.isEmpty() ) return;
+  QFile file(filename);
+  if( file.exists() ) {
+        if( KMessageBox::Yes != 
+                KMessageBox::warningYesNo( this, i18n("The file named \"%1\" already \
" +                                                                                   \
"exists. Are you sure you want " +                                                    \
"to overwrite it?").arg(filename),  +                                                 \
i18n("Overwrite File") ) ) { +          return;
+        }
+  }
+  if( file.open( IO_WriteOnly ) ) {
+        QTextStream st(&file);
+        st << mCentralWidget->text();
+        file.close();
+  }
+}
+
 void KWatchGnuPGMainWindow::slotQuit()
 {

--- kdepim/certmanager/kwatchgnupg/kwatchgnupgmainwin.h  #1.4:1.5
@@ -50,4 +50,5 @@ public slots:
   void slotReadStdout();
 
+  void slotSaveAs();
   void slotQuit();
   void slotClear();

--- kdepim/certmanager/kwatchgnupg/kwatchgnupgui.rc  #1.1:1.2
@@ -4,4 +4,5 @@
                 <text>&amp;File</text>
                 <Action name="clear_log"/>
+                <Action name="saveas"/>
                 <Action name="print"/>
                 <Separator/>


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic