1
/* This file is part of the KDE project
2
Copyright (C) 2002 Montel Laurent <lmontel@mandrakesoft.com>
3
This library is free software; you can redistribute it and/or
4
modify it under the terms of the GNU Library General Public
5
License as published by the Free Software Foundation; either
6
version 2 of the License, or (at your option) any later version.
8
This library is distributed in the hope that it will be useful,
9
but WITHOUT ANY WARRANTY; without even the implied warranty of
10
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
Library General Public License for more details.
13
You should have received a copy of the GNU Library General Public License
14
along with this library; see the file COPYING.LIB. If not, write to
15
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
16
Boston, MA 02111-1307, USA.
20
#include "kchartPageLayout.h"
21
#include "kchartPageLayout.moc"
22
#include "kchart_params.h"
23
#include <knumvalidator.h>
24
#include <qlineedit.h>
29
KChartPageLayout::KChartPageLayout( KChartParams* _params, QWidget* parent, const char* name )
30
: KDialogBase( parent, name, TRUE,i18n("Page Layout"),KDialogBase::Ok | KDialogBase::Cancel | KDialogBase::User1 | KDialogBase::Apply , KDialogBase::Ok,true )
33
QWidget *page = new QWidget( this );
36
setButtonText( KDialogBase::User1, i18n("&Reset") );
38
QGridLayout *grid = new QGridLayout(page, 4, 2, KDialog::marginHint(), KDialog::spacingHint());
40
QLabel *lab=new QLabel(i18n("Left:"),page);
41
grid->addWidget(lab,0,0);
43
leftBorder=new QLineEdit(page);
44
leftBorder->setValidator( new KIntValidator( 0,9999,leftBorder ) );
45
grid->addWidget(leftBorder,1,0);
47
lab=new QLabel(i18n("Right:"),page);
48
grid->addWidget(lab,0,1);
50
rightBorder=new QLineEdit(page);
51
rightBorder->setValidator( new KIntValidator( 0,9999,rightBorder ) );
52
grid->addWidget(rightBorder,1,1);
54
lab=new QLabel(i18n("Top:"),page);
55
grid->addWidget(lab,2,0);
57
topBorder=new QLineEdit(page);
58
topBorder->setValidator( new KIntValidator( 0,9999,topBorder ) );
59
grid->addWidget(topBorder,3,0);
61
lab=new QLabel(i18n("Bottom:"),page);
62
grid->addWidget(lab,2,1);
64
bottomBorder=new QLineEdit(page);
65
bottomBorder->setValidator( new KIntValidator( 0,9999,bottomBorder ) );
66
grid->addWidget(bottomBorder,3,1);
69
connect( this, SIGNAL( okClicked() ), this, SLOT( slotOk() ) );
70
connect( this, SIGNAL( applyClicked() ), this, SLOT( slotApply() ) );
71
connect( this, SIGNAL( user1Clicked() ), this ,SLOT( slotReset() ));
75
void KChartPageLayout::init()
77
oldGlobalLeadingRight = params->globalLeadingRight();
78
oldGlobalLeadingLeft = params->globalLeadingLeft();
79
oldGlobalLeadingTop = params->globalLeadingTop();
80
oldGlobalLeadingBottom = params->globalLeadingBottom();
84
void KChartPageLayout::slotOk()
90
void KChartPageLayout::slotApply()
92
params->setGlobalLeading( leftBorder->text().toInt(),topBorder->text().toInt() , rightBorder->text().toInt(), bottomBorder->text().toInt() );
96
void KChartPageLayout::slotReset()
98
rightBorder->setText(QString::number(oldGlobalLeadingRight));
99
leftBorder->setText(QString::number(oldGlobalLeadingLeft));
100
topBorder->setText(QString::number(oldGlobalLeadingTop));
101
bottomBorder->setText(QString::number(oldGlobalLeadingBottom));