1 /* 2 This file is part of KAddressBook. 3 SPDX-FileCopyrightText: 2002 Anders Lund <anders.lund@lund.tdcadsl.dk> 4 SPDX-FileCopyrightText: Tobias Koenig <tokoe@kde.org> 5 SPDX-FileCopyrightText: 2009-2021 Laurent Montel <montel@kde.org> 6 7 SPDX-License-Identifier: GPL-2.0-or-later WITH Qt-Commercial-exception-1.0 8 */ 9 10 #pragma once 11 12 #include "importexport/contactfields.h" 13 #include <QWidget> 14 15 class QLabel; 16 class QPixmap; 17 class QComboBox; 18 19 class StylePage : public QWidget 20 { 21 Q_OBJECT 22 23 public: 24 explicit StylePage(QWidget *parent = nullptr, const QString &name = QString()); 25 ~StylePage() override; 26 27 /** 28 * Set a preview image. If @p pixmap is 'null' a text will 29 * be displayed instead. 30 */ 31 void setPreview(const QPixmap &pixmap); 32 33 /** 34 * Add a style name. 35 */ 36 void addStyleName(const QString &name); 37 38 /** 39 * Clear the style name list. 40 */ 41 void clearStyleNames(); 42 43 /** 44 * Set the sort criterion field. 45 */ 46 void setSortField(KAddressBookImportExport::ContactFields::Field field); 47 48 /** 49 * Returns the sort criterion field. 50 */ 51 KAddressBookImportExport::ContactFields::Field sortField() const; 52 53 /** 54 * Sets the sort order. 55 */ 56 void setSortOrder(Qt::SortOrder sortOrder); 57 58 /** 59 * Returns the sort order. 60 */ 61 Qt::SortOrder sortOrder() const; 62 63 /** 64 * Returns the sort order. 65 */ 66 int printingStyle() const; 67 68 /** 69 * Returns the sort order. 70 */ 71 void setPrintingStyle(int index); 72 73 Q_SIGNALS: 74 /** 75 * This signal is emitted when the user selects a new style in the 76 * style combo box. 77 */ 78 void styleChanged(int index); 79 80 private: 81 void initGUI(); 82 void initFieldCombo(); 83 84 QComboBox *mFieldCombo = nullptr; 85 QComboBox *mSortTypeCombo = nullptr; 86 QComboBox *mStyleCombo = nullptr; 87 QLabel *mPreview = nullptr; 88 89 KAddressBookImportExport::ContactFields::Fields mFields; 90 }; 91 92