summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhjk <qtc-committer@nokia.com>2009-02-04 17:53:58 +0100
committerhjk <qtc-committer@nokia.com>2009-02-04 17:53:58 +0100
commit2c77b0b90393c133d06d074ceb8b4e38c034a2d2 (patch)
tree44c120596f438cbe0c63a771611789f4f29c194a
parent50661f994d264a51b044ac67c50e4c38f3c6a63d (diff)
downloadqt-creator-2c77b0b90393c133d06d074ceb8b4e38c034a2d2.tar.gz
Fixes: cpaster: make complete urls also acceptable.
Details: also accept trailing slashes
-rw-r--r--src/plugins/cpaster/cpasterplugin.cpp17
-rw-r--r--src/plugins/cpaster/cpasterplugin.h1
2 files changed, 15 insertions, 3 deletions
diff --git a/src/plugins/cpaster/cpasterplugin.cpp b/src/plugins/cpaster/cpasterplugin.cpp
index 4558ccaae8..28936dc62e 100644
--- a/src/plugins/cpaster/cpasterplugin.cpp
+++ b/src/plugins/cpaster/cpasterplugin.cpp
@@ -124,6 +124,16 @@ void CodepasterPlugin::extensionsInitialized()
->getObject<ProjectExplorer::ProjectExplorerPlugin>();
}
+QString CodepasterPlugin::serverUrl() const
+{
+ QString url = m_settingsPage->serverUrl().toString();
+ if (url.startsWith("http://"))
+ url = url.mid(7);
+ if (url.endsWith('/'))
+ url.chop(1);
+ return url;
+}
+
void CodepasterPlugin::post()
{
if (m_poster)
@@ -171,7 +181,8 @@ void CodepasterPlugin::post()
data = view.getContent();
// Submit to codepaster
- m_poster = new CustomPoster(m_settingsPage->serverUrl().toString());
+
+ m_poster = new CustomPoster(serverUrl());
// Copied from cpaster. Otherwise lineendings will screw up
if (!data.contains("\r\n")) {
@@ -187,7 +198,7 @@ void CodepasterPlugin::fetch()
{
if (m_fetcher)
delete m_fetcher;
- m_fetcher = new CustomFetcher(m_settingsPage->serverUrl().toString());
+ m_fetcher = new CustomFetcher(serverUrl());
QDialog dialog;
Ui_PasteSelectDialog ui;
@@ -208,7 +219,7 @@ void CodepasterPlugin::fetch()
return;
delete m_fetcher;
- m_fetcher = new CustomFetcher(m_settingsPage->serverUrl().toString());
+ m_fetcher = new CustomFetcher(serverUrl());
m_fetcher->fetch(pasteID);
}
diff --git a/src/plugins/cpaster/cpasterplugin.h b/src/plugins/cpaster/cpasterplugin.h
index 56c41144a9..3658169c6c 100644
--- a/src/plugins/cpaster/cpasterplugin.h
+++ b/src/plugins/cpaster/cpasterplugin.h
@@ -70,6 +70,7 @@ public slots:
void fetch();
private:
+ QString serverUrl() const;
QAction *m_postAction;
QAction *m_fetchAction;