/* -*- mode: c++; -*-
 *
 * This file is part of the Mango recipe management distribution.
 * Copyright (c) 2000-2003, Roland Jesse
 * All rights reserved.
 *
 * For license and copyright information see the file COPYRIGHT or 
 * <http://www.opensource.org/licenses/bsd-license.html>.
 *
 * $Id: RecipeListDialog.h,v 1.8 2003/01/12 16:19:56 rjesse Exp $
 */
 
#ifndef RECIPE_LIST_DIALOG_HPP
#define RECIPE_LIST_DIALOG_HPP

#include "RecipeListForm.h"

class Recipe;
class RecipeModel;

/*!
  Dialog for viewing and editing a cookbook.

  The recipes are listed in alphabetical order.
*/
class RecipeListDialog : public RecipeListForm {
	  Q_OBJECT
          typedef RecipeListForm inherited;
      
   public:
      RecipeListDialog( RecipeModel*, QWidget* parent = 0, const char* name = 0);
      ~RecipeListDialog();

   protected slots:
      virtual void slotEdit();
      virtual void slotEdit( const QString&);
      void slotExportSelected();
      void slotHelp();
      void slotPreview( int);
      void slotRemoveSelected();
      virtual void slotView();
      virtual void slotView( QListBoxItem*);
      virtual void slotView( const QString&);
      void update();
      void populateListBox();

   private slots:
      void slotContextMenu( QListBoxItem*, const QPoint&);
      
   private:
      void previewCookbook( const Recipe&);
      void previewCategories( const Recipe&);
      void exportSingleRecipe();
      void exportMultipleRecipes();
      int getSelectionIndex() const;
      int getIndex( const QString&) const;
      
      RecipeModel* m_model;

      void initContextMenu();
      QPopupMenu* m_contextMenu;
};
#endif // RECIPE_LIST_DIALOG_HPP
