homescreenapp/hsdomainmodel/inc/hswidgetcomponent.h
branchRCL_3
changeset 82 5f0182e07bfb
equal deleted inserted replaced
79:f00a6757af32 82:5f0182e07bfb
       
     1 /*
       
     2 * Copyright (c) 2009 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 #ifndef HSWIDGETCOMPONENT_H
       
    19 #define HSWIDGETCOMPONENT_H
       
    20 
       
    21 #include <QObject>
       
    22 #include <QTranslator>
       
    23 
       
    24 #include "hsdomainmodel_global.h"
       
    25 
       
    26 #include "hstest_global.h"
       
    27 HOMESCREEN_TEST_CLASS(TestHsDomainModel)
       
    28 
       
    29 class HSDOMAINMODEL_EXPORT HsWidgetComponent : public QObject
       
    30 {
       
    31     Q_OBJECT
       
    32 	Q_PROPERTY(QString rootPath READ rootPath)
       
    33 	Q_PROPERTY(QString uri READ uri)
       
    34 	
       
    35 	enum State {Available, Unavailable, Uninstalling,Uninstalled };
       
    36 public:
       
    37     ~HsWidgetComponent();
       
    38 
       
    39 	QString rootPath() const;
       
    40 	QString uri() const;
       
    41 	bool isAvailable() const;
       
    42 signals:
       
    43 	void aboutToUninstall();
       
    44 	void uninstalled();
       
    45 	void updated();
       
    46 	void unavailable();
       
    47 	void available();
       
    48 private:
       
    49     Q_DISABLE_COPY(HsWidgetComponent)
       
    50 	HsWidgetComponent(const QString &uri, QObject *parent = 0);
       
    51 
       
    52 	void resolveRootPathAndTranslationFilename();
       
    53     void installTranslator();
       
    54 	void uninstallTranslator();
       
    55 	
       
    56 	void emitAboutToUninstall();
       
    57 	void emitUninstalled();
       
    58 	void emitUpdated();
       
    59 	void emitUnavailable();
       
    60 	void emitAvailable();
       
    61 private:	
       
    62 	QTranslator mTranslator;
       
    63 	QString mUri;
       
    64 	
       
    65 	QString mRootPath;
       
    66 	QString mDrive;
       
    67 	State mState;
       
    68 	QString mTranslationFilename;
       
    69 	friend class HsWidgetComponentRegistry;
       
    70 
       
    71     HOMESCREEN_TEST_FRIEND_CLASS(TestHsDomainModel)
       
    72 };
       
    73 
       
    74 #endif // HSWIDGETCOMPONENT_H