Skip to content

Commit

Permalink
Check user themes directory for writability before downloading theme.
Browse files Browse the repository at this point in the history
This patch will check that the user's themes directory (normally
~/.mythtv/themes on a *nix system) is writable when the user enters
the Theme Chooser screen and warn the user if it is not writable.

Another check happens at theme download time to warn the user if
the selected theme can not be downloaded and installed if the themes
directory is not writable.

Fixes #10634.
  • Loading branch information
cpinkham committed Jun 15, 2013
1 parent d395df6 commit 4167259
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions mythtv/programs/mythfrontend/themechooser.cpp
Expand Up @@ -401,6 +401,16 @@ void ThemeChooser::Init(void)
MythUIButtonListItem *current = m_themes->GetItemCurrent();
if (current)
itemChanged(current);

QString testFile = m_userThemeDir + "/.test";
QFile test(testFile);
if (test.open(QIODevice::WriteOnly))
test.remove();
else
{
ShowOkPopup(tr("Error creating test file, %1 themes directory is "
"not writable.").arg(m_userThemeDir));
}
}

ThemeInfo *ThemeChooser::loadThemeInfo(QFileInfo &theme)
Expand Down Expand Up @@ -600,6 +610,17 @@ void ThemeChooser::saveAndReload(MythUIButtonListItem *item)

if (!info->GetDownloadURL().isEmpty())
{
QString testFile = m_userThemeDir + "/.test";
QFile test(testFile);
if (test.open(QIODevice::WriteOnly))
test.remove();
else
{
ShowOkPopup(tr("Unable to install theme, %1 themes directory is "
"not writable.").arg(m_userThemeDir));
return;
}

QString downloadURL = info->GetDownloadURL();
QFileInfo qfile(downloadURL);
QString baseName = qfile.fileName();
Expand Down

0 comments on commit 4167259

Please sign in to comment.