[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: 2004-01-17 1:12:55
Message-ID: 20040117011255.8C1BD946C () office ! kde ! org
[Download RAW message or body]
CVS commit by jkivlighn:
Use a progress bar to inform user the recipes are being opened, since categories with \
many recipes can take some time.
M +26 -6 recipeviewdialog.cpp 1.60
M +7 -3 recipeviewdialog.h 1.24
--- kdenonbeta/krecipes/src/dialogs/recipeviewdialog.cpp #1.59:1.60
@@ -16,4 +16,5 @@
#include <qlayout.h>
+#include <kapplication.h>
#include <kdebug.h>
#include <khtmlview.h>
@@ -21,5 +22,8 @@
#include <kiconloader.h>
#include <klocale.h>
+#include <kmainwindow.h>
+#include <kprogress.h>
#include <kstandarddirs.h>
+#include <kstatusbar.h>
#include "mixednumber.h"
@@ -58,11 +62,11 @@ RecipeViewDialog::~RecipeViewDialog()
}
-void RecipeViewDialog::loadRecipe(int recipeID)
+bool RecipeViewDialog::loadRecipe(int recipeID)
{
QValueList<int> ids; ids.append(recipeID);
- loadRecipes(ids);
+ return loadRecipes(ids);
}
-void RecipeViewDialog::loadRecipes( const QValueList<int> &ids )
+bool RecipeViewDialog::loadRecipes( const QValueList<int> &ids )
{
// Remove any files created by the last recipe loaded
@@ -73,13 +77,26 @@ ids_loaded = ids; //need to save these i
recipe_loaded = ( ids.count() > 0 && ids[0] >= 0 );
-showRecipes( ids );
+return showRecipes( ids );
}
-void RecipeViewDialog::showRecipes( const QValueList<int> &ids )
+bool RecipeViewDialog::showRecipes( const QValueList<int> &ids )
+{
+KProgressDialog *progress_dialog = 0;
+
+if ( ids.count() > 1 ) //we don't want a progress bar coming up when there is only \
one recipes... it may show up during the splash screen {
+ progress_dialog = new KProgressDialog(this, "open_progress_dialog", \
QString::null, i18n("Opening recipes, please wait..."), true ); + \
progress_dialog->resize(240,80); +}
+
HTMLExporter html_generator( database, tmp_filename+".html", "html", \
parentWidget()->width() );
RecipeList recipe_list; database->loadRecipes( &recipe_list, ids );
-html_generator.exporter( recipe_list ); //writes the generated HTML to \
'tmp_filename+".html"' +html_generator.exporter( recipe_list, progress_dialog ); \
//writes the generated HTML to 'tmp_filename+".html"' +if ( progress_dialog && \
progress_dialog->wasCancelled() ) +{
+ delete progress_dialog;
+ return false;
+}
delete recipeView; // Temporary workaround
@@ -89,4 +106,7 @@ KURL url;
url.setPath( tmp_filename+".html" );
recipeView->openURL( url );
+
+delete progress_dialog;
+return true;
}
--- kdenonbeta/krecipes/src/dialogs/recipeviewdialog.h #1.23:1.24
@@ -34,6 +34,10 @@ public:
~RecipeViewDialog();
- void loadRecipe(int recipeID);
- void loadRecipes( const QValueList<int> &ids );
+
+ /** @return Boolean indicating whether or not the recipe was successfully loaded \
*/ + bool loadRecipe(int recipeID);
+
+ /** @return Boolean indicating whether or not the recipes were successfully \
loaded */ + bool loadRecipes( const QValueList<int> &ids );
signals:
@@ -51,5 +55,5 @@ private:
// Internal Methods
- void showRecipes( const QValueList<int> &ids );
+ bool showRecipes( const QValueList<int> &ids );
void removeOldFiles();
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic