Skip to content

Commit

Permalink
fix: wireless item display problem when ssid contains "&"
Browse files Browse the repository at this point in the history
linuxdeepin/developer-center#880

Change-Id: I44a71eb7e1ffaf0626c4c03805e5fe01fc12bfc2
  • Loading branch information
listenerri committed Feb 14, 2019
1 parent 49b84eb commit ecea16f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
6 changes: 3 additions & 3 deletions plugins/network/item/applet/accesspointwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ AccessPointWidget::AccessPointWidget()
: QFrame(nullptr),

m_activeState(NetworkDevice::Unknow),
m_ssidBtn(new QPushButton(this)),
m_ssidBtn(new SsidButton(this)),
m_disconnectBtn(new DImageButton(this)),
m_securityLabel(new QLabel),
m_strengthLabel(new QLabel)
Expand Down Expand Up @@ -89,8 +89,8 @@ AccessPointWidget::AccessPointWidget()
// "color:#2ca7f8;"
"}");

connect(m_ssidBtn, &QPushButton::clicked, this, &AccessPointWidget::clicked);
connect(m_ssidBtn, &QPushButton::clicked, this, &AccessPointWidget::ssidClicked);
connect(m_ssidBtn, &SsidButton::clicked, this, &AccessPointWidget::clicked);
connect(m_ssidBtn, &SsidButton::clicked, this, &AccessPointWidget::ssidClicked);
connect(m_disconnectBtn, &DImageButton::clicked, this, &AccessPointWidget::disconnectBtnClicked);
}

Expand Down
20 changes: 19 additions & 1 deletion plugins/network/item/applet/accesspointwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,24 @@
#include <dimagebutton.h>
#include <NetworkDevice>

class SsidButton : public QLabel
{
Q_OBJECT
public:
SsidButton(QWidget *parent = nullptr) : QLabel(parent){}
virtual ~SsidButton() {}

signals:
void clicked();

protected:
void mouseReleaseEvent(QMouseEvent *event) override {
QLabel::mouseReleaseEvent(event);

Q_EMIT clicked();
}
};

class AccessPointWidget : public QFrame
{
Q_OBJECT
Expand Down Expand Up @@ -64,7 +82,7 @@ private slots:
dde::network::NetworkDevice::DeviceStatus m_activeState;

AccessPoint m_ap;
QPushButton *m_ssidBtn;
SsidButton *m_ssidBtn;
Dtk::Widget::DImageButton *m_disconnectBtn;
QLabel *m_securityLabel;
QLabel *m_strengthLabel;
Expand Down

0 comments on commit ecea16f

Please sign in to comment.