Skip to content

Commit

Permalink
Fixed|Updater: Printing last checked time when never actually checked
Browse files Browse the repository at this point in the history
The case of "never checked" needs to be handled separately.
  • Loading branch information
skyjake committed Apr 9, 2013
1 parent bd304d1 commit 169c6c3
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
11 changes: 9 additions & 2 deletions doomsday/client/src/updater/updater.cpp
Expand Up @@ -599,6 +599,13 @@ void Updater_ShowSettings(void)

void Updater_PrintLastUpdated(void)
{
Con_Message("Latest update check was made %s.",
UpdaterSettings().lastCheckAgo().toLatin1().constData());
de::String ago = UpdaterSettings().lastCheckAgo();
if(ago.isEmpty())
{
Con_Message("Never checked for updates.");
}
else
{
Con_Message("Latest update check was made %s.", ago.toLatin1().constData());
}
}
2 changes: 2 additions & 0 deletions doomsday/client/src/updater/updatersettings.cpp
Expand Up @@ -191,6 +191,8 @@ de::NativePath UpdaterSettings::defaultDownloadPath()
de::String UpdaterSettings::lastCheckAgo() const
{
de::Time when = lastCheckTime();
if(!when.isValid()) return ""; // Never checked.

de::TimeDelta delta = when.since();

int t;
Expand Down
12 changes: 10 additions & 2 deletions doomsday/client/src/updater/updatersettingsdialog.cpp
Expand Up @@ -119,8 +119,16 @@ DENG2_PIMPL(UpdaterSettingsDialog)
{
UpdaterSettings st;

lastChecked->setText(tr("<small>Last checked %1.</small>")
.arg(st.lastCheckAgo()));
String ago = st.lastCheckAgo();
if(!ago.isEmpty())
{
lastChecked->setText(tr("<small>Last checked %1.</small>")
.arg(st.lastCheckAgo()));
}
else
{
lastChecked->setText(tr("<small>Never checked.</small>"));
}

autoCheck->setChecked(!st.onlyCheckManually());
freqList->setEnabled(!st.onlyCheckManually());
Expand Down

0 comments on commit 169c6c3

Please sign in to comment.