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