Fix bug can check ip conflict again in a short time

This commit is contained in:
chenlelin 2021-04-13 16:27:45 +08:00
parent 52b48cf883
commit 37b459c87c
2 changed files with 15 additions and 2 deletions

View File

@ -239,7 +239,6 @@ void ConfForm::on_btnCreate_clicked()
if (kylindbus.multiWiredIfName.size() == 0) {
QString tip(tr("Can not create new wired network for without wired card"));
kylindbus.showDesktopNotify(tip);
//this->close();this->hide();
onConfformHide();
return;
} else {
@ -457,6 +456,12 @@ void ConfForm::showNotify(QString message)
bool ConfForm::check_ip_conflict(QString ifname)
{
if (canCheckIpConflict) {
canCheckIpConflict = false;
QTimer::singleShot(2*1000, this, SLOT(changeEnableCheckIp() ));
} else {
return true;
}
//即将检测Ip地址冲突
QString strIpCheck = tr("Will check the IP address conflict");
QString bufferIpCheck = "notify-send -i network-offline " + strIpCheck;
@ -500,6 +505,11 @@ bool ConfForm::check_ip_conflict(QString ifname)
return false;
}
void ConfForm::changeEnableCheckIp()
{
canCheckIpConflict = true;
}
//点击取消按钮
void ConfForm::on_btnCancel_clicked()
{

View File

@ -44,6 +44,7 @@ public:
public slots:
void cbTypeChanged(int index);
void changeEnableCheckIp();
protected:
void paintEvent(QPaintEvent *event);
@ -83,15 +84,17 @@ private:
void showNotify(QString message);
bool check_ip_conflict(QString ifname);
void onConfformHide();
bool isEditingAlready(); //连接按钮是否可被按
bool isPress;
QPoint winPos;
QPoint dragPos;
bool isActConf; //是否对已经连接的网络进行的更改
bool isCreateNewNet = false; //是否是创建的新网络
bool isShowSaveBtn = true; //是否显示保存按钮,即是否是编辑网络界面
bool isEditingAlready(); //连接按钮是否可被按下
QString lastConnName, lastIpv4, netUuid, newUuid;
bool isActWifi; //是否是wifi网络
bool canCheckIpConflict = true; //当前是否可以执行IP冲突的检测
QString labelQss, cbxQss, leQss, lineQss, btnOnQss, btnOffQss;