|
|
@ -37,9 +37,6 @@ InstallerPrompt::InstallerPrompt(QWidget *parent)
|
|
|
|
palette.setBrush(QPalette::Window, bg);
|
|
|
|
palette.setBrush(QPalette::Window, bg);
|
|
|
|
this->setPalette(palette);
|
|
|
|
this->setPalette(palette);
|
|
|
|
|
|
|
|
|
|
|
|
// Resize the layout widget to the screen size
|
|
|
|
|
|
|
|
ui->gridLayoutWidget->resize(screenGeometry.size());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Initialize process for external app launch
|
|
|
|
// Initialize process for external app launch
|
|
|
|
process = new QProcess(this);
|
|
|
|
process = new QProcess(this);
|
|
|
|
|
|
|
|
|
|
|
@ -58,6 +55,7 @@ InstallerPrompt::InstallerPrompt(QWidget *parent)
|
|
|
|
foreach (const NetworkManager::Device::Ptr &device, NetworkManager::networkInterfaces()) {
|
|
|
|
foreach (const NetworkManager::Device::Ptr &device, NetworkManager::networkInterfaces()) {
|
|
|
|
if (device->type() == NetworkManager::Device::Wifi) {
|
|
|
|
if (device->type() == NetworkManager::Device::Wifi) {
|
|
|
|
wifiDevice = device.objectCast<NetworkManager::WirelessDevice>();
|
|
|
|
wifiDevice = device.objectCast<NetworkManager::WirelessDevice>();
|
|
|
|
|
|
|
|
connect(wifiDevice.data(), &NetworkManager::Device::stateChanged, this, [this]{updateConnectionStatus();});
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -183,6 +181,7 @@ void InstallerPrompt::handleWifiConnection(const QString &ssid) {
|
|
|
|
|
|
|
|
|
|
|
|
// Update the connection settings
|
|
|
|
// Update the connection settings
|
|
|
|
qDebug() << "Saving the connection...";
|
|
|
|
qDebug() << "Saving the connection...";
|
|
|
|
|
|
|
|
QDBusObjectPath path;
|
|
|
|
NetworkManager::ConnectionSettings::Ptr newConnectionSettings(new NetworkManager::ConnectionSettings(NetworkManager::ConnectionSettings::Wireless));
|
|
|
|
NetworkManager::ConnectionSettings::Ptr newConnectionSettings(new NetworkManager::ConnectionSettings(NetworkManager::ConnectionSettings::Wireless));
|
|
|
|
newConnectionSettings->fromMap(nmMap);
|
|
|
|
newConnectionSettings->fromMap(nmMap);
|
|
|
|
QDBusPendingReply<QDBusObjectPath> addreply = NetworkManager::addConnection(nmMap);
|
|
|
|
QDBusPendingReply<QDBusObjectPath> addreply = NetworkManager::addConnection(nmMap);
|
|
|
@ -190,27 +189,26 @@ void InstallerPrompt::handleWifiConnection(const QString &ssid) {
|
|
|
|
if (addreply.isError()) {
|
|
|
|
if (addreply.isError()) {
|
|
|
|
qDebug() << nmMap;
|
|
|
|
qDebug() << nmMap;
|
|
|
|
qDebug() << "Unable to save the connection:" << addreply.error().message();
|
|
|
|
qDebug() << "Unable to save the connection:" << addreply.error().message();
|
|
|
|
return;
|
|
|
|
} else {
|
|
|
|
|
|
|
|
path = addreply.value();
|
|
|
|
|
|
|
|
qDebug() << "Added connection path:" << path.path();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
QString uuid = fullSettings.value("connection").toMap().value("uuid").toString();
|
|
|
|
NetworkManager::Connection::Ptr connection = NetworkManager::findConnection(path.path());
|
|
|
|
NetworkManager::Connection::Ptr connection = NetworkManager::findConnectionByUuid(uuid);
|
|
|
|
|
|
|
|
if (!connection) {
|
|
|
|
if (!connection) {
|
|
|
|
qDebug() << "Unable to retrieve the connection after saving:" << addreply.error().message();
|
|
|
|
qDebug() << "Unable to retrieve the connection after saving:" << addreply.error().message();
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
QDBusPendingReply<QDBusObjectPath> reply = NetworkManager::activateConnection(connection->path(), wifiDevice->uni(), QString());
|
|
|
|
QDBusPendingReply<QDBusObjectPath> reply = NetworkManager::activateConnection(connection->path(), wifiDevice->uni(), QString());
|
|
|
|
reply.waitForFinished();
|
|
|
|
reply.waitForFinished();
|
|
|
|
if (reply.isError()) {
|
|
|
|
if (reply.isError()) {
|
|
|
|
qDebug() << "Unable to activate the connection:" << addreply.error().message();
|
|
|
|
qDebug() << "Unable to activate the connection:" << addreply.error().message();
|
|
|
|
return;
|
|
|
|
} else {
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
NetworkManager::reloadConnections();
|
|
|
|
NetworkManager::reloadConnections();
|
|
|
|
qDebug() << "Successfully connected:" << ssid;
|
|
|
|
qDebug() << "Successfully connected:" << ssid;
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
label.setStyleSheet("color: red;");
|
|
|
|
label.setStyleSheet("color: red;");
|
|
|
|
label.setText(tr("Incorrect password. Please try again:"));
|
|
|
|
label.setText(tr("Incorrect password. Please try again:"));
|
|
|
|