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

List:       kde-commits
Subject:    kdenonbeta/krecipes/src/dialogs
From:       Jason Kivlighn <confederacy2 () excite ! com>
Date:       2003-11-30 22:55:50
[Download RAW message or body]

CVS commit by jkivlighn: 

-Use locateLocal( "tmp", <filename> ) for a temporary file name instead of the static \
                "/tmp/<filename>" (This usually ends up using \
                "/tmp/kde-<username>/<filename>")
-Delete HTML files when done with them


  M +13 -12    recipeviewdialog.cpp   1.57
  M +1 -0      recipeviewdialog.h   1.21


--- kdenonbeta/krecipes/src/dialogs/recipeviewdialog.h  #1.20:1.21
@@ -41,4 +41,5 @@ private:
   RecipeDB  *database;
   Recipe *loadedRecipe;
+  QString tmp_filename;
 
   // Internal Methods

--- kdenonbeta/krecipes/src/dialogs/recipeviewdialog.cpp  #1.56:1.57
@@ -13,12 +13,9 @@
 #include "recipeviewdialog.h"
 
-#include <klocale.h>
-#include <kapplication.h>
 #include <kconfig.h>
 #include <kdebug.h>
 #include <khtmlview.h>
 #include <khtml_part.h>
-
-#include <qfile.h>
+#include <kstandarddirs.h>
 
 #include "mixednumber.h"
@@ -36,18 +33,22 @@ database=db; // Store the database point
 loadedRecipe=new Recipe();
 
+tmp_filename = locateLocal("tmp", "krecipes_recipe_view");
+kdDebug()<<tmp_filename<<endl;
+
 //----------Load  the recipe --------
 loadRecipe(recipeID);
 
 //this->calculateProperties();
-
-
- }
+}
 
 RecipeViewDialog::~RecipeViewDialog()
 {
+HTMLExporter::removeHTMLFiles(tmp_filename,loadedRecipe->title);
 }
 
 void RecipeViewDialog::loadRecipe(int recipeID)
 {
+// Remove any files created by the last recipe loaded
+HTMLExporter::removeHTMLFiles(tmp_filename,loadedRecipe->title);
 
 // Load specified Recipe ID
@@ -60,13 +61,13 @@ showRecipe();
 void RecipeViewDialog::showRecipe(void)
 {
-QFile old_file("/tmp/krecipes_recipe_view.html");
-old_file.remove();
-
-HTMLExporter html_generator( database, "/tmp/krecipes_recipe_view.html", "html", \
((QWidget*)parent())->width() ); +HTMLExporter html_generator( database, \
tmp_filename+".html", "html", ((QWidget*)parent())->width() );  \
html_generator.exporter( loadedRecipe->recipeID );  
 delete recipeView;              // Temporary workaround
 recipeView=new KHTMLPart(this); // to avoid the problem of caching images of \
                KHTMLPart
-recipeView->openURL( "file:/tmp/krecipes_recipe_view.html" );
+
+KURL url;
+url.setPath( tmp_filename+".html" );
+recipeView->openURL( url );
 }
 


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

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