bool InternalWindow::takeFocus(bool Temporary) { if(getFocused() && getParentDrawingSurface() != NULL && getParentDrawingSurface()->getFocusedWindow() == this) { return true; } setFocused(true); if(Temporary || getParentDrawingSurface() == NULL) { FocusEventDetailsUnrecPtr Details(FocusEventDetails::create(this,getSystemTime(),Temporary, NULL)); focusGained(Details); } else { if(getParentDrawingSurface()->getFocusedWindow() != NULL) { getParentDrawingSurface()->getFocusedWindow()->giveFocus(this); } getParentDrawingSurface()->setFocusedWindow(this); FocusEventDetailsUnrecPtr Details(FocusEventDetails::create(this,getSystemTime(),Temporary, getParentDrawingSurface()->getFocusedWindow())); focusGained(Details); } return true; }
bool InternalWindow::takeFocus(bool Temporary) { if(getFocused() && getDrawingSurface() != NULL && getDrawingSurface()->getFocusedWindow() == InternalWindowRefPtr(this)) { return true; } setFocused(true); if(Temporary || getDrawingSurface() == NULL) { focusGained(FocusEvent::create(ComponentRefPtr(this),getSystemTime(),Temporary, NULL)); } else { if(getDrawingSurface()->getFocusedWindow() != NULL) { getDrawingSurface()->getFocusedWindow()->giveFocus(this); } getDrawingSurface()->setFocusedWindow(this); focusGained(FocusEvent::create(ComponentRefPtr(this),getSystemTime(),Temporary, getDrawingSurface()->getFocusedWindow())); } return true; }
void Curses::requestFocus() { Curses *oldFocus=currentFocus; currentFocus=NULL; cursesPtr<Curses> ptr=this; if (oldFocus) oldFocus->focusLost(); if (!ptr.isDestroyed() && currentFocus == NULL) { currentFocus=this; focusGained(); } }
FMPanel::FMPanel( MainWindow* aMainW, bool aLeft, QWidget * parent, Qt::WindowFlags f) : QWidget( parent, f ), left(aLeft) { //setup variables mainW = aMainW; lastClick = QTime::currentTime (); noDrive = false; driveJustLoaded = false; //setup layouts and lists wholeLayout = new QVBoxLayout(); tab = new QTabWidget(); blist = new bookmarkListView(); blist->setSelectionMode( QAbstractItemView::NoSelection ); blist->setEditTriggers( QAbstractItemView::NoEditTriggers ); #if !defined(QEFEM_MAEMO_DEV) hlist = new historyListView( left ); hlist->setSelectionMode( QAbstractItemView::NoSelection ); hlist->setEditTriggers( QAbstractItemView::NoEditTriggers ); #endif foundList = new QListWidget( this ); foundList->setSelectionMode( QAbstractItemView::NoSelection ); foundList->setEditTriggers( QAbstractItemView::NoEditTriggers ); #if !defined(QEFEM_MAEMO_DEV) && !defined(Q_OS_LINUX) dlist = new driveListView(); #endif dirList = new FMListView(); #if !defined(QEFEM_MAEMO_DEV) && !defined(Q_OS_LINUX) tab->addTab(dlist,"Drives"); #endif tab->addTab(dirList,"Files"); #if !defined(QEFEM_MAEMO_DEV) tab->addTab(hlist,"History"); #endif tab->addTab(blist,"Bookmarks"); tab->addTab(foundList,"Found"); #if defined(QEFEM_MAEMO_DEV) || defined(Q_OS_LINUX) tab->setCurrentIndex(0); #else tab->setCurrentIndex(1); #endif pathEdit = new QLineEdit(); #if defined(QEFEM_MAEMO_DEV) pathEdit->setVisible( false ); #endif wholeLayout->setContentsMargins( 0, 0, 0, 0 ); wholeLayout->setSpacing(0); wholeLayout->addWidget( tab ); wholeLayout->addWidget( pathEdit ); setLayout( wholeLayout ); setVisible( true ); setPathEditText( QDir::homePath()); currentDir.clear(); currentDir.append(QDir::homePath()); currentFile.clear(); currentFile.append(QDir::homePath()); #if !defined(QEFEM_MAEMO_DEV) #if !defined(Q_OS_LINUX) //tab->setToolTip("Drive tab shows the drives. Files tab shows the files. History shows the last 128 visited directories. Bookmark tab shows bookmarks."); #else //tab->setToolTip("Files tab shows the files. History shows the last 128 visited directories. Bookmark tab shows bookmarks."); #endif #endif //setup signals and slots #if !defined(QEFEM_MAEMO_DEV) && !defined(Q_OS_LINUX) connect(dlist, SIGNAL(clicked( const QModelIndex& )), this, SLOT( driveClicked( const QModelIndex & ) )); connect(dlist, SIGNAL(activated( const QModelIndex& )), this, SLOT( driveClicked( const QModelIndex & ) )); connect(hlist, SIGNAL(clicked( const QModelIndex& )), this, SLOT( listClicked( const QModelIndex & ) )); connect(hlist, SIGNAL(activated( const QModelIndex& )), this, SLOT( listClicked( const QModelIndex & ) )); connect(dirList, SIGNAL(clicked( const QModelIndex& )), this, SLOT( dirClicked( const QModelIndex & ) )); connect(dirList, SIGNAL(activated( const QModelIndex& )), this, SLOT( dirDoubleClicked( const QModelIndex & ) )); connect(dirList, SIGNAL(entered( const QModelIndex& )), this, SLOT( dirClicked( const QModelIndex & ) )); #endif connect(blist, SIGNAL(clicked( const QModelIndex& )), this, SLOT( listClicked( const QModelIndex & ) )); connect(blist, SIGNAL(activated( const QModelIndex& )), this, SLOT( listClicked( const QModelIndex & ) )); connect(foundList, SIGNAL(itemDoubleClicked ( QListWidgetItem *)), this, SLOT( foundListClicked( QListWidgetItem * ) )); connect(foundList, SIGNAL(itemClicked ( QListWidgetItem *)), this, SLOT( foundListClicked( QListWidgetItem * ) )); connect(pathEdit, SIGNAL(editingFinished()),this,SLOT( editFinished() )); connect(dirList, SIGNAL(keyUpOrDownPressed()),this,SLOT( highlightMoved() )); connect(dirList, SIGNAL(copyFiles(const QStringList&)),this,SLOT( copy(const QStringList& ) )); connect(dirList, SIGNAL(focusGained()),this,SLOT( listGotFocus() )); //connect(dirList->model(), SIGNAL( rowChange()),this,SLOT(rowsChanged())); connect(dirList, SIGNAL( rootPathChanged ( const QString& )),this, SLOT( rootChanged ( const QString& ) )); foundList->clear(); foundList->addItem("Clear list"); }
SpeedDial::SpeedDial(QWidget* parent) : QGroupBox(parent) , m_timer(new QTimer(this)) , m_dial(NULL) , m_hrs(NULL) , m_min(NULL) , m_sec(NULL) , m_ms(NULL) , m_focus(NULL) , m_previousDialValue(0) , m_preventSignals(false) , m_value(0) , m_tapTime(NULL) , m_tapTickTimer(NULL) , m_tapTick(false) { QGridLayout* grid = new QGridLayout(this); grid->setSpacing(0); grid->setMargin(2); m_plus = new QToolButton(this); m_plus->setIconSize(QSize(32, 32)); m_plus->setIcon(QIcon(":/edit_add.png")); grid->addWidget(m_plus, 0, 0, Qt::AlignVCenter | Qt::AlignLeft); connect(m_plus, SIGNAL(pressed()), this, SLOT(slotPlusMinus())); connect(m_plus, SIGNAL(released()), this, SLOT(slotPlusMinus())); m_minus = new QToolButton(this); m_minus->setIconSize(QSize(32, 32)); m_minus->setIcon(QIcon(":/edit_remove.png")); grid->addWidget(m_minus, 1, 0, Qt::AlignVCenter | Qt::AlignLeft); connect(m_minus, SIGNAL(pressed()), this, SLOT(slotPlusMinus())); connect(m_minus, SIGNAL(released()), this, SLOT(slotPlusMinus())); m_dial = new QDial(this); m_dial->setWrapping(true); m_dial->setNotchesVisible(true); m_dial->setTracking(true); grid->addWidget(m_dial, 0, 1, 2, 2, Qt::AlignHCenter); connect(m_dial, SIGNAL(valueChanged(int)), this, SLOT(slotDialChanged(int))); m_tap = new QPushButton(tr("Tap"), this); m_tap->setStyleSheet(tapDefaultSS); m_tap->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); grid->addWidget(m_tap, 0, 3, 2, 1); connect(m_tap, SIGNAL(clicked()), this, SLOT(slotTapClicked())); m_hrs = new FocusSpinBox(this); m_hrs->setRange(0, HRS_MAX); m_hrs->setSuffix("h"); m_hrs->setButtonSymbols(QSpinBox::NoButtons); m_hrs->setToolTip(tr("Hours")); grid->addWidget(m_hrs, 2, 0); connect(m_hrs, SIGNAL(valueChanged(int)), this, SLOT(slotHoursChanged())); connect(m_hrs, SIGNAL(focusGained()), this, SLOT(slotSpinFocusGained())); m_min = new FocusSpinBox(this); m_min->setRange(0, MIN_MAX); m_min->setSuffix("m"); m_min->setButtonSymbols(QSpinBox::NoButtons); m_min->setToolTip(tr("Minutes")); grid->addWidget(m_min, 2, 1); connect(m_min, SIGNAL(valueChanged(int)), this, SLOT(slotMinutesChanged())); connect(m_min, SIGNAL(focusGained()), this, SLOT(slotSpinFocusGained())); m_sec = new FocusSpinBox(this); m_sec->setRange(0, SEC_MAX); m_sec->setSuffix("s"); m_sec->setButtonSymbols(QSpinBox::NoButtons); m_sec->setToolTip(tr("Seconds")); grid->addWidget(m_sec, 2, 2); connect(m_sec, SIGNAL(valueChanged(int)), this, SLOT(slotSecondsChanged())); connect(m_sec, SIGNAL(focusGained()), this, SLOT(slotSpinFocusGained())); m_ms = new FocusSpinBox(this); m_ms->setRange(0, MS_MAX / MS_DIV); m_ms->setPrefix("."); m_ms->setButtonSymbols(QSpinBox::NoButtons); m_ms->setToolTip(tr("Milliseconds")); grid->addWidget(m_ms, 2, 3); connect(m_ms, SIGNAL(valueChanged(int)), this, SLOT(slotMSChanged())); connect(m_ms, SIGNAL(focusGained()), this, SLOT(slotSpinFocusGained())); m_infiniteCheck = new QCheckBox(this); m_infiniteCheck->setText(tr("Infinite")); grid->addWidget(m_infiniteCheck, 3, 0, 1, 4); connect(m_infiniteCheck, SIGNAL(toggled(bool)), this, SLOT(slotInfiniteChecked(bool))); m_focus = m_ms; m_dial->setRange(m_focus->minimum(), m_focus->maximum()); m_dial->setSingleStep(m_focus->singleStep()); m_timer->setInterval(TIMER_HOLD); connect(m_timer, SIGNAL(timeout()), this, SLOT(slotPlusMinusTimeout())); }
void FocusSpinBox::focusInEvent(QFocusEvent* event) { if (event->gotFocus() == true) emit focusGained(); }
SpeedDial::SpeedDial(QWidget* parent) : QGroupBox(parent) , m_timer(new QTimer(this)) , m_dial(NULL) , m_hrs(NULL) , m_min(NULL) , m_sec(NULL) , m_ms(NULL) , m_focus(NULL) , m_previousDialValue(0) , m_preventSignals(false) , m_value(0) , m_tapTick(false) , m_tapTime(NULL) , m_tapTickTimer(NULL) , m_tapTickElapseTimer(NULL) , m_visibilityMask(DEFAULT_VISIBILITY_MASK) { new QVBoxLayout(this); layout()->setSpacing(0); layout()->setMargin(2); QHBoxLayout* topHBox = new QHBoxLayout(); QVBoxLayout* pmVBox1 = new QVBoxLayout(); QVBoxLayout* taVBox3 = new QVBoxLayout(); layout()->addItem(topHBox); m_plus = new QToolButton(this); m_plus->setIconSize(QSize(32, 32)); m_plus->setIcon(QIcon(":/edit_add.png")); pmVBox1->addWidget(m_plus, Qt::AlignVCenter | Qt::AlignLeft); connect(m_plus, SIGNAL(pressed()), this, SLOT(slotPlusMinus())); connect(m_plus, SIGNAL(released()), this, SLOT(slotPlusMinus())); m_minus = new QToolButton(this); m_minus->setIconSize(QSize(32, 32)); m_minus->setIcon(QIcon(":/edit_remove.png")); pmVBox1->addWidget(m_minus, Qt::AlignVCenter | Qt::AlignLeft); connect(m_minus, SIGNAL(pressed()), this, SLOT(slotPlusMinus())); connect(m_minus, SIGNAL(released()), this, SLOT(slotPlusMinus())); topHBox->addItem(pmVBox1); m_dial = new QDial(this); m_dial->setWrapping(true); m_dial->setNotchesVisible(true); m_dial->setNotchTarget(15); m_dial->setTracking(true); topHBox->addWidget(m_dial); connect(m_dial, SIGNAL(valueChanged(int)), this, SLOT(slotDialChanged(int))); m_tap = new QPushButton(tr("Tap"), this); m_tap->setStyleSheet(tapDefaultSS); m_tap->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); taVBox3->addWidget(m_tap); connect(m_tap, SIGNAL(clicked()), this, SLOT(slotTapClicked())); topHBox->addItem (taVBox3); QHBoxLayout* timeHBox = new QHBoxLayout(); layout()->addItem(timeHBox); m_hrs = new FocusSpinBox(this); m_hrs->setRange(0, HRS_MAX); m_hrs->setSuffix("h"); m_hrs->setButtonSymbols(QSpinBox::NoButtons); m_hrs->setToolTip(tr("Hours")); timeHBox->addWidget(m_hrs); connect(m_hrs, SIGNAL(valueChanged(int)), this, SLOT(slotHoursChanged())); connect(m_hrs, SIGNAL(focusGained()), this, SLOT(slotSpinFocusGained())); m_min = new FocusSpinBox(this); m_min->setRange(0, MIN_MAX); m_min->setSuffix("m"); m_min->setButtonSymbols(QSpinBox::NoButtons); m_min->setToolTip(tr("Minutes")); timeHBox->addWidget(m_min); connect(m_min, SIGNAL(valueChanged(int)), this, SLOT(slotMinutesChanged())); connect(m_min, SIGNAL(focusGained()), this, SLOT(slotSpinFocusGained())); m_sec = new FocusSpinBox(this); m_sec->setRange(0, SEC_MAX); m_sec->setSuffix("s"); m_sec->setButtonSymbols(QSpinBox::NoButtons); m_sec->setToolTip(tr("Seconds")); timeHBox->addWidget(m_sec); connect(m_sec, SIGNAL(valueChanged(int)), this, SLOT(slotSecondsChanged())); connect(m_sec, SIGNAL(focusGained()), this, SLOT(slotSpinFocusGained())); m_ms = new FocusSpinBox(this); m_ms->setRange(0, MS_MAX); m_ms->setSuffix("ms"); m_ms->setButtonSymbols(QSpinBox::NoButtons); m_ms->setToolTip(tr("Milliseconds")); timeHBox->addWidget(m_ms); connect(m_ms, SIGNAL(valueChanged(int)), this, SLOT(slotMSChanged())); connect(m_ms, SIGNAL(focusGained()), this, SLOT(slotSpinFocusGained())); m_infiniteCheck = new QCheckBox(this); m_infiniteCheck->setText(tr("Infinite")); layout()->addWidget(m_infiniteCheck); connect(m_infiniteCheck, SIGNAL(toggled(bool)), this, SLOT(slotInfiniteChecked(bool))); m_focus = m_ms; m_dial->setRange(m_focus->minimum(), m_focus->maximum()); m_dial->setSingleStep(m_focus->singleStep()); m_timer->setInterval(TIMER_HOLD); connect(m_timer, SIGNAL(timeout()), this, SLOT(slotPlusMinusTimeout())); m_tapTickElapseTimer = new QTimer(); #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) m_tapTickElapseTimer->setTimerType(Qt::PreciseTimer); #endif m_tapTickElapseTimer->setSingleShot(true); connect(m_tapTickElapseTimer, SIGNAL(timeout()), this, SLOT(slotTapTimeout())); //Hide elements according to current visibility mask setVisibilityMask(m_visibilityMask); }
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); } }