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_FUNC_ENTER; |
|
1921 _AKNTRACE("iDialogFlags = %d, buttonId = %d", iDialogFlags, aButtonId); |
1921 if ( iDialogFlags & EEikDialogFlagNoUserExit ) |
1922 if ( iDialogFlags & EEikDialogFlagNoUserExit ) |
1922 { |
1923 { |
1923 _AKNTRACE_FUNC_EXIT; |
|
1924 return; |
1924 return; |
1925 } |
1925 } |
1926 |
1926 |
1927 // use delayed exit if pointer event handling is in progress |
1927 // use delayed exit if pointer event handling is in progress |
1928 if ( Extension()->iPublicFlags.IsSet( CEikDialogExtension::EDelayedExit ) ) |
1928 if ( Extension()->iPublicFlags.IsSet( CEikDialogExtension::EDelayedExit ) ) |
1929 { |
1929 { |
1930 Extension()->iButtonId = aButtonId; |
1930 Extension()->iButtonId = aButtonId; |
1931 Extension()->StartDelayedExit(); |
1931 Extension()->StartDelayedExit(); |
1932 _AKNTRACE_FUNC_EXIT; |
1932 _AKNTRACE("CEikDialog::TryExitL return with delayedExit"); |
1933 return; |
1933 return; |
1934 } |
1934 } |
|
1935 |
|
1936 TBool needToCheckExit = ETrue; |
|
1937 |
|
1938 if (aButtonId != EEikBidCancel) |
|
1939 { |
|
1940 PrepareForFocusTransitionL(); |
|
1941 } |
|
1942 else if (!(iDialogFlags & EEikDialogFlagNotifyEsc)) |
|
1943 { |
|
1944 needToCheckExit = EFalse; |
|
1945 } |
|
1946 |
|
1947 if (needToCheckExit) |
|
1948 { |
|
1949 if (!OkToExitL(aButtonId)) |
|
1950 { |
|
1951 _AKNTRACE("CEikDialog::TryExitL return with OkToExitL false"); |
|
1952 return; |
|
1953 } |
1935 |
1954 |
1936 TBool effectTriggered = EFalse; |
1955 if (aButtonId != EEikBidCancel) |
1937 TBool effectButton = aButtonId == EEikBidCancel |
1956 { |
1938 || aButtonId == EAknSoftkeyExit |
1957 GetAutoValues(); |
1939 || aButtonId == EAknSoftkeyBack |
|
1940 || aButtonId == EAknSoftkeyNo; |
|
1941 #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS |
|
1942 effectButton = effectButton |
|
1943 || aButtonId == EAknSoftkeyClose |
|
1944 || aButtonId == EAknSoftkeyDone; |
|
1945 #endif |
|
1946 CAknAppUi* aknAppUi = static_cast<CAknAppUi*>( iEikonEnv->EikAppUi() ); |
|
1947 if ( GfxTransEffect::IsRegistered( this ) && IsVisible() && effectButton |
|
1948 #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS |
|
1949 && !(iDialogFlags&EEikDialogFlagSleeping) |
|
1950 #endif |
|
1951 && ( !aknAppUi->IsFullScreenApp() || aknAppUi->IsForeground() ) |
|
1952 && !IsBlankScreenDisplayed() |
|
1953 ) |
|
1954 { |
|
1955 CAknTransitionUtils::SetAllParents(this); |
|
1956 GfxTransEffect::Begin(this, KGfxControlDisappearAction); |
|
1957 GfxTransEffect::NotifyExternalState(ECaptureComponentsBegin, (const TDesC8*)this); |
|
1958 |
|
1959 TRect demarcation; |
|
1960 CAknTransitionUtils::GetDemarcation(CAknTransitionUtils::EPopup, |
|
1961 demarcation); |
|
1962 GfxTransEffect::SetDemarcation(this, demarcation); |
|
1963 effectTriggered = ETrue; |
|
1964 } |
|
1965 |
|
1966 if (aButtonId!=EEikBidCancel) |
|
1967 PrepareForFocusTransitionL(); |
|
1968 else if (!(iDialogFlags&EEikDialogFlagNotifyEsc)) |
|
1969 goto finished; |
|
1970 if (!OkToExitL(aButtonId)) |
|
1971 { |
|
1972 if ( effectTriggered ) |
|
1973 { |
|
1974 GfxTransEffect::NotifyExternalState( ECaptureComponentsAbort, |
|
1975 ( const TDesC8* ) this ); |
|
1976 GfxTransEffect::Abort( this ); |
|
1977 } |
1958 } |
1978 _AKNTRACE_FUNC_EXIT; |
1959 } |
1979 return; |
1960 |
1980 } |
|
1981 |
|
1982 if (aButtonId!=EEikBidCancel) |
|
1983 GetAutoValues(); |
|
1984 finished: |
|
1985 if (iExitConfirmed) |
1961 if (iExitConfirmed) |
1986 *iExitConfirmed=((MappedCommandId( aButtonId ) ==EEikBidCancel)? 0: aButtonId); |
1962 { |
1987 |
1963 *iExitConfirmed = (MappedCommandId(aButtonId) == EEikBidCancel) ? 0 : aButtonId; |
|
1964 } |
1988 // Remove content observer in order to prevent unnecessary layout |
1965 // Remove content observer in order to prevent unnecessary layout |
1989 // calculations in dialog shutdown. |
1966 // calculations in dialog shutdown. |
1990 EnableContentObserver( EFalse ); |
1967 EnableContentObserver(EFalse); |
1991 |
1968 |
1992 if (iDialogFlags&EEikDialogFlagSleeping) |
1969 if (iDialogFlags & EEikDialogFlagSleeping) |
1993 ExitSleepingDialog(); |
1970 { |
1994 else |
1971 ExitSleepingDialog(); |
1995 { |
1972 } |
1996 // Remove content observer in order to prevent unnecessary layout |
1973 else |
1997 // calculations in dialog shutdown. |
1974 { |
1998 EnableContentObserver( EFalse ); |
1975 // Trigger the transition effects for the exiting dialog. |
1999 |
1976 CAknAppUi* aknAppUi = static_cast<CAknAppUi*>(iEikonEnv->EikAppUi()); |
2000 if ( effectTriggered ) |
1977 TBool effectButton = aButtonId == EEikBidCancel |
2001 { |
1978 || aButtonId == EAknSoftkeyExit |
2002 MakeVisible(EFalse); |
1979 || aButtonId == EAknSoftkeyBack |
2003 CAknTransitionUtils::MakeVisibleSubComponents( this, |
1980 || aButtonId == EAknSoftkeyNo; |
2004 CAknTransitionUtils::EForceInvisible ); |
1981 #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS |
2005 |
1982 effectButton = effectButton |
2006 GfxTransEffect::NotifyExternalState(ECaptureComponentsEnd, (const TDesC8*)this); |
1983 || aButtonId == EAknSoftkeyClose |
2007 GfxTransEffect::End(this); |
1984 || aButtonId == EAknSoftkeyDone; |
2008 } |
1985 #endif |
2009 else |
1986 |
2010 { |
1987 if (GfxTransEffect::IsRegistered(this) && IsVisible() && effectButton |
2011 MakeVisible(EFalse); |
1988 && (!aknAppUi->IsFullScreenApp() || aknAppUi->IsForeground()) |
2012 CAknTransitionUtils::MakeVisibleSubComponents( this, |
1989 && !IsBlankScreenDisplayed()) |
2013 CAknTransitionUtils::EForceInvisible ); |
1990 { |
2014 GfxTransEffect::NotifyExternalState( ECaptureComponentsAbort, |
1991 // Begin transition. |
2015 ( const TDesC8* ) this ); |
1992 TRect demarcation; |
2016 GfxTransEffect::Abort(this); |
1993 CAknTransitionUtils::SetAllParents(this); |
2017 } |
1994 GfxTransEffect::Begin(this, KGfxControlDisappearAction); |
2018 delete(this); |
1995 GfxTransEffect::NotifyExternalState(ECaptureComponentsBegin, (const TDesC8*)this); |
2019 } |
1996 CAknTransitionUtils::GetDemarcation(CAknTransitionUtils::EPopup, demarcation); |
2020 _AKNTRACE_FUNC_EXIT; |
1997 GfxTransEffect::SetDemarcation(this, demarcation); |
|
1998 |
|
1999 // End transiton. |
|
2000 MakeVisible(EFalse); |
|
2001 CAknTransitionUtils::MakeVisibleSubComponents(this, |
|
2002 CAknTransitionUtils::EForceInvisible); |
|
2003 GfxTransEffect::NotifyExternalState(ECaptureComponentsEnd, (const TDesC8*)this); |
|
2004 GfxTransEffect::End(this); |
|
2005 } |
|
2006 delete(this); |
|
2007 } |
|
2008 _AKNTRACE_FUNC_EXIT; |
2021 } |
2009 } |
2022 |
2010 |
2023 /** |
2011 /** |
2024 * Returns the input capabilites of the dialog. By default, the dialog is |
2012 * Returns the input capabilites of the dialog. By default, the dialog is |
2025 * capable of handling all text input. |
2013 * capable of handling all text input. |