增加通知
This commit is contained in:
parent
c156426ddb
commit
0be90ace26
|
@ -203,6 +203,7 @@ void SwitchButton::mousePressEvent(QMouseEvent *){
|
|||
}
|
||||
if(disabled){
|
||||
mEndX = 0;
|
||||
Q_EMIT disabledClick();
|
||||
return ;
|
||||
}else{
|
||||
checked = !checked;
|
||||
|
|
|
@ -115,7 +115,7 @@ private Q_SLOTS:
|
|||
|
||||
Q_SIGNALS:
|
||||
void checkedChanged(bool checked);
|
||||
|
||||
void disabledClick();
|
||||
};
|
||||
|
||||
#endif // SWITCHBUTTON_H
|
||||
|
|
|
@ -49,6 +49,26 @@ const QByteArray GSETTINGS_SCHEMA = "org.ukui.kylin-nm.switch";
|
|||
bool sortByVal(const QPair<QString, int> &l, const QPair<QString, int> &r) {
|
||||
return (l.second < r.second);
|
||||
}
|
||||
|
||||
void NetConnect::showDesktopNotify(const QString &message)
|
||||
{
|
||||
QDBusInterface iface("org.freedesktop.Notifications",
|
||||
"/org/freedesktop/Notifications",
|
||||
"org.freedesktop.Notifications",
|
||||
QDBusConnection::sessionBus());
|
||||
QList<QVariant> args;
|
||||
args<<(tr("ukui control center"))
|
||||
<<((unsigned int) 0)
|
||||
<<QString("/usr/share/icons/ukui-icon-theme-default/24x24/devices/gnome-dev-ethernet.png")
|
||||
<<tr("ukui control center desktop message") //显示的是什么类型的信息
|
||||
<<message //显示的具体信息
|
||||
<<QStringList()
|
||||
<<QVariantMap()
|
||||
<<(int)-1;
|
||||
iface.callWithArgumentList(QDBus::AutoDetect,"Notify",args);
|
||||
}
|
||||
|
||||
|
||||
NetConnect::NetConnect() : mFirstLoad(true) {
|
||||
QTranslator* translator = new QTranslator(this);
|
||||
translator->load("/usr/share/kylin-nm/netconnect/" + QLocale::system().name());
|
||||
|
@ -147,6 +167,10 @@ void NetConnect::initComponent() {
|
|||
ui->openWIifLayout->addWidget(wiredSwitch);
|
||||
ui->detailLayOut->setContentsMargins(MAIN_LAYOUT_MARGINS);
|
||||
|
||||
connect(wiredSwitch, &SwitchButton::disabledClick, this, []() {
|
||||
showDesktopNotify(tr("No ethernet device avaliable"));
|
||||
});
|
||||
|
||||
if (QGSettings::isSchemaInstalled(GSETTINGS_SCHEMA)) {
|
||||
m_switchGsettings = new QGSettings(GSETTINGS_SCHEMA);
|
||||
connect(wiredSwitch, &SwitchButton::checkedChanged, this, [=] (bool checked) {
|
||||
|
|
|
@ -87,6 +87,8 @@ private:
|
|||
void initComponent();
|
||||
void runExternalApp();
|
||||
|
||||
void showDesktopNotify(const QString &message);
|
||||
|
||||
|
||||
//开关相关
|
||||
void setSwitchStatus();
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<context>
|
||||
<name>AddNetBtn</name>
|
||||
<message>
|
||||
<location filename="../addnetbtn.cpp" line="22"/>
|
||||
<location filename="../addnetbtn.cpp" line="18"/>
|
||||
<source>Add WiredNetork</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
@ -13,37 +13,52 @@
|
|||
<name>NetConnect</name>
|
||||
<message>
|
||||
<location filename="../netconnect.ui" line="47"/>
|
||||
<location filename="../netconnect.cpp" line="129"/>
|
||||
<location filename="../netconnect.cpp" line="149"/>
|
||||
<source>Wired Network</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../netconnect.ui" line="109"/>
|
||||
<location filename="../netconnect.cpp" line="131"/>
|
||||
<location filename="../netconnect.cpp" line="151"/>
|
||||
<source>open</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<extra-contents_path>/netconnect/open</extra-contents_path>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../netconnect.ui" line="192"/>
|
||||
<location filename="../netconnect.cpp" line="128"/>
|
||||
<location filename="../netconnect.cpp" line="148"/>
|
||||
<source>Advanced settings</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<extra-contents_path>/netconnect/Advanced settings"</extra-contents_path>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../netconnect.cpp" line="57"/>
|
||||
<location filename="../netconnect.cpp" line="60"/>
|
||||
<source>ukui control center</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../netconnect.cpp" line="63"/>
|
||||
<source>ukui control center desktop message</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../netconnect.cpp" line="77"/>
|
||||
<source>WiredConnect</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../netconnect.cpp" line="403"/>
|
||||
<location filename="../netconnect.cpp" line="814"/>
|
||||
<location filename="../netconnect.cpp" line="171"/>
|
||||
<source>No ethernet device avaliable</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../netconnect.cpp" line="420"/>
|
||||
<location filename="../netconnect.cpp" line="837"/>
|
||||
<source>connected</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../netconnect.cpp" line="467"/>
|
||||
<location filename="../netconnect.cpp" line="484"/>
|
||||
<source>card</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<context>
|
||||
<name>AddNetBtn</name>
|
||||
<message>
|
||||
<location filename="../addnetbtn.cpp" line="22"/>
|
||||
<location filename="../addnetbtn.cpp" line="18"/>
|
||||
<source>Add WiredNetork</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
@ -13,37 +13,52 @@
|
|||
<name>NetConnect</name>
|
||||
<message>
|
||||
<location filename="../netconnect.ui" line="47"/>
|
||||
<location filename="../netconnect.cpp" line="129"/>
|
||||
<location filename="../netconnect.cpp" line="149"/>
|
||||
<source>Wired Network</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../netconnect.ui" line="109"/>
|
||||
<location filename="../netconnect.cpp" line="131"/>
|
||||
<location filename="../netconnect.cpp" line="151"/>
|
||||
<source>open</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<extra-contents_path>/netconnect/open</extra-contents_path>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../netconnect.ui" line="192"/>
|
||||
<location filename="../netconnect.cpp" line="128"/>
|
||||
<location filename="../netconnect.cpp" line="148"/>
|
||||
<source>Advanced settings</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<extra-contents_path>/netconnect/Advanced settings"</extra-contents_path>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../netconnect.cpp" line="57"/>
|
||||
<location filename="../netconnect.cpp" line="60"/>
|
||||
<source>ukui control center</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../netconnect.cpp" line="63"/>
|
||||
<source>ukui control center desktop message</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../netconnect.cpp" line="77"/>
|
||||
<source>WiredConnect</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../netconnect.cpp" line="403"/>
|
||||
<location filename="../netconnect.cpp" line="814"/>
|
||||
<location filename="../netconnect.cpp" line="171"/>
|
||||
<source>No ethernet device avaliable</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../netconnect.cpp" line="420"/>
|
||||
<location filename="../netconnect.cpp" line="837"/>
|
||||
<source>connected</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../netconnect.cpp" line="467"/>
|
||||
<location filename="../netconnect.cpp" line="484"/>
|
||||
<source>card</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
|
Binary file not shown.
|
@ -4,7 +4,7 @@
|
|||
<context>
|
||||
<name>AddNetBtn</name>
|
||||
<message>
|
||||
<location filename="../addnetbtn.cpp" line="22"/>
|
||||
<location filename="../addnetbtn.cpp" line="18"/>
|
||||
<source>Add WiredNetork</source>
|
||||
<translation>添加有线网络</translation>
|
||||
</message>
|
||||
|
@ -13,37 +13,52 @@
|
|||
<name>NetConnect</name>
|
||||
<message>
|
||||
<location filename="../netconnect.ui" line="47"/>
|
||||
<location filename="../netconnect.cpp" line="129"/>
|
||||
<location filename="../netconnect.cpp" line="149"/>
|
||||
<source>Wired Network</source>
|
||||
<translation>有线网络</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../netconnect.ui" line="109"/>
|
||||
<location filename="../netconnect.cpp" line="131"/>
|
||||
<location filename="../netconnect.cpp" line="151"/>
|
||||
<source>open</source>
|
||||
<translation>开启</translation>
|
||||
<extra-contents_path>/netconnect/open</extra-contents_path>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../netconnect.ui" line="192"/>
|
||||
<location filename="../netconnect.cpp" line="128"/>
|
||||
<location filename="../netconnect.cpp" line="148"/>
|
||||
<source>Advanced settings</source>
|
||||
<translation>高级设置</translation>
|
||||
<extra-contents_path>/netconnect/Advanced settings"</extra-contents_path>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../netconnect.cpp" line="57"/>
|
||||
<location filename="../netconnect.cpp" line="60"/>
|
||||
<source>ukui control center</source>
|
||||
<translation>控制面板</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../netconnect.cpp" line="63"/>
|
||||
<source>ukui control center desktop message</source>
|
||||
<translation>控制面板桌面通知</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../netconnect.cpp" line="77"/>
|
||||
<source>WiredConnect</source>
|
||||
<translation>有线网络</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../netconnect.cpp" line="403"/>
|
||||
<location filename="../netconnect.cpp" line="814"/>
|
||||
<location filename="../netconnect.cpp" line="171"/>
|
||||
<source>No ethernet device avaliable</source>
|
||||
<translation>未检测到有线设备</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../netconnect.cpp" line="420"/>
|
||||
<location filename="../netconnect.cpp" line="837"/>
|
||||
<source>connected</source>
|
||||
<translation>已连接</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../netconnect.cpp" line="467"/>
|
||||
<location filename="../netconnect.cpp" line="484"/>
|
||||
<source>card</source>
|
||||
<translation>网卡</translation>
|
||||
</message>
|
||||
|
|
|
@ -5,39 +5,54 @@
|
|||
<name>WlanConnect</name>
|
||||
<message>
|
||||
<location filename="../wlanconnect.ui" line="14"/>
|
||||
<location filename="../wlanconnect.cpp" line="72"/>
|
||||
<location filename="../wlanconnect.cpp" line="89"/>
|
||||
<source>WlanConnect</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../wlanconnect.ui" line="35"/>
|
||||
<location filename="../wlanconnect.cpp" line="143"/>
|
||||
<location filename="../wlanconnect.cpp" line="160"/>
|
||||
<source>WLAN</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../wlanconnect.ui" line="94"/>
|
||||
<location filename="../wlanconnect.cpp" line="145"/>
|
||||
<location filename="../wlanconnect.cpp" line="162"/>
|
||||
<source>open</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<extra-contents_path>/wlanconnect/open</extra-contents_path>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../wlanconnect.ui" line="147"/>
|
||||
<location filename="../wlanconnect.cpp" line="142"/>
|
||||
<location filename="../wlanconnect.cpp" line="159"/>
|
||||
<source>Advanced settings</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<extra-contents_path>/wlanconnect/Advanced settings"</extra-contents_path>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../wlanconnect.cpp" line="297"/>
|
||||
<location filename="../wlanconnect.cpp" line="865"/>
|
||||
<location filename="../wlanconnect.cpp" line="927"/>
|
||||
<location filename="../wlanconnect.cpp" line="72"/>
|
||||
<source>ukui control center</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../wlanconnect.cpp" line="75"/>
|
||||
<source>ukui control center desktop message</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../wlanconnect.cpp" line="182"/>
|
||||
<source>No wireless network card detected</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../wlanconnect.cpp" line="319"/>
|
||||
<location filename="../wlanconnect.cpp" line="906"/>
|
||||
<location filename="../wlanconnect.cpp" line="968"/>
|
||||
<source>connected</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../wlanconnect.cpp" line="827"/>
|
||||
<location filename="../wlanconnect.cpp" line="859"/>
|
||||
<source>card</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
|
|
@ -5,39 +5,54 @@
|
|||
<name>WlanConnect</name>
|
||||
<message>
|
||||
<location filename="../wlanconnect.ui" line="14"/>
|
||||
<location filename="../wlanconnect.cpp" line="72"/>
|
||||
<location filename="../wlanconnect.cpp" line="89"/>
|
||||
<source>WlanConnect</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../wlanconnect.ui" line="35"/>
|
||||
<location filename="../wlanconnect.cpp" line="143"/>
|
||||
<location filename="../wlanconnect.cpp" line="160"/>
|
||||
<source>WLAN</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../wlanconnect.ui" line="94"/>
|
||||
<location filename="../wlanconnect.cpp" line="145"/>
|
||||
<location filename="../wlanconnect.cpp" line="162"/>
|
||||
<source>open</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<extra-contents_path>/wlanconnect/open</extra-contents_path>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../wlanconnect.ui" line="147"/>
|
||||
<location filename="../wlanconnect.cpp" line="142"/>
|
||||
<location filename="../wlanconnect.cpp" line="159"/>
|
||||
<source>Advanced settings</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<extra-contents_path>/wlanconnect/Advanced settings"</extra-contents_path>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../wlanconnect.cpp" line="297"/>
|
||||
<location filename="../wlanconnect.cpp" line="865"/>
|
||||
<location filename="../wlanconnect.cpp" line="927"/>
|
||||
<location filename="../wlanconnect.cpp" line="72"/>
|
||||
<source>ukui control center</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../wlanconnect.cpp" line="75"/>
|
||||
<source>ukui control center desktop message</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../wlanconnect.cpp" line="182"/>
|
||||
<source>No wireless network card detected</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../wlanconnect.cpp" line="319"/>
|
||||
<location filename="../wlanconnect.cpp" line="906"/>
|
||||
<location filename="../wlanconnect.cpp" line="968"/>
|
||||
<source>connected</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../wlanconnect.cpp" line="827"/>
|
||||
<location filename="../wlanconnect.cpp" line="859"/>
|
||||
<source>card</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
|
Binary file not shown.
|
@ -5,39 +5,54 @@
|
|||
<name>WlanConnect</name>
|
||||
<message>
|
||||
<location filename="../wlanconnect.ui" line="14"/>
|
||||
<location filename="../wlanconnect.cpp" line="72"/>
|
||||
<location filename="../wlanconnect.cpp" line="89"/>
|
||||
<source>WlanConnect</source>
|
||||
<translation>无线局域网</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../wlanconnect.ui" line="35"/>
|
||||
<location filename="../wlanconnect.cpp" line="143"/>
|
||||
<location filename="../wlanconnect.cpp" line="160"/>
|
||||
<source>WLAN</source>
|
||||
<translation>无线局域网</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../wlanconnect.ui" line="94"/>
|
||||
<location filename="../wlanconnect.cpp" line="145"/>
|
||||
<location filename="../wlanconnect.cpp" line="162"/>
|
||||
<source>open</source>
|
||||
<translation>开启</translation>
|
||||
<extra-contents_path>/wlanconnect/open</extra-contents_path>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../wlanconnect.ui" line="147"/>
|
||||
<location filename="../wlanconnect.cpp" line="142"/>
|
||||
<location filename="../wlanconnect.cpp" line="159"/>
|
||||
<source>Advanced settings</source>
|
||||
<translation>高级设置</translation>
|
||||
<extra-contents_path>/wlanconnect/Advanced settings"</extra-contents_path>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../wlanconnect.cpp" line="297"/>
|
||||
<location filename="../wlanconnect.cpp" line="865"/>
|
||||
<location filename="../wlanconnect.cpp" line="927"/>
|
||||
<location filename="../wlanconnect.cpp" line="72"/>
|
||||
<source>ukui control center</source>
|
||||
<translation>控制面板</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../wlanconnect.cpp" line="75"/>
|
||||
<source>ukui control center desktop message</source>
|
||||
<translation>控制面板桌面通知</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../wlanconnect.cpp" line="182"/>
|
||||
<source>No wireless network card detected</source>
|
||||
<translation>未检测到无线网卡</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../wlanconnect.cpp" line="319"/>
|
||||
<location filename="../wlanconnect.cpp" line="906"/>
|
||||
<location filename="../wlanconnect.cpp" line="968"/>
|
||||
<source>connected</source>
|
||||
<translation>已连接</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../wlanconnect.cpp" line="827"/>
|
||||
<location filename="../wlanconnect.cpp" line="859"/>
|
||||
<source>card</source>
|
||||
<translation>网卡</translation>
|
||||
</message>
|
||||
|
|
|
@ -62,6 +62,23 @@ bool intThan(int sign1, int sign2)
|
|||
return sign1 < sign2;
|
||||
}
|
||||
|
||||
void WlanConnect::showDesktopNotify(const QString &message)
|
||||
{
|
||||
QDBusInterface iface("org.freedesktop.Notifications",
|
||||
"/org/freedesktop/Notifications",
|
||||
"org.freedesktop.Notifications",
|
||||
QDBusConnection::sessionBus());
|
||||
QList<QVariant> args;
|
||||
args<<(tr("ukui control center"))
|
||||
<<((unsigned int) 0)
|
||||
<<QString("/usr/share/icons/ukui-icon-theme-default/24x24/devices/gnome-dev-ethernet.png")
|
||||
<<tr("ukui control center desktop message") //显示的是什么类型的信息
|
||||
<<message //显示的具体信息
|
||||
<<QStringList()
|
||||
<<QVariantMap()
|
||||
<<(int)-1;
|
||||
iface.callWithArgumentList(QDBus::AutoDetect,"Notify",args);
|
||||
}
|
||||
|
||||
WlanConnect::WlanConnect() : mFirstLoad(true) {
|
||||
|
||||
|
@ -161,6 +178,10 @@ void WlanConnect::initComponent() {
|
|||
ui->openWIifLayout->addWidget(wifiSwtch);
|
||||
ui->detailLayOut_3->setContentsMargins(MAIN_LAYOUT_MARGINS);
|
||||
|
||||
connect(wifiSwtch, &SwitchButton::disabledClick, this, []() {
|
||||
showDesktopNotify(tr("No wireless network card detected"));
|
||||
});
|
||||
|
||||
//开关
|
||||
if (QGSettings::isSchemaInstalled(GSETTINGS_SCHEMA)) {
|
||||
m_switchGsettings = new QGSettings(GSETTINGS_SCHEMA);
|
||||
|
|
|
@ -75,6 +75,8 @@ private:
|
|||
void runExternalApp();
|
||||
void initSearchText();
|
||||
|
||||
void showDesktopNotify(const QString &message);
|
||||
|
||||
//点击item 连接/断开
|
||||
void activeConnect(QString netName, QString deviceName, int type);
|
||||
void deActiveConnect(QString netName, QString deviceName, int type);
|
||||
|
|
Loading…
Reference in New Issue