homescreenapp/hswidgetuninstaller/src/main.cpp
changeset 46 23b5d6a29cce
child 61 2b1b11a301d2
equal deleted inserted replaced
39:4e8ebe173323 46:23b5d6a29cce
       
     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:
       
    15 *
       
    16 */
       
    17 
       
    18 #include <QCoreApplication>
       
    19 #include <QDebug>
       
    20 #include <QString>
       
    21 #include <QStringList>
       
    22 #include <QDir>
       
    23 #include <QFileInfo>
       
    24 #include <apacmdln.h> 
       
    25 
       
    26 #include "hswidgetcomponentparser.h"
       
    27 #include "hswidgetinstallersender.h"
       
    28 
       
    29 const char UNINSTALL_WIDGET_FUNCTION_NAME[] = "widgetUninstalled(QVariantHash)";
       
    30 
       
    31 int main(int argc, char *argv[])
       
    32 {
       
    33 	// Initialization
       
    34     CApaCommandLine* commandLine = 0;
       
    35     TInt err = CApaCommandLine::GetCommandLineFromProcessEnvironment(commandLine);
       
    36     QString commandParam((QChar*)commandLine->DocumentName().Ptr(),commandLine->DocumentName().Length());
       
    37     qDebug() << "HSWIDGETUNINSTALLER commandParam:" << commandParam;
       
    38     
       
    39     QCoreApplication app(argc, argv);
       
    40     QStringList args = QCoreApplication::arguments();
       
    41     
       
    42     if (commandParam.isEmpty()) {
       
    43         return -1;
       
    44     }
       
    45     
       
    46     HsWidgetComponentParser componentParser(commandParam);
       
    47     if ( !componentParser.error() ) {
       
    48         HsWidgetInstallerSender installerSender;
       
    49         HsWidgetComponentDescriptor componentDescriptor = componentParser.widgetComponentDescriptor();
       
    50         QDir componentDir(commandParam);
       
    51         componentDir.cdUp();
       
    52         QString componentPath = componentDir.path();
       
    53         if ( componentDir.exists(componentPath)) {
       
    54             componentDescriptor.installationPath = componentPath;
       
    55         }
       
    56         installerSender.widgetChanged(UNINSTALL_WIDGET_FUNCTION_NAME, componentDescriptor);
       
    57     }
       
    58     
       
    59     qDebug() << "HSWIDGETUNINSTALLER finished";
       
    60     
       
    61     return 0; //app.exec();
       
    62 }