Skip to content
This repository has been archived by the owner on Feb 27, 2023. It is now read-only.

Inform the user if more images are available #267

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions recovery/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ void MainWindow::populate()
_qpd->setWindowFlags(Qt::Window | Qt::CustomizeWindowHint | Qt::WindowTitleHint);
_qpd->show();
QTimer::singleShot(2000, this, SLOT(hideDialogIfNoNetwork()));
QTimer::singleShot(2000, this, SLOT(showMoreAvailableDialogIfNoNetwork()));
}

if (QFile::exists(SETTINGS_PARTITION))
Expand Down Expand Up @@ -1471,3 +1472,16 @@ void MainWindow::hideDialogIfNoNetwork()
}
}
}

void MainWindow::showMoreAvailableDialogIfNoNetwork()
{
QByteArray carrier = getFileContents("/sys/class/net/eth0/carrier").trimmed();
if (carrier != "1" && ui->list->count() > 0) /* We don't want to show this if hideDialogIfNoNetwork's messagebox showed too */
{
/* No network cable inserted, but have local images */
QMessageBox::information(this,
tr("More images are available online"),
tr("A greater variety of more up to date images may be available online. Please insert a network cable in to the network port to access them."),
QMessageBox::Close);
}
}
1 change: 1 addition & 0 deletions recovery/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ protected slots:
void downloadMetaComplete();
void onQuery(const QString &msg, const QString &title, QMessageBox::StandardButton* answer);
void hideDialogIfNoNetwork();
void showMoreAvailableDialogIfNoNetwork();

private slots:
/* UI events */
Expand Down