forked from qt-creator/qt-creator
Fix handleHelpRequest.
* Make sure we only change our own urls inside that function * QDesktopService::setUrlHandler expects the target slot to take a QUrl Reviewed-by: ck
This commit is contained in:
@@ -102,7 +102,7 @@ bool HelpManager::guiEngineNeedsUpdate() const
|
|||||||
|
|
||||||
void HelpManager::handleHelpRequest(const QString &url)
|
void HelpManager::handleHelpRequest(const QString &url)
|
||||||
{
|
{
|
||||||
emit helpRequested(url);
|
emit helpRequested(QUrl(url));
|
||||||
}
|
}
|
||||||
|
|
||||||
void HelpManager::verifyDocumenation()
|
void HelpManager::verifyDocumenation()
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ QT_FORWARD_DECLARE_CLASS(QHelpEngine)
|
|||||||
QT_FORWARD_DECLARE_CLASS(QHelpEngineCore)
|
QT_FORWARD_DECLARE_CLASS(QHelpEngineCore)
|
||||||
QT_FORWARD_DECLARE_CLASS(QString)
|
QT_FORWARD_DECLARE_CLASS(QString)
|
||||||
QT_FORWARD_DECLARE_CLASS(QStringList)
|
QT_FORWARD_DECLARE_CLASS(QStringList)
|
||||||
|
QT_FORWARD_DECLARE_CLASS(QUrl)
|
||||||
|
|
||||||
class BookmarkManager;
|
class BookmarkManager;
|
||||||
|
|
||||||
@@ -69,7 +70,7 @@ public:
|
|||||||
static BookmarkManager& bookmarkManager();
|
static BookmarkManager& bookmarkManager();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void helpRequested(const QString &Url);
|
void helpRequested(const QUrl &url);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static bool m_guiNeedsSetup;
|
static bool m_guiNeedsSetup;
|
||||||
|
|||||||
@@ -145,8 +145,8 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error)
|
|||||||
SLOT(updateFilterPage()));
|
SLOT(updateFilterPage()));
|
||||||
connect(m_generalSettingsPage, SIGNAL(fontChanged()), this,
|
connect(m_generalSettingsPage, SIGNAL(fontChanged()), this,
|
||||||
SLOT(fontChanged()));
|
SLOT(fontChanged()));
|
||||||
connect(m_helpManager, SIGNAL(helpRequested(QString)), this,
|
connect(m_helpManager, SIGNAL(helpRequested(QUrl)), this,
|
||||||
SLOT(handleHelpRequest(QString)));
|
SLOT(handleHelpRequest(QUrl)));
|
||||||
connect(m_filterSettingsPage, SIGNAL(filtersChanged()), this,
|
connect(m_filterSettingsPage, SIGNAL(filtersChanged()), this,
|
||||||
SLOT(setupHelpEngineIfNeeded()));
|
SLOT(setupHelpEngineIfNeeded()));
|
||||||
connect(m_docSettingsPage, SIGNAL(documentationChanged()), this,
|
connect(m_docSettingsPage, SIGNAL(documentationChanged()), this,
|
||||||
@@ -825,13 +825,12 @@ void HelpPlugin::addBookmark()
|
|||||||
manager->showBookmarkDialog(m_centralWidget, viewer->title(), url);
|
manager->showBookmarkDialog(m_centralWidget, viewer->title(), url);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HelpPlugin::handleHelpRequest(const QString &address)
|
void HelpPlugin::handleHelpRequest(const QUrl &url)
|
||||||
{
|
{
|
||||||
if (HelpViewer::launchWithExternalApp(address))
|
if (HelpViewer::launchWithExternalApp(url))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (m_helpManager->helpEngineCore().findFile(address).isValid()) {
|
if (m_helpManager->helpEngineCore().findFile(url).isValid()) {
|
||||||
const QUrl url(address);
|
|
||||||
if (url.queryItemValue(QLatin1String("view")) == QLatin1String("split")) {
|
if (url.queryItemValue(QLatin1String("view")) == QLatin1String("split")) {
|
||||||
if (HelpViewer* viewer = viewerForContextMode())
|
if (HelpViewer* viewer = viewerForContextMode())
|
||||||
viewer->setSource(url);
|
viewer->setSource(url);
|
||||||
@@ -840,16 +839,20 @@ void HelpPlugin::handleHelpRequest(const QString &address)
|
|||||||
m_centralWidget->setSource(url);
|
m_centralWidget->setSource(url);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// local help not installed, resort to external web help
|
QString address = url.toString();
|
||||||
QString urlPrefix;
|
if (address.startsWith(HelpViewer::NsNokia)
|
||||||
if (address.startsWith(QLatin1String("qthelp://com.nokia.qtcreator"))) {
|
|| address.startsWith(HelpViewer::NsTrolltech)) {
|
||||||
urlPrefix = QString::fromLatin1("http://doc.trolltech.com/qtcreator"
|
// local help not installed, resort to external web help
|
||||||
"-%1.%2/").arg(IDE_VERSION_MAJOR).arg(IDE_VERSION_MINOR);
|
QString urlPrefix = QLatin1String("http://doc.trolltech.com/");
|
||||||
} else {
|
if (url.authority() == QLatin1String("com.nokia.qtcreator")) {
|
||||||
urlPrefix = QLatin1String("http://doc.trolltech.com/latest/");
|
urlPrefix.append(QString::fromLatin1("qtcreator-%1.%2")
|
||||||
|
.arg(IDE_VERSION_MAJOR).arg(IDE_VERSION_MINOR));
|
||||||
|
} else {
|
||||||
|
urlPrefix.append(QLatin1String("latest"));
|
||||||
|
}
|
||||||
|
address = urlPrefix + address.mid(address.lastIndexOf(QLatin1Char('/')));
|
||||||
}
|
}
|
||||||
QDesktopServices::openUrl(QUrl(urlPrefix + address.mid(address
|
QDesktopServices::openUrl(address);
|
||||||
.lastIndexOf(QLatin1Char('/')) + 1)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -73,9 +73,6 @@ public:
|
|||||||
void extensionsInitialized();
|
void extensionsInitialized();
|
||||||
void shutdown();
|
void shutdown();
|
||||||
|
|
||||||
public slots:
|
|
||||||
void handleHelpRequest(const QString &url);
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void modeChanged(Core::IMode *mode);
|
void modeChanged(Core::IMode *mode);
|
||||||
|
|
||||||
@@ -101,6 +98,8 @@ private slots:
|
|||||||
void updateCloseButton();
|
void updateCloseButton();
|
||||||
void setupHelpEngineIfNeeded();
|
void setupHelpEngineIfNeeded();
|
||||||
|
|
||||||
|
void handleHelpRequest(const QUrl &url);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setupUi();
|
void setupUi();
|
||||||
void resetFilter();
|
void resetFilter();
|
||||||
|
|||||||
Reference in New Issue
Block a user