×

Discussion Board

Results 1 to 15 of 21

Hybrid View

  1. #1
    Regular Contributor
    Join Date
    Nov 2009
    Posts
    63

    [moved] Use Symbian C++ code to open default browser from a Qt app

    Hello,

    I'm trying to open an URL from a Qt app in the browser set as the default browser in the Symbian settings. Therefore I found this one: http://www.developer.nokia.com/Commu...ymbian_C%2B%2B

    It's mainly now only about Symbian:penUrlInDefaultBrowser(QString url); and Symbian::LaunchBrowserL(const TDesC& aUrl, TUid& _id);. I know that in the first one url isn't used yet. I'm able to compile and build this code with the following libs included:
    Code:
    LIBS += -lcone \ #openDefaultBrowser
    -leikcore \ #openDefaultBrowser
    -lavkon \
    -lws32\
    -lapgrfx\ #openDefaultBrowser
    -leikcoctl\
    -leiksrv\
    -lProfileEngine \
    -letel3rdparty\
    -lQtMessaging \
    -letel\
    -lfeatdiscovery\
    -lc32\
    -laknicon\
    -laknskins\
    -laknnotify\
    -lapmime #openDefaultBrowser
    }
    But if I try to use this code on the device nothing happens. As the device is not connected to QtCreator (never figured that out and it'll be far complicated cause QtCreator is running in VMware) and the Qt Simulator is not able to run Symbian code I'm not able to give any debug messages or so. But I hope that you can help me anyway, maybe there is somewhere something I missed or don't see as a bug, cause I'm not good in Symbian C++...

    Both files:
    http://dl.dropbox.com/u/95990477/Qt/symbian.h
    http://dl.dropbox.com/u/95990477/Qt/symbian.cpp

    Best Regards,
    schumi1331

  2. #2
    Nokia Developer Champion
    Join Date
    Jun 2008
    Location
    Noida,India
    Posts
    3,956

    Re: Use Symbian C++ code to open default browser from a Qt app

    Is it possible for you to make log files in your code & check till what point the code executes(make the log directory somewhere in C:\\data\\ for e.g).

    Note: Please make sure that the browser is not already launched when you try to do that from your app ( trying to launch the browser from code when its already running would do nothing)

  3. #3
    Nokia Developer Moderator
    Join Date
    Sep 2004
    Location
    Tampere, Finland
    Posts
    11,355

    Re: Use Symbian C++ code to open default browser from a Qt app

    The browser launching is handled correctly (at least for the native browser case) when the browser is running, i.e. task.Exists() in http://www.developer.nokia.com/Commu...in_3rd_edition but the application would require the SwEvent capability in that case.

    schumi1331, if the code compiles and runs without crashing, check indeed if you have the target browser running and if so, whether you have the SeEvent capability. Also, it might be relevant to know which browser you are targeting, but at least with the build-in one you should always see the solution working.
    -- Lucian

    If you are not yet a DVLUP member it is time to correct that mistake :) Click here to join: http://www.dvlup.com/lucian/Invite

  4. #4
    Regular Contributor
    Join Date
    Nov 2009
    Posts
    63

    Re: Use Symbian C++ code to open default browser from a Qt app

    Hm, thanks for your replies. I modified now my code to have a log function in it and the error I get is:
    TypeError: Result of expression 'symbian.openUrlInDefaultBrowser' [undefined] is not a function.
    I checked the symbian.h to have Q_OBJECT at the top and that's how I'm adding it in main.cpp:
    Code:
    #include "symbian.h"
    ...
    Q_DECL_EXPORT int main(int argc, char *argv[])
    {
        QScopedPointer<QApplication> app(createApplication(argc, argv));
        ...
        Symbian symbian;
        QmlApplicationViewer viewer;
    
        viewer.rootContext()->setContextProperty("symbian", &symbian);
        ...
        viewer.showExpanded();   
    
        return app->exec();
    And here's how I'm calling it from QML:
    Code:
    ToolButton {
                id: rightButton
                flat: true
                visible: driverModel.get(currentIndex).twitter == "" ? false : true
                enabled: driverModel.get(currentIndex).twitter == "" ? false : true
                iconSource: "images/qtg_toolbar_twitter.svg"
    
                onClicked: {
                    symbian.openUrlInDefaultBrowser("http://twitter.com/"+driverModel.get(currentIndex).twitter)
                }
            }
    "driverModel.get(currentIndex).twitter" is a string and is returned correctly, so visible and enabled work how they should work. I have absolutely no idea what's wrong here...

  5. #5
    Nokia Developer Champion
    Join Date
    Jun 2008
    Location
    Noida,India
    Posts
    3,956

    Re: Use Symbian C++ code to open default browser from a Qt app

    You said in #1 that you were able to compile the code successfully & the error you have stated now does not seems to be that due to the log function(though you have not posted the function here).

    Was this symbian.openUrlInDefaultBrowser() compiling earlier successfully?

  6. #6
    Regular Contributor
    Join Date
    Nov 2009
    Posts
    63

    Re: Use Symbian C++ code to open default browser from a Qt app

    thanks for moving the thread

    @vineet.jain: I posted the function openUrlInDefaultBrowser in the first post in the linked cpp/h file (symbian.cpp & symbian.h at the bottom of #1). Everything was compiled successfully.

Similar Threads

  1. Open default browser from qml
    By CristianL in forum [Archived] Qt Quick
    Replies: 3
    Last Post: 2011-08-12, 17:12
  2. How to open the default browser with URL path
    By ashraf fawzy in forum Symbian Networking & Messaging (Closed)
    Replies: 1
    Last Post: 2011-04-16, 10:48
  3. How to open a url in default browser?
    By arnab321 in forum Symbian
    Replies: 1
    Last Post: 2011-03-15, 07:23
  4. [moved] Open source a simple Symbian C++ code with use Google static map API
    By zhang_guoqing in forum News and Announcements
    Replies: 8
    Last Post: 2010-09-16, 20:04
  5. open local file with default browser?
    By brah in forum Browsing and Mark-ups
    Replies: 3
    Last Post: 2005-06-24, 13:37

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •