summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authorTheo J.A. de Vries <t.j.a.devries@imotec.nl>2012-05-18 22:35:09 +0200
committerFriedemann Kleint <Friedemann.Kleint@nokia.com>2012-05-25 10:40:56 +0200
commit1efd121b3913918a0f9a7a026d162885d6182927 (patch)
tree3b99b2f1f2148636b62f335fd18477b15b651f54 /src/plugins
parent637ae98c6fa27038095e2a691e83817b0fbabf2d (diff)
downloadqt-creator-1efd121b3913918a0f9a7a026d162885d6182927.tar.gz
added possibility to enter port specifier to gitorious address
Change-Id: I4558b5151dfe1abde98037173c0a83b6a070c6b5 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/git/gitorious/gitorious.cpp25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/plugins/git/gitorious/gitorious.cpp b/src/plugins/git/gitorious/gitorious.cpp
index 598d71ac29..ef32969670 100644
--- a/src/plugins/git/gitorious/gitorious.cpp
+++ b/src/plugins/git/gitorious/gitorious.cpp
@@ -55,16 +55,19 @@ static const char settingsKeyC[] = "GitoriousHosts";
// Gitorious paginates projects as 20 per page. It starts with page 1.
enum { ProjectsPageSize = 20 };
-// Format an URL for a XML request
-static inline QUrl xmlRequest(const QString &host, const QString &request, int page = -1)
+// Format an URL for a http request
+static inline QUrl httpRequest(const QString &host, const QString &request)
{
QUrl url;
url.setScheme(QLatin1String("http"));
- url.setHost(host);
+ const QStringList hostList = host.split(QLatin1Char(':'), QString::SkipEmptyParts);
+ if (hostList.size() > 0)
+ {
+ url.setHost(hostList.at(0));
+ if (hostList.size() > 1)
+ url.setPort(hostList.at(1).toInt());
+ }
url.setPath(QLatin1Char('/') + request);
- url.addQueryItem(QLatin1String("format"), QLatin1String("xml"));
- if (page >= 0)
- url.addQueryItem(QLatin1String("page"), QString::number(page));
return url;
}
@@ -545,10 +548,7 @@ QNetworkReply *Gitorious::createRequest(const QUrl &url, int protocol, int hostI
void Gitorious::updateCategories(int index)
{
// For now, parse the HTML of the projects site for "Popular Categories":
- QUrl url;
- url.setScheme(QLatin1String("http"));
- url.setHost(hostName(index));
- url.setPath(QLatin1String("/projects"));
+ const QUrl url = httpRequest(hostName(index), QLatin1String("projects"));
createRequest(url, ListCategoriesProtocol, index);
}
@@ -559,7 +559,10 @@ void Gitorious::updateProjectList(int hostIndex)
void Gitorious::startProjectsRequest(int hostIndex, int page)
{
- const QUrl url = xmlRequest(hostName(hostIndex), QLatin1String("projects"), page);
+ QUrl url = httpRequest(hostName(hostIndex), QLatin1String("projects"));
+ url.addQueryItem(QLatin1String("format"), QLatin1String("xml"));
+ if (page >= 0)
+ url.addQueryItem(QLatin1String("page"), QString::number(page));
createRequest(url, ListProjectsProtocol, hostIndex, page);
}