1915 * If the EEikDialogFlagNotifyEsc flag is not set and the dialog has been cancelled it |
1915 * If the EEikDialogFlagNotifyEsc flag is not set and the dialog has been cancelled it |
1916 * immediately deletes itself. |
1916 * immediately deletes itself. |
1917 */ |
1917 */ |
1918 EXPORT_C void CEikDialog::TryExitL(TInt aButtonId) |
1918 EXPORT_C void CEikDialog::TryExitL(TInt aButtonId) |
1919 { |
1919 { |
1920 _AKNTRACE_FUNC_ENTER; |
1920 _AKNTRACE("CEikDialog::TryExitL iDialogFlags = %d, buttonId = %d", iDialogFlags, aButtonId); |
1921 _AKNTRACE("iDialogFlags = %d, buttonId = %d", iDialogFlags, aButtonId); |
1921 if (iDialogFlags & EEikDialogFlagNoUserExit) |
1922 if ( iDialogFlags & EEikDialogFlagNoUserExit ) |
1922 { |
1923 { |
1923 return; |
1924 return; |
|
1925 } |
1924 } |
1926 |
1925 |
1927 // use delayed exit if pointer event handling is in progress |
1926 // use delayed exit if pointer event handling is in progress |
1928 if ( Extension()->iPublicFlags.IsSet( CEikDialogExtension::EDelayedExit ) ) |
1927 if (Extension()->iPublicFlags.IsSet(CEikDialogExtension::EDelayedExit)) |
1929 { |
1928 { |
1930 Extension()->iButtonId = aButtonId; |
1929 Extension()->iButtonId = aButtonId; |
1931 Extension()->StartDelayedExit(); |
1930 Extension()->StartDelayedExit(); |
|
1931 |
1932 _AKNTRACE("CEikDialog::TryExitL return with delayedExit"); |
1932 _AKNTRACE("CEikDialog::TryExitL return with delayedExit"); |
1933 return; |
1933 return; |
1934 } |
1934 } |
1935 |
1935 |
|
1936 TBool effectButton = aButtonId == EEikBidCancel |
|
1937 || aButtonId == EAknSoftkeyExit |
|
1938 || aButtonId == EAknSoftkeyBack |
|
1939 || aButtonId == EAknSoftkeyNo; |
|
1940 #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS |
|
1941 effectButton = effectButton |
|
1942 || aButtonId == EAknSoftkeyClose |
|
1943 || aButtonId == EAknSoftkeyDone |
|
1944 || aButtonId == EAknSoftkeyOk; |
|
1945 #endif |
|
1946 |
1936 TBool effectTriggered = EFalse; |
1947 TBool effectTriggered = EFalse; |
1937 |
1948 CAknAppUi* aknAppUi = static_cast<CAknAppUi*>(iEikonEnv->EikAppUi()); |
1938 TBool effectButton = aButtonId == EEikBidCancel |
1949 |
1939 || aButtonId == EAknSoftkeyExit |
1950 if (!(iDialogFlags & EEikDialogFlagDelayEffects) |
1940 || aButtonId == EAknSoftkeyBack |
1951 && GfxTransEffect::IsRegistered(this) && IsVisible() && effectButton |
1941 || aButtonId == EAknSoftkeyNo; |
1952 #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS |
1942 #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS |
1953 && !(iDialogFlags & EEikDialogFlagSleeping) |
1943 effectButton = effectButton |
|
1944 || aButtonId == EAknSoftkeyClose |
|
1945 || aButtonId == EAknSoftkeyDone |
|
1946 || aButtonId == EAknSoftkeyOk; |
|
1947 #endif |
1954 #endif |
1948 CAknAppUi* aknAppUi = static_cast<CAknAppUi*>( iEikonEnv->EikAppUi() ); |
1955 && (!aknAppUi->IsFullScreenApp() || aknAppUi->IsForeground()) |
1949 if (GfxTransEffect::IsRegistered(this) && IsVisible() && effectButton |
|
1950 #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS |
|
1951 && !(iDialogFlags&EEikDialogFlagSleeping) |
|
1952 #endif |
|
1953 && (!aknAppUi->IsFullScreenApp() || aknAppUi->IsForeground()) |
|
1954 && !IsBlankScreenDisplayed() |
1956 && !IsBlankScreenDisplayed() |
1955 ) |
1957 ) |
1956 { |
1958 { |
1957 CAknTransitionUtils::SetAllParents(this); |
1959 CAknTransitionUtils::SetAllParents(this); |
1958 GfxTransEffect::Begin(this, KGfxControlDisappearAction); |
1960 GfxTransEffect::Begin(this, KGfxControlDisappearAction); |
1959 GfxTransEffect::NotifyExternalState(ECaptureComponentsBegin, (const TDesC8*)this); |
1961 GfxTransEffect::NotifyExternalState(ECaptureComponentsBegin, (const TDesC8*)this); |
1960 TRect demarcation; |
1962 TRect demarcation; |
1961 CAknTransitionUtils::GetDemarcation(CAknTransitionUtils::EPopup, |
1963 CAknTransitionUtils::GetDemarcation(CAknTransitionUtils::EPopup, demarcation); |
1962 demarcation); |
|
1963 GfxTransEffect::SetDemarcation(this, demarcation); |
1964 GfxTransEffect::SetDemarcation(this, demarcation); |
1964 effectTriggered = ETrue; |
1965 effectTriggered = ETrue; |
1965 } |
1966 } |
1966 |
1967 |
1967 if (aButtonId!=EEikBidCancel) |
1968 if (aButtonId != EEikBidCancel) |
|
1969 { |
1968 PrepareForFocusTransitionL(); |
1970 PrepareForFocusTransitionL(); |
1969 else if (!(iDialogFlags&EEikDialogFlagNotifyEsc)) |
1971 } |
|
1972 else if (!(iDialogFlags & EEikDialogFlagNotifyEsc)) |
|
1973 { |
1970 goto finished; |
1974 goto finished; |
|
1975 } |
|
1976 |
1971 if (!OkToExitL(aButtonId)) |
1977 if (!OkToExitL(aButtonId)) |
1972 { |
1978 { |
1973 if ( effectTriggered ) |
1979 if (effectTriggered) |
1974 { |
1980 { |
1975 GfxTransEffect::NotifyExternalState( ECaptureComponentsAbort, |
1981 GfxTransEffect::NotifyExternalState(ECaptureComponentsAbort, (const TDesC8*)this); |
1976 ( const TDesC8* ) this ); |
1982 GfxTransEffect::Abort(this); |
1977 GfxTransEffect::Abort( this ); |
|
1978 } |
|
1979 _AKNTRACE_FUNC_EXIT; |
|
1980 return; |
|
1981 } |
1983 } |
1982 |
1984 |
1983 if (aButtonId != EEikBidCancel) |
1985 _AKNTRACE("CEikDialog::TryExitL return with OkToExitL false"); |
|
1986 return; |
|
1987 } |
|
1988 |
|
1989 if (aButtonId != EEikBidCancel) |
|
1990 { |
1984 GetAutoValues(); |
1991 GetAutoValues(); |
|
1992 } |
|
1993 |
1985 finished: |
1994 finished: |
|
1995 |
1986 if (iExitConfirmed) |
1996 if (iExitConfirmed) |
1987 *iExitConfirmed=((MappedCommandId( aButtonId ) ==EEikBidCancel)? 0: aButtonId); |
1997 { |
|
1998 *iExitConfirmed = MappedCommandId(aButtonId) == EEikBidCancel ? 0 : aButtonId; |
|
1999 } |
1988 |
2000 |
1989 // Remove content observer in order to prevent unnecessary layout |
2001 // Remove content observer in order to prevent unnecessary layout |
1990 // calculations in dialog shutdown. |
2002 // calculations in dialog shutdown. |
1991 EnableContentObserver( EFalse ); |
2003 EnableContentObserver(EFalse); |
1992 |
2004 |
1993 if (iDialogFlags&EEikDialogFlagSleeping) |
2005 if (iDialogFlags & EEikDialogFlagSleeping) |
|
2006 { |
1994 ExitSleepingDialog(); |
2007 ExitSleepingDialog(); |
|
2008 } |
1995 else |
2009 else |
1996 { |
2010 { |
1997 // Remove content observer in order to prevent unnecessary layout |
2011 // Remove content observer in order to prevent unnecessary layout |
1998 // calculations in dialog shutdown. |
2012 // calculations in dialog shutdown. |
1999 EnableContentObserver( EFalse ); |
2013 EnableContentObserver(EFalse); |
2000 |
2014 |
2001 if ( effectTriggered ) |
2015 // The dialog is asked to postpone the effect after OkToExitL. |
2002 { |
2016 if ((iDialogFlags & EEikDialogFlagDelayEffects) && !effectTriggered) |
2003 MakeVisible(EFalse); |
2017 { |
2004 CAknTransitionUtils::MakeVisibleSubComponents( this, |
2018 if (GfxTransEffect::IsRegistered(this) && IsVisible() && effectButton |
2005 CAknTransitionUtils::EForceInvisible ); |
2019 && (!aknAppUi->IsFullScreenApp() || aknAppUi->IsForeground()) |
2006 |
2020 && !IsBlankScreenDisplayed() |
2007 GfxTransEffect::NotifyExternalState(ECaptureComponentsEnd, (const TDesC8*)this); |
2021 ) |
2008 GfxTransEffect::End(this); |
2022 { |
|
2023 TRect demarcation; |
|
2024 CAknTransitionUtils::SetAllParents(this); |
|
2025 GfxTransEffect::Begin(this, KGfxControlDisappearAction); |
|
2026 GfxTransEffect::NotifyExternalState(ECaptureComponentsBegin, (const TDesC8*)this); |
|
2027 CAknTransitionUtils::GetDemarcation(CAknTransitionUtils::EPopup, demarcation); |
|
2028 GfxTransEffect::SetDemarcation(this, demarcation); |
|
2029 effectTriggered = ETrue; |
2009 } |
2030 } |
2010 else |
2031 } |
2011 { |
2032 |
2012 MakeVisible(EFalse); |
2033 if (effectTriggered) |
2013 CAknTransitionUtils::MakeVisibleSubComponents( this, |
2034 { |
2014 CAknTransitionUtils::EForceInvisible ); |
2035 MakeVisible(EFalse); |
2015 GfxTransEffect::NotifyExternalState( ECaptureComponentsAbort, |
2036 CAknTransitionUtils::MakeVisibleSubComponents(this, CAknTransitionUtils::EForceInvisible); |
2016 ( const TDesC8* ) this ); |
2037 GfxTransEffect::NotifyExternalState(ECaptureComponentsEnd, (const TDesC8*)this); |
2017 GfxTransEffect::Abort(this); |
2038 GfxTransEffect::End(this); |
|
2039 } |
|
2040 else |
|
2041 { |
|
2042 // Why we need abort the effect here ?? |
|
2043 MakeVisible(EFalse); |
|
2044 CAknTransitionUtils::MakeVisibleSubComponents(this, CAknTransitionUtils::EForceInvisible); |
|
2045 GfxTransEffect::NotifyExternalState(ECaptureComponentsAbort, (const TDesC8*)this); |
|
2046 GfxTransEffect::Abort(this); |
2018 } |
2047 } |
2019 delete(this); |
2048 delete(this); |
2020 } |
2049 } |
2021 _AKNTRACE_FUNC_EXIT; |
2050 _AKNTRACE_FUNC_EXIT; |
2022 } |
2051 } |