homescreenapp/examples/contentpublishclient/src/main.cpp
changeset 36 cdae8c6c3876
child 39 4e8ebe173323
equal deleted inserted replaced
35:f9ce957a272c 36:cdae8c6c3876
       
     1 /*
       
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Example of home screen content publishing client
       
    15 *
       
    16 */
       
    17 
       
    18 #include <HbApplication>
       
    19 #include <HbMainWindow>
       
    20 #include <HbView>
       
    21 #include <HbPushButton>
       
    22 
       
    23 #include <QDir>
       
    24 
       
    25 #include "contentpublishclient.h"
       
    26 
       
    27 int main(int argc, char *argv[])
       
    28 {
       
    29 	// Initialization
       
    30     HbApplication app(argc, argv);
       
    31 
       
    32     QString path = QDir::toNativeSeparators(QDir("z:\\hsresources\\plugins\\homescreenclientplugin\\").absolutePath());
       
    33     QString fullFileName = path + "\\hshomescreenclientplugin.xml";
       
    34     
       
    35     QServiceManager manager;
       
    36     
       
    37     if(QFile::exists(fullFileName)) {
       
    38         QCoreApplication::addLibraryPath(path);
       
    39         manager.addService(fullFileName);
       
    40     }
       
    41     
       
    42     // Create main window.
       
    43     HbMainWindow* mainWindow = new HbMainWindow();
       
    44 
       
    45     // Create content publisher client
       
    46 	ContentPublishClient contentPublishClient(manager);
       
    47 	
       
    48     QString buttonString = "Create widget";
       
    49     if(!contentPublishClient.load()) {
       
    50         buttonString = "Open failed";
       
    51     }
       
    52 
       
    53     HbPushButton* button = new HbPushButton(buttonString);
       
    54 
       
    55 	// Add view
       
    56     mainWindow->addView(button);
       
    57     
       
    58     contentPublishClient.connect(button, SIGNAL(pressed()), SLOT(addWidget()));
       
    59     
       
    60     // Show main window
       
    61     mainWindow->show();
       
    62 
       
    63     return app.exec();
       
    64 }