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

Commit

Permalink
Inform the user if more images are available (they do not have a netw…
Browse files Browse the repository at this point in the history
…ork connection)
  • Loading branch information
samnazarko committed Jun 16, 2015
1 parent bf295af commit e23a6f2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
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

0 comments on commit e23a6f2

Please sign in to comment.