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

0001 /*
0002   This file is part of KAddressBook.
0003   SPDX-FileCopyrightText: 2002 Anders Lund <anders.lund@lund.tdcadsl.dk>
0004   SPDX-FileCopyrightText: Tobias Koenig <tokoe@kde.org>
0005   SPDX-FileCopyrightText: 2009-2024 Laurent Montel <montel@kde.org>
0006 
0007   SPDX-License-Identifier: GPL-2.0-or-later WITH Qt-Commercial-exception-1.0
0008 */
0009 
0010 #pragma once
0011 
0012 #include "importexport/contactfields.h"
0013 #include <QWidget>
0014 
0015 class QLabel;
0016 class QPixmap;
0017 class QComboBox;
0018 
0019 class StylePage : public QWidget
0020 {
0021     Q_OBJECT
0022 
0023 public:
0024     explicit StylePage(QWidget *parent = nullptr, const QString &name = QString());
0025     ~StylePage() override;
0026 
0027     /**
0028      * Set a preview image. If @p pixmap is 'null' a text will
0029      * be displayed instead.
0030      */
0031     void setPreview(const QPixmap &pixmap);
0032 
0033     /**
0034      * Add a style name.
0035      */
0036     void addStyleName(const QString &name);
0037 
0038     /**
0039      * Clear the style name list.
0040      */
0041     void clearStyleNames();
0042 
0043     /**
0044      * Set the sort criterion field.
0045      */
0046     void setSortField(KAddressBookImportExport::ContactFields::Field field);
0047 
0048     /**
0049      * Returns the sort criterion field.
0050      */
0051     KAddressBookImportExport::ContactFields::Field sortField() const;
0052 
0053     /**
0054      * Sets the sort order.
0055      */
0056     void setSortOrder(Qt::SortOrder sortOrder);
0057 
0058     /**
0059      * Returns the sort order.
0060      */
0061     Qt::SortOrder sortOrder() const;
0062 
0063     /**
0064      * Returns the sort order.
0065      */
0066     int printingStyle() const;
0067 
0068     /**
0069      * Returns the sort order.
0070      */
0071     void setPrintingStyle(int index);
0072 
0073 Q_SIGNALS:
0074     /**
0075      * This signal is emitted when the user selects a new style in the
0076      * style combo box.
0077      */
0078     void styleChanged(int index);
0079 
0080 private:
0081     void initGUI();
0082     void initFieldCombo();
0083 
0084     QComboBox *mFieldCombo = nullptr;
0085     QComboBox *mSortTypeCombo = nullptr;
0086     QComboBox *mStyleCombo = nullptr;
0087     QLabel *mPreview = nullptr;
0088 
0089     KAddressBookImportExport::ContactFields::Fields mFields;
0090 };