/*!
	Add the toolbar item
 */
void AgendaEventView::addToolBarItem(AgendaEventViewer::Actions action)
{
    OstTraceFunctionEntry0( AGENDAEVENTVIEW_ADDTOOLBARITEM_ENTRY );

	HbToolBar *toolBar = qobject_cast<HbToolBar *> (
	                       mDocLoader->findWidget(AGENDA_EVENT_VIEWER_TOOLBAR));

	// Load all the actions for event viewer
	
	if ((action == AgendaEventViewer::ActionEditDelete) || (action
	        == AgendaEventViewer::ActionEdit)) {
		HbAction *editAction = new HbAction();
		editAction->setIcon(HbIcon("qtg_mono_edit"));
		connect(editAction, SIGNAL(triggered()), this, SLOT(edit()));
		toolBar->addAction(editAction);
	}

	if ((action == AgendaEventViewer::ActionEditDelete) || (action
	        == AgendaEventViewer::ActionDelete)) {
		HbAction *deleteAction = new HbAction();
		deleteAction->setIcon(HbIcon("qtg_mono_delete"));
		connect(deleteAction, SIGNAL(triggered()), this,
		        SLOT(deleteAgendaEntry()));
		toolBar->addAction(deleteAction);
	}

	if (action == AgendaEventViewer::ActionSave) {
		HbAction *saveAction = new HbAction();
		saveAction->setIcon(HbIcon("qtg_mono_add_to_calendar"));
		connect(saveAction, SIGNAL(triggered()), this, SLOT(saveAgendaEntry()));
		toolBar->addAction(saveAction);
	}

	OstTraceFunctionExit0( AGENDAEVENTVIEW_ADDTOOLBARITEM_EXIT );
}
void QtSyncStatusLogView::createMenu()
{
    HbMenu* myMenu = menu();
    connect( myMenu->addAction( tr("Update")), SIGNAL( triggered() ), SLOT( updateView() ) );
    connect( myMenu->addAction( tr("Delete log")), SIGNAL( triggered() ), SLOT( deleteLog() ) );
    connect( myMenu->addAction( tr("Back")), SIGNAL( triggered() ), SLOT( goToMainView() ) );
    
    HbToolBar* myToolBar = toolBar();
    connect( myToolBar->addAction( tr("Update")), SIGNAL( triggered() ), SLOT( updateView() ) );
    connect( myToolBar->addAction( tr("Delete log")), SIGNAL( triggered() ), SLOT( deleteLog() ) );
    connect( myToolBar->addAction( tr("Back")), SIGNAL( triggered() ), SLOT( goToMainView() ) );
}
/*!
    Pushes the given view into the view stack. The new view is also activated
    and shown. If the view stack contains other views, the one on the top is
    hidden.

    \param newView The view to push into the stack.
*/
void NmApplication::pushView(NmBaseView *newView)
{
    if (newView && mViewStack) {
        NM_COMMENT("NmApplication::pushView(): The given view is valid.");
        newView->setNavigationAction(mBackAction);
        
        // Store the view to be hidden.
        NmBaseView *viewToHide(NULL);

        if (!mViewStack->isEmpty()) {
            // The stack contains at least one other view.
            viewToHide = mViewStack->top();
        }
		else {
			// viewReady should be informed immediately.
			if (mViewReady) {
				newView->viewReady();
			}
		}
        
        // Activate the new view.
    	NM_COMMENT("NmApplication::pushView(): Adding the view into the stack.");

        mMainWindow->addView(newView);
        mViewStack->push(newView);
        mMainWindow->setCurrentView(newView);
        mActiveViewId = newView->nmailViewId();
        
        // Set the orientation of the toolbar.
        HbToolBar *tb = newView->toolBar();

        if (tb) {
            tb->setOrientation(Qt::Horizontal);
        }
        
        // Hide the old view.
        NM_COMMENT("NmApplication::pushView(): Removing the previous view.");

        if (viewToHide) {
            mMainWindow->removeView(viewToHide);
        }
    }
}
HbServiceClientView::HbServiceClientView(QGraphicsItem *parent)
    : HbView(parent)
{
    XQSERVICE_DEBUG_PRINT("HbServiceClientView::HbServiceClientView");
    setTitle(tr("HB Service client view"));

    QGraphicsLinearLayout* layout = new QGraphicsLinearLayout(Qt::Vertical,this);

    layout->addItem(new HbLabel("Call service",this));
    mNumberEdit = new HbLineEdit(this);
    mNumberEdit->setText("+35850123456789");
    layout->addItem(mNumberEdit);

    mServiceEdit = new HbLineEdit(this);
    mServiceEdit->setText("com.nokia.services.hbserviceprovider.Dialer");
    layout->addItem(mServiceEdit);

    /*
    mServiceEmbedded = HbCheckBox("Embedded",this)
    mServiceEmbedded->setTristate(true);
    layout->addItem(mServiceEmbedded);
    */
    
    mRetValue = new HbLineEdit(this);
    mRetValue->setText("*****");
    layout->addItem(mRetValue);

    layout->addItem(new HbLabel("Map service",this));
    mAddressEdit = new HbLineEdit(this);
    mAddressEdit->setText("Karakaari 13");
    layout->addItem(mAddressEdit);

    mCityEdit = new HbLineEdit(this);
    mCityEdit->setText("Espoo");
    layout->addItem(mCityEdit);

    mCountryEdit = new HbLineEdit(this);
    mCountryEdit->setText("Finland");
    layout->addItem(mCountryEdit);

    mServiceMapEdit = new HbLineEdit(this);
    mServiceMapEdit->setText("com.nokia.services.hbserviceprovider.Map");
    layout->addItem(mServiceMapEdit);

    mRetMapValue = new HbLineEdit(this);
    mRetMapValue->setText("*****");
    layout->addItem(mRetMapValue);
    
    setLayout(layout);

    HbToolBar* toolBar = this->toolBar();
    
    HbAction* callAction = new HbAction("Call"); 
    connect(callAction, SIGNAL(triggered()), this, SLOT(callContact()));

    HbAction* callEmbeddedAction = new HbAction("Call Embedded"); 
    connect(callEmbeddedAction, SIGNAL(triggered()), this, SLOT(callContactEmbedded()));

    HbAction* showAddressesAction = new HbAction("Select contacts"); 
    connect(showAddressesAction, SIGNAL(triggered()), this, SLOT(launchContactSelecting()));
    
    toolBar->addAction(callAction);
    toolBar->addAction(callEmbeddedAction);
    toolBar->addAction(showAddressesAction);
    sndAsync = NULL;
}