mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 10:46:35 +01:00
Use .qupzilla/tmp instead of /tmp.
- use it for downloading temporary files that are going to be opened - this directory will be cleaned upon application close
This commit is contained in:
parent
7c2af06845
commit
999f499288
@ -665,6 +665,7 @@ void MainApplication::saveSettings()
|
||||
m_networkmanager->saveCertificates();
|
||||
m_plugins->shutdown();
|
||||
qIconProvider->saveIconsToDatabase();
|
||||
clearTempPath();
|
||||
|
||||
AdBlockManager::instance()->save();
|
||||
QFile::remove(currentProfilePath() + "WebpageIcons.db");
|
||||
@ -992,6 +993,25 @@ QString MainApplication::currentStyle() const
|
||||
return m_proxyStyle->baseStyle()->objectName();
|
||||
}
|
||||
|
||||
void MainApplication::clearTempPath()
|
||||
{
|
||||
QString path = PROFILEDIR + "tmp/";
|
||||
QDir dir(path);
|
||||
|
||||
if (dir.exists())
|
||||
qz_removeDir(path);
|
||||
}
|
||||
|
||||
QString MainApplication::tempPath() const
|
||||
{
|
||||
QString path = PROFILEDIR + "tmp/";
|
||||
QDir dir(path);
|
||||
if (!dir.exists())
|
||||
dir.mkdir(path);
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
MainApplication::~MainApplication()
|
||||
{
|
||||
delete m_uaManager;
|
||||
|
@ -83,9 +83,11 @@ public:
|
||||
|
||||
bool checkSettingsDir();
|
||||
void destroyRestoreManager();
|
||||
void clearTempPath();
|
||||
|
||||
void setProxyStyle(ProxyStyle* style);
|
||||
QString currentStyle() const;
|
||||
QString tempPath() const;
|
||||
|
||||
QupZilla* getWindow();
|
||||
CookieManager* cookieManager();
|
||||
|
@ -78,7 +78,7 @@ void DesktopNotificationsFactory::showNotification(const QPixmap &icon, const QS
|
||||
break;
|
||||
case DesktopNative:
|
||||
#if defined(Q_WS_X11) && !defined(DISABLE_DBUS)
|
||||
QFile tmp(QDir::tempPath() + "/qupzilla_notif.png");
|
||||
QFile tmp(mApp->tempPath() + "/qupzilla_notif.png");
|
||||
tmp.open(QFile::WriteOnly);
|
||||
icon.save(tmp.fileName());
|
||||
|
||||
@ -105,7 +105,7 @@ void DesktopNotificationsFactory::showNotification(const QPixmap &icon, const QS
|
||||
void DesktopNotificationsFactory::nativeNotificationPreview()
|
||||
{
|
||||
#if defined(Q_WS_X11) && !defined(DISABLE_DBUS)
|
||||
QFile tmp(QDir::tempPath() + "/qupzilla_notif.png");
|
||||
QFile tmp(mApp->tempPath() + "/qupzilla_notif.png");
|
||||
tmp.open(QFile::WriteOnly);
|
||||
QPixmap(":icons/preferences/dialog-question.png").save(tmp.fileName());
|
||||
|
||||
|
@ -182,7 +182,7 @@ void DownloadFileHelper::optionsDialogAccepted(int finish)
|
||||
}
|
||||
}
|
||||
else {
|
||||
fileNameChoosed(QDir::tempPath() + "/" + m_h_fileName, true);
|
||||
fileNameChoosed(mApp->tempPath() + "/" + m_h_fileName, true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -210,7 +210,7 @@ void DownloadFileHelper::fileNameChoosed(const QString &name, bool fileNameAutoG
|
||||
m_fileName = qz_ensureUniqueFilename(m_fileName);
|
||||
}
|
||||
|
||||
if (!m_path.contains(QDir::tempPath())) {
|
||||
if (!m_path.contains(mApp->tempPath())) {
|
||||
m_lastDownloadPath = m_path;
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,7 @@ void GM_AddScriptDialog::showSource()
|
||||
return;
|
||||
}
|
||||
|
||||
const QString &tmpFileName = qz_ensureUniqueFilename(QDir::tempPath() + "/tmp-userscript.js");
|
||||
const QString &tmpFileName = qz_ensureUniqueFilename(mApp->tempPath() + "/tmp-userscript.js");
|
||||
|
||||
if (QFile::copy(m_script->fileName(), tmpFileName)) {
|
||||
int index = qz->tabWidget()->addView(QUrl::fromLocalFile(tmpFileName), Qz::NT_SelectedTabAtTheEnd);
|
||||
|
Loading…
Reference in New Issue
Block a user