/*! The main entry point of the clock application. Constructs the view manager object. */ int main(int argc, char *argv[]) { OstTraceFunctionEntry0( _MAIN_ENTRY ); // Create and initialize an ClockApplication instance QScopedPointer<ClockApplication> application( new ClockApplication(argc, argv)); // Main window widget. // Includes decorator such as signal strength and battery life indicator. HbMainWindow window; window.setRenderHints( QPainter::HighQualityAntialiasing | QPainter::SmoothPixmapTransform); window.setViewportUpdateMode(QGraphicsView::MinimalViewportUpdate); // Load the translation file. HbTranslator translator("clock"); translator.loadCommon(); // Construct the application controller. application->createController(); // Show widget window.show(); // Start the event loop for the application return application->execution(); }
void CntFavoritesView::activate( const CntViewParameters aArgs ) { if (mView->navigationAction() != mSoftkey) mView->setNavigationAction(mSoftkey); HbMainWindow* window = mView->mainWindow(); connect(window, SIGNAL(orientationChanged(Qt::Orientation)), this, SLOT(setOrientation(Qt::Orientation))); setOrientation(window->orientation()); mContact = new QContact(aArgs.value(ESelectedGroupContact).value<QContact>()); mViewManager = &mEngine->viewManager(); HbPushButton *addButton = static_cast<HbPushButton*>(mDocumentLoader.findWidget(QString("cnt_button_add"))); connect(addButton, SIGNAL(clicked()), this, SLOT(openSelectionPopup())); connect(addButton, SIGNAL(longPress(QPointF)), this, SLOT(openSelectionPopup())); // If no contacts are present, then disable the button QContactDetailFilter filter; filter.setDetailDefinitionName(QContactType::DefinitionName, QContactType::FieldType); filter.setValue(QLatin1String(QContactType::TypeContact)); QList<QContactLocalId> contactIds = getContactManager()->contactIds(filter); if (contactIds.isEmpty()) { addButton->setEnabled(false); } }
void HomeScreenStatePluginTest::testLoadBackupRestoreStateOnEntryExit() { HbInstance::instance(); HbMainWindow mainWindow; mainWindow.show(); QCoreApplication::sendPostedEvents(); QStateMachine *sm = new QStateMachine; HsBackupRestoreState *brs = new HsBackupRestoreState; sm->addState(brs); sm->setInitialState(brs); QFinalState *fs = new QFinalState; sm->addState(fs); brs->addTransition(this, SIGNAL(finishStateMachine()), fs); sm->start(); QCoreApplication::sendPostedEvents(); emit finishStateMachine(); sm->stop(); // main window deleted -> HsGui must be deleted also delete HsGui::takeInstance(); delete sm; }
/*! The main() function. Responsible for constructing the NotesApplication object and showing the main window. */ int main(int argc, char *argv[]) { OstTraceFunctionEntry0( _MAIN_ENTRY ); // Create and initialize an NotesApplication instance QScopedPointer<NotesApplication> application( new NotesApplication(argc, argv)); //NotesApplication *application = new NotesApplication(argc, argv); // Main window for providing the scene context HbMainWindow window; window.setRenderHints( QPainter::Antialiasing | QPainter::SmoothPixmapTransform); window.setViewportUpdateMode(QGraphicsView::MinimalViewportUpdate); // Load the translation file. HbTranslator notesViewsTranslator("notes"); notesViewsTranslator.loadCommon(); // Construct the application controller. application->createController(); // Show the main window. window.show(); // Start the event loop for the application return application->execution(); }
/*! 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 ); }
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; }
// --------------------------------------------------------------------------- // 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"); }
void FeedView::startPressed() { if (!mStarted) { static_cast<HbPushButton*>(mDocumentLoader.findObject("createContactsButton"))->setEnabled(false); HbMainWindow* window = mView->mainWindow(); window->setInteractive(false); HbLabel *label = static_cast<HbLabel*>(mDocumentLoader.findObject("textLabel")); label->setPlainText("Presence feeder active."); QContactDetailFilter filter; filter.setDetailDefinitionName(QContactType::DefinitionName, QContactType::FieldType); QString typeContact = QContactType::TypeContact; filter.setValue(typeContact); QList<QContactLocalId> contacts = mManager->contactIds(filter); foreach (QContactLocalId id, contacts) { QContact contact = mManager->contact(id); QList<QContactOnlineAccount> accounts = contact.details<QContactOnlineAccount>(); foreach (QContactOnlineAccount account, accounts) { PrcPresenceBuddyInfoQt* buddy = PrcPresenceBuddyInfoQt::createInstance(); QString fullAccount = account.serviceProvider() + ':' + account.accountUri(); buddy->setIdentity(fullAccount); mBuddyList.append(fullAccount); if (qrand() % 2 == 0) { buddy->setAvailability(PrcPresenceBuddyInfoQt::PrcNotAvailable, "hep"); } else { buddy->setAvailability(PrcPresenceBuddyInfoQt::PrcAvailable, "hep"); } iWriter->writePresence( *buddy ); delete buddy; }
// --------------------------------------------------------------------------- // PosSettingsForm::closeAdvancedView // --------------------------------------------------------------------------- // void PosSettingsForm::closeAdvancedView() { qDebug() << "+ PosSettingsForm::closeAdvancedView()"; disconnect(mBackAction, SIGNAL(triggered()), this, SLOT(closeAdvancedView())); HbMainWindow* mainWindow = hbInstance->allMainWindows().at(0); mainWindow->removeView(mAdvancedView); mAdvancedView->setParent(NULL); delete mAdvancedView; mAdvancedView = NULL; // refresh first view setPosTypeState( PosTypeIndexGps); setPosTypeState( PosTypeIndexWireless); setPosTypeState( PosTypeIndexBackground); validatePosTypeVisibility(PosTypeIndexBackground); qDebug() << "- PosSettingsForm::closeAdvancedView()"; }
int main(int argc, char *argv[]) { // Initialization HbApplication app(argc, argv); // Main window widget. // Includes decorators such as signal strength and battery life indicator. HbMainWindow mainWindow; // View BubbleTestView *view = new BubbleTestView(mainWindow); mainWindow.addView(view); // Show widget mainWindow.setAttribute( Qt::WA_InputMethodEnabled, false ); mainWindow.show(); mainWindow.scene()->setFocusItem( view ); // Enter event loop return app.exec(); }
int main(int argc, char *argv[]) { #ifdef THEME_CHANGER_TIMER_LOG qInstallMsgHandler(debugOutput); #endif // Initialization HbApplication app(argc, argv); app.setApplicationName("ThemeChanger"); // Main window widget. // Includes decorators such as signal strength and battery life indicator. HbMainWindow mainWindow; // Show the list of themes available ThemeSelectionList *themelist=new ThemeSelectionList(&mainWindow); themelist->displayThemes(); mainWindow.addView( themelist ); // Show widget mainWindow.show(); // Enter event loop return app.exec(); }
/*! Called when activating the view */ void CntImageEditorView::activate( const CntViewParameters aArgs ) { mArgs = aArgs; mViewManager = &mEngine->viewManager(); mThumbnailManager = &mEngine->thumbnailManager(); connect( mThumbnailManager, SIGNAL(thumbnailReady(QPixmap, void*, int, int)), this, SLOT(thumbnailReady(QPixmap, void*, int, int)) ); if (mView->navigationAction() != mSoftkey) mView->setNavigationAction(mSoftkey); HbMainWindow* window = mView->mainWindow(); if ( window ) { connect(window, SIGNAL(orientationChanged(Qt::Orientation)), this, SLOT(setOrientation(Qt::Orientation))); setOrientation(window->orientation()); } if ( mArgs.contains(ESelectedContact)) { mContact = new QContact(mArgs.value(ESelectedContact).value<QContact>()); } if ( mArgs.contains(ESelectedGroupContact) && !mContact ) { mContact = new QContact(mArgs.value(ESelectedGroupContact).value<QContact>()); } QString myCard = mArgs.value( EMyCard ).toString(); QContactLocalId localId = mContact->localId(); QContactLocalId selfContactId = mEngine->contactManager(SYMBIAN_BACKEND).selfContactId(); bool isMyCard = ( localId == selfContactId && localId != 0 ) || !myCard.isEmpty(); if (isMyCard) { mSaveManager = new CntSaveManager(CntSaveManager::EMyCard); } else if (mContact->type() == QContactType::TypeGroup) { mSaveManager = new CntSaveManager(CntSaveManager::EGroup); } else { mSaveManager = new CntSaveManager(); } // set the correct image if the contact already has an image set mImageLabel = static_cast<CntImageLabel*>(mDocumentLoader.findWidget(QString("cnt_image_label"))); mImageLabel->ungrabGesture(Qt::TapGesture); QList<QContactAvatar> details = mContact->details<QContactAvatar>(); if (details.count() > 0) { for (int i = 0;i < details.count();i++) { if (details.at(i).imageUrl().isValid()) { mAvatar = new QContactAvatar(details.at(i)); mThumbnailManager->getThumbnail(ThumbnailManager::ThumbnailLarge, mAvatar->imageUrl().toString()); break; } } } else { mAvatar = new QContactAvatar(); mRemoveImage->setEnabled(false); if (mContact->type() == QContactType::TypeGroup) { mImageLabel->setAvatarIcon(HbIcon("qtg_large_add_group_picture")); } } // set up the list mListView = static_cast<HbListView*>(mDocumentLoader.findWidget(QString("cnt_listview"))); connect(mListView, SIGNAL(activated(const QModelIndex&)), this, SLOT(listViewActivated(const QModelIndex&))); HbFrameBackground frame; frame.setFrameGraphicsName("qtg_fr_list_normal"); frame.setFrameType(HbFrameDrawer::NinePieces); mListView->itemPrototypes().first()->setDefaultFrame(frame); mListView->listItemPrototype()->setGraphicsSize(HbListViewItem::LargeIcon); mListView->setUniformItemSizes(true); mModel = new QStandardItemModel(); populateModel(mModel); mListView->setModel(mModel); }
void PhoneUiHouseHoldPrivate::ConstructL() { new( ELeave ) CPhoneLogger( KUidPhoneUILoggerSingleton ); FeatureManager::InitializeLibL(); HbTranslator *translator = new HbTranslator(QString("telephone")); if (translator) { translator->loadCommon(); m_translators.append(translator); } HbTranslator *translator2 = new HbTranslator(QString("telephone_cp")); if (translator2) { m_translators.append(translator2); } PhoneUIQtView *view = new PhoneUIQtView(m_window); iViewAdapter = new PhoneUIQtViewAdapter(*view); iPhoneUIController = CPhoneUIController::NewL(iViewAdapter); iViewAdapter->setEngineInfo(iPhoneUIController->EngineInfo()); m_window.addView (view); m_window.setCurrentView (view); m_window.scene ()->setFocusItem (view); iKeyEventAdapter = new PhoneUIKeyEventAdapter (*iPhoneUIController); iCommandAdapter = new PhoneUiCommandAdapter (*iPhoneUIController); QObject::connect(view, SIGNAL(dialpadIsAboutToClose()), iViewAdapter, SLOT(dialpadClosed())); QObject::connect(view, SIGNAL(keyReleased(QKeyEvent *)), iViewAdapter, SLOT(keyReleased (QKeyEvent *))); QObject::connect(view, SIGNAL(keyPressed (QKeyEvent *)), iKeyEventAdapter, SLOT(keyPressed (QKeyEvent *))); QObject::connect(view, SIGNAL(keyReleased (QKeyEvent *)), iKeyEventAdapter, SLOT(keyReleased (QKeyEvent *))); QObject::connect(view, SIGNAL(command (int)), iCommandAdapter, SLOT(handleCommand (int)), Qt::QueuedConnection); // async to enable deletion of widget during signal handling QObject::connect(view, SIGNAL(windowActivated()), iViewAdapter, SLOT(handleWindowActivated())); QObject::connect(view, SIGNAL(windowDeactivated()), iViewAdapter, SLOT(handleWindowDeactivated())); QObject::connect(&m_window, SIGNAL(focusLost()),iViewAdapter, SLOT(onFocusLost())); QObject::connect(&m_window, SIGNAL(focusGained()),iViewAdapter, SLOT(onFocusGained())); QObject::connect(iViewAdapter->noteController(), SIGNAL(command (int)), iCommandAdapter, SLOT(handleCommand (int))); // Disable default Send key functionality in application framework // avkon removal // CAknAppUi *appUi = static_cast<CAknAppUi*>(CEikonEnv::Static()->AppUi()); // appUi->SetKeyEventFlags( CAknAppUiBase::EDisableSendKeyShort | // CAknAppUiBase::EDisableSendKeyLong ); // CLI Name. TInt err = RProperty::Define( KPSUidTelRemotePartyInformation, KTelCLIName, RProperty::EText, KPhoneReadPolicy, KPhoneWritePolicy ); // CLI Number. err = RProperty::Define( KPSUidTelRemotePartyInformation, KTelCLINumber, RProperty::EText, KPhoneReadPolicy, KPhoneWritePolicy ); // Startup event signalling // Define the telephony application system property err = RProperty::Define( KPSUidTelInformation, KTelPhoneUid, RProperty::EInt, KPhoneReadPolicy, KPhoneWritePolicy ); // DefineNewPSKeys: // UID: KPSUidTelInternalInformation: err = RProperty::Define( KPSUidTelInternalInformation, KTelRemotePartyContactInfo, RProperty::EByteArray, KPhoneReadPolicy, KPhoneWritePolicy ); // VT UID. err = RProperty::Define( KPSUidTelInternalInformation, KTelVideoCallUid, RProperty::EInt, KPhoneReadPolicy, KPhoneWritePolicy ); // TELINTERNALPSKEY CHANGE // Move to AudioHandling // UID: KPSUidTelAudioPreference // Call Audio Routing err = RProperty::Define( KPSUidTelAudioPreference, KTelAudioOutput, RProperty::EInt, KPhoneReadPolicyAlwaysPass, KPhoneWritePolicy ); // UID: KPSUidNEInformation err = RProperty::Define( KPSUidNEInformation, KTelNumberEntryInfo, RProperty::EInt, KPhoneReadPolicyAlwaysPass, KPhoneWritePolicy ); // Add DoStartupSignalL to the recovery system iStartupSignalRecoveryId = CPhoneRecoverySystem::Instance()->AddL( TCallBack( DoStartupSignalL, this ), CTeleRecoverySystem::EPhonePriorityHigh, CTeleRecoverySystem::EPhoneStateIdle ); // Call DoStartupSignalL within recovery system const TInt startupState = CPhonePubSubProxy::Instance()->Value( KPSUidStartup, KPSGlobalSystemState ); PHONE_DEBUG2("phoneui::main() startupState value=", startupState ); if ( startupState == ESwStateCriticalPhaseOK || startupState == ESwStateEmergencyCallsOnly || startupState == ESwStateNormalRfOn || startupState == ESwStateNormalRfOff || startupState == ESwStateNormalBTSap ) { PHONE_DEBUG("phoneui::main() Notify Starter that phone is ready..."); CPhoneRecoverySystem::Instance()->RecoverNow( iStartupSignalRecoveryId, CTeleRecoverySystem::EPhonePriorityHigh ); } else { PHONE_DEBUG("phoneui::main() Startup not ready yet. Start listening..."); CPhonePubSubProxy::Instance()->NotifyChangeL( KPSUidStartup, KPSGlobalSystemState, this ); } if ( err == KErrNone || err == KErrAlreadyExists ) { // Indicate to the system that the Phone has been started CPhonePubSubProxy::Instance()->ChangePropertyValue( KPSUidTelInformation, KTelPhoneUid, KUidPhoneApplication.iUid ); } // Update the Apps ready flag iAppsReady += EPhoneStartedUp; HbMainWindow *main = hbInstance->allMainWindows().at(0); RWindow *win = static_cast<RWindow *>(main->effectiveWinId()->DrawableWindow()); CEikonEnv* env = CEikonEnv::Static(); if ( env ) { env->SetSystem(ETrue); // Blacklist singleton is initialized here CPhoneClearBlacklist::CreateL( env->WsSession(), *win); } }