phonebookengines/cntactions/src/cntbrowseraction.cpp
changeset 65 ae724a111993
parent 40 b46a585f6909
equal deleted inserted replaced
59:a642906a277a 65:ae724a111993
    17 
    17 
    18 #include "cntbrowseraction.h"
    18 #include "cntbrowseraction.h"
    19 
    19 
    20 #include <qcontacturl.h>
    20 #include <qcontacturl.h>
    21 #include <qcontactfilters.h>
    21 #include <qcontactfilters.h>
       
    22 #include <QDesktopServices>
    22 
    23 
    23 //Action class
    24 //Action class
    24 CntBrowserAction::CntBrowserAction() : 
    25 CntBrowserAction::CntBrowserAction() : 
    25     CntAction("url")
    26     CntAction("url")
    26 {
    27 {
    55      return new CntBrowserAction();
    56      return new CntBrowserAction();
    56 }
    57 }
    57 
    58 
    58 void CntBrowserAction::performAction()
    59 void CntBrowserAction::performAction()
    59 {
    60 {
    60     QVariant retValue;
    61     if (m_detail.definitionName() == QContactUrl::DefinitionName)
    61     emitResult(GeneralError, retValue);
    62     {
    62     
    63         const QContactUrl &contactUrl = static_cast<const QContactUrl &>(m_detail);
    63     /*
    64         
    64     QString service("com.nokia.services.telephony");
    65         QString address = contactUrl.url();
    65     QString type("dial(QString,int)");
    66         if (!address.startsWith("http://"))
    66     
    67         {
    67     performNumberAction(service, type);
    68             address.prepend("http://");
    68     */
    69         }
       
    70         
       
    71         bool success = QDesktopServices::openUrl(QUrl(address));
       
    72         QVariant retValue;
       
    73         emitResult(success, retValue);
       
    74     }
       
    75     else
       
    76     {
       
    77         QVariant retValue;
       
    78         emitResult(GeneralError, retValue);
       
    79     }
    69 }
    80 }