mirror of
https://github.com/Quill-OS/quill.git
synced 2024-10-31 21:33:22 -07:00
Wi-Fi: password -> passphrase
This commit is contained in:
parent
c49da9dc90
commit
edffb452bd
8 changed files with 128 additions and 96 deletions
|
@ -497,7 +497,7 @@ void generalDialog::on_okBtn_clicked()
|
||||||
if(!global::keyboard::keyboardText.isEmpty()) {
|
if(!global::keyboard::keyboardText.isEmpty()) {
|
||||||
if(global::keyboard::keyboardText.count() < 8) {
|
if(global::keyboard::keyboardText.count() < 8) {
|
||||||
global::toast::delay = 3000;
|
global::toast::delay = 3000;
|
||||||
showToast("Minimum password length is 8 characters");
|
showToast("Minimum passphrase length is 8 characters");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
generalDialog::close();
|
generalDialog::close();
|
||||||
|
|
|
@ -21,7 +21,7 @@ connectiondialog::connectiondialog(QWidget *parent) :
|
||||||
|
|
||||||
ui->cancelBtn->setStyleSheet("font-size: 9pt");
|
ui->cancelBtn->setStyleSheet("font-size: 9pt");
|
||||||
ui->connectBtn->setStyleSheet("font-size: 9pt");
|
ui->connectBtn->setStyleSheet("font-size: 9pt");
|
||||||
ui->showPasswordBtn->setStyleSheet("font-size: 9pt");
|
ui->showPassphraseBtn->setStyleSheet("font-size: 9pt");
|
||||||
|
|
||||||
// Size
|
// Size
|
||||||
QRect screenGeometry = QGuiApplication::screens()[0]->geometry();
|
QRect screenGeometry = QGuiApplication::screens()[0]->geometry();
|
||||||
|
@ -42,12 +42,12 @@ void connectiondialog::applyVariables() {
|
||||||
ui->signalLabel->setText(QString::number(connectedNetworkData.signal) + "%");
|
ui->signalLabel->setText(QString::number(connectedNetworkData.signal) + "%");
|
||||||
|
|
||||||
if(connectedNetworkData.encryption == false) {
|
if(connectedNetworkData.encryption == false) {
|
||||||
ui->showPasswordBtn->hide();
|
ui->showPassphraseBtn->hide();
|
||||||
ui->passwordTextEdit->setText("No password required");
|
ui->passphraseTextEdit->setText("No passphrase required");
|
||||||
ui->passwordTextEdit->setDisabled(true);
|
ui->passphraseTextEdit->setDisabled(true);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(passwordDatabase.exists() == false) {
|
if(passphraseDatabase.exists() == false) {
|
||||||
log("Creating empty database", className);
|
log("Creating empty database", className);
|
||||||
// https://forum.qt.io/topic/104791/how-i-can-create-json-format-in-qt/5
|
// https://forum.qt.io/topic/104791/how-i-can-create-json-format-in-qt/5
|
||||||
QJsonObject root;
|
QJsonObject root;
|
||||||
|
@ -56,33 +56,33 @@ void connectiondialog::applyVariables() {
|
||||||
root["list"] = array;
|
root["list"] = array;
|
||||||
newJsonDocument.setObject(root);
|
newJsonDocument.setObject(root);
|
||||||
|
|
||||||
passwordDatabase.open(QFile::WriteOnly | QFile::Text | QFile::Truncate);
|
passphraseDatabase.open(QFile::WriteOnly | QFile::Text | QFile::Truncate);
|
||||||
passwordDatabase.write(newJsonDocument.toJson());
|
passphraseDatabase.write(newJsonDocument.toJson());
|
||||||
passwordDatabase.flush();
|
passphraseDatabase.flush();
|
||||||
passwordDatabase.close();
|
passphraseDatabase.close();
|
||||||
}
|
}
|
||||||
QString password = searchDatabase(connectedNetworkData.name);
|
QString passphrase = searchDatabase(connectedNetworkData.name);
|
||||||
if(password.isEmpty() == false) {
|
if(passphrase.isEmpty() == false) {
|
||||||
log("Found password: " + password, className);
|
log("Found passphrase: " + passphrase, className);
|
||||||
ui->showPasswordBtn->setIcon(QIcon(":/resources/show.png"));
|
ui->showPassphraseBtn->setIcon(QIcon(":/resources/show.png"));
|
||||||
showedPassword = false;
|
showedPassphrase = false;
|
||||||
savedPassword = password;
|
savedPassphrase = passphrase;
|
||||||
|
|
||||||
ui->passwordTextEdit->setText("********");
|
ui->passphraseTextEdit->setText("********");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
log("No password found", className);
|
log("No passphrase found", className);
|
||||||
ui->passwordTextEdit->setText("No password was saved");
|
ui->passphraseTextEdit->setText("No passphrase was saved");
|
||||||
showedPassword = true;
|
showedPassphrase = true;
|
||||||
ui->showPasswordBtn->hide();
|
ui->showPassphraseBtn->hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString connectiondialog::searchDatabase(QString key) {
|
QString connectiondialog::searchDatabase(QString key) {
|
||||||
passwordDatabase.open(QIODevice::ReadOnly | QIODevice::Text);
|
passphraseDatabase.open(QIODevice::ReadOnly | QIODevice::Text);
|
||||||
QString fileRead = passwordDatabase.readAll();
|
QString fileRead = passphraseDatabase.readAll();
|
||||||
passwordDatabase.close();
|
passphraseDatabase.close();
|
||||||
QJsonDocument jsonDocument = QJsonDocument::fromJson(fileRead.toUtf8());
|
QJsonDocument jsonDocument = QJsonDocument::fromJson(fileRead.toUtf8());
|
||||||
|
|
||||||
if(jsonDocument["list"].isArray() == true) {
|
if(jsonDocument["list"].isArray() == true) {
|
||||||
|
@ -92,9 +92,9 @@ QString connectiondialog::searchDatabase(QString key) {
|
||||||
QString searchedName = jsonMainObject.keys().first().toUtf8();
|
QString searchedName = jsonMainObject.keys().first().toUtf8();
|
||||||
log("Found in database: '" + searchedName + "'", className);
|
log("Found in database: '" + searchedName + "'", className);
|
||||||
if(searchedName == key) {
|
if(searchedName == key) {
|
||||||
QString returnedPassword = jsonMainObject.value(key).toString();
|
QString returnedPassphrase = jsonMainObject.value(key).toString();
|
||||||
log("Searched name '" + searchedName + "' matched '" + key + "' and the password is: '" + returnedPassword + "'", className);
|
log("Searched name '" + searchedName + "' matched '" + key + "' and the passphrase is: '" + returnedPassphrase + "'", className);
|
||||||
return returnedPassword;
|
return returnedPassphrase;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
log("Searched name '" + searchedName + "' doesn't match '" + key + "'", className);
|
log("Searched name '" + searchedName + "' doesn't match '" + key + "'", className);
|
||||||
|
@ -107,14 +107,14 @@ QString connectiondialog::searchDatabase(QString key) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void connectiondialog::writeToDatabase(QString name, QString password) {
|
void connectiondialog::writeToDatabase(QString name, QString passphrase) {
|
||||||
if(searchDatabase(name).isEmpty() == false) {
|
if(searchDatabase(name).isEmpty() == false) {
|
||||||
removeFromDatabase(name);
|
removeFromDatabase(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
passwordDatabase.open(QIODevice::ReadOnly | QIODevice::Text);
|
passphraseDatabase.open(QIODevice::ReadOnly | QIODevice::Text);
|
||||||
QString fileRead = passwordDatabase.readAll();
|
QString fileRead = passphraseDatabase.readAll();
|
||||||
passwordDatabase.close();
|
passphraseDatabase.close();
|
||||||
QJsonDocument jsonDocument = QJsonDocument::fromJson(fileRead.toUtf8());
|
QJsonDocument jsonDocument = QJsonDocument::fromJson(fileRead.toUtf8());
|
||||||
|
|
||||||
if(jsonDocument["list"].isArray() == true) {
|
if(jsonDocument["list"].isArray() == true) {
|
||||||
|
@ -123,7 +123,7 @@ void connectiondialog::writeToDatabase(QString name, QString password) {
|
||||||
|
|
||||||
// https://stackoverflow.com/questions/26804660/how-to-initialize-qjsonobject-from-qstring
|
// https://stackoverflow.com/questions/26804660/how-to-initialize-qjsonobject-from-qstring
|
||||||
// I hoped this would be easier
|
// I hoped this would be easier
|
||||||
QJsonObject newObject = QJsonDocument::fromJson(QString("{\"" + name + "\" : \"" + password + "\" }").toUtf8()).object();
|
QJsonObject newObject = QJsonDocument::fromJson(QString("{\"" + name + "\" : \"" + passphrase + "\" }").toUtf8()).object();
|
||||||
jsonArray.append(newObject);
|
jsonArray.append(newObject);
|
||||||
|
|
||||||
QJsonDocument newJsonDocument;
|
QJsonDocument newJsonDocument;
|
||||||
|
@ -131,10 +131,10 @@ void connectiondialog::writeToDatabase(QString name, QString password) {
|
||||||
root["list"] = jsonArray;
|
root["list"] = jsonArray;
|
||||||
newJsonDocument.setObject(root);
|
newJsonDocument.setObject(root);
|
||||||
|
|
||||||
passwordDatabase.open(QFile::WriteOnly | QFile::Text | QFile::Truncate);
|
passphraseDatabase.open(QFile::WriteOnly | QFile::Text | QFile::Truncate);
|
||||||
passwordDatabase.write(newJsonDocument.toJson());
|
passphraseDatabase.write(newJsonDocument.toJson());
|
||||||
passwordDatabase.flush();
|
passphraseDatabase.flush();
|
||||||
passwordDatabase.close();
|
passphraseDatabase.close();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
log("Something went horribly wrong", className);
|
log("Something went horribly wrong", className);
|
||||||
|
@ -142,9 +142,9 @@ void connectiondialog::writeToDatabase(QString name, QString password) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void connectiondialog::removeFromDatabase(QString name) {
|
void connectiondialog::removeFromDatabase(QString name) {
|
||||||
passwordDatabase.open(QIODevice::ReadOnly | QIODevice::Text);
|
passphraseDatabase.open(QIODevice::ReadOnly | QIODevice::Text);
|
||||||
QString fileRead = passwordDatabase.readAll();
|
QString fileRead = passphraseDatabase.readAll();
|
||||||
passwordDatabase.close();
|
passphraseDatabase.close();
|
||||||
QJsonDocument jsonDocument = QJsonDocument::fromJson(fileRead.toUtf8());
|
QJsonDocument jsonDocument = QJsonDocument::fromJson(fileRead.toUtf8());
|
||||||
|
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
|
@ -169,10 +169,10 @@ void connectiondialog::removeFromDatabase(QString name) {
|
||||||
root["list"] = jsonArray;
|
root["list"] = jsonArray;
|
||||||
newJsonDocument.setObject(root);
|
newJsonDocument.setObject(root);
|
||||||
|
|
||||||
passwordDatabase.open(QFile::WriteOnly | QFile::Text | QFile::Truncate);
|
passphraseDatabase.open(QFile::WriteOnly | QFile::Text | QFile::Truncate);
|
||||||
passwordDatabase.write(newJsonDocument.toJson());
|
passphraseDatabase.write(newJsonDocument.toJson());
|
||||||
passwordDatabase.flush();
|
passphraseDatabase.flush();
|
||||||
passwordDatabase.close();
|
passphraseDatabase.close();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
log("ERROR: tried to remove from database, but couldn't find key", className);
|
log("ERROR: tried to remove from database, but couldn't find key", className);
|
||||||
|
@ -186,18 +186,18 @@ void connectiondialog::on_cancelBtn_clicked()
|
||||||
this->close();
|
this->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void connectiondialog::on_passwordTextEdit_selectionChanged()
|
void connectiondialog::on_passphraseTextEdit_selectionChanged()
|
||||||
{
|
{
|
||||||
ui->passwordTextEdit->setSelection(0, 0);
|
ui->passphraseTextEdit->setSelection(0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void connectiondialog::on_passwordTextEdit_cursorPositionChanged(int oldpos, int newpos)
|
void connectiondialog::on_passphraseTextEdit_cursorPositionChanged(int oldpos, int newpos)
|
||||||
{
|
{
|
||||||
log("Detected click on text edit widget", className);
|
log("Detected click on text edit widget", className);
|
||||||
if(cursorPositionIgnore == true) {
|
if(cursorPositionIgnore == true) {
|
||||||
if(newpos != 0) {
|
if(newpos != 0) {
|
||||||
if(showedPassword == true) {
|
if(showedPassphrase == true) {
|
||||||
ui->passwordTextEdit->setCursorPosition(0);
|
ui->passphraseTextEdit->setCursorPosition(0);
|
||||||
global::keyboard::keyboardDialog = true;
|
global::keyboard::keyboardDialog = true;
|
||||||
global::keyboard::wifiPassphraseDialog = true;
|
global::keyboard::wifiPassphraseDialog = true;
|
||||||
global::keyboard::keyboardText = "";
|
global::keyboard::keyboardText = "";
|
||||||
|
@ -212,19 +212,19 @@ void connectiondialog::on_passwordTextEdit_cursorPositionChanged(int oldpos, int
|
||||||
global::keyboard::keyboardDialog = false;
|
global::keyboard::keyboardDialog = false;
|
||||||
global::keyboard::wifiPassphraseDialog = false;
|
global::keyboard::wifiPassphraseDialog = false;
|
||||||
if(global::keyboard::keyboardText.isEmpty() == false) {
|
if(global::keyboard::keyboardText.isEmpty() == false) {
|
||||||
// A bit hacky: avoid summoning the keyboard back when the text is changing (and the cursor too) showedPassword shouldn't be used for this, but it works and adding another boolean would start being messy
|
// A bit hacky: avoid summoning the keyboard back when the text is changing (and the cursor too) showedPassphrase shouldn't be used for this, but it works and adding another boolean would start being messy
|
||||||
showedPassword = false;
|
showedPassphrase = false;
|
||||||
ui->passwordTextEdit->setText(global::keyboard::keyboardText);
|
ui->passphraseTextEdit->setText(global::keyboard::keyboardText);
|
||||||
ui->showPasswordBtn->setIcon(QIcon(":/resources/hide.png"));
|
ui->showPassphraseBtn->setIcon(QIcon(":/resources/hide.png"));
|
||||||
ui->showPasswordBtn->show();
|
ui->showPassphraseBtn->show();
|
||||||
showedPassword = true;
|
showedPassphrase = true;
|
||||||
savedPassword = global::keyboard::keyboardText;
|
savedPassphrase = global::keyboard::keyboardText;
|
||||||
ui->showPasswordBtn->show();
|
ui->showPassphraseBtn->show();
|
||||||
}
|
}
|
||||||
global::keyboard::keyboardText = "";
|
global::keyboard::keyboardText = "";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
log("Password is not saved; ignoring text edit call", className);
|
log("Passphrase is not saved; ignoring text edit call", className);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -238,17 +238,17 @@ void connectiondialog::showToastSlot(QString message) {
|
||||||
emit showToastSignal(message);
|
emit showToastSignal(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void connectiondialog::on_showPasswordBtn_clicked()
|
void connectiondialog::on_showPassphraseBtn_clicked()
|
||||||
{
|
{
|
||||||
if(showedPassword == false) {
|
if(showedPassphrase == false) {
|
||||||
ui->showPasswordBtn->setIcon(QIcon(":/resources/hide.png"));
|
ui->showPassphraseBtn->setIcon(QIcon(":/resources/hide.png"));
|
||||||
ui->passwordTextEdit->setText(savedPassword);
|
ui->passphraseTextEdit->setText(savedPassphrase);
|
||||||
showedPassword = true;
|
showedPassphrase = true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
showedPassword = false;
|
showedPassphrase = false;
|
||||||
ui->showPasswordBtn->setIcon(QIcon(":/resources/show.png"));
|
ui->showPassphraseBtn->setIcon(QIcon(":/resources/show.png"));
|
||||||
ui->passwordTextEdit->setText("********");
|
ui->passphraseTextEdit->setText("********");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -259,28 +259,28 @@ void connectiondialog::refreshScreenSlot() {
|
||||||
|
|
||||||
void connectiondialog::on_connectBtn_clicked()
|
void connectiondialog::on_connectBtn_clicked()
|
||||||
{
|
{
|
||||||
QString finalPassword;
|
QString finalPassphrase;
|
||||||
if(connectedNetworkData.encryption == false) {
|
if(connectedNetworkData.encryption == false) {
|
||||||
finalPassword = "NONE";
|
finalPassphrase = "NONE";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(savedPassword.isEmpty() == false) {
|
if(savedPassphrase.isEmpty() == false) {
|
||||||
finalPassword = savedPassword;
|
finalPassphrase = savedPassphrase;
|
||||||
writeToDatabase(connectedNetworkData.name, savedPassword);
|
writeToDatabase(connectedNetworkData.name, savedPassphrase);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
showToastSlot("Provide a password first");
|
showToastSlot("Provide a passphrase first");
|
||||||
return void();
|
return void();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
passwordForReconnecting = finalPassword;
|
passphraseForReconnecting = finalPassphrase;
|
||||||
|
|
||||||
ui->cancelBtn->setEnabled(false);
|
ui->cancelBtn->setEnabled(false);
|
||||||
if(checkWifiState() == global::wifi::wifiState::configured) {
|
if(checkWifiState() == global::wifi::wifiState::configured) {
|
||||||
string_writeconfig("/opt/ibxd", "stop_wifi_operations\n");
|
string_writeconfig("/opt/ibxd", "stop_wifi_operations\n");
|
||||||
}
|
}
|
||||||
writeFile("/run/wifi_network_essid", connectedNetworkData.name);
|
writeFile("/run/wifi_network_essid", connectedNetworkData.name);
|
||||||
writeFile("/run/wifi_network_passphrase", finalPassword);
|
writeFile("/run/wifi_network_passphrase", finalPassphrase);
|
||||||
finalConnectWait();
|
finalConnectWait();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -307,7 +307,7 @@ void connectiondialog::finalConnectWait() {
|
||||||
// This will be deleted later in MainWindow's icon updater if it failed. It is also deleted in the Wi-Fi stop script
|
// This will be deleted later in MainWindow's icon updater if it failed. It is also deleted in the Wi-Fi stop script
|
||||||
log("Writing to config directory with connection information data", className);
|
log("Writing to config directory with connection information data", className);
|
||||||
string_writeconfig("/mnt/onboard/.adds/inkbox/.config/17-wifi_connection_information/essid", connectedNetworkData.name.toStdString());
|
string_writeconfig("/mnt/onboard/.adds/inkbox/.config/17-wifi_connection_information/essid", connectedNetworkData.name.toStdString());
|
||||||
string_writeconfig("/mnt/onboard/.adds/inkbox/.config/17-wifi_connection_information/passphrase", passwordForReconnecting.toStdString());
|
string_writeconfig("/mnt/onboard/.adds/inkbox/.config/17-wifi_connection_information/passphrase", passphraseForReconnecting.toStdString());
|
||||||
|
|
||||||
this->deleteLater();
|
this->deleteLater();
|
||||||
this->close();
|
this->close();
|
||||||
|
|
|
@ -18,7 +18,7 @@ public:
|
||||||
~connectiondialog();
|
~connectiondialog();
|
||||||
global::wifi::wifiNetworkData connectedNetworkData;
|
global::wifi::wifiNetworkData connectedNetworkData;
|
||||||
QString currentlyConnectedNetworkName;
|
QString currentlyConnectedNetworkName;
|
||||||
QFile passwordDatabase = QFile("/mnt/onboard/.adds/inkbox/.config/17-wifi_connection_information/passwords.json");
|
QFile passphraseDatabase = QFile("/mnt/onboard/.adds/inkbox/.config/17-wifi_connection_information/passphrases.json");
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void showToastSignal(QString message);
|
void showToastSignal(QString message);
|
||||||
|
@ -34,25 +34,25 @@ private slots:
|
||||||
// 1. It's modular
|
// 1. It's modular
|
||||||
// 2. Those operations are rare
|
// 2. Those operations are rare
|
||||||
QString searchDatabase(QString key);
|
QString searchDatabase(QString key);
|
||||||
void writeToDatabase(QString name, QString password);
|
void writeToDatabase(QString name, QString passphrase);
|
||||||
void removeFromDatabase(QString name);
|
void removeFromDatabase(QString name);
|
||||||
|
|
||||||
void finalConnectWait();
|
void finalConnectWait();
|
||||||
bool checkIfWifiBusy();
|
bool checkIfWifiBusy();
|
||||||
|
|
||||||
void on_cancelBtn_clicked();
|
void on_cancelBtn_clicked();
|
||||||
void on_passwordTextEdit_selectionChanged();
|
void on_passphraseTextEdit_selectionChanged();
|
||||||
void on_passwordTextEdit_cursorPositionChanged(int arg1, int arg2);
|
void on_passphraseTextEdit_cursorPositionChanged(int arg1, int arg2);
|
||||||
void on_showPasswordBtn_clicked();
|
void on_showPassphraseBtn_clicked();
|
||||||
void on_connectBtn_clicked();
|
void on_connectBtn_clicked();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::connectiondialog *ui;
|
Ui::connectiondialog *ui;
|
||||||
bool cursorPositionIgnore = false;
|
bool cursorPositionIgnore = false;
|
||||||
bool showedPassword;
|
bool showedPassphrase;
|
||||||
QString savedPassword;
|
QString savedPassphrase;
|
||||||
int waitTry = 0;
|
int waitTry = 0;
|
||||||
QString passwordForReconnecting;
|
QString passphraseForReconnecting;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CONNECTIONDIALOG_H
|
#endif // CONNECTIONDIALOG_H
|
||||||
|
|
|
@ -71,7 +71,7 @@
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLineEdit" name="passwordTextEdit">
|
<widget class="QLineEdit" name="passphraseTextEdit">
|
||||||
<property name="cursor">
|
<property name="cursor">
|
||||||
<cursorShape>BlankCursor</cursorShape>
|
<cursorShape>BlankCursor</cursorShape>
|
||||||
</property>
|
</property>
|
||||||
|
@ -81,7 +81,7 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="showPasswordBtn">
|
<widget class="QPushButton" name="showPassphraseBtn">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
|
|
|
@ -72,7 +72,7 @@ wifiDialog::wifiDialog(QWidget *parent) :
|
||||||
ui->refreshBtn->click();
|
ui->refreshBtn->click();
|
||||||
} else {
|
} else {
|
||||||
wifiButtonEnabled = true;
|
wifiButtonEnabled = true;
|
||||||
ui->stopBtn->setStyleSheet("background-color: gray;");
|
ui->stopBtn->setStyleSheet("background-color: lightGray;");
|
||||||
ui->stopBtn->setEnabled(false);
|
ui->stopBtn->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ void wifiDialog::launchRefresh() {
|
||||||
// Order is important
|
// Order is important
|
||||||
if(scanInProgress == false) {
|
if(scanInProgress == false) {
|
||||||
scanInProgress = true;
|
scanInProgress = true;
|
||||||
ui->refreshBtn->setStyleSheet("background-color: gray;");
|
ui->refreshBtn->setStyleSheet("background-color: lightGray;");
|
||||||
ui->refreshBtn->setEnabled(false);
|
ui->refreshBtn->setEnabled(false);
|
||||||
|
|
||||||
elapsedSeconds = 0;
|
elapsedSeconds = 0;
|
||||||
|
@ -218,7 +218,7 @@ void wifiDialog::refreshNetworksList() {
|
||||||
int countVec = 0;
|
int countVec = 0;
|
||||||
int vectorNetworkLocation = 9999;
|
int vectorNetworkLocation = 9999;
|
||||||
for(global::wifi::wifiNetworkData wifiNetwork: pureNetworkList) {
|
for(global::wifi::wifiNetworkData wifiNetwork: pureNetworkList) {
|
||||||
if(currentWifiNetwork.isEmpty() == false and wifiNetwork.name.contains(currentWifiNetwork) == true) {
|
if(currentWifiNetwork.isEmpty() == false and wifiNetwork.name == currentWifiNetwork) {
|
||||||
log("Found current network in vector", className);
|
log("Found current network in vector", className);
|
||||||
vectorNetworkLocation = countVec;
|
vectorNetworkLocation = countVec;
|
||||||
currentNetwork = wifiNetwork.name;
|
currentNetwork = wifiNetwork.name;
|
||||||
|
@ -308,9 +308,9 @@ void wifiDialog::on_wifiCheckBox_stateChanged(int arg1)
|
||||||
} else {
|
} else {
|
||||||
log("Turning Wi-Fi off", className);
|
log("Turning Wi-Fi off", className);
|
||||||
QTimer::singleShot(0, this, SLOT(turnOffWifi()));
|
QTimer::singleShot(0, this, SLOT(turnOffWifi()));
|
||||||
// To inform the wifi icon GUI to don't show the connected/failed to connect message
|
// To inform the Wi-Fi icon updater to not show the connected/failed to connect message
|
||||||
string_writeconfig("/mnt/onboard/.adds/inkbox/.config/17-wifi_connection_information/stopped", "true");
|
string_writeconfig("/mnt/onboard/.adds/inkbox/.config/17-wifi_connection_information/stopped", "true");
|
||||||
ui->stopBtn->setStyleSheet("background-color: gray;");
|
ui->stopBtn->setStyleSheet("background-color: lightGray;");
|
||||||
ui->stopBtn->setEnabled(false);
|
ui->stopBtn->setEnabled(false);
|
||||||
}
|
}
|
||||||
emit killNetworkWidgets();
|
emit killNetworkWidgets();
|
||||||
|
@ -375,7 +375,7 @@ void wifiDialog::refreshScreenSlot() {
|
||||||
* smarter_time_sync.sh - Syncs time
|
* smarter_time_sync.sh - Syncs time
|
||||||
* toggle.sh - Turns on/off Wi-Fi adapter
|
* toggle.sh - Turns on/off Wi-Fi adapter
|
||||||
* list_networks - Lists networks
|
* list_networks - Lists networks
|
||||||
* check_wifi_password.sh - Checks Wi-Fi network password
|
* check_wifi_passphrase.sh - Checks Wi-Fi network passphrase
|
||||||
* watcher() first watches at processes that could kill other ones
|
* watcher() first watches at processes that could kill other ones
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -426,10 +426,10 @@ void wifiDialog::watcher() {
|
||||||
return void();
|
return void();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool passwordCheck = checkProcessName("check_wifi_password.sh");
|
bool passphraseCheck = checkProcessName("check_wifi_passphrase.sh");
|
||||||
if(passwordCheck == true) {
|
if(passphraseCheck == true) {
|
||||||
forceRefresh = true;
|
forceRefresh = true;
|
||||||
setStatusText("Checking Wi-Fi network password");
|
setStatusText("Checking Wi-Fi network passphrase");
|
||||||
QTimer::singleShot(relaunchMs, this, SLOT(watcher()));
|
QTimer::singleShot(relaunchMs, this, SLOT(watcher()));
|
||||||
return void();
|
return void();
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,10 +124,14 @@
|
||||||
<widget class="QLabel" name="label">
|
<widget class="QLabel" name="label">
|
||||||
<property name="font">
|
<property name="font">
|
||||||
<font>
|
<font>
|
||||||
|
<family>Inter</family>
|
||||||
<weight>75</weight>
|
<weight>75</weight>
|
||||||
<bold>true</bold>
|
<bold>true</bold>
|
||||||
</font>
|
</font>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">font-family: Inter</string>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Wi-Fi</string>
|
<string>Wi-Fi</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -144,18 +148,42 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="Line" name="line_4">
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Plain</enum>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="statusLabel">
|
<widget class="QLabel" name="statusLabel">
|
||||||
<property name="font">
|
<property name="font">
|
||||||
<font>
|
<font>
|
||||||
|
<family>u001</family>
|
||||||
<pointsize>9</pointsize>
|
<pointsize>9</pointsize>
|
||||||
</font>
|
</font>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">padding-left: 10px; font-family: u001</string>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Wi-Fi status</string>
|
<string>Wi-Fi status</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="Line" name="line_5">
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Plain</enum>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QScrollArea" name="scrollArea">
|
<widget class="QScrollArea" name="scrollArea">
|
||||||
<property name="frameShape">
|
<property name="frameShape">
|
||||||
|
@ -182,7 +210,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>585</width>
|
<width>585</width>
|
||||||
<height>557</height>
|
<height>538</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
|
|
@ -70,7 +70,7 @@ void wifilogger::setWifiInfoPage() {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ui->stackedWidget->setCurrentIndex(1);
|
ui->stackedWidget->setCurrentIndex(1);
|
||||||
ui->nameLabel->setText("Not currently connected to a network");
|
ui->nameLabel->setText("Not connected to a network");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -229,7 +229,7 @@
|
||||||
</font>
|
</font>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Password protected:</string>
|
<string>Passphrase-protected:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -349,10 +349,14 @@
|
||||||
<widget class="QLabel" name="label_8">
|
<widget class="QLabel" name="label_8">
|
||||||
<property name="font">
|
<property name="font">
|
||||||
<font>
|
<font>
|
||||||
|
<family>Inter</family>
|
||||||
<weight>75</weight>
|
<weight>75</weight>
|
||||||
<bold>true</bold>
|
<bold>true</bold>
|
||||||
</font>
|
</font>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">font-family: Inter; font-weight: bold</string>
|
||||||
|
</property>
|
||||||
<property name="lineWidth">
|
<property name="lineWidth">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
|
|
Loading…
Reference in a new issue