diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-01-20 01:29:50 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-01-20 01:29:50 +0000 |
commit | 8362bf63dea22bbf6736609b0f49c152f975eb63 (patch) | |
tree | 0eea3928e39e50fae91d4e68b21b1e6cbae25604 /kchart/kchartPageLayout.cc | |
download | koffice-8362bf63dea22bbf6736609b0f49c152f975eb63.tar.gz koffice-8362bf63dea22bbf6736609b0f49c152f975eb63.zip |
Added old abandoned KDE3 version of koffice
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1077364 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kchart/kchartPageLayout.cc')
-rw-r--r-- | kchart/kchartPageLayout.cc | 120 |
1 files changed, 120 insertions, 0 deletions
diff --git a/kchart/kchartPageLayout.cc b/kchart/kchartPageLayout.cc new file mode 100644 index 00000000..a5a45e7e --- /dev/null +++ b/kchart/kchartPageLayout.cc @@ -0,0 +1,120 @@ +/* This file is part of the KDE project + Copyright (C) 2002 Montel Laurent <[email protected]> + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + 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 "kchartPageLayout.h" +#include "kchartPageLayout.moc" +#include "kchart_params.h" +#include <knumvalidator.h> +#include <qlineedit.h> +#include <qlayout.h> +#include <klocale.h> +#include <qlabel.h> +#include <qgroupbox.h> + +namespace KChart +{ + +KChartPageLayout::KChartPageLayout( KChartParams* _params, QWidget* parent, const char* name ) + : KDialogBase( parent, name, TRUE,i18n("Page Layout"),KDialogBase::Ok | KDialogBase::Cancel | KDialogBase::User1 | KDialogBase::Apply , KDialogBase::Ok,true ) +{ + params=_params; +#if 0 + QWidget *page = new QWidget( this ); +#else + QGroupBox* page = new QGroupBox( 2, Qt::Horizontal, i18n("Margins"), + this ); +#endif + setMainWidget(page); + + // FIXME: The following code is strange, since it is written to + // use a grid layout with a standard QWidget. However, with the + // QGroupBox, it looks better, and since it actually works, there + // is no immediate need for rewriting. In the sake of clarity, it + // should be done though, and we should use the layout + // capabilities of the groupbox instead.. + + setButtonText( KDialogBase::User1, i18n("&Reset") ); + + QGridLayout *grid = new QGridLayout(page, 4, 2, KDialog::marginHint(), KDialog::spacingHint()); + + QLabel *lab=new QLabel(i18n("Left:"),page); + grid->addWidget(lab,0,0); + + leftBorder=new QLineEdit(page); + leftBorder->setValidator( new KIntValidator( 0,9999,leftBorder ) ); + grid->addWidget(leftBorder,1,0); + + lab=new QLabel(i18n("Right:"),page); + grid->addWidget(lab,0,1); + + rightBorder=new QLineEdit(page); + rightBorder->setValidator( new KIntValidator( 0,9999,rightBorder ) ); + grid->addWidget(rightBorder,1,1); + + lab=new QLabel(i18n("Top:"),page); + grid->addWidget(lab,2,0); + + topBorder=new QLineEdit(page); + topBorder->setValidator( new KIntValidator( 0,9999,topBorder ) ); + grid->addWidget(topBorder,3,0); + + lab=new QLabel(i18n("Bottom:"),page); + grid->addWidget(lab,2,1); + + bottomBorder=new QLineEdit(page); + bottomBorder->setValidator( new KIntValidator( 0,9999,bottomBorder ) ); + grid->addWidget(bottomBorder,3,1); + + init(); + connect( this, SIGNAL( okClicked() ), this, SLOT( slotOk() ) ); + connect( this, SIGNAL( applyClicked() ), this, SLOT( slotApply() ) ); + connect( this, SIGNAL( user1Clicked() ), this ,SLOT( slotReset() )); + +} + +void KChartPageLayout::init() +{ + oldGlobalLeadingRight = params->globalLeadingRight(); + oldGlobalLeadingLeft = params->globalLeadingLeft(); + oldGlobalLeadingTop = params->globalLeadingTop(); + oldGlobalLeadingBottom = params->globalLeadingBottom(); + slotReset(); +} + +void KChartPageLayout::slotOk() +{ + slotApply(); + accept(); +} + +void KChartPageLayout::slotApply() +{ + params->setGlobalLeading( leftBorder->text().toInt(),topBorder->text().toInt() , rightBorder->text().toInt(), bottomBorder->text().toInt() ); + emit dataChanged(); +} + +void KChartPageLayout::slotReset() +{ + rightBorder->setText(QString::number(oldGlobalLeadingRight)); + leftBorder->setText(QString::number(oldGlobalLeadingLeft)); + topBorder->setText(QString::number(oldGlobalLeadingTop)); + bottomBorder->setText(QString::number(oldGlobalLeadingBottom)); +} + +} //KChart namespace |