summaryrefslogtreecommitdiffstats
path: root/src/dialogs/recipeprintpreview.cpp
blob: 7350d118d065f724ff3d31271ab216bed6f0a197 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/***************************************************************************
*   Copyright (C) 2006 by                                                 *
*   Jason Kivlighn ([email protected])                                  *
*                                                                         *
*   This program is free software; you can redistribute it and/or modify  *
*   it under the terms of the GNU General Public License as published by  *
*   the Free Software Foundation; either version 2 of the License, or     *
*   (at your option) any later version.                                   *
***************************************************************************/

#include "recipeprintpreview.h"

#include <tqvbox.h>

#include <kdebug.h>
#include <tdelocale.h>

#include "recipeviewdialog.h"
#include "pagesetupdialog.h"

RecipePrintPreview::RecipePrintPreview( TQWidget *parent, RecipeDB *db, const TQValueList<int> &ids )
		: KDialogBase( parent, "RecipePrintPreview", true, i18n("Print Preview"),
		    KDialogBase::Ok | KDialogBase::Cancel | KDialogBase::User1 | KDialogBase::Help, KDialogBase::Ok )
{
	setHelp("print-recipe");
	setButtonText( KDialogBase::User1, i18n("&Edit") );
	setButtonText( KDialogBase::Ok, i18n("&Print") );

	setSizeGripEnabled( true );

	// Initialize UI Elements
	TQVBox *page = makeVBoxMainWidget();

	recipeView = new RecipeViewDialog( page, db );
	recipeView->loadRecipes( ids, "Print" );

	setInitialSize( TQSize(450,500), false );
}

RecipePrintPreview::~RecipePrintPreview()
{
}

void RecipePrintPreview::slotOk()
{
	recipeView->printNoPreview();
	accept();
}

void RecipePrintPreview::slotUser1( void )
{
	PageSetupDialog pageSetup( this, Recipe(), "Print" );
	if ( pageSetup.exec() == TQDialog::Accepted )
		reload();
}

void RecipePrintPreview::reload()
{
	recipeView->reload( "Print" );
}

#include "recipeprintpreview.moc"