Merge pull request #3292 from Atlante45/fix_for_custom_URL_schemes

Fix for custom URL schemes
This commit is contained in:
AndrewMeadows 2014-08-15 14:22:49 -07:00
commit adef45538c
2 changed files with 3 additions and 4 deletions

View file

@ -814,9 +814,8 @@ bool Application::event(QEvent* event) {
QFileOpenEvent* fileEvent = static_cast<QFileOpenEvent*>(event);
bool isHifiSchemeURL = !fileEvent->url().isEmpty() && fileEvent->url().toLocalFile().startsWith(CUSTOM_URL_SCHEME);
if (isHifiSchemeURL) {
Menu::getInstance()->goTo(fileEvent->url().toString());
Menu::getInstance()->goToURL(fileEvent->url().toLocalFile());
}
return false;
}
return QApplication::event(event);

View file

@ -1153,8 +1153,8 @@ void Menu::goTo() {
}
bool Menu::goToURL(QString location) {
if (location.startsWith(CUSTOM_URL_SCHEME + "//")) {
QStringList urlParts = location.remove(0, CUSTOM_URL_SCHEME.length() + 2).split('/', QString::SkipEmptyParts);
if (location.startsWith(CUSTOM_URL_SCHEME + "/")) {
QStringList urlParts = location.remove(0, CUSTOM_URL_SCHEME.length()).split('/', QString::SkipEmptyParts);
if (urlParts.count() > 1) {
// if url has 2 or more parts, the first one is domain name