kchart

kchartPrinterDlg.cc

00001 /*
00002 *
00003 * Copyright (C) 2005  Fredrik Edemar
00004 *                     f_edemar@linux.se
00005 *
00006 * This program is free software; you can redistribute it and/or modify
00007 * it under the terms of the GNU General Public License as published by
00008 * the Free Software Foundation; either version 2 of the License, or
00009 * (at your option) any later version.
00010 * 
00011 * This program is distributed in the hope that it will be useful,
00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 * GNU General Public License for more details.
00015 * 
00016 * You should have received a copy of the GNU General Public License
00017 * along with this program; if not, write to the Free Software
00018 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
00019  * Boston, MA 02110-1301, USA.
00020 *
00021 */
00022 
00023 // Qt includes
00024 #include <qlayout.h>
00025 
00026 // KDE includes
00027 #include <kdebug.h>
00028 #include <kdialog.h>
00029 #include <klocale.h>
00030 
00031 // local includes
00032 #include "kchartPrinterDlg.h"
00033 namespace KChart
00034 {
00035 
00036  KChartPrinterDlg::KChartPrinterDlg( QWidget *parent, const char *name )
00037   : KPrintDialogPage( parent, name )
00038 {
00039   setTitle( i18n( "KChart Options" ) );
00040   QVBoxLayout *layout = new QVBoxLayout( this );
00041   layout->setMargin( KDialog::marginHint() );
00042   layout->setSpacing( KDialog::spacingHint() );
00043   txtSizex = new KIntNumInput(this );
00044   txtSizex->setSuffix("%");
00045   txtSizex->setMinValue(1);
00046   txtSizex->setMaxValue(100);
00047   txtSizex->setValue(100);
00048   txtSizey = new KIntNumInput(this );
00049   txtSizey->setSuffix("%");
00050   txtSizey->setMinValue(1);
00051   txtSizey->setMaxValue(100);
00052   txtSizey->setValue(100);
00053   
00054   layout->addWidget( new QLabel(i18n("Print Size"), this) );
00055   layout->addWidget( new QLabel(i18n("Width: "), this) );
00056   layout->addWidget( txtSizex );
00057   layout->addWidget( new QLabel(i18n("Height: "), this) );
00058   layout->addWidget( txtSizey );
00059   layout->addStretch( 1 );
00060 }
00061 
00062 void KChartPrinterDlg::getOptions( QMap<QString, QString>& opts, bool )
00063 {
00064   opts["kde-kchart-printsizex"] = QString::number(txtSizex->value());
00065   opts["kde-kchart-printsizey"] = QString::number(txtSizey->value());
00066 }
00067 
00068 void KChartPrinterDlg::setOptions( const QMap<QString, QString>& opts )
00069 {
00070   if ( opts["kde-kchart-printsizex"].isEmpty() )
00071     txtSizex->setValue(100);
00072   else
00073     txtSizex->setValue((opts["kde-kchart-printsizex"]).toInt());
00074   if ( opts["kde-kchart-printsizey"].isEmpty() )
00075     txtSizey->setValue(100);
00076   else
00077     txtSizey->setValue((opts["kde-kchart-printsizey"]).toInt());
00078 }
00079 
00080 bool KChartPrinterDlg::isValid( const QString& )
00081 {
00082   return true;
00083 }
00084 }  //namespace KChart
00085 #include "kchartPrinterDlg.moc"
KDE Home | KDE Accessibility Home | Description of Access Keys