File indexing completed on 2025-01-05 05:09:28
0001 /* 0002 SPDX-FileCopyrightText: 2010 Daniel Nicoletti <dantti12@gmail.com> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef CLASS_LIST_WIDGET_H 0008 #define CLASS_LIST_WIDGET_H 0009 0010 #include <QListView> 0011 #include <QStandardItemModel> 0012 #include <QTimer> 0013 0014 #include <KPixmapSequenceOverlayPainter> 0015 #include <kcupslib_export.h> 0016 0017 class KCupsRequest; 0018 class KCUPSLIB_EXPORT ClassListWidget : public QListView 0019 { 0020 Q_OBJECT 0021 Q_PROPERTY(QString selectedPrinters READ selectedPrinters WRITE setSelectedPrinters USER true) 0022 Q_PROPERTY(bool showClasses READ showClasses WRITE setShowClasses) 0023 public: 0024 explicit ClassListWidget(QWidget *parent = nullptr); 0025 ~ClassListWidget() override; 0026 0027 bool hasChanges(); 0028 void setPrinter(const QString &printer); 0029 QString selectedPrinters() const; 0030 void setSelectedPrinters(const QString &selected); 0031 bool showClasses() const; 0032 void setShowClasses(bool enable); 0033 QStringList currentSelected(bool uri) const; 0034 0035 signals: 0036 void changed(bool changed); 0037 0038 private slots: 0039 void init(); 0040 void loadFinished(KCupsRequest *request); 0041 void modelChanged(); 0042 0043 private: 0044 void updateItemState(QStandardItem *item) const; 0045 0046 QString m_printerName; 0047 QStringList m_selectedPrinters; 0048 KPixmapSequenceOverlayPainter *m_busySeq = nullptr; 0049 KCupsRequest *m_request = nullptr; 0050 bool m_changed; 0051 bool m_showClasses = false; 0052 QStandardItemModel *m_model = nullptr; 0053 QTimer m_delayedInit; 0054 }; 0055 0056 #endif