forked from qt-creator/qt-creator
Fixes: cpaster: make complete urls also acceptable.
Details: also accept trailing slashes
This commit is contained in:
@@ -124,6 +124,16 @@ void CodepasterPlugin::extensionsInitialized()
|
|||||||
->getObject<ProjectExplorer::ProjectExplorerPlugin>();
|
->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()
|
void CodepasterPlugin::post()
|
||||||
{
|
{
|
||||||
if (m_poster)
|
if (m_poster)
|
||||||
@@ -171,7 +181,8 @@ void CodepasterPlugin::post()
|
|||||||
data = view.getContent();
|
data = view.getContent();
|
||||||
|
|
||||||
// Submit to codepaster
|
// Submit to codepaster
|
||||||
m_poster = new CustomPoster(m_settingsPage->serverUrl().toString());
|
|
||||||
|
m_poster = new CustomPoster(serverUrl());
|
||||||
|
|
||||||
// Copied from cpaster. Otherwise lineendings will screw up
|
// Copied from cpaster. Otherwise lineendings will screw up
|
||||||
if (!data.contains("\r\n")) {
|
if (!data.contains("\r\n")) {
|
||||||
@@ -187,7 +198,7 @@ void CodepasterPlugin::fetch()
|
|||||||
{
|
{
|
||||||
if (m_fetcher)
|
if (m_fetcher)
|
||||||
delete m_fetcher;
|
delete m_fetcher;
|
||||||
m_fetcher = new CustomFetcher(m_settingsPage->serverUrl().toString());
|
m_fetcher = new CustomFetcher(serverUrl());
|
||||||
|
|
||||||
QDialog dialog;
|
QDialog dialog;
|
||||||
Ui_PasteSelectDialog ui;
|
Ui_PasteSelectDialog ui;
|
||||||
@@ -208,7 +219,7 @@ void CodepasterPlugin::fetch()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
delete m_fetcher;
|
delete m_fetcher;
|
||||||
m_fetcher = new CustomFetcher(m_settingsPage->serverUrl().toString());
|
m_fetcher = new CustomFetcher(serverUrl());
|
||||||
m_fetcher->fetch(pasteID);
|
m_fetcher->fetch(pasteID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ public slots:
|
|||||||
void fetch();
|
void fetch();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
QString serverUrl() const;
|
||||||
|
|
||||||
QAction *m_postAction;
|
QAction *m_postAction;
|
||||||
QAction *m_fetchAction;
|
QAction *m_fetchAction;
|
||||||
|
|||||||
Reference in New Issue
Block a user