2
This file is part of KContactManager.
3
Copyright (c) 1996-2002 Mirko Boehm <mirko@kde.org>
5
This program is free software; you can redistribute it and/or modify
6
it under the terms of the GNU General Public License as published by
7
the Free Software Foundation; either version 2 of the License, or
8
(at your option) any later version.
10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
GNU General Public License for more details.
15
You should have received a copy of the GNU General Public License
16
along with this program; if not, write to the Free Software
17
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19
As a special exception, permission is given to link this program
20
with any edition of Qt, and distribute the resulting executable,
21
without including the source code for Qt in the source distribution.
27
#include <QtCore/QHash>
28
#include <QtCore/QStringList>
29
#include <QtGui/QPixmap>
30
#include <QtGui/QWidget>
32
#include <kabc/addressee.h>
33
#include "contactfields.h"
34
class KPageWidgetItem;
37
namespace KABPrinting {
43
The class PrintStyle implements the abstract interface to the
44
PrintingWizards style objects.
45
To implement a print style, derive from this class and read
46
the information in printingwizard.h to see how this two pieces
47
work together. Basically, the print style gets the contacts it
48
is supposed to print from the PrintingWizard is will not
49
change this set - neither its content nor its order.
50
To register your new style in the printing wizard, you need to
51
define a PrintStyleFactory that handles how your objects are
52
created and deleted. See the existing print styles for
54
A print style should have a preview image that gives the user
55
a basic impression on how it will look. Add this image to the
56
printing folder (right here :-), and edit Makefile.am to have
57
it installed along with kaddressbook. Load it using
59
Your print style is supposed to add its options as pages to
60
the printing wizard. The method wizard() gives you a pointer
64
class PrintStyle : public QObject
69
explicit PrintStyle( PrintingWizard* parent, const char* name = 0 );
70
virtual ~PrintStyle();
73
Reimplement this method to actually print.
75
virtual void print( const KABC::Addressee::List &contacts, PrintProgress* ) = 0;
78
Reimplement this method to provide a preview of what will
79
be printed. It returns an invalid QPixmap by default,
80
resulting in a message that no preview is available.
82
const QPixmap& preview();
85
Hide all style specific pages in the wizard.
90
Show all style specific pages in the wizard.
95
Returns the preferred sort criterion field.
97
ContactFields::Field preferredSortField();
100
Returns the preferred sort type.
105
bool preferredSortType();
109
Load the preview image from the kaddressbook data
110
directory. The image should be located in the subdirectory
111
"printing". Give only the file name without any prefix as
114
bool setPreview( const QString& fileName );
117
Set the preview image.
119
void setPreview( const QPixmap& image );
122
Set preferred sort options for this printing style.
124
void setPreferredSortOptions( ContactFields::Field, bool ascending = true );
127
Return the wizard object.
129
PrintingWizard *wizard();
132
Add additional page to the wizard e.g. a configuration page for
135
void addPage( QWidget *page, const QString &title );
138
PrintingWizard *mWizard;
140
QList<QWidget*> mPageList;
141
QHash<QWidget*, KPageWidgetItem*> mPageItems;
142
QStringList mPageTitles;
144
ContactFields::Field mSortField;
150
The factories are used to have all object of the respective
151
print style created in one place.
152
This will maybe be changed to a template because of its simple
155
class PrintStyleFactory
158
explicit PrintStyleFactory( PrintingWizard* parent, const char* name = 0 );
159
virtual ~PrintStyleFactory();
161
virtual PrintStyle *create() const = 0;
164
Overload this method to provide a one-liner description
165
for your print style.
167
virtual QString description() const = 0;
170
PrintingWizard* mParent;