/*!
	Displays the to-do viewer and populates the to-do entry attributes.

	\param entry Agenda entry from which attributes have to be read.
 */
void AgendaEventView::execute(AgendaEntry entry,
											AgendaEventViewer::Actions action)
{
    OstTraceFunctionEntry0( AGENDAEVENTVIEW_EXECUTE_ENTRY );

	mOriginalAgendaEntry = entry;
	mAgendaEntry = entry;
	
	// For later reference
	mParentId = mOwner->mAgendaUtil->parentEntry(mAgendaEntry).id();
	
	// Add the viewer data reading from the agenda entry.
	addViewerData();
	
	// Remove unnecessary widget from event viewer.
	removeWidget();
	
	// Add the menu items to event viewer.
	addMenuItem();
	
	// Add the toolbar items to event viewer
	addToolBarItem(action);

	// Connect for the entry updation and addtion signal to refresh the view
	// when the same is edited in editor.
	connect(mOwner->mAgendaUtil, SIGNAL(entryUpdated(ulong)),
				this, SLOT(handleEntryUpdation(ulong)));
	
	connect(mOwner->mAgendaUtil, SIGNAL(entryAdded(ulong)),
				this, SLOT(handleEntryUpdation(ulong)));

	// Connect for entry deletion signal to close the event viewer.
	connect(mOwner->mAgendaUtil, SIGNAL(entryDeleted(ulong)), this,
	        SLOT(handleEntryDeletion(ulong)));

	// Add the view to the main window.
	HbMainWindow *window = hbInstance->allMainWindows().first();
	if (!window) {
		// Might be some non-ui based app called us
		// so create mainwindow now
		mMainWindow = new HbMainWindow();
		mMainWindow->addView(mViewer);
		mMainWindow->setCurrentView(mViewer);
	    connect(mMainWindow,SIGNAL(orientationChanged(Qt::Orientation)),this,SLOT(changedOrientation(Qt::Orientation)));
	} else {
		window->addView(mViewer);
		window->setCurrentView(mViewer);
		connect(window,SIGNAL(orientationChanged(Qt::Orientation)),this,SLOT(changedOrientation(Qt::Orientation)));
	}
	
	// Add softkey after adding view on window
	mBackAction = new HbAction(Hb::BackNaviAction);
	mViewer->setNavigationAction(mBackAction);
		
	connect(mBackAction, SIGNAL(triggered()), this, SLOT(close()));

	OstTraceFunctionExit0( AGENDAEVENTVIEW_EXECUTE_EXIT );
}
Exemplo n.º 2
0
int main(int argc, char *argv[])
{
    qDebug () << "AUTOMATICANSWER__main()<<";
    HbApplication app (argc, argv);    
    HbMainWindow mainWindow;
    automaticanswertest* testview = new automaticanswertest ();
    mainWindow.addView(testview);
    mainWindow.setCurrentView(testview);
    mainWindow.show();
    return app.exec();
}
void HsViewAppSettingsState::onExit(QEvent *event)
{
    
    QState::onExit(event);
    // Remove mView from main window and restore previous view.
    HbMainWindow *hbMainWindow = mainWindow();
    hbMainWindow->setCurrentView(mPreviousView);
    hbMainWindow->removeView(mView);

    
    delete mActionConfirm;
    mActionConfirm = NULL;
    delete mView;
    mView = NULL;
}
Exemplo n.º 4
0
// ---------------------------------------------------------------------------
// PosSettingsForm::onPressedAdvanced
// ---------------------------------------------------------------------------
void PosSettingsForm::onPressedAdvanced()
{
    qDebug() << "+ PosSettingsForm::onPressedAdvanced()";
    mAdvancedView = new PosSettingsAdvView();
    HbMainWindow* mainWindow = hbInstance->allMainWindows().at(0);

    mainWindow->addView(mAdvancedView);
    mainWindow->setCurrentView(mAdvancedView);

    //take back action from controlpanel main window.
    mBackAction = new HbAction(Hb::BackNaviAction ,mAdvancedView);
    mAdvancedView->setNavigationAction(mBackAction);

    connect(mBackAction, SIGNAL(triggered()), this, SLOT(closeAdvancedView()));
    mAdvancedView->show();
    qDebug() << "- PosSettingsForm::onPressedAdvanced()";
}
/*!
 onEntry method invoked on entering the state
 \param event: event
 \retval void
 */
void HsViewAppSettingsState::onEntry(QEvent *event)
{
    HSMENUTEST_FUNC_ENTRY("HsViewAppSettingsState::onEntry");
    QState::onEntry(event);
    qDebug("CollectionState::onEntry()");
    HsMenuEvent *menuEvent = static_cast<HsMenuEvent *>(event);
    QVariantMap data = menuEvent->data();
    
    const int entryId = data.value(Hs::itemIdKey).toInt();   
    QSharedPointer<const CaEntry> entry = CaService::instance()->getEntry(entryId);    
    
    QString pluginPath;
    pluginPath = pluginPath.append("/resource/qt/plugins/appsettings/")
        .append(entry->attribute(Hs::appSettingsPlugin)).append(".qtplugin");
    QPluginLoader loader(pluginPath);
    mView = qobject_cast<HbView *>(loader.instance()); 
    
    mActionConfirm = new HbAction(Hb::ConfirmNaviAction, mView);
    connect(mActionConfirm, SIGNAL(triggered()), SIGNAL(exit()));
    
    if (mView) {    
        QScopedPointer<HsMenuEntryRemovedHandler> entryObserver(
            new HsMenuEntryRemovedHandler(entryId, this, SIGNAL(exit())));
        
        entryObserver.take()->setParent(mView);
        // remove it when JAVA will start to provide only version with two strings
        QObject::connect(this, SIGNAL(initialize(QString, QString)), mView, SLOT(initialize(QString)));        
        QObject::connect(this, SIGNAL(initialize(QString, QString)), mView, SLOT(initialize(QString, QString)));
        mView->setParent(this);
        emit initialize(entry->attribute(Hs::applicationUidEntryKey), entry->text());        
        // Add View to main window
        HbMainWindow *hbMainWindow = mainWindow();
        // add confirm action
        mView->setNavigationAction(mActionConfirm);
    
        hbMainWindow->addView(mView);
        // record the current view in order to activate it once done
        mPreviousView = hbMainWindow->currentView();
        hbMainWindow->setCurrentView(mView);
        hbMainWindow->show();
    }

    
    HSMENUTEST_FUNC_EXIT("HsViewAppSettingsState::onEntry");
}