summaryrefslogtreecommitdiffstats
path: root/kfax/kfax_printsettings.cpp
blob: 02aa4050b47519f664f96cd7cb8a9d7253093726 (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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/*
 *  This file is part of the KDE libraries
 *  Copyright (c) 2005 Helge Deller <deller@kde.org>
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Library General Public
 *  License version 2 as published by the Free Software Foundation.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Library General Public License for more details.
 *
 *  You should have received a copy of the GNU Library General Public License
 *  along with this library; see the file COPYING.LIB.  If not, write to
 *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 *  Boston, MA 02110-1301, USA.
 **/

#include "kfax_printsettings.h"

#include <klocale.h>
#include <qcheckbox.h>
#include <qlayout.h>
#include <qwhatsthis.h>

KFAXPrintSettings::KFAXPrintSettings(QWidget *parent, const char *name)
: KPrintDialogPage(parent, name)
{
	QString whatsThisScaleFullPage = i18n( "<qt>"
		"<p><strong>'Ignore Paper Margins'</strong></p>"
		"<p>"
		"If this checkbox is enabled, the paper margins will be ignored "
		"and the fax will be printed on the full paper size."
		"</p>"
		"<p>"
		"If this checkbox is disabled, KFax will respect the standard paper "
		"margins and print the fax inside this printable area."
		"</p>"
						" </qt>" );
	QString whatsThisCenterHorz = i18n( "<qt>"
		"<p><strong>'Horizontal centered'</strong></p>"
		"<p>"
		"If this checkbox is enabled, the fax will be centered horizontally "
		"on the page."
		"</p>"
		"<p>"
		"If this checkbox is disabled, the fax will be printed at the left "
		"side of the page."
		"</p>"
						" </qt>" );
	QString whatsThisCenterVert = i18n( "<qt>"
		"<p><strong>'Vertical centered'</strong></p>"
		"<p>"
		"If this checkbox is enabled, the fax will be centered vertically "
		"on the page."
		"</p>"
		"<p>"
		"If this checkbox is disabled, the fax will be printed at the top "
		"of the page."
		"</p>"
						" </qt>" );

	setTitle(i18n("&Layout"));

	m_scaleFullPage = new QCheckBox(i18n("Ignore paper margins"), this);
	QWhatsThis::add(m_scaleFullPage, whatsThisScaleFullPage);
	m_center_horz = new QCheckBox(i18n("Horizontal centered"), this);
	QWhatsThis::add(m_center_horz, whatsThisCenterHorz);
	m_center_vert = new QCheckBox(i18n("Vertical centered"), this);
	QWhatsThis::add(m_center_vert, whatsThisCenterVert);

	QVBoxLayout *l0 = new QVBoxLayout(this, 0, 10);
	l0->addWidget(m_scaleFullPage);
	l0->addWidget(m_center_horz);
	l0->addWidget(m_center_vert);
	l0->addStretch(1);
}

KFAXPrintSettings::~KFAXPrintSettings()
{
}

void KFAXPrintSettings::getOptions(QMap<QString,QString>& opts, bool /*incldef*/)
{
	opts[APP_KFAX_SCALE_FULLPAGE] = (m_scaleFullPage->isChecked() ? "true" : "false");
	opts[APP_KFAX_CENTER_HORZ]    = (m_center_horz->isChecked() ? "true" : "false");
	opts[APP_KFAX_CENTER_VERT]    = (m_center_vert->isChecked() ? "true" : "false");
}

void KFAXPrintSettings::setOptions(const QMap<QString,QString>& opts)
{
	m_scaleFullPage->setChecked(opts[APP_KFAX_SCALE_FULLPAGE] == "true");
	m_center_horz->setChecked(opts[APP_KFAX_CENTER_HORZ] != "false");
	m_center_vert->setChecked(opts[APP_KFAX_CENTER_VERT] == "true");
}

#include "kfax_printsettings.moc"