File indexing completed on 2024-12-22 04:55:33

0001 /*
0002   This file is part of KAddressBook.
0003   SPDX-FileCopyrightText: 2011 Mario Scheel <zweistein12@gmx.de>
0004 
0005   SPDX-License-Identifier: GPL-2.0-or-later WITH Qt-Commercial-exception-1.0
0006 */
0007 
0008 #pragma once
0009 
0010 #include "printstyle.h"
0011 
0012 namespace KABPrinting
0013 {
0014 class CompactStyleForm;
0015 
0016 class CompactStyle : public PrintStyle
0017 {
0018     Q_OBJECT
0019 
0020 public:
0021     explicit CompactStyle(PrintingWizard *parent);
0022     ~CompactStyle() override;
0023 
0024     /**
0025      * prints the contacts
0026      */
0027     void print(const KContacts::Addressee::List &, PrintProgress *) override;
0028 
0029 private:
0030     QString contactsToHtml(const KContacts::Addressee::List &contacts) const;
0031 
0032     CompactStyleForm *mPageSettings = nullptr;
0033 
0034     /**
0035      * various settings
0036      */
0037     bool withAlternating = false;
0038     bool withBusinessAddress = false;
0039     bool withHomeAddress = false;
0040     bool withBirthday = false;
0041     bool withEMail = false;
0042     QColor firstColor;
0043     QColor secondColor;
0044 
0045 private:
0046     /**
0047      * Enable or disable the controls for color selection. The colors
0048      * are needed for alternating background color of the rows.
0049      */
0050     void setAlternatingColors();
0051 };
0052 
0053 class CompactStyleFactory : public PrintStyleFactory
0054 {
0055 public:
0056     explicit CompactStyleFactory(PrintingWizard *parent);
0057 
0058     PrintStyle *create() const override;
0059     QString description() const override;
0060 };
0061 }