From kde-commits Sun Nov 30 22:55:50 2003 From: Jason Kivlighn Date: Sun, 30 Nov 2003 22:55:50 +0000 To: kde-commits Subject: kdenonbeta/krecipes/src/dialogs X-MARC-Message: https://marc.info/?l=kde-commits&m=107023319909229 CVS commit by jkivlighn: -Use locateLocal( "tmp", ) for a temporary file name instead of the static "/tmp/" (This usually ends up using "/tmp/kde-/") -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 -#include #include #include #include #include - -#include +#include #include "mixednumber.h" @@ -36,18 +33,22 @@ database=db; // Store the database point loadedRecipe=new Recipe(); +tmp_filename = locateLocal("tmp", "krecipes_recipe_view"); +kdDebug()<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 ); }