• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeprint
 

tdeprint

  • tdeprint
kmuimanager.cpp
1/*
2 * This file is part of the KDE libraries
3 * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License version 2 as published by the Free Software Foundation.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
13 *
14 * You should have received a copy of the GNU Library General Public License
15 * along with this library; see the file COPYING.LIB. If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 **/
19
20#include <config.h>
21
22#include "kmuimanager.h"
23#include "kprintdialog.h"
24#include "kprintdialogpage.h"
25#include "kpcopiespage.h"
26#include "kprinter.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"
33#include "kpqtpage.h"
34#include "kpfilterpage.h"
35#include "kpfileselectpage.h"
36#include "kxmlcommand.h"
37#include "kpposterpage.h"
38
39#include <tdelocale.h>
40#include <kdebug.h>
41
42KMUiManager::KMUiManager(TQObject *parent, const char *name)
43: TQObject(parent,name)
44{
45 m_printdialogflags = KMUiManager::PrintDialogAll;
46 m_printdialogpages.setAutoDelete(false);
47}
48
49KMUiManager::~KMUiManager()
50{
51}
52
53void KMUiManager::setupPropertyPages(KMPropertyPage*)
54{
55}
56
57void KMUiManager::setupWizard(KMWizard*)
58{
59}
60
61void KMUiManager::setupConfigDialog(KMConfigDialog*)
62{
63}
64
65int KMUiManager::copyFlags(KPrinter *pr, bool usePlugin)
66{
67 int fl(0), pcap(pluginPageCap());
68 if (KMFactory::self()->settings()->pageSelection == KPrinter::ApplicationSide)
69 {
70 if (pr)
71 {
72 if (pr->currentPage() > 0) fl |= Current;
73 if (pr->minPage() > 0 && pr->maxPage() > 0)
74 fl |= (Range|PageSet|Order);
75 }
76 //else fl = CopyAll;
77 if (usePlugin)
78 fl |= (pcap & (Collate|NoAutoCollate));
79 else
80 fl |= NoAutoCollate;
81 }
82 else if (usePlugin)
83 // in this case, we want page capabilities with plugin, it means
84 // for a regular real printer.
85 fl = pageCap();
86 else
87 // int this case, we want page capabilities for non standard
88 // printer, set auto-collate to false as copies will be handled
89 // by Qt
90 fl = systemPageCap() | NoAutoCollate;
91 return fl;
92}
93
94int KMUiManager::dialogFlags()
95{
96 int f = m_printdialogflags;
97 int appf = KMFactory::self()->settings()->application;
98 if (appf != KPrinter::Dialog)
99 {
100 f &= ~(KMUiManager::Preview);
101 if ( appf == KPrinter::StandAlonePersistent)
102 f |= KMUiManager::Persistent;
103 }
104 return f;
105}
106
107void KMUiManager::setupPrintDialog(KPrintDialog *dlg)
108{
109 // dialog flags
110 int f = dialogFlags();
111 dlg->setFlags(f);
112
113 // add standard dialog pages
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"));
119
120 // add plugins pages
121 setupPrintDialogPages(&m_printdialogpages);
122
123 dlg->setDialogPages(&m_printdialogpages);
124}
125
126void KMUiManager::setupPropertyDialog(KPrinterPropertyDialog *dlg)
127{
128 if (dlg->printer())
129 {
130 DrMain *driver = KMManager::self()->loadDriver(dlg->printer(), false);
131 dlg->setDriver(driver);
132
133 if (dlg->printer()->isSpecial())
134 { // special case
135 dlg->addPage(new KPQtPage(dlg,"QtPage"));
136 //dlg->enableSaveButton(false);
137 }
138 else
139 {
140 // add pages specific to print system
141 setupPrinterPropertyDialog(dlg);
142 }
143
144 // retrieve the KPrinter object
145 KPrinter *prt(0);
146 if (dlg->parent() && dlg->parent()->isA("KPrintDialog"))
147 prt = static_cast<KPrintDialog*>(dlg->parent())->printer();
148
149 // add margin page
150 if ( ( prt && !prt->fullPage() && prt->applicationType() == KPrinter::Dialog )
151 || prt->applicationType() < 0 )
152 dlg->addPage(new KPMarginPage(prt, driver, dlg, "MarginPage"));
153
154 // add driver page
155 if (driver)
156 dlg->addPage(new KPDriverPage(dlg->printer(),driver,dlg,"DriverPage"));
157
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);
163 }
164}
165
166void KMUiManager::setupPrinterPropertyDialog(KPrinterPropertyDialog *dlg)
167{
168 if (KMFactory::self()->settings()->application == KPrinter::Dialog
169 || KMFactory::self()->settings()->application < 0 )
170 dlg->addPage(new KPQtPage(dlg,"QtPage"));
171}
172
173int KMUiManager::pageCap()
174{
175 int val = systemPageCap();
176 val |= pluginPageCap();
177 return val;
178}
179
180int KMUiManager::systemPageCap()
181{
182 int val(0);
183 if (KXmlCommandManager::self()->checkCommand("psselect"))
184 val |= KMUiManager::PSSelect;
185 return val;
186}
187
188int KMUiManager::pluginPageCap()
189{
190 return 0;
191}
192
193void KMUiManager::setupPrintDialogPages(TQPtrList<KPrintDialogPage>*)
194{
195}
196
197void KMUiManager::setupJobViewer(TQListView*)
198{
199}
200
201#include "kmuimanager.moc"
KPrinter
This class is the main interface to access the TDE print framework.
Definition: kprinter.h:89
KPrinter::maxPage
int maxPage() const
See TQPrinter::maxPage().
Definition: kprinter.cpp:842
KPrinter::currentPage
int currentPage() const
Returns the current page number.
Definition: kprinter.cpp:864
KPrinter::minPage
int minPage() const
See TQPrinter::minPage().
Definition: kprinter.cpp:839

tdeprint

Skip menu "tdeprint"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

tdeprint

Skip menu "tdeprint"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeprint by doxygen 1.9.4
This website is maintained by Timothy Pearson.