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

List:       kde-core-devel
Subject:    [Patch] kdegraphics/kfax/kfax.cpp
From:       Kevin Lo <kevlo () kde ! org>
Date:       2000-11-29 14:23:50
[Download RAW message or body]

Hi KDE big brothers :-)

This patch is to use KTempFile instead of tmpnam.
Please apply it or I can commit it if no problem, thanks.

Best regards,
Kevin.

["patch-kfax.cpp" (text/plain)]

--- kfax/kfax.cpp.orig	Wed Nov 29 20:39:24 2000
+++ kfax/kfax.cpp	Wed Nov 29 22:19:37 2000
@@ -46,6 +46,7 @@
 #include <kmessagebox.h>
 #include <kcmdlineargs.h>
 #include <kio/netaccess.h>
+#include <ktempfile.h>
 
 #include "kfax.h"
 #include "kfax.moc"
@@ -994,9 +995,9 @@
       if(defaultpage.expander ==  g31expand)
 	faxtype = 31;
 
-
-      QString tempfile;
-      tempfile = tmpnam(NULL);
+      KTempFile tmpFile;
+      tmpFile.setAutoDelete(true); // delete file when we are done.
+      QString tempfile = tmpFile.name();
 
       fax2tiffmain(pn->pathname,tempfile.ascii(),pn->lsbfirst,pn->vres?0:1,faxtype);
       fax2psmain(tempfile.ascii(),psfile,width,height,pi.scale);
@@ -1012,6 +1013,7 @@
   else
     fclose(psfile);
 
+  unlink(tmpFile);
   QApplication::restoreOverrideCursor();
   XDefineCursor(qtdisplay, Win, ReadyCursor);
 


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

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