~ubuntu-branches/ubuntu/karmic/kdepim/karmic-backports

« back to all changes in this revision

Viewing changes to kcontactmanager/printing/printstyle.h

  • Committer: Bazaar Package Importer
  • Author(s): Alessandro Ghersi, Alessandro Ghersi, Harald Sitter
  • Date: 2009-06-27 04:40:05 UTC
  • mfrom: (1.1.39 upstream)
  • Revision ID: james.westby@ubuntu.com-20090627044005-4y2vm9xz7rvmzi4p
Tags: 4:4.2.95svn20090701-0ubuntu1
[ Alessandro Ghersi ]
* New upstream release
  - Bump build-deps
* Remove akonadi-kde and libmaildir4 packages
  - remove akonadi-kde.install and libmaildir4.install
  - remove libmaildir4 from debian/rules
  - remove akonadi-kde and libmaildir4 from depends
  - remove akonadi-kde and libmaildir4 from installgen
* Update kdepim-dev.install
* Update kpilot.install
* Add akonadi-kde and libmaildir4 transitional packages

[ Harald Sitter ]
* KAddressbook replaces Kontact << 4.2.85 (LP: #378373)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
    This file is part of KContactManager.
3
 
    Copyright (c) 1996-2002 Mirko Boehm <mirko@kde.org>
4
 
 
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.
9
 
 
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.
14
 
 
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.
18
 
 
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.
22
 
*/
23
 
 
24
 
#ifndef PRINTSTYLE_H
25
 
#define PRINTSTYLE_H
26
 
 
27
 
#include <QtCore/QHash>
28
 
#include <QtCore/QStringList>
29
 
#include <QtGui/QPixmap>
30
 
#include <QtGui/QWidget>
31
 
 
32
 
#include <kabc/addressee.h>
33
 
#include "contactfields.h"
34
 
class KPageWidgetItem;
35
 
 
36
 
 
37
 
namespace KABPrinting {
38
 
 
39
 
class PrintingWizard;
40
 
class PrintProgress;
41
 
 
42
 
/**
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
53
 
 examples.
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
58
 
 setPreview(QString).
59
 
 Your print style is supposed to add its options as pages to
60
 
 the printing wizard. The method wizard() gives you a pointer
61
 
 to the wizard object.
62
 
 */
63
 
 
64
 
class PrintStyle : public QObject
65
 
{
66
 
  Q_OBJECT
67
 
 
68
 
  public:
69
 
    explicit PrintStyle( PrintingWizard* parent, const char* name = 0 );
70
 
    virtual ~PrintStyle();
71
 
 
72
 
    /**
73
 
     Reimplement this method to actually print.
74
 
     */
75
 
    virtual void print( const KABC::Addressee::List &contacts, PrintProgress* ) = 0;
76
 
 
77
 
    /**
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.
81
 
     */
82
 
    const QPixmap& preview();
83
 
 
84
 
    /**
85
 
     Hide all style specific pages in the wizard.
86
 
     */
87
 
    void hidePages();
88
 
 
89
 
    /**
90
 
     Show all style specific pages in the wizard.
91
 
     */
92
 
    void showPages();
93
 
 
94
 
    /**
95
 
      Returns the preferred sort criterion field.
96
 
     */
97
 
    ContactFields::Field preferredSortField();
98
 
 
99
 
    /**
100
 
      Returns the preferred sort type.
101
 
 
102
 
      true = ascending
103
 
      false = descending
104
 
     */
105
 
    bool preferredSortType();
106
 
 
107
 
  protected:
108
 
    /**
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
112
 
     the parameter.
113
 
     */
114
 
    bool setPreview( const QString& fileName );
115
 
 
116
 
    /**
117
 
     Set the preview image.
118
 
     */
119
 
    void setPreview( const QPixmap& image );
120
 
 
121
 
    /**
122
 
      Set preferred sort options for this printing style.
123
 
     */
124
 
    void setPreferredSortOptions( ContactFields::Field, bool ascending = true );
125
 
 
126
 
    /**
127
 
     Return the wizard object.
128
 
     */
129
 
    PrintingWizard *wizard();
130
 
 
131
 
    /**
132
 
     Add additional page to the wizard e.g. a configuration page for
133
 
     the style.
134
 
     */
135
 
    void addPage( QWidget *page, const QString &title );
136
 
 
137
 
  private:
138
 
    PrintingWizard *mWizard;
139
 
    QPixmap mPreview;
140
 
    QList<QWidget*> mPageList;
141
 
    QHash<QWidget*, KPageWidgetItem*> mPageItems;
142
 
    QStringList mPageTitles;
143
 
 
144
 
    ContactFields::Field mSortField;
145
 
    bool mSortType;
146
 
};
147
 
 
148
 
 
149
 
/**
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
153
 
  nature :-)
154
 
*/
155
 
class PrintStyleFactory
156
 
{
157
 
  public:
158
 
    explicit PrintStyleFactory( PrintingWizard* parent, const char* name = 0 );
159
 
    virtual ~PrintStyleFactory();
160
 
 
161
 
    virtual PrintStyle *create() const = 0;
162
 
 
163
 
    /**
164
 
      Overload this method to provide a one-liner description
165
 
      for your print style.
166
 
     */
167
 
    virtual QString description() const = 0;
168
 
 
169
 
  protected:
170
 
    PrintingWizard* mParent;
171
 
    const char* mName;
172
 
};
173
 
 
174
 
}
175
 
 
176
 
#endif