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 TQString m_docfilename;
105 TQString m_docdirectory;
106 KPrinterWrapper *m_wrapper;
107 TQMap<TQString,TQString> m_options;
108 TQString m_tmpbuffer;
109 TQString m_printername;
110 TQString 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"));
607 d->m_impl->broadcastOption(
"kde-orientation-fixed",
"1" );
615 d->m_impl->broadcastOption( key, value );
620 KMFactory::self()->settings()->pageSize = s;
621 setOption(
"kde-pagesize",TQString::number((
int)s),
true);
624 d->m_impl->broadcastOption(
"kde-pagesize-fixed",
"1" );
632 TQMap<TQString,TQString> tmpset = d->m_options;
636 tmpset.remove(
"kde-pagesize");
637 tmpset.remove(
"kde-printsize" );
638 tmpset.remove(
"kde-orientation");
639 tmpset.remove(
"kde-colormode");
640 tmpset.remove(
"kde-margin-top");
641 tmpset.remove(
"kde-margin-left");
642 tmpset.remove(
"kde-margin-bottom");
643 tmpset.remove(
"kde-margin-right");
644 tmpset.remove(
"kde-resolution" );
645 tmpset.remove(
"kde-fonts" );
646 for (TQMap<TQString,TQString>::ConstIterator it=tmpset.begin();it!=tmpset.end();++it)
647 if (it.key().left(4) ==
"kde-" && !(d->m_options.contains(it.key())))
648 d->m_options[it.key()] = it.data();
655 for (TQMap<TQString,TQString>::ConstIterator it=opts.begin(); it!=opts.end(); ++it)
658 if (it.key().left(4) !=
"kde-")
659 d->m_impl->broadcastOption(it.key(),it.data());
663 void KPrinter::reload()
665 d->m_impl = KMFactory::self()->printerImplementation();
666 int global = KMFactory::self()->settings()->orientation;
668 global = KMFactory::self()->settings()->pageSize;
675 KMManager *mgr = KMManager::self();
678 mgr->printerList(
false);
679 if (prname.isEmpty())
680 mprt = mgr->defaultPrinter();
682 mprt = mgr->findPrinter(prname);
685 return mprt->autoConfigure(
this, parent);
696 if (!KNotifyClient::event(0,
"printerror",i18n(
"<p><nobr>A print error occurred. Error message received from system:</nobr></p><br>%1").arg(p->
errorMessage())))
697 kdDebug(500) <<
"could not send notify event" << endl;
702 TQString name = _name.upper();
703 if (name ==
"LETTER")
return KPrinter::Letter;
704 else if (name ==
"LEGAL")
return KPrinter::Legal;
705 else if (name ==
"A4")
return KPrinter::A4;
706 else if (name ==
"A3")
return KPrinter::A3;
707 else if (name ==
"EXECUTIVE")
return KPrinter::Executive;
708 else if (name ==
"LEDGER")
return KPrinter::Ledger;
709 else if (name ==
"TABLOID")
return KPrinter::Tabloid;
710 else if (name ==
"FOLIO")
return KPrinter::Folio;
711 else if (name ==
"A5")
return KPrinter::A5;
712 else if (name ==
"A6")
return KPrinter::A6;
713 else if (name ==
"A7")
return KPrinter::A7;
714 else if (name ==
"A8")
return KPrinter::A8;
715 else if (name ==
"A9")
return KPrinter::A9;
716 else if (name ==
"A2")
return KPrinter::A2;
717 else if (name ==
"A1")
return KPrinter::A1;
718 else if (name ==
"A0")
return KPrinter::A0;
719 else if (name ==
"B0" || name ==
"B0ISO")
return KPrinter::B0;
720 else if (name ==
"B1" || name ==
"B1ISO")
return KPrinter::B1;
721 else if (name ==
"B2" || name ==
"B2ISO")
return KPrinter::B2;
722 else if (name ==
"B3" || name ==
"B3ISO")
return KPrinter::B3;
723 else if (name ==
"B4" || name ==
"B4ISO")
return KPrinter::B4;
724 else if (name ==
"B5" || name ==
"B5ISO")
return KPrinter::B5;
725 else if (name ==
"B6" || name ==
"B6ISO")
return KPrinter::B6;
726 else if (name ==
"B7" || name ==
"B7ISO")
return KPrinter::B7;
727 else if (name ==
"B8" || name ==
"B8ISO")
return KPrinter::B8;
728 else if (name ==
"B9" || name ==
"B9ISO")
return KPrinter::B9;
729 else if (name ==
"B10" || name ==
"B10ISO")
return KPrinter::B10;
730 else if (name ==
"C5" || name ==
"C5E" || name ==
"ENVC5")
return KPrinter::C5E;
731 else if (name ==
"DL" || name ==
"DLE" || name ==
"ENVDL")
return KPrinter::DLE;
732 else if (name ==
"COMM10" || name ==
"COM10" || name ==
"ENV10")
return KPrinter::Comm10E;
733 else return KPrinter::A4;
740 case KPrinter::Letter:
return "Letter";
741 case KPrinter::Legal:
return "Legal";
742 case KPrinter::A4:
return "A4";
743 case KPrinter::A3:
return "A3";
744 case KPrinter::Executive:
return "Executive";
745 case KPrinter::Ledger:
return "Ledger";
746 case KPrinter::Tabloid:
return "Tabloid";
747 case KPrinter::Folio:
return "Folio";
748 case KPrinter::A5:
return "A5";
749 case KPrinter::A6:
return "A6";
750 case KPrinter::A7:
return "A7";
751 case KPrinter::A8:
return "A8";
752 case KPrinter::A9:
return "A9";
753 case KPrinter::A2:
return "A2";
754 case KPrinter::A1:
return "A1";
755 case KPrinter::A0:
return "A0";
756 case KPrinter::B0:
return "B0";
757 case KPrinter::B1:
return "B1";
758 case KPrinter::B2:
return "B2";
759 case KPrinter::B3:
return "B3";
760 case KPrinter::B4:
return "B4";
761 case KPrinter::B5:
return "B5";
762 case KPrinter::B6:
return "B6";
763 case KPrinter::B7:
return "B7";
764 case KPrinter::B8:
return "B8";
765 case KPrinter::B9:
return "B9";
766 case KPrinter::B10:
return "B10";
767 case KPrinter::C5E:
return "C5";
768 case KPrinter::DLE:
return "DL";
769 case KPrinter::Comm10E:
return "Comm10";
770 default:
return "A4";
775 TQSize rangeToSize(
const TQString& )
777 kdWarning( 500 ) <<
"rangeToSize(TQString) is obsolete, do not use (no effect)" << endl;
781 static void dumpOptions(
const TQMap<TQString,TQString>& opts)
783 kdDebug(500) <<
"********************" << endl;
784 for (TQMap<TQString,TQString>::ConstIterator it=opts.begin(); it!=opts.end(); ++it)
785 kdDebug(500) << it.key() <<
" = " << it.data() << endl;
789 {
return d->m_impl; }
792 {
return ((
const KPrinterPrivate*)(d))->m_options[key]; }
795 { d->m_options[key] = value; }
798 {
return option(
"kde-docname"); }
804 {
return option(
"kde-creator"); }
810 {
return (
option(
"kde-fullpage") ==
"1"); }
813 {
setOption(
"kde-fullpage",(on ?
"1" :
"0")); }
819 {
setOption(
"kde-colormode",(m == Color ?
"Color" :
"GrayScale")); }
822 {
setOption(
"kde-copies",TQString::number(n)); }
825 {
return (
option(
"kde-orientation") ==
"Landscape" ? Landscape : Portrait); }
828 {
return (
option(
"kde-pageorder") ==
"Reverse" ? LastPageFirst : FirstPageFirst); }
831 {
setOption(
"kde-pageorder",(o == LastPageFirst ?
"Reverse" :
"Forward")); }
834 {
return (
option(
"kde-collate") ==
"Collate" ? Collate : Uncollate); }
837 {
setOption(
"kde-collate",(c == Collate ?
"Collate" :
"Uncollate")); }
840 {
return (
option(
"kde-minpage").isEmpty() ? 0 :
option(
"kde-minpage").toInt()); }
843 {
return (
option(
"kde-maxpage").isEmpty() ? 0 :
option(
"kde-maxpage").toInt()); }
846 {
setOption(
"kde-minpage",TQString::number(m));
setOption(
"kde-maxpage",TQString::number(M)); }
849 {
return (
option(
"kde-frompage").isEmpty() ? 0 :
option(
"kde-frompage").toInt()); }
852 {
return (
option(
"kde-topage").isEmpty() ? 0 :
option(
"kde-topage").toInt()); }
855 {
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(
""))); }
865 {
return (
option(
"kde-currentpage").isEmpty() ? 0 :
option(
"kde-currentpage").toInt()); }
868 {
setOption(
"kde-currentpage",TQString::number(p)); }
871 {
return d->m_printername; }
874 { d->m_printername = s; }
877 {
return (
option(
"kde-isspecial") ==
"1" ?
option(
"kde-special-command") : TQString::null); }
884 d->m_options.remove(
"kde-special-command");
889 if (s.find(
"%in") == -1)
898 {
return TQString::fromLatin1(
""); }
904 {
return d->m_options; }
907 {
return d->m_searchname; }
910 { d->m_searchname = s; }
915 d->m_impl->statusMessage(i18n(
"Generating print data: page %1").arg(d->m_pagenumber),
this);
916 return d->m_wrapper->newPage();
920 {
return option(
"kde-outputfilename"); }
926 {
return (
option(
"kde-outputtofile") ==
"1" || (
option(
"kde-isspecial") ==
"1" &&
option(
"kde-special-command").isEmpty())); }
930 setOption(
"kde-outputtofile",(on ?
"1" :
"0"));
933 setOption(
"kde-special-command",TQString::null);
939 {
return d->m_wrapper->abort(); }
942 {
return d->m_wrapper->aborted(); }
946 setMargins( m.height(), m.width(), m.height(), m.width() );
951 d->m_wrapper->setMargins( top, left, bottom, right );
952 setOption(
"kde-margin-top", TQString::number( top ),
true );
953 setOption(
"kde-margin-left", TQString::number( left ),
true );
954 setOption(
"kde-margin-bottom", TQString::number( bottom ),
true );
955 setOption(
"kde-margin-right", TQString::number( right ),
true );
961 kdWarning( 500 ) <<
"KPrinter::realPageSize() is obsolete, do not use" << endl;
963 return d->m_pagesize->pageSize();
972 kdDebug( 500 ) <<
"Page size: width =" << p->pageWidth() << endl;
973 kdDebug( 500 ) <<
"Page size: height =" << p->pageHeight() << endl;
974 kdDebug( 500 ) <<
"Page size: left =" << p->leftMargin() << endl;
975 kdDebug( 500 ) <<
"Page size: top =" << p->topMargin() << endl;
976 kdDebug( 500 ) <<
"Page size: right =" << p->rightMargin() << endl;
977 kdDebug( 500 ) <<
"Page size: bottom =" << p->bottomMargin() << endl;
980 kdDebug( 500 ) <<
"Resetting page size" << endl;
985 delete d->m_pagesize;
988 d->m_pagesize =
new DrPageSize( *p );
994 kdWarning( 500 ) <<
"KPrinter::setRealPageSize(TQSize) is obsolete, do not use (no effect)" << endl;
1000 kdWarning( 500 ) <<
"KPrinter::setRealDrawableArea(TQRect) is obsolete, do not use (no effect)" << endl;
1006 kdWarning( 500 ) <<
"KPrinter::realDrawableArea() is obsolete, do not use" << endl;
1007 if ( d->m_pagesize )
1008 return d->m_pagesize->pageRect();
1014 {
return d->m_errormsg; }
1017 { d->m_errormsg = msg; }
1024 { d->m_previewonly = on; }
1027 {
return d->m_previewonly; }
1030 { d->m_docfilename = s; }
1033 {
return d->m_docfilename; }
1036 { d->m_docdirectory = s; }
1039 {
return ( d->m_docdirectory.isEmpty() ? TQDir::homeDirPath() : d->m_docdirectory ); }
1043 d->m_wrapper->setResolution(dpi);
1044 d->m_defaultres = dpi;
1048 {
return d->m_wrapper->resolution(); }
1051 { d->m_useprinterres = on; }
void setResolution(int dpi)
Set the resolution of the current KPrinter object.
void setErrorMessage(const TQString &msg)
Sets the last error message.
ColorMode
Defines the color mode of the printer.
void setMargins(TQSize m)
Not used yet.
int toPage() const
Returns the last page to be printed.
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().
TQString printProgram() const
Returns the print program as set by setPrintProgram() or by the print dialog if a special printer has...
TQSize margins() const
See TQPrinter::margins().
CollateType collate() const
Returns the collate status of the current KPrinter.
PageOrder pageOrder() const
See TQPrinter::pageOrder().
void setDocName(const TQString &)
See TQPrinter::setDocName().
int minPage() const
See TQPrinter::minPage().
bool fullPage() const
See TQPrinter::fullPage().
void setPreviewOnly(bool on)
Sets the KPrinter object to preview mode if on is true.
void setPrinterSelectionOption(const TQString &)
See TQPrinter::setPrinterSelectionOption().
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().
Orientation orientation() const
See TQPrinter::orientation().
void setCollate(CollateType type)
Sets the collate status for the current KPrinter to type.
int currentPage() const
Returns the current page number.
static void setPageSelection(PageSelectionType _mode)
Sets the page selection mode of the application.
void setMinMax(int, int)
See TQPrinter::setMinMax().
bool outputToFile() const
See TQPrinter::outputToFile().
TQString outputFileName() const
See TQPrinter::outputFileName().
This class is the main interface to access the TDE print framework.
TQString docFileName() const
Get the default document filename, that is the default basename used for the output file...
static void removeStandardPage(int p)
Removes a standard page from the print dialog.
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:
const TQMap< TQString, TQString > & options() const
Returns the complete set of print options from the KPrinter object.
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.
PageSelectionType
Defines whether the application can perform page selection itself or not.
TQString errorMessage() const
Returns the last error message issued by the print system.
static void setApplicationType(ApplicationType type)
Sets the application type concerning the print dialog.
void setPageOrder(PageOrder)
See TQPrinter::setPageOrder().
int numCopies() const
See TQPrinter::numCopies().
int resolution() const
Resturns the resolution of the current KPrinter object.
void setPrinterName(const TQString &)
See TQPrinter::setPrinterName().
PageSize pageSize() const
See TQPrinter::pageSize().
bool newPage()
See TQPrinter::newPage().
TQString creator() const
See TQPrinter::creator().
void setCreator(const TQString &)
See TQPrinter::setCreator().
TQValueList< int > pageList() const
Returns the page list to be printed, correpsonding to the options selected by the user...
void setOrientation(Orientation, bool locking=false)
See TQPrinter::setOrientation().
TQString searchName() const
Returns the search name of the printer selected by the user.
bool aborted() const
See TQPrinter::aborted(.)
void setNumCopies(int n)
See TQPrinter::setNumCopies().
PageSetType pageSet() const
Returns the page set of the current KPrinter object.
This class is intended to be used as base class for customized print dialog page. ...
void setPageSize(PageSize, bool locking=false)
See TQPrinter::setPageSize().
KPrinterImpl * implementation() const
For internal use only.
CollateType
Defines the collate property of the printer (if supported by the print system):
const TQString & option(const TQString &key) const
Starts the add printer wizard.
TQString docName() const
See TQPrinter::docName().
int fromPage() const KDE_DEPRECATED
Returns the first page to be printed.
static ApplicationType applicationType()
Returns the application type concerning the print dialog.
PageSize
Defines the paper size to use.
TQString printerSelectionOption() const
See TQPrinter::printerSelectionOption().
ColorMode colorMode() const
See TQPrinter::colorMode().
void setCurrentPage(int p=0)
Sets the current page number.
TQString printerName() const
See TQPrinter::printerName().
TQSize realPageSize() const
Returns the page size in dot unit ( 1 dot = 1/72th in ).
void setOutputFileName(const TQString &)
See TQPrinter::setOutputFileName().
void setRealDrawableArea(const TQRect &r)
DO NOT USE, WILL BE REMOVED.
TQString docDirectory() const
Get the default document directory, that is the directory used for any output file.
void setSearchName(const TQString &n)
Sets the search name of the KPrinter object.
bool previewOnly() const
Returns the preview-only state for this KPrinter object.
int maxPage() const
See TQPrinter::maxPage().
static void addStandardPage(int p)
Adds a standard page to the print dialog.
void setOption(const TQString &key, const TQString &value)
Adds or modifies an option in the KPrinter object.
TQRect realDrawableArea() const
DO NOT USE, WILL BE REMOVED.
void setFullPage(bool)
See TQPrinter::setFullPage().
Orientation
Defines the orientation of the paper.
void setOutputToFile(bool)
See TQPrinter::setOutputToFile().