Themes Window: don't set cache folder on each request.

The Themes Window reuses the download object for getting preview images. Since
the object is reused it isn't necessary to set the cache path on each network
request.

Change-Id: Ibc531e09ad19ede3cab7326d9230bd5188710d98
This commit is contained in:
Dominik Riebeling 2013-01-27 10:32:02 +01:00
parent 6a6e7ea26a
commit abd87ccf15

View file

@ -47,12 +47,25 @@ ThemesInstallWindow::ThemesInstallWindow(QWidget *parent) : QDialog(parent)
connect(ui.listThemes, SIGNAL(itemSelectionChanged()), this, SLOT(updateSize()));
connect(&igetter, SIGNAL(done(bool)), this, SLOT(updateImage(bool)));
if(!RbSettings::value(RbSettings::CacheDisabled).toBool())
igetter.setCache(true);
else
{
if(infocachedir.isEmpty())
{
infocachedir = QDir::tempPath() + "rbutil-themeinfo";
QDir d = QDir::temp();
d.mkdir("rbutil-themeinfo");
}
igetter.setCache(infocachedir);
}
logger = NULL;
}
ThemesInstallWindow::~ThemesInstallWindow()
{
if(infocachedir!="")
if(!infocachedir.isEmpty())
Utils::recursiveRmdir(infocachedir);
}
@ -75,7 +88,7 @@ void ThemesInstallWindow::downloadInfo()
infoUrl.replace("%RELEASE%", installInfo.release());
infoUrl.replace("%RBUTILVER%", VERSION);
QUrl url = QUrl(infoUrl);
qDebug() << "[Themes] Info URL:" << url << "Query:" << url.queryItems();
qDebug() << "[Themes] Info URL:" << url;
getter->setFile(&themesInfo);
connect(getter, SIGNAL(done(bool)), this, SLOT(downloadDone(bool)));
@ -219,21 +232,7 @@ void ThemesInstallWindow::updateDetails(QListWidgetItem* cur, QListWidgetItem* p
text.replace("\n", "<br/>");
ui.themeDescription->setHtml(text);
iniDetails.endGroup();
igetter.abort();
if(!RbSettings::value(RbSettings::CacheDisabled).toBool())
igetter.setCache(true);
else
{
if(infocachedir=="")
{
infocachedir = QDir::tempPath() + "rbutil-themeinfo";
QDir d = QDir::temp();
d.mkdir("rbutil-themeinfo");
}
igetter.setCache(infocachedir);
}
igetter.getFile(img);
}