summaryrefslogtreecommitdiffstats
path: root/installerbuilder/common
diff options
context:
space:
mode:
authorkh1 <karsten.heimrich@nokia.com>2011-11-01 14:50:10 +0100
committerKarsten Heimrich <karsten.heimrich@nokia.com>2011-11-01 15:36:10 +0100
commit6817964cda7e750ba758c49c38471f041325aa3d (patch)
tree7996612ea7fb1c4c62fe8cca6830c1d249e97769 /installerbuilder/common
parent7c7638997f249e4cbca8ef03ac99e37e16daea1b (diff)
Read possible authentication settings for remote repos.
Change-Id: Ic7a2c0d572f84f1374e2f97fe77555dba560bd46 Reviewed-by: Tim Jenssen <tim.jenssen@nokia.com> Reviewed-by: Alexander Lenhardt <alexander.lenhardt@nokia.com> Reviewed-by: Karsten Heimrich <karsten.heimrich@nokia.com>
Diffstat (limited to 'installerbuilder/common')
-rw-r--r--installerbuilder/common/repository.cpp131
-rw-r--r--installerbuilder/common/repository.h42
2 files changed, 145 insertions, 28 deletions
diff --git a/installerbuilder/common/repository.cpp b/installerbuilder/common/repository.cpp
index c58ea5aac..215d105fd 100644
--- a/installerbuilder/common/repository.cpp
+++ b/installerbuilder/common/repository.cpp
@@ -1,17 +1,11 @@
/**************************************************************************
**
-** This file is part of Qt SDK**
+** This file is part of Installer Framework
**
-** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).*
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
**
-** Contact: Nokia Corporation qt-info@nokia.com**
+** Contact: Nokia Corporation (info@qt.nokia.com)
**
-** No Commercial Usage
-**
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
**
** GNU Lesser General Public License Usage
**
@@ -23,11 +17,16 @@
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception version
-** 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
**
-** If you are unsure which license is appropriate for your use, please contact
-** (qt-info@nokia.com).
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
**
**************************************************************************/
#include "repository.h"
@@ -38,21 +37,37 @@ namespace QInstaller {
Constructs an invalid Repository object.
*/
Repository::Repository()
+ : m_default(false)
+ , m_enabled(false)
{
}
/*!
- Constructs a new repository by setting it's address to \a url.
+ Constructs a new repository by using all fields of the given repository \a other.
*/
-Repository::Repository(const QUrl &url)
+Repository::Repository(const Repository &other)
+ : m_url(other.m_url)
+ , m_default(other.m_default)
+ , m_enabled(other.m_enabled)
+ , m_username(other.m_username)
+ , m_password(other.m_password)
+{
+}
+
+/*!
+ Constructs a new repository by setting it's address to \a url and it's default state.
+*/
+Repository::Repository(const QUrl &url, bool isDefault)
: m_url(url)
+ , m_default(isDefault)
+ , m_enabled(true)
{
}
/*!
Returns true if the repository URL is valid; otherwise returns false.
- Note: The URL is simpley run through a conformance test. It is not checked that the repository
+ Note: The URL is simply run through a conformance test. It is not checked that the repository
actually exists.
*/
bool Repository::isValid() const
@@ -61,6 +76,15 @@ bool Repository::isValid() const
}
/*!
+ Returns true if the repository was set using the package manager configuration file; otherwise returns
+ false.
+*/
+bool Repository::isDefault() const
+{
+ return m_default;
+}
+
+/*!
Returns the URL of the repository. By default an invalid \sa QUrl is returned.
*/
QUrl Repository::url() const
@@ -76,9 +100,80 @@ void Repository::setUrl(const QUrl& url)
m_url = url;
}
-bool Repository::operator==(const Repository &repository) const
+/*!
+ Returns whether the repository is enabled and used during information retrieval.
+*/
+bool Repository::isEnabled() const
+{
+ return m_enabled;
+}
+
+/*!
+ Sets this repository to \n enabled state and thus to use this repository for information retrieval or not.
+*/
+void Repository::setEnabled(bool enabled)
+{
+ m_enabled = enabled;
+}
+
+/*!
+ Returns the user name used for authentication.
+*/
+QString Repository::username() const
+{
+ return m_username;
+}
+
+/*!
+ Sets the user name for authentication to be \a username.
+*/
+void Repository::setUsername(const QString &username)
+{
+ m_username = username;
+}
+
+/*!
+ Returns the password used for authentication.
+*/
+QString Repository::password() const
+{
+ return m_password;
+}
+
+/*!
+ Sets the password for authentication to be \a password.
+*/
+void Repository::setPassword(const QString &password)
+{
+ m_password = password;
+}
+
+/*!
+ Compares the value 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).
+*/
+bool Repository::operator==(const Repository &other) const
{
- return m_url == repository.m_url;
+ return m_url == other.m_url && m_default == other.m_default && m_enabled == other.m_enabled
+ && m_username == other.m_username && m_password == other.m_password;
+;
+}
+
+/*!
+ Assigns the values of repository \a other to this repository.
+*/
+const Repository &Repository::operator=(const Repository &other)
+{
+ if (this == &other)
+ return *this;
+
+ m_url = other.m_url;
+ m_default = other.m_default;
+ m_enabled = other.m_enabled;
+ m_username = other.m_username;
+ m_password = other.m_password;
+
+ return *this;
}
}
diff --git a/installerbuilder/common/repository.h b/installerbuilder/common/repository.h
index f8fe34d49..d6e90d094 100644
--- a/installerbuilder/common/repository.h
+++ b/installerbuilder/common/repository.h
@@ -1,10 +1,11 @@
/**************************************************************************
**
-** This file is part of Qt SDK**
+** This file is part of Installer Framework
**
-** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).*
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
**
-** Contact: Nokia Corporation qt-info@nokia.com**
**
** GNU Lesser General Public License Usage
**
@@ -16,11 +17,16 @@
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception version
-** 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
**
-** If you are unsure which license is appropriate for your use, please contact
-** (qt-info@nokia.com).
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
**
**************************************************************************/
#ifndef REPOSITORY_H
@@ -36,19 +42,35 @@ namespace QInstaller {
class INSTALLER_EXPORT Repository
{
public:
- Repository();
- explicit Repository(const QUrl &url);
+ explicit Repository();
+ Repository(const Repository &other);
+ explicit Repository(const QUrl &url, bool isDefault = true);
bool isValid() const;
+ bool isDefault() const;
QUrl url() const;
void setUrl(const QUrl& url);
+ bool isEnabled() const;
+ void setEnabled(bool enabled);
+
+ QString username() const;
+ void setUsername(const QString &username);
+
+ QString password() const;
+ void setPassword(const QString &password);
+
uint qHash(const Repository &repository);
- bool operator==(const Repository &repository) const;
+ bool operator==(const Repository &other) const;
+ const Repository &operator=(const Repository &other);
private:
QUrl m_url;
+ bool m_default;
+ bool m_enabled;
+ QString m_username;
+ QString m_password;
};
inline uint qHash(const Repository &repository)