/*!
  KeySequenceRecognitionProvider::KeySequenceRecognitionProvider.
 */
KeySequenceRecognitionProvider::KeySequenceRecognitionProvider(
    QObject* parent)
    : 
    XQServiceProvider(QLatin1String(
        "keysequencerecognitionservice.com.nokia.symbian.IKeySequenceRecognition"),
        parent),
    m_keySequenceValidator("")
{
    DPRINT_METHODENTRYEXIT;
    
    publishAll();
    
    setupLocalization();
    
    // One should not call anything exception generating after handlers are
    // created because memory for handlers will be leaked on an exception 
    // while being in c++ constructor.
    constructKeySequenceHandlers();

    // Keysequencerecognitionprovider to be invisible in taskswitcher 
    TsTaskSettings taskSettings;
    taskSettings.setVisibility(false);
}
Ejemplo n.º 2
0
/*!
 Initializes the widget.
 
 called by home screen fw when widget is added to home screen
 */
void NmHsWidget::onInitialize()
{
    NM_FUNCTION;
    
    QT_TRY {
    
	    HbStyleLoader::registerFilePath(":/layout/nmhswidgetlistviewitem.widgetml");
	    HbStyleLoader::registerFilePath(":/layout/nmhswidgetlistviewitem.css");
	    
	    // Use document loader to load the contents
	    HbDocumentLoader loader;
		//setup localization before docml loading
	    setupLocalization();
		
	    //load containers and mNoMailsLabel
        if (!loadDocML(loader)) {
            NM_ERROR(1,"NmHsWidget::onInitialize Fail @ loader");
            emit error(); //failure, no point to continue
            return;
        }

        //construct title row
        mTitleRow = new NmHsWidgetTitleRow(this);
        if (!mTitleRow->setupUI(loader)) {
            //title row creation failed
            NM_ERROR(1,"NmHsWidget::onInitialize fail @ titlerow");
            emit error(); //failure, no point to continue
            return;            
        }
				
        setupUi();

        //Engine construction is 2 phased. 
        mEngine = new NmHsWidgetEmailEngine(mAccountId);
        //Client must connect to exception signals before calling the initialize function
        //because we don't want to miss any signals.
        connect(mEngine, SIGNAL( exceptionOccured(const int&) ), this,
            SLOT( onEngineException(const int&) ));
        if (!mEngine->initialize()) {
            //engine construction failed. Give up.
            NM_ERROR(1,"NmHsWidget::onInitialize fail @ engine");
            emit error();
            return;
        }

		//set account name to title row
        mTitleRow->updateAccountName(mEngine->accountName());

        //create observer for date/time change events
        mDateObserver = new NmHsWidgetDateTimeObserver();

      	//Crete list for mail items
        createMailRowsList();

        updateMailData();
        mTitleRow->updateUnreadCount(mEngine->unreadCount());
        mTitleRow->setAccountIcon(mAccountIconName);
        mTitleRow->setExpandCollapseIcon(mIsExpanded);

        //Get signals about changes in mail data
        connect(mEngine, SIGNAL( mailDataChanged() ), this, SLOT( updateMailData() ));

        //Get Signals about changes in unread count
        connect(mEngine, SIGNAL( unreadCountChanged(const int&) )
                ,mTitleRow, SLOT( updateUnreadCount(const int&) ) );
        
        //Get signals about account name changes
        connect(mEngine, SIGNAL( accountNameChanged(const QString&) )
                ,mTitleRow, SLOT( updateAccountName(const QString&) ) );

	    //Get signals about user actions
        //Qt::QueuedConnection used to improve ui responsiveness 
	    connect(mTitleRow, SIGNAL( mailboxLaunchTriggered() )
	            ,mEngine, SLOT( launchMailAppInboxView() ), Qt::QueuedConnection);
	    
	    connect(mTitleRow, SIGNAL( expandCollapseButtonPressed() )
	            ,this, SLOT( handleExpandCollapseEvent() ) );
	    
	    //Get date/time events from date observer
	    connect(mDateObserver, SIGNAL(dateTimeChanged())
	            , this, SLOT(updateMailData()));
	    setMinimumSize(mTitleRow->minimumWidth(), 
	            mEmptySpaceContainer->minimumHeight() + mTitleRow->minimumHeight());
    }
    QT_CATCH(...) {
        NM_ERROR(1,"NmHsWidget::onInitialize fail @ catch");
        emit error();
    }