File indexing completed on 2024-03-24 17:10:48

0001 /*
0002     SPDX-FileCopyrightText: 2011 Lamarque Souza <lamarque@kde.org>
0003 
0004     SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0005 */
0006 
0007 #ifndef PLASMA_NM_PIN_DIALOG_H
0008 #define PLASMA_NM_PIN_DIALOG_H
0009 
0010 #include <QWidget>
0011 
0012 #include <QDialog>
0013 #include <QPushButton>
0014 #include <Solid/Device>
0015 
0016 #include "ui_pinwidget.h"
0017 #include <ModemManagerQt/Modem>
0018 
0019 class PinWidget;
0020 
0021 class PinDialog : public QDialog
0022 {
0023     Q_OBJECT
0024 public:
0025     enum Type {
0026         SimPin,
0027         SimPin2,
0028         SimPuk,
0029         SimPuk2,
0030         ModemServiceProviderPin,
0031         ModemServiceProviderPuk,
0032         ModemNetworkPin,
0033         ModemNetworkPuk,
0034         ModemPin,
0035         ModemCorporatePin,
0036         ModemCorporatePuk,
0037         ModemPhFsimPin,
0038         ModemPhFsimPuk,
0039         ModemNetworkSubsetPin,
0040         ModemNetworkSubsetPuk,
0041     };
0042     enum ErrorCode { PinCodeTooShort, PinCodesDoNotMatch, PukCodeTooShort };
0043 
0044     explicit PinDialog(ModemManager::Modem *modem, const Type type = SimPin, QWidget *parent = nullptr);
0045     ~PinDialog() override;
0046 
0047     Type type() const;
0048     QString pin() const;
0049     QString pin2() const;
0050     QString puk() const;
0051 
0052 public Q_SLOTS:
0053     void accept() override;
0054 
0055 private Q_SLOTS:
0056     void chkShowPassToggled(bool on);
0057     void modemRemoved(const QString &udi);
0058 
0059 private:
0060     void showErrorMessage(const PinDialog::ErrorCode);
0061     bool isPukDialog() const;
0062     bool isPinDialog() const;
0063     Ui::PinWidget *ui = nullptr;
0064     QLabel *pixmapLabel = nullptr;
0065     QString m_name;
0066     const Type m_type;
0067     QString m_udi;
0068 };
0069 
0070 #endif // PLASMA_NM_PIN_DIALOG_H