• Skip to content
  • Skip to link menu
KDE 3.5 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

kviewshell

kprintDialogPage_DJVUpageoptions.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2005 by Stefan Kebekus                                  *
00003  *   kebekus@kde.org                                                       *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.             *
00019  ***************************************************************************/
00020 
00021 #include <klocale.h>
00022 #include <qbuttongroup.h>
00023 #include <qcheckbox.h>
00024 #include <qlayout.h>
00025 #include <qtooltip.h>
00026 #include <qwhatsthis.h>
00027 #include <kdebug.h>
00028 
00029 #include "kprintDialogPage_DJVUpageoptions.h"
00030 
00031 KPrintDialogPage_DJVUPageOptions::KPrintDialogPage_DJVUPageOptions( QWidget *parent, const char *name )
00032   : KPrintDialogPage( parent, name )
00033 {
00034   setTitle( i18n("Page Size & Placement") );
00035 
00036   kprintDialogPage_pageoptions_baseLayout = 0;
00037   checkBox_rotate = 0;
00038   checkBox_fitpage = 0;
00039 
00040 
00041   kprintDialogPage_pageoptions_baseLayout = new QVBoxLayout( this, 11, 6, "kprintDialogPage_pageoptions_baseLayout");
00042   if (kprintDialogPage_pageoptions_baseLayout == 0) {
00043     kdError(1223) << "KPrintDialogPage_DJVUPageOptions::KPrintDialogPage_DJVUPageOptions() cannot create layout" << endl;
00044     return;
00045   }
00046 
00047   checkBox_rotate = new QCheckBox( this, "checkBox_rotate" );
00048   if (checkBox_rotate != 0) {
00049     checkBox_rotate->setText( i18n( "Automatically choose landscape or portrait orientation" ) );
00050     QToolTip::add( checkBox_rotate, i18n( "If this option is enabled, some pages might be rotated to better fit the paper size." ) );
00051     QWhatsThis::add( checkBox_rotate, i18n( "<qt><p>If this option is enabled, landscape or portrait orientation are automatically chosen on a "
00052                         "page-by-page basis. This makes better use of the paper and gives more visually-"
00053                         "appealing printouts.</p>"
00054                         "<p><b>Note:</b> This option overrides the Portrait/Landscape option chosen in the printer "
00055                         "properties. If this option is enabled, and if the pages in your document have different sizes, "
00056                         "then some pages might be rotated while others are not.</p></qt>" ) );
00057     kprintDialogPage_pageoptions_baseLayout->addWidget( checkBox_rotate );
00058   }
00059 
00060   checkBox_fitpage = new QCheckBox( this, "checkBox_shrink" );
00061   if (checkBox_fitpage != 0) {
00062     checkBox_fitpage->setText( i18n( "Scale pages to fit paper size" ) );
00063     QToolTip::add( checkBox_fitpage, i18n( "If this option is enabled, all pages will be scaled to optimally fit the printer's paper size." ) );
00064     QWhatsThis::add( checkBox_fitpage, i18n( "<qt><p>If this option is enabled, all pages will be scaled to optimally fit the printer's "
00065                         "paper size.</p>"
00066                         "<p><b>Note:</b> If this option is enabled, and if the pages in your document have different sizes, "
00067                         "then different pages might be scaled by different scaling factors.</p></qt>" ) );
00068     kprintDialogPage_pageoptions_baseLayout->addWidget( checkBox_fitpage );
00069   }
00070 
00071   kprintDialogPage_pageoptions_baseLayout->addStretch();
00072 
00073   resize( QSize(319, 166).expandedTo(minimumSizeHint()) );
00074   clearWState( WState_Polished );
00075 }
00076 
00077 
00078 
00079 void KPrintDialogPage_DJVUPageOptions::getOptions( QMap<QString,QString>& opts, bool )
00080 {
00081   // Save options, taking default values into consideration. Warning:
00082   // The default values are also coded into setOptions() and
00083   // kmultipage::print(..).
00084 
00085   if (checkBox_rotate != 0)
00086     if (checkBox_rotate->isChecked())
00087       opts[ "kde-kviewshell-rotatepage" ] = "true";
00088     else
00089       opts[ "kde-kviewshell-rotatepage" ] = "false";
00090 
00091   if (checkBox_fitpage != 0)
00092     if (checkBox_fitpage->isChecked())
00093       opts[ "kde-kdjvu-fitpage" ] = "true";
00094     else
00095       opts[ "kde-kdjvu-fitpage" ] = "false";
00096 }
00097 
00098 
00099 void KPrintDialogPage_DJVUPageOptions::setOptions( const QMap<QString,QString>& opts )
00100 {
00101   // Warning: All default values are also coded into getOptions() and
00102   // kmultipage::print(..).
00103 
00104   // same for rotation
00105   QString op = opts[ "kde-kviewshell-rotatepage" ];
00106   if (checkBox_rotate != 0)
00107     checkBox_rotate->setChecked( op != "false" );
00108 
00109   // Sets the fitpage option. By default, this option is not checked
00110   op = opts[ "kde-kdjvu-fitpage" ];
00111   if (checkBox_fitpage != 0)
00112     checkBox_fitpage->setChecked( op == "true" );
00113 }
00114 
00115 
00116 bool KPrintDialogPage_DJVUPageOptions::isValid( QString& )
00117 {
00118   return true;
00119 }

kviewshell

Skip menu "kviewshell"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members

API Reference

Skip menu "API Reference"
  • kviewshell
Generated for API Reference by doxygen 1.5.9
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal