~ubuntu-branches/ubuntu/edgy/koffice/edgy-updates

1.1.2 by Jonathan Riddell
Import upstream version 1.4.2
1
/*
2
*
3
* Copyright (C) 2005  Fredrik Edemar
4
*                     f_edemar@linux.se
5
*
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
9
* (at your option) any later version.
10
* 
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
* GNU General Public License for more details.
15
* 
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
1.1.3 by Jonathan Riddell
Import upstream version 1.5.0
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
19
 * Boston, MA 02110-1301, USA.
1.1.2 by Jonathan Riddell
Import upstream version 1.4.2
20
*
21
*/
22
23
// Qt includes
24
#include <qlayout.h>
25
26
// KDE includes
27
#include <kdebug.h>
28
#include <kdialog.h>
29
#include <klocale.h>
30
31
// local includes
32
#include "kchartPrinterDlg.h"
33
namespace KChart
34
{
35
36
 KChartPrinterDlg::KChartPrinterDlg( QWidget *parent, const char *name )
37
  : KPrintDialogPage( parent, name )
38
{
39
  setTitle( i18n( "KChart Options" ) );
40
  QVBoxLayout *layout = new QVBoxLayout( this );
41
  layout->setMargin( KDialog::marginHint() );
42
  layout->setSpacing( KDialog::spacingHint() );
43
  txtSizex = new KIntNumInput(this );
44
  txtSizex->setSuffix("%");
45
  txtSizex->setMinValue(1);
46
  txtSizex->setMaxValue(100);
47
  txtSizex->setValue(100);
48
  txtSizey = new KIntNumInput(this );
49
  txtSizey->setSuffix("%");
50
  txtSizey->setMinValue(1);
51
  txtSizey->setMaxValue(100);
52
  txtSizey->setValue(100);
53
  
54
  layout->addWidget( new QLabel(i18n("Print Size"), this) );
55
  layout->addWidget( new QLabel(i18n("Width: "), this) );
56
  layout->addWidget( txtSizex );
57
  layout->addWidget( new QLabel(i18n("Height: "), this) );
58
  layout->addWidget( txtSizey );
59
  layout->addStretch( 1 );
60
}
61
62
void KChartPrinterDlg::getOptions( QMap<QString, QString>& opts, bool )
63
{
64
  opts["kde-kchart-printsizex"] = QString::number(txtSizex->value());
65
  opts["kde-kchart-printsizey"] = QString::number(txtSizey->value());
66
}
67
68
void KChartPrinterDlg::setOptions( const QMap<QString, QString>& opts )
69
{
70
  if ( opts["kde-kchart-printsizex"].isEmpty() )
71
    txtSizex->setValue(100);
72
  else
73
    txtSizex->setValue((opts["kde-kchart-printsizex"]).toInt());
74
  if ( opts["kde-kchart-printsizey"].isEmpty() )
75
    txtSizey->setValue(100);
76
  else
77
    txtSizey->setValue((opts["kde-kchart-printsizey"]).toInt());
78
}
79
80
bool KChartPrinterDlg::isValid( const QString& )
81
{
82
  return true;
83
}
84
}  //namespace KChart
85
#include "kchartPrinterDlg.moc"