diff options
Diffstat (limited to 'src/libs/installer/repository.cpp')
-rw-r--r-- | src/libs/installer/repository.cpp | 37 |
1 files changed, 29 insertions, 8 deletions
diff --git a/src/libs/installer/repository.cpp b/src/libs/installer/repository.cpp index 0bfa23a96..eb45573a9 100644 --- a/src/libs/installer/repository.cpp +++ b/src/libs/installer/repository.cpp @@ -27,7 +27,7 @@ **************************************************************************/ #include "repository.h" -#include "kdupdaterfiledownloaderfactory.h" +#include "filedownloaderfactory.h" #include <QDataStream> #include <QFileInfo> @@ -41,6 +41,7 @@ namespace QInstaller { Repository::Repository() : m_default(false) , m_enabled(false) + , m_compressed(false) { registerMetaType(); } @@ -55,28 +56,31 @@ Repository::Repository(const Repository &other) , m_username(other.m_username) , m_password(other.m_password) , m_displayname(other.m_displayname) + , m_compressed(other.m_compressed) { registerMetaType(); } /*! - Constructs a new repository by setting its address to \a url and its default state. + Constructs a new repository by setting its address to \a url + and its default and \a compressed states. */ -Repository::Repository(const QUrl &url, bool isDefault) +Repository::Repository(const QUrl &url, bool isDefault, bool compressed) : m_url(url) , m_default(isDefault) , m_enabled(true) + , m_compressed(compressed) { registerMetaType(); } /*! - Constructs a new repository by setting its address to \a repositoryUrl as string and its - default state. + Constructs a new repository by setting its address to \a repositoryUrl as + string and its \a compressed state. Note: user and password can be inside the \a repositoryUrl string: http://user:password@repository.url */ -Repository Repository::fromUserInput(const QString &repositoryUrl) +Repository Repository::fromUserInput(const QString &repositoryUrl, bool compressed) { QUrl url = QUrl::fromUserInput(repositoryUrl); const QStringList supportedSchemes = KDUpdater::FileDownloaderFactory::supportedSchemes(); @@ -88,7 +92,7 @@ Repository Repository::fromUserInput(const QString &repositoryUrl) url.setUserName(QString()); url.setPassword(QString()); - Repository repository(url, false); + Repository repository(url, false, compressed); repository.setUsername(userName); repository.setPassword(password); return repository; @@ -195,6 +199,22 @@ void Repository::setDisplayName(const QString &displayname) } /*! + Returns true if repository is compressed +*/ +bool Repository::isCompressed() const +{ + return m_compressed; +} + +/*! + Sets this repository to \a compressed state to know weather the repository + needs to be uncompressed before use. +*/ +void Repository::setCompressed(bool compressed) +{ + m_compressed = compressed; +} +/*! Compares the values of this repository to \a other and returns true if they are equal (same server, default state, enabled state as well as username and password). \sa operator!=() */ @@ -227,6 +247,7 @@ const Repository &Repository::operator=(const Repository &other) m_username = other.m_username; m_password = other.m_password; m_displayname = other.m_displayname; + m_compressed = other.m_compressed; return *this; } @@ -239,7 +260,7 @@ void Repository::registerMetaType() QDataStream &operator>>(QDataStream &istream, Repository &repository) { - QByteArray url, username, password, displayname; + QByteArray url, username, password, displayname, compressed; istream >> url >> repository.m_default >> repository.m_enabled >> username >> password >> displayname; repository.setUrl(QUrl::fromEncoded(QByteArray::fromBase64(url))); repository.setUsername(QString::fromUtf8(QByteArray::fromBase64(username))); |