File indexing completed on 2022-11-23 12:38:57

0001 /*
0002     SPDX-FileCopyrightText: 2010-2018 Daniel Nicoletti <dantti12@gmail.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #ifndef PRINT_QUEUE_UI_H
0008 #define PRINT_QUEUE_UI_H
0009 
0010 #include <QDialog>
0011 #include <QModelIndex>
0012 #include <QToolButton>
0013 
0014 namespace Ui {
0015     class PrintQueueUi;
0016 }
0017 
0018 class KCupsRequest;
0019 class KCupsPrinter;
0020 class JobSortFilterModel;
0021 class JobModel;
0022 class PrintQueueUi : public QDialog
0023 {
0024     Q_OBJECT
0025 public:
0026     explicit PrintQueueUi(const KCupsPrinter &printer, QWidget *parent = nullptr);
0027     ~PrintQueueUi() override;
0028 
0029 signals:
0030     void finished();
0031 
0032 public slots:
0033     void update();
0034 
0035 private slots:
0036     void updatePrinterByName(const QString &printer);
0037     void updatePrinter(const QString &text,
0038                        const QString &printerUri,
0039                        const QString &printerName,
0040                        uint printerState,
0041                        const QString &printerStateReasons,
0042                        bool printerIsAcceptingJobs);
0043     void whichJobsIndexChanged(int index);
0044     void pausePrinter();
0045     void configurePrinter();
0046 
0047     void cancelJob();
0048     void holdJob();
0049     void resumeJob();
0050     void reprintJob();
0051     void authenticateJob();
0052 
0053     int columnCount(const QModelIndex &parent = QModelIndex()) const;
0054     void updateButtons();
0055     void showContextMenu(const QPoint &point);
0056     void showHeaderContextMenu(const QPoint &point);
0057     void getAttributesFinished(KCupsRequest *request);
0058 
0059 private:
0060     void closeEvent(QCloseEvent *event) override;
0061     void setupButtons();
0062     void setState(int state, const QString &message);
0063     void modifyJob(int action, const QString &destName = QString());
0064 
0065     Ui::PrintQueueUi *ui;
0066     QToolButton *m_filterJobs;
0067     JobSortFilterModel *m_proxyModel;
0068     JobModel *m_model;
0069     QString m_destName;
0070     QString m_title;
0071     QPixmap m_printerIcon;
0072     char m_lastState = 0;
0073     bool m_isClass;
0074     bool m_preparingMenu = false;
0075     bool m_printerPaused = false;
0076 };
0077 
0078 #endif