23 #include "kprinterimpl.h"
24 #include "kprintdialog.h"
25 #include "kprintpreview.h"
26 #include "kmfactory.h"
27 #include "kmuimanager.h"
28 #include "kmmanager.h"
31 #include <tqpaintdevicemetrics.h>
35 #include <tqguardedptr.h>
36 #include <tdeapplication.h>
37 #include <kstandarddirs.h>
38 #include <tdeglobal.h>
39 #include <tdeconfig.h>
41 #include <knotifyclient.h>
43 #include <tdelocale.h>
45 #include <klibloader.h>
46 #include <tdemessagebox.h>
48 static void dumpOptions(
const TQMap<TQString,TQString>& opts);
55 class KPrinterWrapper :
public TQPrinter
59 KPrinterWrapper(
KPrinter*, PrinterMode m = ScreenResolution);
62 virtual bool cmd(
int, TQPainter*, TQPDevCmdParam*);
63 virtual int metric(
int)
const;
64 int qprinterMetric(
int)
const;
69 KPrinterWrapper::KPrinterWrapper(
KPrinter *prt, TQPrinter::PrinterMode m)
70 : TQPrinter(m), m_printer(prt)
74 KPrinterWrapper::~KPrinterWrapper()
78 bool KPrinterWrapper::cmd(
int c, TQPainter *painter, TQPDevCmdParam *p)
80 return TQPrinter::cmd(c,painter,p);
83 int KPrinterWrapper::metric(
int m)
const
85 return m_printer->metric(m);
88 int KPrinterWrapper::qprinterMetric(
int m)
const
90 return TQPrinter::metric(m);
100 TQGuardedPtr<KPrinterImpl> m_impl;
104 QString m_docfilename;
105 TQString m_docdirectory;
106 KPrinterWrapper *m_wrapper;
107 TQMap<TQString,TQString> m_options;
109 QString m_printername;
110 QString m_searchname;
114 DrPageSize *m_pagesize;
115 bool m_useprinterres;
124 : TQPaintDevice(TQInternal::Printer|TQInternal::ExternalDevice)
139 delete d->m_pagesize;
143 void KPrinter::init(
bool restore, TQPrinter::PrinterMode m)
146 d =
new KPrinterPrivate;
147 d->m_impl = KMFactory::self()->printerImplementation();
148 d->m_restore = restore;
149 d->m_previewonly =
false;
154 d->m_wrapper =
new KPrinterWrapper(
this, m);
157 d->m_tmpbuffer = d->m_impl->tempFile();
159 d->m_defaultres = d->m_wrapper->resolution();
160 d->m_useprinterres =
false;
167 void KPrinter::loadSettings()
169 d->m_options = d->m_impl->loadOptions();
175 d->m_options.remove(
"kde-searchname");
177 TDEConfig *conf = TDEGlobal::config(), *pconf = KMFactory::self()->printConfig();
178 conf->setGroup(
"KPrinter Settings");
179 pconf->setGroup(
"General");
182 if (
searchName().isEmpty() && pconf->readBoolEntry(
"UseLast",
true))
186 setOption(
"kde-printcommand",conf->readPathEntry(
"PrintCommand"));
193 void KPrinter::saveSettings()
198 d->m_impl->saveOptions(d->m_options);
202 TDEConfig *conf = TDEGlobal::config();
203 conf->setGroup(
"KPrinter Settings");
206 conf->writePathEntry(
"PrintCommand",
option(
"kde-printcommand"));
209 if ( d->m_docdirectory.isEmpty() )
213 conf->writePathEntry(
"DocDirectory", url.directory() );
216 conf->writePathEntry(
"DocDirectory", d->m_docdirectory );
221 if (!kapp->authorize(
"print/dialog"))
228 d->m_parentId = parent->winId();
230 KPrintDialog *dlg = KPrintDialog::printerDialog(
this, parent, caption, forceExpand);
242 KMFactory::self()->settings()->standardDialogPages |= p;
247 KMFactory::self()->settings()->standardDialogPages &= (~p);
252 KMFactory::self()->uiManager()->addPrintDialogPage(page);
257 KMFactory::self()->settings()->pageSelection = t;
267 KMFactory::self()->settings()->application = t;
275 bool KPrinter::cmd(
int c, TQPainter *painter, TQPDevCmdParam *p)
278 if (c == TQPaintDevice::PdcBegin)
280 d->m_impl->statusMessage(i18n(
"Initialization..."),
this);
283 d->m_impl->statusMessage(i18n(
"Generating print data: page %1").arg(d->m_pagenumber),
this);
285 value = d->m_wrapper->cmd(c,painter,p);
286 if (c == TQPaintDevice::PdcEnd)
289 value = value &&
printFiles(TQStringList(d->m_wrapper->outputFileName()),
true);
298 d->m_wrapper->setCreator(
creator());
299 d->m_wrapper->setDocName(
docName());
300 d->m_wrapper->setFullPage(
fullPage());
301 d->m_wrapper->setColorMode((TQPrinter::ColorMode)
colorMode());
302 d->m_wrapper->setOrientation((TQPrinter::Orientation)
orientation());
303 if ( !
option(
"kde-printsize" ).isEmpty() )
304 d->m_wrapper->setPageSize( ( TQPrinter::PageSize )
option(
"kde-printsize" ).toInt() );
306 d->m_wrapper->setPageSize((TQPrinter::PageSize)
pageSize());
307 d->m_wrapper->setOutputToFile(
true);
308 d->m_wrapper->setOutputFileName(d->m_tmpbuffer);
309 d->m_wrapper->setNumCopies(
option(
"kde-qtcopies").isEmpty() ? 1 :
option(
"kde-qtcopies").toInt());
310 if (!
option(
"kde-margin-top").isEmpty())
319 d->m_wrapper->setMargins(
320 (
int )( (
option(
"kde-margin-top").toFloat() * res + 71 ) / 72 ),
321 (
int )( (
option(
"kde-margin-left").toFloat() * res + 71 ) / 72 ),
322 (
int )( (
option(
"kde-margin-bottom").toFloat() * res + 71 ) / 72 ),
323 (
int )( (
option(
"kde-margin-right").toFloat() * res + 71 ) / 72 ) );
325 else if ( d->m_pagesize != NULL )
328 DrPageSize *ps = d->m_pagesize;
329 int top = ( int )( ps->topMargin() * res + 71 ) / 72;
330 int left = ( int )( ps->leftMargin() * res + 71 ) / 72;
331 int bottom = ( int )( ps->bottomMargin() * res + 71 ) / 72;
332 int right = ( int )( ps->rightMargin() * res + 71 ) / 72;
339 unsigned int it, il, ib, ir;
340 d->m_wrapper->margins( &it, &il, &ib, &ir );
341 top = TQMAX( top, (
int)it );
342 left = TQMAX( left, (
int)il );
343 bottom = TQMAX( bottom, (
int)ib );
344 right = TQMAX( right, (
int)ir );
346 d->m_wrapper->setMargins( top, left, bottom, right );
354 if (
option(
"kde-isspecial") ==
"1")
360 TQStringList files(l);
365 int fresult = d->m_impl->filterFiles(
this, files, flag);
371 else if (fresult == 1)
377 fresult = d->m_impl->autoConvertFiles(
this, files, flag);
383 else if (fresult == 1)
388 if (status && files.count() > 0)
393 if (((files.count() != 1 ||
option(
"kde-preview") !=
"1") && !d->m_previewonly) || doPreview(files[0]))
399 if (!d->m_impl->printFiles(
this, files, flag))
406 if ( startviewer && !TQFile::exists(
"/etc/xdg/autostart/system-config-printer-applet-kde.desktop") )
412 kapp->tdeinitExec(
"kjobviewer", args);
420 TQFile::remove(files[0]);
427 bool KPrinter::doPreview(
const TQString& file)
429 d->m_impl->statusMessage(i18n(
"Previewing..."),
this);
430 d->m_impl->statusMessage(TQString::null,
this);
431 return KPrintPreview::preview(file, d->m_previewonly, d->m_parentId);
434 void KPrinter::preparePrinting()
437 if (d->m_ready)
return;
446 if (
option(
"kde-isspecial") !=
"1")
447 d->m_impl->preparePrinting(
this);
450 int res =
option(
"kde-resolution" ).toInt();
451 if ( d->m_useprinterres && res > 0 )
452 d->m_wrapper->setResolution( res );
454 d->m_wrapper->setResolution( d->m_defaultres );
460 dumpOptions(d->m_options);
463 void KPrinter::finishPrinting()
467 d->m_impl->statusMessage(TQString::null,
this);
472 TQValueList<int> list;
474 if (mp > 0 && MP > 0 && MP >= mp)
476 if (
option(
"kde-current") ==
"1")
479 if (pp >= mp && pp <= MP) list.append(pp);
484 if (!
option(
"kde-range").isEmpty())
486 TQStringList ranges = TQStringList::split(
',',
option(
"kde-range"),
false);
487 for (TQStringList::ConstIterator it=ranges.begin();it!=ranges.end();++it)
489 int p = (*it).find(
'-');
493 int pp = (*it).toInt(&ok);
494 if (ok && pp >= mp && pp <= MP)
500 p1 = (*it).left(p).toInt(&ok);
501 if (ok) p2 = (*it).right((*it).length()-p-1).toInt(&ok);
507 for (
int i=p1;i<=p2;i++)
515 for (
int i=mp;i<=MP;i++) list.append(i);
521 for (uint i=0;i<(list.count()/2);i++)
522 tqSwap(list[i],list[list.count()-1-i]);
528 bool keepEven = (
pageSet() == EvenPages);
529 for (TQValueList<int>::Iterator it=list.begin();it!=list.end();)
530 if ((((*it) % 2) != 0 && keepEven) ||
531 (((*it) % 2) == 0 && !keepEven)) it = list.remove(it);
546 int p =
option(
"kde-copies").toInt(&ok);
552 return d->m_wrapper->margins();
557 d->m_wrapper->margins( top, left, bottom, right );
560 int KPrinter::metric(
int m)
const
562 if (d->m_pagesize == NULL || !
option(
"kde-printsize" ).isEmpty())
563 return d->m_wrapper->qprinterMetric(m);
566 bool land = (
orientation() == KPrinter::Landscape);
567 uint res(d->m_wrapper->resolution()), top = res/2, left = res/2, bottom = res/3, right = res/2;
568 margins( &top, &left, &bottom, &right );
571 case TQPaintDeviceMetrics::PdmWidth:
572 val = (land ? ( int )d->m_pagesize->pageHeight() : ( int )d->m_pagesize->pageWidth());
574 val = (val * res + 36) / 72;
576 val -= ( left + right );
578 case TQPaintDeviceMetrics::PdmHeight:
579 val = (land ? ( int )d->m_pagesize->pageWidth() : ( int )d->m_pagesize->pageHeight());
581 val = (val * res + 36) / 72;
583 val -= ( top + bottom );
585 case TQPaintDeviceMetrics::PdmWidthMM:
586 val = metric( TQPaintDeviceMetrics::PdmWidth );
587 val = (val * 254 + 5*res) / (10*res);
589 case TQPaintDeviceMetrics::PdmHeightMM:
590 val = metric( TQPaintDeviceMetrics::PdmHeight );
591 val = (val * 254 + 5*res) / (10*res);
594 val = d->m_wrapper->qprinterMetric(m);
602 KMFactory::self()->settings()->orientation = o;
603 setOption(
"kde-orientation",(o == Landscape ?
"Landscape" :
"Portrait"));
604 d->m_impl->broadcastOption(
"kde-orientation",(o == Landscape ?
"Landscape" :
"Portrait"));
605 d->m_impl->broadcastOption(
"kde-orientation-fixed",
"1" );
612 d->m_impl->broadcastOption( key, value );
617 KMFactory::self()->settings()->pageSize = s;
618 setOption(
"kde-pagesize",TQString::number((
int)s),
true);
619 d->m_impl->broadcastOption(
"kde-pagesize-fixed",
"1" );
626 TQMap<TQString,TQString> tmpset = d->m_options;
630 tmpset.remove(
"kde-pagesize");
631 tmpset.remove(
"kde-printsize" );
632 tmpset.remove(
"kde-orientation");
633 tmpset.remove(
"kde-colormode");
634 tmpset.remove(
"kde-margin-top");
635 tmpset.remove(
"kde-margin-left");
636 tmpset.remove(
"kde-margin-bottom");
637 tmpset.remove(
"kde-margin-right");
638 tmpset.remove(
"kde-resolution" );
639 tmpset.remove(
"kde-fonts" );
640 for (TQMap<TQString,TQString>::ConstIterator it=tmpset.begin();it!=tmpset.end();++it)
641 if (it.key().left(4) ==
"kde-" && !(d->m_options.contains(it.key())))
642 d->m_options[it.key()] = it.data();
649 for (TQMap<TQString,TQString>::ConstIterator it=opts.begin(); it!=opts.end(); ++it)
652 if (it.key().left(4) !=
"kde-")
653 d->m_impl->broadcastOption(it.key(),it.data());
657 void KPrinter::reload()
659 d->m_impl = KMFactory::self()->printerImplementation();
660 int global = KMFactory::self()->settings()->orientation;
662 global = KMFactory::self()->settings()->pageSize;
669 KMManager *mgr = KMManager::self();
672 mgr->printerList(
false);
673 if (prname.isEmpty())
674 mprt = mgr->defaultPrinter();
676 mprt = mgr->findPrinter(prname);
679 return mprt->autoConfigure(
this, parent);
690 if (!KNotifyClient::event(0,
"printerror",i18n(
"<p><nobr>A print error occurred. Error message received from system:</nobr></p><br>%1").arg(p->
errorMessage())))
691 kdDebug(500) <<
"could not send notify event" << endl;
696 TQString name = _name.upper();
697 if (name ==
"LETTER")
return KPrinter::Letter;
698 else if (name ==
"LEGAL")
return KPrinter::Legal;
699 else if (name ==
"A4")
return KPrinter::A4;
700 else if (name ==
"A3")
return KPrinter::A3;
701 else if (name ==
"EXECUTIVE")
return KPrinter::Executive;
702 else if (name ==
"LEDGER")
return KPrinter::Ledger;
703 else if (name ==
"TABLOID")
return KPrinter::Tabloid;
704 else if (name ==
"FOLIO")
return KPrinter::Folio;
705 else if (name ==
"A5")
return KPrinter::A5;
706 else if (name ==
"A6")
return KPrinter::A6;
707 else if (name ==
"A7")
return KPrinter::A7;
708 else if (name ==
"A8")
return KPrinter::A8;
709 else if (name ==
"A9")
return KPrinter::A9;
710 else if (name ==
"A2")
return KPrinter::A2;
711 else if (name ==
"A1")
return KPrinter::A1;
712 else if (name ==
"A0")
return KPrinter::A0;
713 else if (name ==
"B0" || name ==
"B0ISO")
return KPrinter::B0;
714 else if (name ==
"B1" || name ==
"B1ISO")
return KPrinter::B1;
715 else if (name ==
"B2" || name ==
"B2ISO")
return KPrinter::B2;
716 else if (name ==
"B3" || name ==
"B3ISO")
return KPrinter::B3;
717 else if (name ==
"B4" || name ==
"B4ISO")
return KPrinter::B4;
718 else if (name ==
"B5" || name ==
"B5ISO")
return KPrinter::B5;
719 else if (name ==
"B6" || name ==
"B6ISO")
return KPrinter::B6;
720 else if (name ==
"B7" || name ==
"B7ISO")
return KPrinter::B7;
721 else if (name ==
"B8" || name ==
"B8ISO")
return KPrinter::B8;
722 else if (name ==
"B9" || name ==
"B9ISO")
return KPrinter::B9;
723 else if (name ==
"B10" || name ==
"B10ISO")
return KPrinter::B10;
724 else if (name ==
"C5" || name ==
"C5E" || name ==
"ENVC5")
return KPrinter::C5E;
725 else if (name ==
"DL" || name ==
"DLE" || name ==
"ENVDL")
return KPrinter::DLE;
726 else if (name ==
"COMM10" || name ==
"COM10" || name ==
"ENV10")
return KPrinter::Comm10E;
727 else return KPrinter::A4;
734 case KPrinter::Letter:
return "Letter";
735 case KPrinter::Legal:
return "Legal";
736 case KPrinter::A4:
return "A4";
737 case KPrinter::A3:
return "A3";
738 case KPrinter::Executive:
return "Executive";
739 case KPrinter::Ledger:
return "Ledger";
740 case KPrinter::Tabloid:
return "Tabloid";
741 case KPrinter::Folio:
return "Folio";
742 case KPrinter::A5:
return "A5";
743 case KPrinter::A6:
return "A6";
744 case KPrinter::A7:
return "A7";
745 case KPrinter::A8:
return "A8";
746 case KPrinter::A9:
return "A9";
747 case KPrinter::A2:
return "A2";
748 case KPrinter::A1:
return "A1";
749 case KPrinter::A0:
return "A0";
750 case KPrinter::B0:
return "B0";
751 case KPrinter::B1:
return "B1";
752 case KPrinter::B2:
return "B2";
753 case KPrinter::B3:
return "B3";
754 case KPrinter::B4:
return "B4";
755 case KPrinter::B5:
return "B5";
756 case KPrinter::B6:
return "B6";
757 case KPrinter::B7:
return "B7";
758 case KPrinter::B8:
return "B8";
759 case KPrinter::B9:
return "B9";
760 case KPrinter::B10:
return "B10";
761 case KPrinter::C5E:
return "C5";
762 case KPrinter::DLE:
return "DL";
763 case KPrinter::Comm10E:
return "Comm10";
764 default:
return "A4";
769 TQSize rangeToSize(
const TQString& )
771 kdWarning( 500 ) <<
"rangeToSize(TQString) is obsolete, do not use (no effect)" << endl;
775 static void dumpOptions(
const TQMap<TQString,TQString>& opts)
777 kdDebug(500) <<
"********************" << endl;
778 for (TQMap<TQString,TQString>::ConstIterator it=opts.begin(); it!=opts.end(); ++it)
779 kdDebug(500) << it.key() <<
" = " << it.data() << endl;
783 {
return d->m_impl; }
786 {
return ((
const KPrinterPrivate*)(d))->m_options[key]; }
789 { d->m_options[key] = value; }
792 {
return option(
"kde-docname"); }
798 {
return option(
"kde-creator"); }
804 {
return (
option(
"kde-fullpage") ==
"1"); }
807 {
setOption(
"kde-fullpage",(on ?
"1" :
"0")); }
813 {
setOption(
"kde-colormode",(m == Color ?
"Color" :
"GrayScale")); }
816 {
setOption(
"kde-copies",TQString::number(n)); }
819 {
return (
option(
"kde-orientation") ==
"Landscape" ? Landscape : Portrait); }
822 {
return (
option(
"kde-pageorder") ==
"Reverse" ? LastPageFirst : FirstPageFirst); }
825 {
setOption(
"kde-pageorder",(o == LastPageFirst ?
"Reverse" :
"Forward")); }
828 {
return (
option(
"kde-collate") ==
"Collate" ? Collate : Uncollate); }
831 {
setOption(
"kde-collate",(c == Collate ?
"Collate" :
"Uncollate")); }
834 {
return (
option(
"kde-minpage").isEmpty() ? 0 :
option(
"kde-minpage").toInt()); }
837 {
return (
option(
"kde-maxpage").isEmpty() ? 0 :
option(
"kde-maxpage").toInt()); }
840 {
setOption(
"kde-minpage",TQString::number(m));
setOption(
"kde-maxpage",TQString::number(M)); }
843 {
return (
option(
"kde-frompage").isEmpty() ? 0 :
option(
"kde-frompage").toInt()); }
846 {
return (
option(
"kde-topage").isEmpty() ? 0 :
option(
"kde-topage").toInt()); }
849 {
setOption(
"kde-frompage",TQString::number(m));
setOption(
"kde-topage",TQString::number(M));
setOption(
"kde-range",(m>0 && M>0 ? TQString(
"%1-%2").arg(m).arg(M) : TQString::fromLatin1(
""))); }
859 {
return (
option(
"kde-currentpage").isEmpty() ? 0 :
option(
"kde-currentpage").toInt()); }
862 {
setOption(
"kde-currentpage",TQString::number(p)); }
865 {
return d->m_printername; }
868 { d->m_printername = s; }
871 {
return (
option(
"kde-isspecial") ==
"1" ?
option(
"kde-special-command") : TQString::null); }
878 d->m_options.remove(
"kde-special-command");
883 if (s.find(
"%in") == -1)
892 {
return TQString::fromLatin1(
""); }
898 {
return d->m_options; }
901 {
return d->m_searchname; }
904 { d->m_searchname = s; }
909 d->m_impl->statusMessage(i18n(
"Generating print data: page %1").arg(d->m_pagenumber),
this);
910 return d->m_wrapper->newPage();
914 {
return option(
"kde-outputfilename"); }
920 {
return (
option(
"kde-outputtofile") ==
"1" || (
option(
"kde-isspecial") ==
"1" &&
option(
"kde-special-command").isEmpty())); }
924 setOption(
"kde-outputtofile",(on ?
"1" :
"0"));
927 setOption(
"kde-special-command",TQString::null);
933 {
return d->m_wrapper->abort(); }
936 {
return d->m_wrapper->aborted(); }
940 setMargins( m.height(), m.width(), m.height(), m.width() );
945 d->m_wrapper->setMargins( top, left, bottom, right );
946 setOption(
"kde-margin-top", TQString::number( top ),
true );
947 setOption(
"kde-margin-left", TQString::number( left ),
true );
948 setOption(
"kde-margin-bottom", TQString::number( bottom ),
true );
949 setOption(
"kde-margin-right", TQString::number( right ),
true );
955 kdWarning( 500 ) <<
"KPrinter::realPageSize() is obsolete, do not use" << endl;
957 return d->m_pagesize->pageSize();
966 kdDebug( 500 ) <<
"Page size: width =" << p->pageWidth() << endl;
967 kdDebug( 500 ) <<
"Page size: height =" << p->pageHeight() << endl;
968 kdDebug( 500 ) <<
"Page size: left =" << p->leftMargin() << endl;
969 kdDebug( 500 ) <<
"Page size: top =" << p->topMargin() << endl;
970 kdDebug( 500 ) <<
"Page size: right =" << p->rightMargin() << endl;
971 kdDebug( 500 ) <<
"Page size: bottom =" << p->bottomMargin() << endl;
974 kdDebug( 500 ) <<
"Resetting page size" << endl;
979 delete d->m_pagesize;
982 d->m_pagesize =
new DrPageSize( *p );
988 kdWarning( 500 ) <<
"KPrinter::setRealPageSize(TQSize) is obsolete, do not use (no effect)" << endl;
994 kdWarning( 500 ) <<
"KPrinter::setRealDrawableArea(TQRect) is obsolete, do not use (no effect)" << endl;
1000 kdWarning( 500 ) <<
"KPrinter::realDrawableArea() is obsolete, do not use" << endl;
1001 if ( d->m_pagesize )
1002 return d->m_pagesize->pageRect();
1008 {
return d->m_errormsg; }
1011 { d->m_errormsg = msg; }
1018 { d->m_previewonly = on; }
1021 {
return d->m_previewonly; }
1024 { d->m_docfilename = s; }
1027 {
return d->m_docfilename; }
1030 { d->m_docdirectory = s; }
1033 {
return ( d->m_docdirectory.isEmpty() ? TQDir::homeDirPath() : d->m_docdirectory ); }
1037 d->m_wrapper->setResolution(dpi);
1038 d->m_defaultres = dpi;
1042 {
return d->m_wrapper->resolution(); }
1045 { d->m_useprinterres = on; }
CollateType collate() const
Returns the collate status of the current KPrinter.
void setResolution(int dpi)
Set the resolution of the current KPrinter object.
void setErrorMessage(const TQString &msg)
Sets the last error message.
TQString errorMessage() const
Returns the last error message issued by the print system.
const TQString & option(const TQString &key) const
Starts the add printer wizard.
const TQMap< TQString, TQString > & options() const
Returns the complete set of print options from the KPrinter object.
ColorMode
Defines the color mode of the printer.
void setMargins(TQSize m)
Not used yet.
void setDocFileName(const TQString &filename)
Set the default document filename.
bool autoConfigure(const TQString &prname=TQString::null, TQWidget *parent=0)
Configure the KPrinter object to be used with the printer named prname.
ApplicationType
Defines the type of the application, this affects the GUI of the print dialog:
static void addDialogPage(KPrintDialogPage *_page)
Adds a customized page to the print dialog.
bool abort()
See TQPrinter::abort().
void setDocName(const TQString &)
See TQPrinter::setDocName().
TQString docFileName() const
Get the default document filename, that is the default basename used for the output file...
void setPreviewOnly(bool on)
Sets the KPrinter object to preview mode if on is true.
bool fullPage() const
See TQPrinter::fullPage().
void setPrinterSelectionOption(const TQString &)
See TQPrinter::setPrinterSelectionOption().
int currentPage() const
Returns the current page number.
void setOptions(const TQMap< TQString, TQString > &opts)
Sets the option set in one operation.
void setPrintProgram(const TQString &cmd)
Sets the command line to use when printing.
void setColorMode(ColorMode)
See TQPrinter::setColorMode().
int minPage() const
See TQPrinter::minPage().
void setCollate(CollateType type)
Sets the collate status for the current KPrinter to type.
TQRect realDrawableArea() const
DO NOT USE, WILL BE REMOVED.
static void setPageSelection(PageSelectionType _mode)
Sets the page selection mode of the application.
void setMinMax(int, int)
See TQPrinter::setMinMax().
This class is the main interface to access the TDE print framework.
Orientation orientation() const
See TQPrinter::orientation().
bool previewOnly() const
Returns the preview-only state for this KPrinter object.
static void removeStandardPage(int p)
Removes a standard page from the print dialog.
TQString docName() const
See TQPrinter::docName().
void setRealPageSize(TQSize p)
DO NOT USE, WILL BE REMOVED.
KPrinter(bool restore=true, TQPrinter::PrinterMode m=TQPrinter::ScreenResolution)
Constructor.
void setUsePrinterResolution(bool on)
Define the KPrinter object to use the actual printer resolution.
void setDocDirectory(const TQString &dir)
Set the default document directory.
void initOptions(const TQMap< TQString, TQString > &opts)
For internal use only.
bool printFiles(const TQStringList &files, bool removeafter=false, bool startviewer=true)
Prints the files given in argument.
static PageSelectionType pageSelection()
Returns the page selection mode of the current application.
PageSetType
Defines the page set to print:
PageOrder
Defines the page order of the print job.
void translateQtOptions()
bool setup(TQWidget *parent=0, const TQString &caption=TQString::null, bool forceExpand=false)
Sets up the KPrinter object using the print dialog, returns true if the user clicked OK...
void setFromTo(int, int)
Sets the first and last page to be printed.
PageOrder pageOrder() const
See TQPrinter::pageOrder().
TQSize margins() const
See TQPrinter::margins().
PageSelectionType
Defines whether the application can perform page selection itself or not.
bool aborted() const
See TQPrinter::aborted(.)
TQSize realPageSize() const
Returns the page size in dot unit ( 1 dot = 1/72th in ).
static void setApplicationType(ApplicationType type)
Sets the application type concerning the print dialog.
void setPageOrder(PageOrder)
See TQPrinter::setPageOrder().
TQString printProgram() const
Returns the print program as set by setPrintProgram() or by the print dialog if a special printer has...
void setPrinterName(const TQString &)
See TQPrinter::setPrinterName().
bool newPage()
See TQPrinter::newPage().
void setOrientation(Orientation)
See TQPrinter::setOrientation().
void setPageSize(PageSize)
See TQPrinter::setPageSize().
void setCreator(const TQString &)
See TQPrinter::setCreator().
int resolution() const
Resturns the resolution of the current KPrinter object.
TQString outputFileName() const
See TQPrinter::outputFileName().
PageSize pageSize() const
See TQPrinter::pageSize().
TQValueList< int > pageList() const
Returns the page list to be printed, correpsonding to the options selected by the user...
void setNumCopies(int n)
See TQPrinter::setNumCopies().
This class is intended to be used as base class for customized print dialog page. ...
int maxPage() const
See TQPrinter::maxPage().
bool outputToFile() const
See TQPrinter::outputToFile().
CollateType
Defines the collate property of the printer (if supported by the print system):
int numCopies() const
See TQPrinter::numCopies().
int toPage() const
Returns the last page to be printed.
TQString docDirectory() const
Get the default document directory, that is the directory used for any output file.
int fromPage() const KDE_DEPRECATED
Returns the first page to be printed.
TQString printerName() const
See TQPrinter::printerName().
static ApplicationType applicationType()
Returns the application type concerning the print dialog.
PageSize
Defines the paper size to use.
TQString creator() const
See TQPrinter::creator().
void setCurrentPage(int p=0)
Sets the current page number.
void setOutputFileName(const TQString &)
See TQPrinter::setOutputFileName().
PageSetType pageSet() const
Returns the page set of the current KPrinter object.
void setRealDrawableArea(const TQRect &r)
DO NOT USE, WILL BE REMOVED.
KPrinterImpl * implementation() const
For internal use only.
void setSearchName(const TQString &n)
Sets the search name of the KPrinter object.
static void addStandardPage(int p)
Adds a standard page to the print dialog.
TQString printerSelectionOption() const
See TQPrinter::printerSelectionOption().
void setOption(const TQString &key, const TQString &value)
Adds or modifies an option in the KPrinter object.
TQString searchName() const
Returns the search name of the printer selected by the user.
ColorMode colorMode() const
See TQPrinter::colorMode().
void setFullPage(bool)
See TQPrinter::setFullPage().
Orientation
Defines the orientation of the paper.
void setOutputToFile(bool)
See TQPrinter::setOutputToFile().