qthighway/examples/hbserviceprovider/src/main.cpp
branchRCL_3
changeset 10 cd2778e5acfe
parent 9 5d007b20cfd0
child 11 19a54be74e5e
equal deleted inserted replaced
9:5d007b20cfd0 10:cd2778e5acfe
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 *
       
     5 * This program is free software: you can redistribute it and/or modify
       
     6 * it under the terms of the GNU Lesser General Public License as published by
       
     7 * the Free Software Foundation, version 2.1 of the License.
       
     8 * 
       
     9 * This program is distributed in the hope that it will be useful,
       
    10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       
    12 * GNU Lesser General Public License for more details.
       
    13 *
       
    14 * You should have received a copy of the GNU Lesser General Public License
       
    15 * along with this program.  If not, 
       
    16 * see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/".
       
    17 *
       
    18 * Description:                                                         
       
    19 *
       
    20 */
       
    21 
       
    22 #include "xqservicelog.h"
       
    23 #include <xqserviceutil.h>
       
    24 
       
    25 #include <hbapplication.h>
       
    26 #include <hbserviceprovidermainwindow.h>
       
    27 
       
    28 int main(int argc, char **argv)
       
    29 {
       
    30     // qInstallMsgHandler(XQSERVICEMESSAGEHANDLER);
       
    31     XQSERVICE_DEBUG_PRINT("HbServiceProvider::main");
       
    32 
       
    33     XQSERVICE_DEBUG_PRINT("HbServiceProvider::main:isService (argv)=%d", XQServiceUtil::isService(argc,argv));
       
    34     XQSERVICE_DEBUG_PRINT("HbServiceProvider::main:interfaceName (argv)=%s", qPrintable(XQServiceUtil::interfaceName(argc,argv)));
       
    35     XQSERVICE_DEBUG_PRINT("HbServiceProvider::main:serviceName (argv)=%s", qPrintable(XQServiceUtil::serviceName(argc,argv)));
       
    36     XQSERVICE_DEBUG_PRINT("HbServiceProvider::main:isEmbbedded (argv)=%d", XQServiceUtil::isEmbedded(argc,argv));
       
    37     XQSERVICE_DEBUG_PRINT("HbServiceProvider::main:operationName (argv)=%s", qPrintable(XQServiceUtil::operationName(argc,argv)));
       
    38     
       
    39     HbApplication app( argc, argv ); 
       
    40 
       
    41     XQSERVICE_DEBUG_PRINT("HbServiceProvider::main:isService =%d", XQServiceUtil::isService());
       
    42     XQSERVICE_DEBUG_PRINT("HbServiceProvider::main:interfaceName=%s", qPrintable(XQServiceUtil::interfaceName()));
       
    43     XQSERVICE_DEBUG_PRINT("HbServiceProvider::main:serviceName =%s", qPrintable(XQServiceUtil::serviceName()));
       
    44     XQSERVICE_DEBUG_PRINT("HbServiceProvider::main:isEmbbedded =%d", XQServiceUtil::isEmbedded());
       
    45     XQSERVICE_DEBUG_PRINT("HbServiceProvider::main:operationName =%s", qPrintable(XQServiceUtil::operationName()));
       
    46 
       
    47     // Let's figure out why application was started?
       
    48     if(app.activateReason()== Hb::ActivationReasonActivity )
       
    49     {
       
    50         QString id = app.activateId();
       
    51         QVariant data = app.activateData();
       
    52         XQSERVICE_DEBUG_PRINT("HbServiceProvider::main Hb::ActivationReasonActivity=%s,data=%s",
       
    53                               qPrintable(id), qPrintable(data.toString()));
       
    54         QVariantHash params = app.activateParams();
       
    55         QHashIterator<QString, QVariant> i(params);
       
    56         while (i.hasNext())
       
    57         {
       
    58             i.next();
       
    59             XQSERVICE_DEBUG_PRINT("HbServiceProvider::param key=%s,value=%s",
       
    60                                   qPrintable(i.key()), qPrintable(i.value().toString()));
       
    61         }        
       
    62     }
       
    63     else if (app.activateReason() == Hb::ActivationReasonNormal)
       
    64     {
       
    65         XQSERVICE_DEBUG_PRINT("HbServiceProvider::main Hb::ActivationReasonNormal");
       
    66     }
       
    67     else if(app.activateReason() == Hb::ActivationReasonService)
       
    68     {
       
    69         // Does not come here: Bug MPAN-84QL7V entered for this
       
    70         XQSERVICE_DEBUG_PRINT("HbServiceProvider::main Hb::ActivationReasonService");
       
    71     }
       
    72     else
       
    73     {
       
    74         // This applicatiob does not support services
       
    75         XQSERVICE_DEBUG_PRINT("HbServiceProvider::main UNKNOWN reason");
       
    76     }
       
    77     
       
    78     HbServiceProviderMainWindow mainWindow;
       
    79 
       
    80     mainWindow.show();
       
    81 
       
    82     return app.exec();     
       
    83 }
       
    84