Hi,
Benjamin, thank you for your tips.  I tested following code, and it worked very 
well.

bool WebPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest 
&request,
                                      NavigationType type)
{
...

    QString scheme = request.url().scheme();
    if (scheme == QLatin1String("mailto")
        || scheme == QLatin1String("ftp")) {
        BrowserApplication::instance()->askDesktopToOpenUrl(request.url());
        return false;
    }
    else if (scheme == QLatin1String("abc")) {
        QString abcCommand = QLatin1String("abc");
        QStringList abcParameters(request.url().toString());
        QProcess abcProcess;
        abcProcess.startDetached(abcCommand, abcParameters);
        return false;
    }

...
}

2010-04-29 



colin121 



From:  Benjamin Poulain 
Sent:  2010-04-28  19:49:53 
To:  ext colin121 
Cc:  webkit-qt 
Subject:  Re: [webkit-qt] How to register an application as a specific 
urlschema handler in QtWebKit 
 
Hi,
ext colin121 wrote:
> Does anybody know how to register an application as your custom protocol 
> handler in WebKit/QtWebKit/arora?
> Please let me know if there is an easy one, really appreciate your work.
> I'm considering using QtWebkit in an embed device to demonstrate my own 
> web page.
> In my page, I have some links which have specific shema, like: 
> custom://abc.com/xxx.
> when users click such link, I want to launch a local application to 
> handle this url.
> I know in Windows, browsers usually read these configures from registry. 
> So how about the implementation of WebKit in Linux?
>  
> implementing PolicyDecisions ?  
> http://diotavelli.net/PyQtWiki/Adding%20the%20Gopher%20Protocol%20to%20QtWebKit
> Netscape-Style Plug-ins?
> WebKit�CBased Plug-ins? 
>  
> any suggestions would be usable :-) 
In Arora, have a look at
webpage.cpp->WebPage::acceptNavigationRequest(). You can also use
handleUnsupportedontent().
To open an url with the default application register on the platform,
you can use QDesktopServices::openUrl().
cheers,
Benjamin
_______________________________________________
webkit-qt mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-qt

Reply via email to