port C++ code to Qt5
This commit is contained in:
@@ -39,6 +39,9 @@
|
||||
#include <QHeaderView>
|
||||
#include <QDebug>
|
||||
#include <QKeyEvent>
|
||||
#if QT_VERSION >= 0x050000
|
||||
#include <QStandardPaths>
|
||||
#endif
|
||||
#include <QTextDocument>
|
||||
|
||||
#include <App/Document.h>
|
||||
@@ -167,7 +170,11 @@ NetworkAccessManager::NetworkAccessManager(QObject *parent)
|
||||
SLOT(proxyAuthenticationRequired(const QNetworkProxy&, QAuthenticator*)));
|
||||
|
||||
QNetworkDiskCache *diskCache = new QNetworkDiskCache(this);
|
||||
#if QT_VERSION >= 0x050000
|
||||
QString location = QStandardPaths::writableLocation(QStandardPaths::CacheLocation);
|
||||
#else
|
||||
QString location = QDesktopServices::storageLocation(QDesktopServices::CacheLocation);
|
||||
#endif
|
||||
diskCache->setCacheDirectory(location);
|
||||
setCache(diskCache);
|
||||
}
|
||||
@@ -184,7 +191,11 @@ void NetworkAccessManager::authenticationRequired(QNetworkReply *reply, QAuthent
|
||||
dialog.adjustSize();
|
||||
|
||||
QString introMessage = tr("<qt>Enter username and password for \"%1\" at %2</qt>");
|
||||
#if QT_VERSION >= 0x050000
|
||||
introMessage = introMessage.arg(QString(reply->url().toString()).toHtmlEscaped()).arg(QString(reply->url().toString()).toHtmlEscaped());
|
||||
#else
|
||||
introMessage = introMessage.arg(Qt::escape(reply->url().toString())).arg(Qt::escape(reply->url().toString()));
|
||||
#endif
|
||||
passwordDialog.siteDescription->setText(introMessage);
|
||||
passwordDialog.siteDescription->setWordWrap(true);
|
||||
|
||||
@@ -206,7 +217,11 @@ void NetworkAccessManager::proxyAuthenticationRequired(const QNetworkProxy &prox
|
||||
dialog.adjustSize();
|
||||
|
||||
QString introMessage = tr("<qt>Connect to proxy \"%1\" using:</qt>");
|
||||
#if QT_VERSION >= 0x050000
|
||||
introMessage = introMessage.arg(QString(proxy.hostName()).toHtmlEscaped());
|
||||
#else
|
||||
introMessage = introMessage.arg(Qt::escape(proxy.hostName()));
|
||||
#endif
|
||||
proxyDialog.siteDescription->setText(introMessage);
|
||||
proxyDialog.siteDescription->setWordWrap(true);
|
||||
|
||||
@@ -272,7 +287,11 @@ void DownloadItem::init()
|
||||
QString DownloadItem::getDownloadDirectory() const
|
||||
{
|
||||
QString exe = QString::fromLatin1(App::GetApplication().getExecutableName());
|
||||
#if QT_VERSION >= 0x050000
|
||||
QString path = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation);
|
||||
#else
|
||||
QString path = QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation);
|
||||
#endif
|
||||
QString dirPath = QDir(path).filePath(exe);
|
||||
Base::Reference<ParameterGrp> hPath = App::GetApplication().GetUserParameter().GetGroup("BaseApp")
|
||||
->GetGroup("Preferences")->GetGroup("General");
|
||||
|
||||
Reference in New Issue
Block a user