File indexing completed on 2025-01-05 05:09:31

0001 /*
0002     SPDX-FileCopyrightText: 2010 Daniel Nicoletti <dantti12@gmail.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #ifndef SELECT_MAKE_MODEL_H
0008 #define SELECT_MAKE_MODEL_H
0009 
0010 #include <QDBusMessage>
0011 #include <QWidget>
0012 
0013 #include <kcupslib_export.h>
0014 
0015 #include "KCupsConnection.h"
0016 #include "PPDModel.h"
0017 
0018 namespace Ui
0019 {
0020 class SelectMakeModel;
0021 }
0022 
0023 class KCupsRequest;
0024 class KCUPSLIB_EXPORT SelectMakeModel : public QWidget
0025 {
0026     Q_OBJECT
0027 public:
0028     explicit SelectMakeModel(QWidget *parent = nullptr);
0029     ~SelectMakeModel() override;
0030 
0031     void setDeviceInfo(const QString &deviceId, const QString &make, const QString &makeAndModel, const QString &deviceUri);
0032     void setMakeModel(const QString &make, const QString &makeAndModel);
0033     QString selectedPPDName() const;
0034     QString selectedPPDMakeAndModel() const;
0035     QString selectedPPDFileName() const;
0036     bool isFileSelected() const;
0037 
0038 public slots:
0039     void checkChanged();
0040     void ppdsLoaded(KCupsRequest *request);
0041 
0042 signals:
0043     void changed(bool);
0044 
0045 private slots:
0046     void getBestDriversFinished(const QDBusMessage &message);
0047     void getBestDriversFailed(const QDBusError &error, const QDBusMessage &message);
0048 
0049 private:
0050     void setModelData();
0051     void selectFirstMake();
0052     void selectMakeModelPPD();
0053     void selectRecommendedPPD();
0054 
0055     ReturnArguments m_ppds;
0056     DriverMatchList m_driverMatchList;
0057     QString m_make;
0058     QString m_makeAndModel;
0059     Ui::SelectMakeModel *const ui;
0060     PPDModel *m_sourceModel = nullptr;
0061     KCupsRequest *m_ppdRequest = nullptr;
0062     bool m_gotBestDrivers = false;
0063     bool m_hasRecommended = false;
0064 };
0065 
0066 #endif