22 #include "kmuimanager.h"
23 #include "kprintdialog.h"
24 #include "kprintdialogpage.h"
25 #include "kpcopiespage.h"
27 #include "kprinterpropertydialog.h"
28 #include "kmfactory.h"
29 #include "kmmanager.h"
30 #include "kmprinter.h"
31 #include "kpdriverpage.h"
32 #include "kpmarginpage.h"
34 #include "kpfilterpage.h"
35 #include "kpfileselectpage.h"
36 #include "kxmlcommand.h"
37 #include "kpposterpage.h"
39 #include <tdelocale.h>
42 KMUiManager::KMUiManager(TQObject *parent,
const char *name)
43 : TQObject(parent,name)
45 m_printdialogflags = KMUiManager::PrintDialogAll;
46 m_printdialogpages.setAutoDelete(
false);
49 KMUiManager::~KMUiManager()
53 void KMUiManager::setupPropertyPages(KMPropertyPage*)
57 void KMUiManager::setupWizard(KMWizard*)
61 void KMUiManager::setupConfigDialog(KMConfigDialog*)
65 int KMUiManager::copyFlags(
KPrinter *pr,
bool usePlugin)
67 int fl(0), pcap(pluginPageCap());
68 if (KMFactory::self()->settings()->pageSelection == KPrinter::ApplicationSide)
74 fl |= (Range|PageSet|Order);
78 fl |= (pcap & (Collate|NoAutoCollate));
90 fl = systemPageCap() | NoAutoCollate;
94 int KMUiManager::dialogFlags()
96 int f = m_printdialogflags;
97 int appf = KMFactory::self()->settings()->application;
98 if (appf != KPrinter::Dialog)
100 f &= ~(KMUiManager::Preview);
101 if ( appf == KPrinter::StandAlonePersistent)
102 f |= KMUiManager::Persistent;
107 void KMUiManager::setupPrintDialog(KPrintDialog *dlg)
110 int f = dialogFlags();
114 int stdpages = KMFactory::self()->settings()->standardDialogPages;
115 if (stdpages & KPrinter::CopiesPage)
116 m_printdialogpages.prepend(
new KPCopiesPage(dlg->printer(), 0,
"CopiesPage"));
117 if (stdpages & KPrinter::FilesPage)
118 m_printdialogpages.prepend(
new KPFileSelectPage(0,
"FileSelectPage"));
121 setupPrintDialogPages(&m_printdialogpages);
123 dlg->setDialogPages(&m_printdialogpages);
126 void KMUiManager::setupPropertyDialog(KPrinterPropertyDialog *dlg)
130 DrMain *driver = KMManager::self()->loadDriver(dlg->printer(),
false);
131 dlg->setDriver(driver);
133 if (dlg->printer()->isSpecial())
135 dlg->addPage(
new KPQtPage(dlg,
"QtPage"));
141 setupPrinterPropertyDialog(dlg);
146 if (dlg->parent() && dlg->parent()->isA(
"KPrintDialog"))
147 prt =
static_cast<KPrintDialog*
>(dlg->parent())->printer();
150 if ( ( prt && !prt->fullPage() && prt->applicationType() == KPrinter::Dialog )
151 || prt->applicationType() < 0 )
152 dlg->addPage(
new KPMarginPage(prt, driver, dlg,
"MarginPage"));
156 dlg->addPage(
new KPDriverPage(dlg->printer(),driver,dlg,
"DriverPage"));
158 dlg->setCaption(i18n(
"Configuration of %1").arg(dlg->printer()->name()));
159 if ( KXmlCommandManager::self()->checkCommand(
"poster", KXmlCommandManager::None, KXmlCommandManager::None ) )
160 dlg->addPage(
new KPPosterPage( dlg,
"PosterPage" ) );
161 dlg->addPage(
new KPFilterPage(dlg,
"FilterPage"));
162 dlg->resize(100,100);
166 void KMUiManager::setupPrinterPropertyDialog(KPrinterPropertyDialog *dlg)
168 if (KMFactory::self()->settings()->application == KPrinter::Dialog
169 || KMFactory::self()->settings()->application < 0 )
170 dlg->addPage(
new KPQtPage(dlg,
"QtPage"));
173 int KMUiManager::pageCap()
175 int val = systemPageCap();
176 val |= pluginPageCap();
180 int KMUiManager::systemPageCap()
183 if (KXmlCommandManager::self()->checkCommand(
"psselect"))
184 val |= KMUiManager::PSSelect;
188 int KMUiManager::pluginPageCap()
193 void KMUiManager::setupPrintDialogPages(TQPtrList<KPrintDialogPage>*)
197 void KMUiManager::setupJobViewer(TQListView*)
201 #include "kmuimanager.moc"
This class is the main interface to access the TDE print framework.
int maxPage() const
See TQPrinter::maxPage().
int currentPage() const
Returns the current page number.
int minPage() const
See TQPrinter::minPage().