kviewshell
kprintDialogPage_DJVUpageoptions.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
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
00082
00083
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
00102
00103
00104
00105 QString op = opts[ "kde-kviewshell-rotatepage" ];
00106 if (checkBox_rotate != 0)
00107 checkBox_rotate->setChecked( op != "false" );
00108
00109
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 }