File indexing completed on 2025-01-19 05:06:22

0001 /*
0002     SPDX-FileCopyrightText: 2010 Daniel Nicoletti <dantti12@gmail.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #ifndef CHOOSE_URI_H
0008 #define CHOOSE_URI_H
0009 
0010 #include "GenericPage.h"
0011 
0012 #include <KCupsPrinter.h>
0013 
0014 #include <QUrl>
0015 
0016 namespace Ui
0017 {
0018 class ChooseUri;
0019 }
0020 class KCupsRequest;
0021 class ChooseUri : public GenericPage
0022 {
0023     Q_OBJECT
0024 public:
0025     explicit ChooseUri(QWidget *parent = nullptr);
0026     ~ChooseUri() override;
0027 
0028     void setValues(const QVariantMap &args) override;
0029     QVariantMap values() const override;
0030     bool isValid() const override;
0031     bool canProceed() const override;
0032 
0033 public slots:
0034     void load();
0035 
0036 signals:
0037     void errorMessage(const QString &message);
0038     void insertDevice(const QString &device_class,
0039                       const QString &device_id,
0040                       const QString &device_info,
0041                       const QString &device_make_and_model,
0042                       const QString &device_uri,
0043                       const QString &device_location,
0044                       const KCupsPrinters &grouped_printers);
0045 
0046 private slots:
0047     void checkSelected();
0048     void textChanged(const QString &text);
0049     void findPrinters();
0050     void getPrintersFinished(KCupsRequest *request);
0051 
0052 private:
0053     QUrl parsedURL(const QString &text) const;
0054 
0055     Ui::ChooseUri *const ui;
0056 };
0057 
0058 #endif